Hi Mark,

> In our use of the calendar extension, I expect to have situations where the
> title is repeated (sometimes for what are really recurring events and
> sometimes not). For this reason, we'll leave the randomly generated string
> in the title field.

To start with, there is probably a bug here. The document where the event is 
stored should
have a name (which indeed has to be unique per calendar, but should only show 
up in the URL
if viewing the "detailed view" of that event) and a title - which is also 
displayed in the overview.

There should be a random generated component of the name, but this should not 
show up in the document title;
this field should initially be empty when creating a new event.

This looks very much like the following bug: 
http://jira.xwiki.org/browse/MOCCACAL-68

I cannot reproduce this with the current version (XWiki 7.4, MoccaCal 2.5). 
Which version of the Mocca Calendar are you using?
(This should be shown in the Wiki Admin, section "Installed Extensions")


> I've added a 'short description' field to the event
> class to use in place of the title. I would like to display the new field in
> the calendar month/week/day view instead of the title. Does anyone have
> suggestions on how to do this?
> 
> I'm using XWiki 7.4.
> 

Fetching the data which is displayed in the actual calendar happens in the page 
MoccaCalendar.JSONService
(You can find this page at /xwiki/bin/view/MoccaCalendar/JSONService )

If you edit it in the Wiki-editor you will see it contains ... quite some code 
handling the creation of unique document names,
and the query to fetch all events that should be shown to the current calendar 
display.
It is the second part that you will want to adapt.

 Scroll down and search for something like:

 #set($event = {"id" : $itemdoc.getDocumentReference().toString(), "title" : 
$itemdoc.getPlainTitle(),  ...

here the "title" is filled in as the document title.
If you want to get a field from the event, then this data is available as:  
$itemdoc.getValue('short_description')
(or whatever the name of the field is), so you can replace the 
$itemdoc.getPlainTitle() with that String.


This covers the "normal" calendar view. The "Agenda"-style view with the 
upcoming events is handled differently unfortunately;
here the JSON-Service this returns fully rendered HTML to be inserted into the 
page directly, and you need to chnage this part, too.

You can search for a  " ... + $escapetool.html($itemdoc.getPlainTitle()) + ... 
"  - that is the place where you want to add / insert your custom field,


hope this helps,
Clemens
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to