Discussion:
[CalendarX-users] CalendarX and Zope3/Five
George Lee
2006-10-03 21:27:21 UTC
Permalink
Hi all!

Hit by a fit of Zope3-ish inspiration, yesterday and today I've been
working on refactoring CalendarX 0.6.6 to use Zope3/Five technology,
in particular views. So far it's been going pretty well, with some
good simplification to the page templates -- getting rid of a lot of
the python logic -- and being able to move stuff out of the many
skinned .py like getEventDictMonth into Zope3 views.

I was really happy to see how some of the coding practices of
CalendarX has made it fairly straightforward to change things into
Zope3 views, because the dictionaries the different calendar views and
events were using, already had a lot of the same structure that the
views will use. At the same time, moving things into views is forcing
eliminating redundancies, centralizing code rather than reusing the
same code in many different places, and more clearly separating
unrelated code.

As things get Zope3-ified, it should be a lot easier to understand and
test the code and make programming customizations.

Anyway, I'll keep you all updated on the progress and hopefully this
will be helpful in making CalendarX easier to customize/develop/test
and moving CalendarX forward!

Peace,
George
+lupa+
2006-10-05 17:14:33 UTC
Permalink
By the name of all that is holy and good, George I love you! :-)

I have seen your postings and questions and growth in the Zope3/Five area,
but had no idea that you might be so inspired, and I could not be more pleased.

I eagerly look forward to see what you have done, the approach you are
taking toward refactoring. PLEASE feel free to dig deep and I will try to
shake up some time toward diving in with you and learning as you go. I
have been wanting to move in this direction since 2.5 came out, but need
the willing partners to help me learn.

This is an obvious direction for CalendarX to move... perhaps the start of
the eventual 1.0 branch releases? Oh, I hope so! Numero Uno concern is
that we (1) move to base classes and other approaches internally that are
NOT deprecated in 2.5, and are instead forward looking to using all the
advantages of Zope3 development. Numero Dos would be to get started on a
testing framework (another fright for me, but I want/need to learn it).

Thanks George!
+lupa+
Post by George Lee
Hi all!
Hit by a fit of Zope3-ish inspiration, yesterday and today I've been
working on refactoring CalendarX 0.6.6 to use Zope3/Five technology,
in particular views. So far it's been going pretty well, with some
good simplification to the page templates -- getting rid of a lot of
the python logic -- and being able to move stuff out of the many
skinned .py like getEventDictMonth into Zope3 views.
I was really happy to see how some of the coding practices of
CalendarX has made it fairly straightforward to change things into
Zope3 views, because the dictionaries the different calendar views and
events were using, already had a lot of the same structure that the
views will use. At the same time, moving things into views is forcing
eliminating redundancies, centralizing code rather than reusing the
same code in many different places, and more clearly separating
unrelated code.
As things get Zope3-ified, it should be a lot easier to understand and
test the code and make programming customizations.
Anyway, I'll keep you all updated on the progress and hopefully this
will be helpful in making CalendarX easier to customize/develop/test
and moving CalendarX forward!
Peace,
George
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
CalendarX-users mailing list
https://lists.sourceforge.net/lists/listinfo/calendarx-users
George Lee
2006-10-05 19:14:59 UTC
Permalink
Great to hear some more excitement =). One of the tricky things to
figure out will be to how to keep it possible to make lots of
customizations, since Five development relies so much on customizing
things through the filesystem instead of through the web. Will keep
you posted on how that looks.

Is 0.6.6 the right place to start? I'm not familiar with cvs compared
to svn, so I'm not sure what the best way to download something that I
can generate a patch against.

