pdf - Confluence Issue with exporting -
we have created custom user macro creates table of child pages, table populated information such last updated, version, updated etc.
when exporting page table populated, when export space table empty.
the code below
## macro title: page data ## macro has body: n ## body processing: n/a ## output: html ## ## developed by: brian mitchell ## date created: 06/27/2013 ## @noparams #set ($pagetitle = $content.displaytitle) #set ($pageversion = $content.version) #set ($pagedate = $action.dateformatter.formatgivenstring("dd mmm yyyy", $content.lastmodificationdate)) #set ($pageauthor = $content.lastmodifiername) #set ($pagelistarray = []) #set ($currentpage = $action.page) #set ($spacehome = $space.gethomepage()) #macro ( process $rp ) #set ($pagelist = $rp.getsortedchildren() ) ## returns list<page> #foreach( $child in $pagelist ) #set($p = $pagelistarray.add( $child ) ) #if( $child.haschildren() ) #process ( $child ) #end #end #end #process ($currentpage) <h1> confluence page versions </h1> <table class="confluencetable"> <tbody> <tr> <th class="confluenceth">page title</th> <th class="confluenceth">page version</th> <th class="confluenceth">date</th> <th class="confluenceth">changed by</th> </tr> <tr> <td>$pagetitle</td> <td><a href=http://confluence.mango.local/pages/viewpreviousversions.action?pageid=$content.getidasstring()>$pageversion</a></td> <td>$pagedate</td> <td>$pageauthor</td> </tr> #foreach( $child in $pagelistarray) ## child of type page <tr> <td class="confluencetd">$child.gettitle()</td> <td class="confluencetd"><a href=http://confluence.mango.local/pages/viewpreviousversions.action?pageid=$child.getidasstring()>$child.getversion()</a> </td> <td class="confluencetd">$action.dateformatter.formatgivenstring("dd mmm yyyy", $child.getlastmodificationdate())</td> <td class="confluencetd">$child.getlastmodifiername()</td> </tr> #end </tbody> </table>
how ever when edit code put entire contents of space in array table populated on export
so replace
#process ($currentpage)
#process ($spacehome)
so think problem on space export following command not working
#set ($currentpage = $action.page)
does have ideas on use instead?
the $action
velocity variable refers current action being performed. in situation when doing space export, $action
refers export space action rather export page action, , since export space action not have page
variable available action object, $action.page
not return anything.
however, in luck: export space feature pass context of current page being exported, , using it! $content
refers contententityobject being exported, same thing trying $action.page
.
to fix example, adjust call #process
macro use $content
. following works me when exporting entire space on confluence 5.5:
## macro title: page data ## macro has body: n ## body processing: n/a ## output: html ## ## developed by: brian mitchell ## date created: 06/27/2013 ## @noparams #set ($pagetitle = $content.displaytitle) #set ($pageversion = $content.version) #set ($pagedate = $action.dateformatter.formatgivenstring("dd mmm yyyy", $content.lastmodificationdate)) #set ($pageauthor = $content.lastmodifiername) #set ($pagelistarray = []) ## #set ($currentpage = $action.page) #set ($spacehome = $space.gethomepage()) #macro ( process $rp ) #set ($pagelist = $rp.getsortedchildren() ) ## returns list<page> #foreach( $child in $pagelist ) #set($p = $pagelistarray.add( $child ) ) #if( $child.haschildren() ) #process ( $child ) #end #end #end #process ($content) <h1> confluence page versions </h1> <table class="confluencetable"> <tbody> <tr> <th class="confluenceth">page title</th> <th class="confluenceth">page version</th> <th class="confluenceth">date</th> <th class="confluenceth">changed by</th> </tr> <tr> <td>$pagetitle</td> <td><a href=http://confluence.mango.local/pages/viewpreviousversions.action?pageid=$content.getidasstring()>$pageversion</a></td> <td>$pagedate</td> <td>$pageauthor</td> </tr> #foreach( $child in $pagelistarray) ## child of type page <tr> <td class="confluencetd">$child.gettitle()</td> <td class="confluencetd"><a href=http://confluence.mango.local/pages/viewpreviousversions.action?pageid=$child.getidasstring()>$child.getversion()</a> </td> <td class="confluencetd">$action.dateformatter.formatgivenstring("dd mmm yyyy", $child.getlastmodificationdate())</td> <td class="confluencetd">$child.getlastmodifiername()</td> </tr> #end </tbody> </table>
Comments
Post a Comment