Page 1 of 1

Calendar Action Event Field Attributes

PostPosted: Fri Jul 29, 2011 6:42 am
by ADobkin
I just started using the calendar action in my Xataface application. Thanks for making it available!

I've noticed that three of the field attributes (event.end, event.location, and event.category) appear to be ignored in Xataface as of version 1.3rc4, although the table in the wiki documenting this feature indicates they are in version 1.0.

These attributes are defined in Dataface/Ontology/Event.php, but they are not yet referenced by either actions/calendar.php or js/dfCalendar.js. I am curious if support for these attributes is still being developed and how the location and category fields would be used. I suspect one of the goals might be to add support for iCalendar/vCalendar in the future.

In the meantime, I have been dabbling with these files to just make the end time attribute work. I see that there is some html formatted in dfCalendar.js for the end time, so it should show the event "from" and "to", but the "to" part doesn't appear because the endTime isn't being passed. So, I made the following change, and it appears to work:

Code: Select all
--- calendar.php.bak    2011-07-21 14:20:02.000000000 -0400
+++ calendar.php        2011-07-29 09:40:27.000000000 -0400
@@ -47,8 +47,9 @@
                        $event = $ontology->newIndividual($record);
                        $datems = strtotime(date('Y-m-d', strtotime($event->strval('date'))))*1000;
                        $timems = (strtotime(date('H:i:s', strtotime($event->strval('start')))) - strtotime(date('Y-m-d')))*1000;
+                       $endtimems = $datems + (strtotime(date('H:i:s', strtotime($event->strval('end')))) - strtotime(date('Y-m-d')))*1000;

-                       $events[] = array('title'=>$record->getTitle(), 'description'=>$record->getDescription(), 'date'=>$datems+$timems, 'startTime'=>strtotime($event->strval('date'))*1000, 'record_id'=>$record->getId());
+                       $events[] = array('title'=>$record->getTitle(), 'description'=>$record->getDescription(), 'date'=>$datems+$timems, 'startTime'=>strtotime($event->strval('date'))*1000, 'endTime'=>$endtimems, 'record_id'=>$record->getId());

                        unset($event);
                        unset($record);

Re: Calendar Action Event Field Attributes

PostPosted: Fri Jul 29, 2011 9:17 am
by shannah
Hmm.. you're right. Looks like it could have been a mistake commit that overwrote some stuff... I'll need to look through the SVN logs to see if I can figure out why this happened (or if it might have been on purpose).