Peace,
George
Post by +lupa+
By the name of all that is holy and good, George I love you! :-)
I have seen your postings and questions and growth in the Zope3/Five area,
but had no idea that you might be so inspired, and I could not be more pleased.
I eagerly look forward to see what you have done, the approach you are
taking toward refactoring. PLEASE feel free to dig deep and I will try to
shake up some time toward diving in with you and learning as you go. I
have been wanting to move in this direction since 2.5 came out, but need
the willing partners to help me learn.
This is an obvious direction for CalendarX to move... perhaps the start of
the eventual 1.0 branch releases? Oh, I hope so! Numero Uno concern is
that we (1) move to base classes and other approaches internally that are
NOT deprecated in 2.5, and are instead forward looking to using all the
advantages of Zope3 development. Numero Dos would be to get started on a
testing framework (another fright for me, but I want/need to learn it).
Thanks George!
+lupa+
Post by George Lee
Hi all!
Hit by a fit of Zope3-ish inspiration, yesterday and today I've been
working on refactoring CalendarX 0.6.6 to use Zope3/Five technology,
in particular views. So far it's been going pretty well, with some
good simplification to the page templates -- getting rid of a lot of
the python logic -- and being able to move stuff out of the many
skinned .py like getEventDictMonth into Zope3 views.
I was really happy to see how some of the coding practices of
CalendarX has made it fairly straightforward to change things into
Zope3 views, because the dictionaries the different calendar views and
events were using, already had a lot of the same structure that the
views will use. At the same time, moving things into views is forcing
eliminating redundancies, centralizing code rather than reusing the
same code in many different places, and more clearly separating
unrelated code.
As things get Zope3-ified, it should be a lot easier to understand and
test the code and make programming customizations.
Anyway, I'll keep you all updated on the progress and hopefully this
will be helpful in making CalendarX easier to customize/develop/test
and moving CalendarX forward!
Peace,
George
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
CalendarX-users mailing list
https://lists.sourceforge.net/lists/listinfo/calendarx-users
+lupa+
2006-10-06 01:28:09 UTC
Permalink
Post by George Lee
Great to hear some more excitement =). One of the tricky things to
figure out will be to how to keep it possible to make lots of
customizations, since Five development relies so much on customizing
things through the filesystem instead of through the web. Will keep
you posted on how that looks.
Is 0.6.6 the right place to start? I'm not familiar with cvs compared
to svn, so I'm not sure what the best way to download something that I
can generate a patch against.
Peace,
George
Yep, for right now 0.6.6 is the way to start. I'm not currently keeping
either a CVS or SVN repository, just the tarballs on
sourceforge.net. There are a couple small bugs that should be fixed and a
couple of translations... I should have released a version 0.6.7 before
this time, but have long been squeezed for time.

If you feel a need for SVN for this work, we can find a way to do that.

I suggest that we work toward making this project of yours into a
0.7.0(experimental) release. I would like to see it whenever you find it
usable, and can install it on a subdomain of Calendarx.org for the
community to examine and play with, when we get it to that stage. I have
Plone 2.5 running on the same server... I'll upgrade it to 2.5.1 in
preparation for the day.

Whoo hoo! Into the future!
+lupa+
Post by George Lee
Post by +lupa+
By the name of all that is holy and good, George I love you! :-)
I have seen your postings and questions and growth in the Zope3/Five area,
but had no idea that you might be so inspired, and I could not be more
pleased.
Post by +lupa+
I eagerly look forward to see what you have done, the approach you are
taking toward refactoring. PLEASE feel free to dig deep and I will try to
shake up some time toward diving in with you and learning as you go. I
have been wanting to move in this direction since 2.5 came out, but need
the willing partners to help me learn.
This is an obvious direction for CalendarX to move... perhaps the start of
the eventual 1.0 branch releases? Oh, I hope so! Numero Uno concern is
that we (1) move to base classes and other approaches internally that are
NOT deprecated in 2.5, and are instead forward looking to using all the
advantages of Zope3 development. Numero Dos would be to get started on a
testing framework (another fright for me, but I want/need to learn it).
Thanks George!
+lupa+
Post by George Lee
Hi all!
Hit by a fit of Zope3-ish inspiration, yesterday and today I've been
working on refactoring CalendarX 0.6.6 to use Zope3/Five technology,
in particular views. So far it's been going pretty well, with some
good simplification to the page templates -- getting rid of a lot of
the python logic -- and being able to move stuff out of the many
skinned .py like getEventDictMonth into Zope3 views.
I was really happy to see how some of the coding practices of
CalendarX has made it fairly straightforward to change things into
Zope3 views, because the dictionaries the different calendar views and
events were using, already had a lot of the same structure that the
views will use. At the same time, moving things into views is forcing
eliminating redundancies, centralizing code rather than reusing the
same code in many different places, and more clearly separating
unrelated code.
As things get Zope3-ified, it should be a lot easier to understand and
test the code and make programming customizations.
Anyway, I'll keep you all updated on the progress and hopefully this
will be helpful in making CalendarX easier to customize/develop/test
and moving CalendarX forward!
Peace,
George
Brett Patterson
2006-10-06 09:41:45 UTC
Permalink
Dear CalX Users,

I have to manage *hundreds* of calendar events.
These are lab bookings for a big team of researchers.

It is *very* tedious to enter/edit each booking manually
using the Plone "through the web" interface.

Is there some way I way upload/download the calendar
events to an external file (e.g. iCal!) that I can then edit
using more efficient methods (e.g. shell scripts)?

Or is there some way to make a python script that will
create/change bookings according to my criteria?

Thanks for your help!

Regards,
Brett Patterson

