Including Rendered Content or Object Properties with an includeTopic

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Including Rendered Content or Object Properties with an includeTopic

Mark Robinson-6
Hi

First of all - Congratulations Ludovic.  I am amazed at the usefulness and flexibility of xwiki.

Secondly, I have created a xwiki with individual subjects on each page.  The data is held in a structured manner in attached objects.  Individually they are displaying perfectly with the ClassSheet.

However, ideally I want to make collected pages which group the individual subject pages so that any change to the base information, also updates the group documents.  Unfortunately, if I include the pages with includeTopic they are not displayed (i think because the relevant object is not referenced).

So 2 questions:

How would I reference the object so it will display correctly?

In the api I can see that you can request the RenderedContent from a page.

Could I build a macro that accepted a page name and returned the Rendered Content? (if so how)

Cheers,


Mark Robinson



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Including Rendered Content or Object Properties with an includeTopic

Mark Robinson-6
Hi Again.

I know it is bad form to reply to your own post, but this is what I am thinking so far.

Unfortunately I can't see how to display the included pages object information with the template page.

End result : Repeated empty templates
 
<< Snip

## Set the list of pages to be included
#set($pages = ["WebSpace.Page1", "WebSpace.Page2", "WebSpace.Page3"])

## Create the macro to display all the included pages with their object information rather than just the template
## Note : Move it to somewhere later we can use it rather than inline
#macro( includePage $pagelist )
#foreach( $page in $pagelist )

#set($displaypage = $xwiki.getDocument($page))
$displaypage.getRenderedContent()

#end
#end

## Run the macro
#includePage($pages)

End Snip>>

Thanks in advance.

Cheers,


Mark Robinson



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Including Rendered Content or Object Properties with an includeTopic

Ludovic Dubost

Hi mark,

What you are doing doesn't look wrong.. It seems to me it should work.
getRenderedContent() is the most recursive API. The page is fully
rendered (velocity, groovy and radeox) in the context of the included
page. So objects should be rendered properly and other includes should
also be done (classsheet and so on).

Do you have and exemple of the page + sheet that fails ?

Ludovic

[hidden email] a écrit :

> Hi Again.
>
> I know it is bad form to reply to your own post, but this is what I am thinking so far.
>
> Unfortunately I can't see how to display the included pages object information with the template page.
>
> End result : Repeated empty templates
>  
> << Snip
>
> ## Set the list of pages to be included
> #set($pages = ["WebSpace.Page1", "WebSpace.Page2", "WebSpace.Page3"])
>
> ## Create the macro to display all the included pages with their object information rather than just the template
> ## Note : Move it to somewhere later we can use it rather than inline
> #macro( includePage $pagelist )
> #foreach( $page in $pagelist )
>
> #set($displaypage = $xwiki.getDocument($page))
> $displaypage.getRenderedContent()
>
> #end
> #end
>
> ## Run the macro
> #includePage($pages)
>
> End Snip>>
>
> Thanks in advance.
>
> Cheers,
>
>
> Mark Robinson
>
>  
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  

--
Ludovic Dubost
XPertNet: http://www.xpertnet.fr/
Blog: http://www.ludovic.org/blog/
XWiki: http://www.xwiki.com
Skype: ldubost AIM: nvludo Yahoo: ludovic




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Including Rendered Content or Object Properties with an includeTopic

Mark Robinson-6
Hi Ludovic.

I am sure it is something obvious, but I can't see it.

I have an object with structured data that I display with the following ClassSheet.  When you look directly at a page that has #includeForm("XWiki.ExampleClassSheet") and an object attached, it displays correctly with all the object properties filling in the right spaces.

But then if you have another page that wants to include these pages, or a macro as described in the previous post (renderedContent), then only ClassSheet is displayed with the properties (eg ${doc.nameOfStep}) rather than the information from the included pages' object.

I am thinking that it is because the template is using the $doc object methods and in the composite page no attached object exists, so I need to change the references in the template to reference the included pages' object but I am not sure how to do that.

