On 04/05/2011 05:11 AM, Lockie wrote:
> Hi all
>
> I'm in the process of starting from a fresh install in 3.0 after using 2.4
> for many months.
>
> I have however encountered a problem with the "Edit" link used for directly
> editing a calendar entry (which is an object generated when you add an event
> to the calendar). These entries appear in a list and with each one there is
> the "Edit" link mentioned above, as well as a "Remove" link.
>
> The "Remove" link removes the calendar entry fine, but in 3.0, the "Edit"
> link always goes to the very first calendar entry, called CalendarEvent 0.
> In my 2.4 installation though it correctly goes to the corresponding
> calendar entry.
>
> This is the section of code I think is at fault, note it's in 1.0 syntax.
>
>
> #foreach($event in $doc.getObjects("XWiki.CalendarEvent"))
>
>
>
> 1.1.1 $event.title.replaceAll('\n', "")
>
> #if($hasedit)
>
> ( $doc.getURL( $msg.get("edit") ,
>
> $doc.getURL( $msg.get("delete") )
>
> #end
>
Hi,

Your code should look like this:

#foreach($event in $doc.getObjects("XWiki.CalendarEvent"))
<div class="vevent">
1.1.1 <span class="summary">$event.title.replaceAll('\n', "")</span> 
#if($hasedit) (<a href="$doc.getURL("edit", 
"editor=object&amp;classname=XWiki.CalendarEvent&amp;nb=${event.number}")">$msg.get("edit")</a>,
 
<a href="$doc.getURL("objectremove", 
"classname=XWiki.CalendarEvent&amp;classid=${event.number}&amp;xredirect=$doc.getURL('view')")">$msg.get("delete")</a>)#end
...
#end

You can make a test and print the ${event.number} inside the #foreach to 
see if the value is correct. I have tested with 3.0 and the links seem ok.

Oana
> Somehow the $event.number is always 0 and not the actual number of the
> entry. It could be related to the Velocity engine getting upgraded to 7.1? I
> tried copying parts of the "Remove" section since that is getting the link
> to the entry correct, but it always goes to the very first entry, number 0.
>
> I really need this functionality because it's much easier for users to edit
> an entry individually then sifting through the objects that eventually grow
> to a big number. It's preventing me from moving to 3.0, so any help would be
> greatly appreciated.
>
> Thanks
>
> -----
> ----
> Lockie
> --
> View this message in 
> context:http://xwiki.475771.n2.nabble.com/Calendar-lost-some-functionality-in-3-0-tp6240869p6240869.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to