University of Edinburgh
Scotland
+lupa+
2006-10-06 12:36:18 UTC
Permalink
Post by Brett Patterson
Dear CalX Users,
I have to manage *hundreds* of calendar events.
These are lab bookings for a big team of researchers.
It is *very* tedious to enter/edit each booking manually
using the Plone "through the web" interface.
Is there some way I way upload/download the calendar
events to an external file (e.g. iCal!) that I can then edit
using more efficient methods (e.g. shell scripts)?
Or is there some way to make a python script that will
create/change bookings according to my criteria?
Thanks for your help!
Regards,
Brett Patterson
University of Edinburgh
Scotland
Hi Brett,
Wow, sounds like an adventurous use for CalendarX.

Strictly, this might be better asked in Plone-users. The reason I suggest
this is that your problem is a Plone content management problem, rather
than a CalendarX problem per se. CalendarX simply displays the events in a
calendar format... Plone is the platform for handling all the events,
entering them, etc.

That said, there are users out there in the Plone + calendar world who use
iCal and importing and exporting and such. Max's mxm icaltool product
perhaps ( http://www.mxm.dk/products/public/mxm_ical_tool )? I'm not one
of these users who do such things, so that's about as much as I can
honestly say about it right now. I've only experimented with it, and never
used it in a production mode at all. It's out there on my todo list to
find ways to better integrate with CalendarX... but for now, I leave that
to the larger community, and concentrate my efforts on making CalendarX a
capable display tool.

Good luck... perhaps someone else on this list (or try the Calendaring
list) can help more... And if you do find success, your words to us all
may well be inspiring, so let us know how you fare.
+lupa+
Brett Patterson
2006-10-09 08:24:04 UTC
Permalink
Dear CalX Users,

At the top of my CalendarX, there is a link "PUBLIC: click for MY
events",
which toggles, when clicked, with "MINE: click for PUBLIC events".

This is a great feature of CalendarX, especially when there a lots of
events.

However, in my case, I am the site administrator, and I am creating
lab bookings
for members of the site. I have added the relevant members as
Attendees for each booking.
Now I want to use the PUBLIC/MINE feature so that members can show
only the
bookings that they are attending. How can I do this?

I have tried customising getEventsBetweenZC so that:

if q_xcrt:
qdict['Creator'] = q_xcrt

Becomes:

if q_xcrt:
qdict['Attendees'] = q_xcrt

But that doesn't work, even though I've
added Attendees (and "attendees") to the portal_catalog metadata.

Any suggestions?

Regards,
Brett

School of Physics
University of Edinburgh
Scotland
+lupa+
2006-10-09 12:25:40 UTC
Permalink
Post by Brett Patterson
Dear CalX Users,
At the top of my CalendarX, there is a link "PUBLIC: click for MY
events",
which toggles, when clicked, with "MINE: click for PUBLIC events".
This is a great feature of CalendarX, especially when there a lots of
events.
However, in my case, I am the site administrator, and I am creating
lab bookings
for members of the site. I have added the relevant members as
Attendees for each booking.
Now I want to use the PUBLIC/MINE feature so that members can show
only the
bookings that they are attending. How can I do this?
qdict['Creator'] = q_xcrt
qdict['Attendees'] = q_xcrt
But that doesn't work, even though I've
added Attendees (and "attendees") to the portal_catalog metadata.
Any suggestions?
Regards,
Brett
Hi Brett,
I'm without a chance to look in detail at the code right at the moment,
but am pretty sure that this will be more analgous to the code for Subjects
rather than the one for Creator. This is because Attendees should be a
list, rather than a string, and so you have to search for any of the (list
of) Attendees, just like you have to search for any of the (list of)
Subjects. So try rewriting your code to mimic the way Subjects is queried.

+lupa+

ps. and don't forget to customize getEventsBeforeZC.py too, once you get
it to start working. :-)

pps. Let us know how your efforts go, this sounds reasonably important. I
am planning to create a new 0.6.x release that will fix a couple bugs and
rewrite the manual to work better with Plone 2.5, which everybody is
starting to use finally (me too).
Brett Patterson
2006-10-09 12:58:59 UTC
Permalink
Hi Lupa,

Thanks for your message.

I'm struggling to understand how the PUBLIC/MY event search
is generated. If you could point me to the right files and/or code
then I might be able to make the necessary changes, to make
the Creator search like the Subject search, but use the Attendees list.

But I don't understand enough about the CalX code to understand
how it's all fitting together to eventually perform the right
portal_catalog search.

Seems I have to prepare a search 'dictionary' (whatever that is)??

By the way, I am using Plone 2.5 now too.
Are there any issues I should know about?