Hope that make sense and thanks for your help.

Have a great day.


Mark


## Multiversion "XWiki.ExampleClassSheet" template depending on action
## Inline for edit form
## View and PDF in the same format
## Everything else in a catchall

#if($context.action == "inline")

1 Document $doc.name

## Change class name to your class name
#set($class = $doc.getObject("XWiki.StepClass").xWikiClass)

<table border="1" cellspacing="0" cellpadding="2">
#foreach($prop in $class.properties)
<tr><td> *${prop.prettyName}* </td>
<td>$doc.display($prop.getName())</td>
</tr>
#end
</table>

#*
This is the end of the "inline" template
that we use to edit in the form on the wiki
Below is the viewing and pdf template
*#


#elseif($context.action == "view" || $context.action == "pdf")
1.1 ${doc.nameOfStep}

*Process Owner* : ${doc.processOwner}

#if($doc.shortDescription == "")

#else
1.1.1 Summary
$doc.shortDescription
#end

#if($doc.objectives == "")

#else
1.1.1 Objectives
$doc.objectives
#end

#if($doc.policies == "")

#else
1.1.1 Policies Relating To This Step
$doc.policies
#end


{table}
INPUTS
${doc.inputs}
{table}

<table class="wiki-table" cellpadding="0" cellspacing="0" border="0">
<tr><td bgcolor="#FFD100">
<strong>PROCESS</strong>
</td></tr>
<tr><td>
${doc.processStep}
</td></tr>
</table>

{table}
OUTPUTS
${doc.outputs}
{table}

#if($doc.keyControls == "")

#else
1.1.1 Key Controls
$doc.keyControls
#end

#if($doc.bpControls == "")

#else
1.1.1 Best Practice Controls
$doc.bpControls
#end

#if($doc.itsystems == "")

#else
1.1.1 IT Systems Used
$doc.itsystems
#end

<table class="wiki-table" cellpadding="0" cellspacing="0" border="0">
<tr><td bgcolor="#FFD100">
<strong>EXECUTORS</strong>
</td><td bgcolor="#FFD100">
<strong>REVIEWERS</strong>
</td><td bgcolor="#FFD100">
<strong>APPROVERS</strong>
</td></tr>
<tr><td>
${doc.executors}
</td><td>
${doc.reviewers}
</td><td>
${doc.approvers}
</td></tr>
</table>

{table}
CYCLE|PROCESS|SUBPROCESS
${doc.cycle}|${doc.process}|${doc.subprocess}
{table}


#foreach($attach in $doc.AttachmentList)
<img class="wiki-table" src="$doc.getAttachmentURL($attach.Filename,"download")" />
#end

#*
This is the end of the "view" template
There is a catch all below this
*#

#else

This is everything apart from view and inline

#end



On 7 Jan 2006, at 6:56 AM, Ludovic Dubost wrote:


Hi mark,

What you are doing doesn't look wrong.. It seems to me it should work.
getRenderedContent() is the most recursive API. The page is fully rendered (velocity, groovy and radeox) in the context of the included page. So objects should be rendered properly and other includes should also be done (classsheet and so on).

Do you have and exemple of the page + sheet that fails ?

Ludovic

[hidden email] a écrit :
Hi Again.

I know it is bad form to reply to your own post, but this is what I am thinking so far.

Unfortunately I can't see how to display the included pages object information with the template page.

End result : Repeated empty templates
 << Snip

## Set the list of pages to be included
#set($pages = ["WebSpace.Page1", "WebSpace.Page2", "WebSpace.Page3"]) 
## Create the macro to display all the included pages with their object information rather than just the template
## Note : Move it to somewhere later we can use it rather than inline
#macro( includePage $pagelist ) #foreach( $page in $pagelist )

#set($displaypage = $xwiki.getDocument($page))
$displaypage.getRenderedContent()

#end #end

