Cannot show calendar events on Main.WebHome

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

Cannot show calendar events on Main.WebHome

Jean Couteau
Dear all,

i am playing with the calendar to do what i thought was quite simple,
but i am stuck. Some explanations :

I am trying to put the calendar table on my wiki home page, without the
event list or the add event form.

What i have done is :

- add a section between calendar and event list on XWiki.CalendarEvent
- use code to retrieve only the first section of this document and
render it :

#set( $doc1=$xwiki.getDocument("XWiki.CalendarSheet").getDocument())
#set ($content = $doc1.getContentOfSection(1))
#set( $doc2=$xwiki.getDocument("Main.EventCalendar"))
$xwiki.renderText($content, $doc2)

It's nice, i have my calendar table rendered, but no sign of my events.

I tried to change the $doc2 variable to see if it was a context problem
or something but nothing worked out.

Am i missing something ?

Thanks in advance

Jean
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Cannot show calendar events on Main.WebHome

Sergiu Dumitriu-2
Jean Couteau wrote:

> Dear all,
>
> i am playing with the calendar to do what i thought was quite simple,
> but i am stuck. Some explanations :
>
> I am trying to put the calendar table on my wiki home page, without the
> event list or the add event form.
>
> What i have done is :
>
> - add a section between calendar and event list on XWiki.CalendarEvent
> - use code to retrieve only the first section of this document and
> render it :
>
> #set( $doc1=$xwiki.getDocument("XWiki.CalendarSheet").getDocument())
> #set ($content = $doc1.getContentOfSection(1))
> #set( $doc2=$xwiki.getDocument("Main.EventCalendar"))
> $xwiki.renderText($content, $doc2)
>
> It's nice, i have my calendar table rendered, but no sign of my events.
>
> I tried to change the $doc2 variable to see if it was a context problem
> or something but nothing worked out.
>
> Am i missing something ?

The calendar plugin does not work well with $xwiki.renderText, since it
uses a different way of getting the current document than the one used
by $xwiki.renderText.

TO fix this, edit XWiki.CalendarSheet and replace:

$cview.getHTMLCalendar($cparams, "")

with:

$cview.getHTMLCalendar($cparams, $doc, "")

--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Cannot show calendar events on Main.WebHome

Jean Couteau
Sergiu Dumitriu a écrit :

> Jean Couteau wrote:
>  
>> Dear all,
>>
>> i am playing with the calendar to do what i thought was quite simple,
>> but i am stuck. Some explanations :
>>
>> I am trying to put the calendar table on my wiki home page, without the
>> event list or the add event form.
>>
>> What i have done is :
>>
>> - add a section between calendar and event list on XWiki.CalendarEvent
>> - use code to retrieve only the first section of this document and
>> render it :
>>
>> #set( $doc1=$xwiki.getDocument("XWiki.CalendarSheet").getDocument())
>> #set ($content = $doc1.getContentOfSection(1))
>> #set( $doc2=$xwiki.getDocument("Main.EventCalendar"))
>> $xwiki.renderText($content, $doc2)
>>
>> It's nice, i have my calendar table rendered, but no sign of my events.
>>
>> I tried to change the $doc2 variable to see if it was a context problem
>> or something but nothing worked out.
>>
>> Am i missing something ?
>>    
>
> The calendar plugin does not work well with $xwiki.renderText, since it
> uses a different way of getting the current document than the one used
> by $xwiki.renderText.
>
> TO fix this, edit XWiki.CalendarSheet and replace:
>
> $cview.getHTMLCalendar($cparams, "")
>
> with:
>
> $cview.getHTMLCalendar($cparams, $doc, "")
>
>  
It works perfectly. Lot of thanks for this quick response.

--
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users