Brett
Post by +lupa+
Post by Brett Patterson
Dear CalX Users,
At the top of my CalendarX, there is a link "PUBLIC: click for MY
events",
which toggles, when clicked, with "MINE: click for PUBLIC events".
This is a great feature of CalendarX, especially when there a lots of
events.
However, in my case, I am the site administrator, and I am creating
lab bookings
for members of the site. I have added the relevant members as
Attendees for each booking.
Now I want to use the PUBLIC/MINE feature so that members can show
only the
bookings that they are attending. How can I do this?
qdict['Creator'] = q_xcrt
qdict['Attendees'] = q_xcrt
But that doesn't work, even though I've
added Attendees (and "attendees") to the portal_catalog metadata.
Any suggestions?
Regards,
Brett
Hi Brett,
I'm without a chance to look in detail at the code right at the
moment, but am pretty sure that this will be more analgous to the
code for Subjects rather than the one for Creator. This is because
Attendees should be a list, rather than a string, and so you have
to search for any of the (list of) Attendees, just like you have to
search for any of the (list of) Subjects. So try rewriting your
code to mimic the way Subjects is queried.
+lupa+
ps. and don't forget to customize getEventsBeforeZC.py too, once
you get it to start working. :-)
pps. Let us know how your efforts go, this sounds reasonably
important. I am planning to create a new 0.6.x release that will
fix a couple bugs and rewrite the manual to work better with Plone
2.5, which everybody is starting to use finally (me too).
Brett Patterson
2006-10-11 08:48:48 UTC
Permalink
Hi!

Some progress with this problem:

I edited the Properties of my booking events in Plone,
so that the *first line* of the Creator field box
is the name of the member I want to be able to
view the booking event with "click for MY events".

This works, but only if the member is on the first line.

There are three issues:

1. Why doesn't it work if the member is the 2nd or 3rd listed Creator?

2. How can I get this to work for the Owner property,
which is more easily assigned to all the contents of a folder
by using the Sharing tab in Plone. The Creator field seems to only
be editable in each individual content item (booking event).

3. Ideally, how can I get this to work for my list of Attendees?

I have searched the CalX skin files and found these code
fragments that seem relevant, in getEventsBetweenZC.py:

...
xcrt = str(xcrt)
if xcrt == '11':
q_xcrt = context.portal_membership.getAuthenticatedMember
().getUserName()
else:
q_xcrt = 0
...

...
if q_xcrt:
qdict['Creator'] = q_xcrt
...
return context.portal_catalog(qdict)
...

Could someone please explain to be what this code is doing?
It seems that q_xcrt is the name of the member in question,
and qdict is python dictionary that associates 'Creator' with
the name of the member. This is used by the portal_catalog
search in the return statement.

So how can this be modified to use 'Owner' or 'Attendees'
(assuming they are in the portal_catalog)? And how can it
be modified to cope with these elements being lists?

Thanks for your support!

Cheers,
Brett

School of Physics
University of Edinburgh, Scotland
Post by +lupa+
Post by Brett Patterson
Dear CalX Users,
At the top of my CalendarX, there is a link "PUBLIC: click for MY
events",
which toggles, when clicked, with "MINE: click for PUBLIC events".
This is a great feature of CalendarX, especially when there a lots of
events.
However, in my case, I am the site administrator, and I am creating
lab bookings
for members of the site. I have added the relevant members as
Attendees for each booking.
Now I want to use the PUBLIC/MINE feature so that members can show
only the
bookings that they are attending. How can I do this?
qdict['Creator'] = q_xcrt
qdict['Attendees'] = q_xcrt
But that doesn't work, even though I've
added Attendees (and "attendees") to the portal_catalog metadata.
Any suggestions?
Regards,
Brett
Hi Brett,
I'm without a chance to look in detail at the code right at the
moment, but am pretty sure that this will be more analgous to the
code for Subjects rather than the one for Creator. This is because
Attendees should be a list, rather than a string, and so you have
to search for any of the (list of) Attendees, just like you have to
search for any of the (list of) Subjects. So try rewriting your
code to mimic the way Subjects is queried.
+lupa+
ps. and don't forget to customize getEventsBeforeZC.py too, once
you get it to start working. :-)
pps. Let us know how your efforts go, this sounds reasonably
important. I am planning to create a new 0.6.x release that will
fix a couple bugs and rewrite the manual to work better with Plone
2.5, which everybody is starting to use finally (me too).
D***@krankenhaus-kempen.de
2006-10-06 13:04:48 UTC
Permalink
Hi,

in "Definitive Guide to Plone"
(http://plone.org/documentation/manual/definitive-guide/definitive_guide_to_plone.pdf)
on page 257 - 259 Andy McKay gave a good example of adding users from a
csv-file. The same should be possible with events, if that is what you
want.

Something like

import csv
fileName = "/path/to/my/file.csv"
reader = csv.reader(open(fileName, "r"))
for row in reader:
myid, mytitle, and_so_on = row
myfolder.invokeFactory(id=myid, type_name='Event')
myevent = getattr(myfolder, myid)
myevent.setTitle(mytitle)
myevent.setWhatever(and_so_on)

wf = getToolByName(myevent, 'portal_workflow')
wf.doActionFor(myevent, 'publish')

should do the trick for you.

Good luck, Johannes
Loading...