Forum OpenACS Development: Re: Multiday event support in OpenACS Calendar Application

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