From de197405d09bcd6fad713a5cccfe9502b8f9e65b Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 14 May 2015 13:20:58 +0200 Subject: [PATCH] port of red's event editing preview --- mod/events.php | 13 +++++++++++++ view/templates/event_form.tpl | 6 +++++- view/templates/event_head.tpl | 13 +++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mod/events.php b/mod/events.php index 94e2ba6b40..eef9303c0b 100755 --- a/mod/events.php +++ b/mod/events.php @@ -7,6 +7,8 @@ require_once('include/items.php'); function events_post(&$a) { + logger('post: ' . print_r($_REQUEST,true)); + if(! local_user()) return; @@ -64,6 +66,10 @@ function events_post(&$a) { if((! $summary) || (! $start)) { notice( t('Event title and start time are required.') . EOL); + if(intval($_REQUEST['preview'])) { + echo( t('Event title and start time are required.')); + killme(); + } goaway($a->get_baseurl() . '/events/new'); } @@ -124,6 +130,12 @@ function events_post(&$a) { $datarray['id'] = $event_id; $datarray['created'] = $created; $datarray['edited'] = $edited; + + if(intval($_REQUEST['preview'])) { + $html = format_event_html($datarray); + echo $html; + killme(); + } $item_id = event_store($datarray); @@ -474,6 +486,7 @@ function events_content(&$a) { '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, + '$preview' => t('Preview'), '$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user),false)), '$submit' => t('Submit') diff --git a/view/templates/event_form.tpl b/view/templates/event_form.tpl index 45e2ea71e0..9633d19af1 100644 --- a/view/templates/event_form.tpl +++ b/view/templates/event_form.tpl @@ -5,11 +5,12 @@ {{$desc}}

-
+ +
{{$s_text}}
{{$s_dsel}} {{$s_tsel}} @@ -38,12 +39,15 @@
{{$l_text}}
+
+
{{$sh_text}}
{{$acl}}
+
diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index 8085a774b3..31f389d9e3 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -12,6 +12,15 @@ } ); } + + function doEventPreview() { + $('#event-edit-preview').val(1); + $.post('events',$('#event-edit-form').serialize(), function(data) { + $.colorbox({ html: data }); + }); + $('#event-edit-preview').val(0); + } + $(document).ready(function() { $('#events-calendar').fullCalendar({ @@ -75,6 +84,7 @@ +{{if $editselect != 'none'}}