Discussion:
[CalendarX-users] Help to customise event display
Brett Patterson
2006-09-23 20:57:36 UTC
Permalink
Dear CalendarX people,

Please, can someone tell me where I can customise the
display of events, so that the Creator and/or the Attendees
are displayed in the Calendar.

The default view only shows the Title and Dates.

Regards,
Brett Patterson
+lupa+
2006-09-25 16:42:17 UTC
Permalink
Post by Brett Patterson
Dear CalendarX people,
Please, can someone tell me where I can customise the
display of events, so that the Creator and/or the Attendees
are displayed in the Calendar.
The default view only shows the Title and Dates.
Regards,
Brett Patterson
Hi Brett,
That would be the "eventstring" code, which is placed into the calendar
in the "eventlister" and "mMeventlister" macro codes, found in
CX_props_macros. However, the "eventstring" is generated differently for
each view, and is found in these Python scripts:

getEventsDictDay.py
getEventsDictMonth.py
getEventsDictMMonth.py
getEventsDictWeekbyday.py
getEventsDictWeekbyhour.py

The main line you are interested looks like this (from the Day script):
eventstring = '<strong>'+eventtitle+'</strong> (start: '+stime+' -
'+smonth+' '+sday+', '+syear+' | end: '+etime+' - '+emonth+' '+eday+',
'+eyear+')'

where all those variables have been set in the code lines above. If you
want to add the creator, you'll have to define its use, like this:

eventcreator = event.Creator

and then use it in your new eventstring code:
eventstring = '<strong>'+eventtitle+'</strong> (start: '+stime+' -
'+smonth+' '+sday+', '+syear+' | end: '+etime+' - '+emonth+' '+eday+',
'+eyear+')+ ' Created by '+eventcreator

same for other features that are included in the metadata of the
portal_catalog for each Event.

NOTE: there are more than one lines that generate "eventstring" depending
on the script and that view's usage/display of continuing and late events.

Sorry for the delay, Good luck.
+lupa+
+lupa+
2006-10-02 19:19:46 UTC
Permalink
Hi Lupa,
Thanks for your reply.
I am wondering how to obtain the contents of the Attendees field for
the event?
"event.Attendees" does not work, so it seems Attendees is not the
same as Creator.
Do you know, or anyone, know how I obtain the attendees?
Regards,
Brett
Hi Brett,
If attendees are being catalogued by the portal_catalog AND included in
the metadata as "Attendees", then this approach will work. "event" is a
catalog brain, and will give you only the metadata attributes that it
contains. Attendees are not a standard part of the Plone catalog metadata,
I don't believe. "Creator" is a standard (out-of-the-box) part of the
metadata in all Plone sites, for all content objects.

1. Look in your portal_catalog for your Event, and see whether the
attendees are being catalogued and included in the metadata. If not, add
them. If so, see what name they are called and use that.

2. A bit slower for lots of events, but instead of using the
portal_catalog you can also use the event brain to get at the event content
object directly, and query it for the attendees. Read the Catalog chapter
of the Zope book at http://plope.com for details on how to fashion and
query your catalog effectively.

