diff options
Diffstat (limited to 'views/default/event_calendar/full_calendar_view.php')
-rw-r--r-- | views/default/event_calendar/full_calendar_view.php | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/views/default/event_calendar/full_calendar_view.php b/views/default/event_calendar/full_calendar_view.php index 80406ac13..d4e85724e 100644 --- a/views/default/event_calendar/full_calendar_view.php +++ b/views/default/event_calendar/full_calendar_view.php @@ -8,7 +8,7 @@ $times_supported = elgg_get_plugin_setting('times','event_calendar') != 'no'; foreach($events as $e) { $event_item = array( - 'id' => $e->guid, + 'guid' => $e->guid, 'title' => $e->title, 'start_date' => $e->start_date, 'end_date' => $e->real_end_time, @@ -18,7 +18,7 @@ foreach($events as $e) { } else { $event_item['allDay'] = TRUE; } - + $event_array[] = $event_item; } @@ -27,12 +27,39 @@ $json_events_string = json_encode($event_array); // TODO: is there an easy way to avoid embedding JS? ?> <script> + +handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) { + + alert( + event.title + "(" + event.guid + ") was moved " + + dayDelta + " days and " + + minuteDelta + " minutes." + ); + + if (!confirm("Are you sure about this change?")) { + revertFunc(); + } else { + elgg.action('event_calendar/modify_full_calendar', + { + data: {event_guid: event.guid,dayDelta: dayDelta, minuteDelta: minuteDelta}, + success: function (res) { + var success = res.success; + var msg = res.message; + if (!success) { + elgg.register_error(msg,2000); + revertFunc() + } + } + } + ); + } +} $(document).ready(function() { var events = <?php echo $json_events_string; ?>; var cal_events = []; for (var i = 0; i < events.length; i++) { cal_events.push({ - id: events[i].id, + guid: events[i].guid, title : events[i].title, start : new Date(1000*events[i].start_date), end : new Date(1000*events[i].end_date), @@ -47,8 +74,10 @@ $(document).ready(function() { right: 'month,agendaWeek,agendaDay' }, editable: true, + slotMinutes: 5, + eventDrop: handleEventDrop, events: cal_events }); }); </script> -<div id='calendar'></div>
\ No newline at end of file +<div id='calendar'></div> |