Revision: 1805
http://gatewiki.svn.sourceforge.net/gatewiki/?rev=1805&view=revAuthor: ian_roberts
Date: 2009-11-11 14:41:07 +0000 (Wed, 11 Nov 2009)
Log Message:
-----------
Fixed logic for print chaining to match what the comments say it's supposed to
do. Previously when calling print for non-YAM HTMLs the chained show action
wrote the file content directly to the servlet response (correctly) but then
the print action rendered another <html> of an empty borderless cow page below
it. This messed up the style information in the original HTML. Now print
checks properly whether the chained show has already rendered a response and if
so it doesn't render another one as well.
Modified Paths:
--------------
trunk/cow/grails-app/controllers/PageController.groovy
Modified: trunk/cow/grails-app/controllers/PageController.groovy
===================================================================
--- trunk/cow/grails-app/controllers/PageController.groovy 2009-11-11 13:11:38 UTC (rev 1804)
+++ trunk/cow/grails-app/controllers/PageController.groovy 2009-11-11 14:41:07 UTC (rev 1805)
@@ -71,6 +71,7 @@
if( params.m && (thisPage.isHtml || (! pageFile.name.contains('.')) )) {
log.debug("redirecting to newpageURI=${thisPage.newpageURI}")
redirect(uri: thisPage.newpageURI)
+ return [:]
} else {
log.debug("non-existant, non-HTML/non-directory: 404")
errMessage = renderError(
@@ -83,6 +84,7 @@
} else if(thisPage.isDir && !request.forwardURI.endsWith('/')) { //dir no /
log.debug("redirecting to slashURI=${thisPage.slashURI}")
redirect(uri: thisPage.slashURI)
+ return [:]
} else if(thisPage.isDirNoIndex || params.type == "dir") { // dir listing
if(thisPage.wiki.directoryListingAllowed) {
thisPage.dirList = pageService.getDirList(pageFile, thisPage.wiki)
@@ -108,9 +110,10 @@
log.debug("non-yam HTML: ${thisPage.pageFile}; allowed=${allowed}")
pageLinks = renderTemplate("htmlLinks", [ thisPage : thisPage ])
if(allowed) { // render the whole (html) text
- if(params.chainFromPrint) // just dump the file to the response
+ if(params.chainFromPrint) { // just dump the file to the response
render(pageFile.text)
- else { // render via an iframe (or as a body if asked)
+ return null
+ } else { // render via an iframe (or as a body if asked)
if(new File(thisPage.pageFileDir, ".cow:no-iframe").exists() ) {
pageBody = FileUtils.getBody(pageFile)
} else {
@@ -155,8 +158,10 @@
params.chainFromPrint = true
Map showModel = show.call(params)
- // reuse the show view
- render(view: "/page/show", model: showModel + [ printing: true ])
+ // reuse the show view, unless show has already rendered something
+ if(showModel) {
+ render(view: "/page/show", model: showModel + [ printing: true ])
+ }
} // print
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
gatewiki-commits mailing list
gatewiki-commits@...
https://lists.sourceforge.net/lists/listinfo/gatewiki-commits