Good luck.
+lupa+
Post by +lupa+
Post by Brett Patterson
Dear CalendarX people,
Please, can someone tell me where I can customise the
display of events, so that the Creator and/or the Attendees
are displayed in the Calendar.
The default view only shows the Title and Dates.
Regards,
Brett Patterson
Hi Brett,
That would be the "eventstring" code, which is placed into the
calendar in the "eventlister" and "mMeventlister" macro codes,
found in CX_props_macros. However, the "eventstring" is generated
getEventsDictDay.py
getEventsDictMonth.py
getEventsDictMMonth.py
getEventsDictWeekbyday.py
getEventsDictWeekbyhour.py
The main line you are interested looks like this (from the Day
eventstring = '<strong>'+eventtitle+'</strong> (start: '+stime +' -
'+smonth+' '+sday+', '+syear+' | end: '+etime+' - '+emonth+'
'+eday+', '+eyear+')'
where all those variables have been set in the code lines above.
If you want to add the creator, you'll have to define its use, like
eventcreator = event.Creator
eventstring = '<strong>'+eventtitle+'</strong> (start: '+stime +' -
'+smonth+' '+sday+', '+syear+' | end: '+etime+' - '+emonth+'
'+eday+', '+eyear+')+ ' Created by '+eventcreator
same for other features that are included in the metadata of the
portal_catalog for each Event.
NOTE: there are more than one lines that generate "eventstring"
depending on the script and that view's usage/display of continuing
and late events.
Sorry for the delay, Good luck.
+lupa+
Brett Patterson
2006-10-03 01:09:26 UTC
Permalink
Thanks Lupa!

With your help, I managed to solve my problem! :-)

I added 'attendees' to the portal_catalog metadata and rebuilt the
catalog.

Then I used this code in portal_skins/custom/getEventDictMonth:

eventattendees = str(string.join(event.attendees))
...
if event.Type == 'Booking':
eventstring = '<strong>'+eventtitle+'</strong><br/>
'+datestring+'<br/><strong> Who: </strong>'+eventattendees
else:
eventstring = '<strong>'+eventtitle+'</strong><br/> '+datestring

(I have a custom Event type called Booking)

and the result is that my Bookings display the attendees ("Who") but
normal events do not.

Thanks again,

Brett
Post by +lupa+
Hi Lupa,
Thanks for your reply.
I am wondering how to obtain the contents of the Attendees field for
the event?
"event.Attendees" does not work, so it seems Attendees is not the
same as Creator.
Do you know, or anyone, know how I obtain the attendees?
Regards,
Brett
Hi Brett,
If attendees are being catalogued by the portal_catalog AND
included in the metadata as "Attendees", then this approach will
work. "event" is a catalog brain, and will give you only the
metadata attributes that it contains. Attendees are not a standard
part of the Plone catalog metadata, I don't believe. "Creator" is
a standard (out-of-the-box) part of the metadata in all Plone
sites, for all content objects.
1. Look in your portal_catalog for your Event, and see whether the
attendees are being catalogued and included in the metadata. If
not, add them. If so, see what name they are called and use that.
2. A bit slower for lots of events, but instead of using the
portal_catalog you can also use the event brain to get at the event
content object directly, and query it for the attendees. Read the
Catalog chapter of the Zope book at http://plope.com for details on
how to fashion and query your catalog effectively.
Good luck.
+lupa+
Post by +lupa+
Post by Brett Patterson
Dear CalendarX people,
Please, can someone tell me where I can customise the
display of events, so that the Creator and/or the Attendees
are displayed in the Calendar.
The default view only shows the Title and Dates.
Regards,
Brett Patterson
Hi Brett,
That would be the "eventstring" code, which is placed into the
calendar in the "eventlister" and "mMeventlister" macro codes,
found in CX_props_macros. However, the "eventstring" is generated
getEventsDictDay.py
getEventsDictMonth.py
getEventsDictMMonth.py
getEventsDictWeekbyday.py
getEventsDictWeekbyhour.py
'+stime +' - '+smonth+' '+sday+', '+syear+' | end: '+etime+' -
'+emonth+'
'+eday+', '+eyear+')'
where all those variables have been set in the code lines above.
If you want to add the creator, you'll have to define its use, like
eventcreator = event.Creator
'+stime +' - '+smonth+' '+sday+', '+syear+' | end: '+etime+' -
'+emonth+'
'+eday+', '+eyear+')+ ' Created by '+eventcreator
same for other features that are included in the metadata of the
portal_catalog for each Event.
NOTE: there are more than one lines that generate "eventstring"
depending on the script and that view's usage/display of continuing
and late events.
Sorry for the delay, Good luck.
+lupa+
Loading...