Calendar lost some functionality in 3.0

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

Calendar lost some functionality in 3.0

Lockie
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"))

<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

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
Reply | Threaded
Open this post in threaded view
|

Re: Calendar lost some functionality in 3.0

Elena-Oana Tabaranu
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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users

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

Re: Calendar lost some functionality in 3.0

Lockie
Hi Oana

Thanks for the reply, as the code you provided almost worked except in the line:

"editor=object&classname=XWiki.CalendarEvent&nb=${event.number}")">$msg.get("edit"),

I had to change "nb" to "object" because I realised that when going through Edit>Objects and directly editing entry 1, the URL had "object=1" at the end whereas nb was still returning entry 0. I notice on my 2.4 calendar that the URL ends in "nb=1" so that must be where the problem lies.

Thanks Again,
Lockie

---
Complete fix:

#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;object=${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 


Elena-Oana Tabaranu wrote
Hi,

Your code should look like this:

#foreach($event in $doc.getObjects("XWiki.CalendarEvent"))
<div class="vevent">
1.1.1 $event.title.replaceAll('\n', "") 
#if($hasedit) ($msg.get("edit"),
$msg.get("delete"))#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
Lockie