From f22f6fd7a985b773bce95accf5172cdc2524575c Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Tue, 29 May 2012 12:35:20 +0200 Subject: added lightbox support for full calendar events --- models/model.php | 20 ++++++++++++-------- start.php | 3 +++ views/default/event_calendar/full_calendar_view.php | 5 ++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/models/model.php b/models/model.php index 7de514802..b53471a44 100644 --- a/models/model.php +++ b/models/model.php @@ -1855,7 +1855,7 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig return $params; } -function event_calendar_get_page_content_view($event_guid) { +function event_calendar_get_page_content_view($event_guid,$light_box = FALSE) { // add personal calendar button and links elgg_push_context('event_calendar:view'); $event = get_entity($event_guid); @@ -1885,12 +1885,16 @@ function event_calendar_get_page_content_view($event_guid) { $content .= elgg_view_comments($event); } } - - $params = array('title' => $title, 'content' => $content,'filter' => ''); - - $body = elgg_view_layout("content", $params); - - return elgg_view_page($title,$body); + + if ($light_box) { + return '
'.elgg_view_title($title).$content.'
'; + } else { + $params = array('title' => $title, 'content' => $content,'filter' => ''); + + $body = elgg_view_layout("content", $params); + + return elgg_view_page($title,$body); + } } function event_calendar_get_page_content_display_users($event_guid) { @@ -2135,7 +2139,7 @@ function event_calendar_get_page_content_fullcalendar_events($start_date,$end_da 'id' => $event->guid, 'guid' => $event->guid, 'title' => $event->title, - 'url' => $event->getURL(), + 'url' => elgg_get_site_url().'event_calendar/view_light_box/'.$event->guid, 'start' => date('c',$ed['start_time']), 'end' => date('c',$ed['end_time']), ); diff --git a/start.php b/start.php index c9f95c8d6..9d3d45e4d 100644 --- a/start.php +++ b/start.php @@ -184,6 +184,9 @@ function event_calendar_page_handler($page) { case 'view': echo event_calendar_get_page_content_view($page[1]); break; + case 'view_light_box': + echo event_calendar_get_page_content_view($page[1],TRUE); + break; case 'display_users': echo event_calendar_get_page_content_display_users($page[1]); break; diff --git a/views/default/event_calendar/full_calendar_view.php b/views/default/event_calendar/full_calendar_view.php index 5fffff624..d7b6d97a2 100644 --- a/views/default/event_calendar/full_calendar_view.php +++ b/views/default/event_calendar/full_calendar_view.php @@ -1,5 +1,7 @@ @@ -7,7 +9,8 @@ elgg_load_js('elgg.full_calendar'); handleEventClick = function(event) { if (event.url) { - window.location.href = event.url; + //window.location.href = event.url; + $.fancybox({'href':event.url}); return false; } }; -- cgit v1.2.3