Forum OpenACS Development: Multiday event support in OpenACS Calendar Application

Hi All,

I am not able to add multiday event in Calendar

Lets say I have one event called "workshop" which starts on 27.06.2008 at 04.00 P.M. and lasts till 05.00 P.M. of next day i.e. 28.06.2008 ( I am asking this question since i did not see end date field in "add item" form )

Could anybody please tell whether the multiday event is supported in OpenACS Calendar Application or not

Going further , if it is not , then how can i add the support using existing datebase design

Awaiting Response

Thanks and Regards,
Poonam

Could anybody help please

Thanks and Regards,
Poonam

Collapse
Posted by Dave Bauer on
This is supported. I am not sure what you are looking at.
I have uploaded a screenshot of the openacs calendar installed here at openacs.org.

https://openacs.org/picture/photo?photo_id=1628201

Hi Dave

Thanks for your reply But it did not help :(
Let me explain it in detail

I have one event with following details

Start Date : 01.07.2008
Start Time : 10.00 A.M.

End Date : 03.07.2008
End Time : 11.00 P.M.

The above event is 3 days long Now my question is how to add this event in calendar "End Date" field is not provided there which brings me to a conclusion that addition of a multiday event is not possible I might be wrong though

So request you to please help

Thanks and Regards,
Poonam

Collapse
Posted by Dave Bauer on
Hey you are right! I was not paying attention.

The data model clearly supports this, but the form does not.

I am not sure how that would affect the display of items on the calendar either.

Has anyone else every needed this feature?

Hi Dave
Now you got me :)

One more observation. With existing design, it is not possible to add an event which starts at 11.00 P.M. today and ends after 1 hour (which means @ 12.00 A.M. of next day).I tried doing this but got an error saying "end time is before start time " But i feel this is a valid event and user should be allowed to add such an event
When i explored , i found the root cause of this error in "dates_valid_p" API. As we don't change the end_date to be the next date, the API fails. This is also one of the reasons which needs addition of end_date in "add-item" form

Could you please suggest solution to this which would do the insertion and displaying part of multiday events

I have one solution for multiday event support but that needs changes in existing data model

Thanks and Regards,
Poonam

Collapse
Posted by Dave Bauer on
The data model doesn't need any changes.
The underlying events are stored with start and end timestamp so that could include different dates.

The issue is how to display those events in the calendar. It does not appear anyone has addresses this so far.

I suggested changes in data model for the support of displaying such events.

Again consider the multiday event example given by me in 4th post. Let's say the event is added in the database. Now I try to see the events for 02.07.2008 ( which falls in the duration of above event). In day view of 02.07.2008 , i would not be seeing the event which, i think, is not the expected behavior from users perspective

Could you please elaborate more on your approach. Chances are there that i am getting you wrong

Thanks and Regards,
Poonam

Hi Poonam,

I think what Dave is saying is that the data model supports multi-day calendar items, but the form and validation code block in ad_form needs to modified to accept multi-day items.

Feel free to update this yourself. The API Browser contains documentation on ad_form and there are many, many examples in the code.

Ryan

Hi Ryan

Thanks a lot for your reply
Adding "end date" field in ad_form , changing/removing -validate case of ad_form and writing this in database are really not the issues here. What I am more concerned about is retrieving the entered information and showing it in "different views"

If a multiday event is added for a month starting from 1st july to 31st july , then it would be added as as a single row in database for which start date would be 1st july and end date would be 31st july
Having this as a pre requisite , when i go and check the day view of "20th july" , i don't get to see the event
This is the reason which makes me think of changing the data model

Could you please explain how the above condition can be done with the existing data model

Awaiting response

Thanks and Regards,
Poonam

Hi Poonam,

Although the calendar datamodel is prepared for multiday events, the logic to display them is not. So beside modifying the form to create/edit events, the day/week/month views would have to be modified too.

Yes , you are right

But again, for displaying the events we use a query which returns all the events for a particular day in case of day view.
Now my question is how the event would be picked up for a particular day which is not the start date or end date but somewhere in between ( 20th july in case of the example given in 10th post by me )

I don't think display logic can do anything if the row itself is not selected by multirow. Please correct me if i am wrong.
I would appreciate if you could explain how the above event would be handled with your solution

Thanks and Regards,
Poonam

oh I see, I missed that, sorry.

The query to retrieve events needs to be rewritten to get not only the events starting or ending in the day, but also, as you said, those that are in between. You can use the OVERLAPS operator to check that:

select (event_start_date,event_end_date) OVERLAPS (view_start_date,view_end_date);

See http://www.postgresql.org/docs/8.2/static/functions-datetime.html for more info.

Hey thanks a ton !
It seems to be working. I would change all the queries to get the expected result. The only overhead would be validating "end date" against "start date"

Thanks again :)

Thanks and Regards,
Poonam