calendars: [],
loadedCalendars: [],
events: [],
-
+
/**
* Perform an Ajax action
*
$.post(Kronolith.conf.URI_AJAX + action, params, callback, 'json');
},
+ /**
+ * Load all events between start and end time. Returns short version of
+ * event info.
+ *
+ * @param Date start
+ * @param Date end
+ */
loadEvents: function(start, end)
{
KronolithMobile.loadedCalendars = [];
}
},
+ /**
+ * Used as sorting funtion to Array.sort for sorting events by start time
+ */
sortEvents: function(events)
{
return events.sort(function(a, b) {
},
/**
- * Callback for the listEvents AJAX request.
+ * Callback for the listEvents AJAX request. For now, assume we are in
+ * day view, wait for all calendar responses to be received and then build
+ * the event elements in the listview.
+ *
+ * @param object data The ajax response.
*/
listEventsCallback: function(data)
{
});
});
}
+
if (KronolithMobile.loadedCalendars.length == KronolithMobile.calendars.length) {
var events = KronolithMobile.sortEvents(KronolithMobile.events);
list = $('<ul>').attr({'data-role': 'listview'});
*
* @param string cal The calendar name returned from the ajax request.
* @param object event The event object returned from the ajax request.
+ * @param string id The event identifier
*/
buildDayEvent: function(cal, event, id)
{
return item.append(a);
},
+ /**
+ * Retrieve a single event from the server.
+ *
+ * @param string cal The calendar identifier.
+ * @param string id The event identifier.
+ * @param Date d The date the event occurs.
+ */
loadEvent: function(cal, id, d)
{
KronolithMobile.doAction('getEvent',
KronolithMobile.loadEventCallback);
},
+ /**
+ * Callback for loadEvent call. Assume we are in Event view for now, build
+ * the event view structure and attach to DOM.
+ *
+ * @param object data The ajax response.
+ */
loadEventCallback: function(data)
{
var event, list, text;
return [start, end];
},
+
/**
* Creates a mini calendar suitable for the navigation calendar and the
* year view.
// Next and Prev day links for the day view.
$('.kronolithDayHeader .kronolithPrevDay').bind('click', KronolithMobile.showPrevDay);
$('.kronolithDayHeader .kronolithNextDay').bind('click', KronolithMobile.showNextDay);
-
+
// Load today's events
$(".kronolithDayDate").html(KronolithMobile.currentDate.toString(Kronolith.conf.date_format));
KronolithMobile.loadEvents(KronolithMobile.currentDate, KronolithMobile.currentDate);