## Run the macro
#includePage($pages)

End Snip>>

Thanks in advance.

Cheers,


Mark Robinson

  ------------------------------------------------------------------------


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

  



-- 
Ludovic Dubost
Skype: ldubost AIM: nvludo Yahoo: ludovic



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Including Rendered Content or Object Properties with an includeTopic

Ludovic Dubost

Hi,

This looks like a bug.. I've tested it out here and #includeTopic or
getRenderedContent should not behave like that. There is something wrong
in the context with multiple level of includes.
To workaround the problem, it is in fact quite simple.. Don't call the
document itself.. use getRenderedContent using the class sheet's content

#set($mysheet = $xwiki.getDocument("XWiki.MySheet")
#set($mydoc = $xwiki.getDocument("XWiki.MyDoc")

$mydoc.getRenderedContent($mysheet.content)

This works. Can you submit a bug to http://jira.xwiki.org for the normal
way of doing it that does not work ?

Ludovic

Mark Robinson a écrit :

> Hi Ludovic.
>
> I am sure it is something obvious, but I can't see it.
>
> I have an object with structured data that I display with the
> following ClassSheet.  When you look directly at a page that
> has #includeForm("XWiki.ExampleClassSheet") and an object attached, it
> displays correctly with all the object properties filling in the right
> spaces.
>
> But then if you have another page that wants to include these pages,
> or a macro as described in the previous post (renderedContent), then
> only ClassSheet is displayed with the properties
> (eg ${doc.nameOfStep}) rather than the information from the included
> pages' object.
>
> I am thinking that it is because the template is using the $doc object
> methods and in the composite page no attached object exists, so I need
> to change the references in the template to reference the included
> pages' object but I am not sure how to do that.
>
> Hope that make sense and thanks for your help.
>
> Have a great day.
>
>
> Mark
>
>
> ## Multiversion "XWiki.ExampleClassSheet" template depending on action
> ## Inline for edit form
> ## View and PDF in the same format
> ## Everything else in a catchall
>
> #if($context.action == "inline")
>
> 1 Document $doc.name
>
> ## Change class name to your class name
> #set($class = $doc.getObject("XWiki.StepClass").xWikiClass)
>
> <table border="1" cellspacing="0" cellpadding="2">
> #foreach($prop in $class.properties)
> <tr><td> *${prop.prettyName}* </td>
> <td>$doc.display($prop.getName())</td>
> </tr>
> #end
> </table>
>
> #*
> This is the end of the "inline" template
> that we use to edit in the form on the wiki
> Below is the viewing and pdf template
> *#
>
>
> #elseif($context.action == "view" || $context.action == "pdf")
> 1.1 ${doc.nameOfStep}
>
> *Process Owner* : ${doc.processOwner}
>
> #if($doc.shortDescription == "")
>
> #else
> 1.1.1 Summary
> $doc.shortDescription
> #end
>
> #if($doc.objectives == "")
>
> #else
> 1.1.1 Objectives
> $doc.objectives
> #end
>
> #if($doc.policies == "")
>
> #else
> 1.1.1 Policies Relating To This Step
> $doc.policies
> #end
>
>
> {table}
> INPUTS
> ${doc.inputs}
> {table}
>
> <table class="wiki-table" cellpadding="0" cellspacing="0" border="0">
> <tr><td bgcolor="#FFD100">
> <strong>PROCESS</strong>
> </td></tr>
> <tr><td>
> ${doc.processStep}
> </td></tr>
> </table>
>
> {table}
> OUTPUTS
> ${doc.outputs}
> {table}
>
> #if($doc.keyControls == "")
>
> #else
> 1.1.1 Key Controls
> $doc.keyControls
> #end
>
> #if($doc.bpControls == "")
>
> #else
> 1.1.1 Best Practice Controls
> $doc.bpControls
> #end
>
> #if($doc.itsystems == "")
>
> #else
> 1.1.1 IT Systems Used
> $doc.itsystems
> #end
>
> <table class="wiki-table" cellpadding="0" cellspacing="0" border="0">
> <tr><td bgcolor="#FFD100">
> <strong>EXECUTORS</strong>
> </td><td bgcolor="#FFD100">
> <strong>REVIEWERS</strong>
> </td><td bgcolor="#FFD100">
> <strong>APPROVERS</strong>
> </td></tr>
> <tr><td>
> ${doc.executors}
> </td><td>
> ${doc.reviewers}
> </td><td>
> ${doc.approvers}
> </td></tr>
> </table>
>
> {table}
> CYCLE|PROCESS|SUBPROCESS
> ${doc.cycle}|${doc.process}|${doc.subprocess}
> {table}
>
>
> #foreach($attach in $doc.AttachmentList)
> <img class="wiki-table"
> src="$doc.getAttachmentURL($attach.Filename,"download")" />
> #end
>
> #*
> This is the end of the "view" template
> There is a catch all below this
> *#
>
> #else
>
> This is everything apart from view and inline
>
> #end
>
>
>
> On 7 Jan 2006, at 6:56 AM, Ludovic Dubost wrote:
>
>>
>> Hi mark,
>>
>> What you are doing doesn't look wrong.. It seems to me it should work.
>> getRenderedContent() is the most recursive API. The page is fully
>> rendered (velocity, groovy and radeox) in the context of the included
>> page. So objects should be rendered properly and other includes
>> should also be done (classsheet and so on).
>>
>> Do you have and exemple of the page + sheet that fails ?
>>
>> Ludovic
>>
>> [hidden email]
>> <mailto:[hidden email]> a écrit :
>>> Hi Again.
>>>
>>> I know it is bad form to reply to your own post, but this is what I
>>> am thinking so far.
>>>
>>> Unfortunately I can't see how to display the included pages object
>>> information with the template page.
>>>
>>> End result : Repeated empty templates
>>>  << Snip
>>>
>>> ## Set the list of pages to be included
>>> #set($pages = ["WebSpace.Page1", "WebSpace.Page2", "WebSpace.Page3"])
>>> ## Create the macro to display all the included pages with their
>>> object information rather than just the template
>>> ## Note : Move it to somewhere later we can use it rather than inline
>>> #macro( includePage $pagelist ) #foreach( $page in $pagelist )
>>>
>>> #set($displaypage = $xwiki.getDocument($page))
>>> $displaypage.getRenderedContent()
>>>
>>> #end #end
>>>
>>> ## Run the macro
>>> #includePage($pages)
>>>
>>> End Snip>>
>>>
>>> Thanks in advance.
>>>
>>> Cheers,
>>>
>>>
>>> Mark Robinson
>>>
>>>  
>>> ------------------------------------------------------------------------
>>>
>>>
>>> --
>>> You receive this message as a subscriber of the
>>> [hidden email] <mailto:[hidden email]> mailing
>>> list.
>>> To unsubscribe: mailto:[hidden email]
>>> For general help: mailto:[hidden email]?subject=help
>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>
>>>  
>>>
>>
>>
>> --
>> Ludovic Dubost
>> XPertNet: http://www.xpertnet.fr/
>> Blog: http://www.ludovic.org/blog/
>> XWiki: http://www.xwiki.com
>> Skype: ldubost AIM: nvludo Yahoo: ludovic
>>
>>
>>
>> --
>> You receive this message as a subscriber of the
>> [hidden email] <mailto:[hidden email]> mailing
>> list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  

--
Ludovic Dubost
XPertNet: http://www.xpertnet.fr/
Blog: http://www.ludovic.org/blog/
XWiki: http://www.xwiki.com
Skype: ldubost AIM: nvludo Yahoo: ludovic




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Including Rendered Content or Object Properties with an includeTopic

Mark Robinson-6
All done.  Bug XWIKI-199 registered.

Thanks again.  Your workaround works perfectly.

Mark



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws