diff options
author | Kevin Jardine <kevinjardine@yahoo.com> | 2011-11-08 12:47:41 +0100 |
---|---|---|
committer | Kevin Jardine <kevinjardine@yahoo.com> | 2011-11-08 12:47:41 +0100 |
commit | 1520b0b67e7ec0129f40e8795eb7ffde4e7c2aac (patch) | |
tree | a30530d279220af11b8c47f0d1f8e1654f2dee97 | |
parent | db951f94b6ae60f899f719f17dce4aa6c47edf54 (diff) | |
download | elgg-1520b0b67e7ec0129f40e8795eb7ffde4e7c2aac.tar.gz elgg-1520b0b67e7ec0129f40e8795eb7ffde4e7c2aac.tar.bz2 |
iCalendar fixes.
-rw-r--r-- | languages/en.php | 1 | ||||
-rw-r--r-- | models/model.php | 6 | ||||
-rw-r--r-- | start.php | 10 | ||||
-rw-r--r-- | views/default/js/event_calendar/event_calendar.php | 7 | ||||
-rw-r--r-- | views/ical/object/event_calendar.php | 4 | ||||
-rw-r--r-- | views/ical/page/default.php | 2 |
6 files changed, 21 insertions, 9 deletions
diff --git a/languages/en.php b/languages/en.php index 1155d76ed..285392e62 100644 --- a/languages/en.php +++ b/languages/en.php @@ -213,6 +213,7 @@ You can manage calendar requests for this event here: 'event_calendar:add' => "Add", 'feed:ical' => "iCal feed for this page", + 'event_calendar:ical_popup_message' => "You can use the following URL to get an iCalendar feed of the public events from this listing page: ", 'event_calendar:ical_auth_file_name:title' => "Location of iCal authentication file on local file system (experimental - not needed for public feeds)", 'event_calendar:owner:permissions_error' => "You do not have permission to view that page.", diff --git a/models/model.php b/models/model.php index 7f6c3d39d..db2bdf95d 100644 --- a/models/model.php +++ b/models/model.php @@ -160,11 +160,11 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) { function event_calendar_get_events_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$container_guid=0,$region='-') { if ($is_count) { - $count = event_calendar_get_entities_from_metadata_between('start_date','end_date', + $count = event_calendar_get_entities_from_metadata_between2('start_date','end_date', $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,true,$region); return $count; } else { - $events = event_calendar_get_entities_from_metadata_between('start_date','end_date', + $events = event_calendar_get_entities_from_metadata_between2('start_date','end_date', $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,false,$region); //return event_calendar_vsort($events,'start_date'); return $events; @@ -1096,6 +1096,7 @@ function event_calendar_send_event_request($event,$user_guid) { // pages function event_calendar_get_page_content_list($page_type,$container_guid,$start_date,$display_mode,$filter,$region='-') { + elgg_load_js('elgg.event_calendar'); global $autofeed; $autofeed = true; if ($page_type == 'group') { @@ -1164,6 +1165,7 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_ $url = elgg_format_url($url); $menu_options = array( 'name' => 'ical', + 'id' => 'event-calendar-ical-link', 'text' => '<img src="'.elgg_get_site_url().'mod/event_calendar/images/ics.png" />', 'href' => $url, 'title' => elgg_echo('feed:ical'), @@ -337,11 +337,13 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) { function event_calendar_entity_menu_prepare($hook, $type, $return, $params) { // remove access level from listings - if (!elgg_in_context('event_calendar:view')) { + if (elgg_in_context('event_calendar') && !elgg_in_context('event_calendar:view')) { $new_return = array(); - foreach($return['default'] AS $item) { - if ($item->getName() != 'access') { - $new_return[] = $item; + if ($return['default']) { + foreach($return['default'] AS $item) { + if ($item->getName() != 'access') { + $new_return[] = $item; + } } } $return['default'] = $new_return; diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php index f3f5b68c8..8c4e735a6 100644 --- a/views/default/js/event_calendar/event_calendar.php +++ b/views/default/js/event_calendar/event_calendar.php @@ -5,6 +5,7 @@ elgg.event_calendar.init = function () { $('.event_calendar_paged_checkbox').click(elgg.event_calendar.handlePagedPersonalCalendarToggle); $('.event-calendar-personal-calendar-toggle').click(elgg.event_calendar.handleDisplayPagePersonalCalendarToggle); $('#event-calendar-region').change(elgg.event_calendar.handleRegionChange); + $('#event-calendar-ical-link').click(elgg.event_calendar.handleIcalPopup); } elgg.event_calendar.handleRegionChange = function(e) { @@ -12,6 +13,12 @@ elgg.event_calendar.handleRegionChange = function(e) { elgg.forward(url); } +elgg.event_calendar.handleIcalPopup = function(e) { + var message = elgg.echo('event_calendar:ical_popup_message')+"\n"+this.href; + alert(message); + return false; +} + elgg.event_calendar.handlePagedPersonalCalendarToggle = function() { guid = parseInt($(this).attr('id').substring('event_calendar_paged_checkbox_'.length)); elgg.event_calendar.togglePagedPersonalCalendar(guid); diff --git a/views/ical/object/event_calendar.php b/views/ical/object/event_calendar.php index a6ed889e5..36d71a66c 100644 --- a/views/ical/object/event_calendar.php +++ b/views/ical/object/event_calendar.php @@ -29,9 +29,9 @@ CREATED:<?php echo date("Ymd\THis\Z", $event->getTimeCreated())?> LAST-MODIFIED:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated()) ?> -DTSTART:<?php echo date("Ymd\THis\Z", $event->start_date); ?> +DTSTART;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->start_date); ?> -DTEND:<?php echo date("Ymd\THis\Z", $event->real_end_time); ?> +DTEND;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->real_end_time); ?> SUMMARY:<?php echo $event->title; ?> diff --git a/views/ical/page/default.php b/views/ical/page/default.php index c269b5849..b4cd7eefb 100644 --- a/views/ical/page/default.php +++ b/views/ical/page/default.php @@ -8,7 +8,7 @@ */ header("Content-Type: text/calendar"); -//header("Content-Disposition: attachment; filename=\"calendar.ics\""); +header("Content-Disposition: inline; filename=\"calendar.ics\""); ?> BEGIN:VCALENDAR VERSION:2.0 |