function events_post(&$a) {
+ logger('post: ' . print_r($_REQUEST,true));
+
if(! local_user())
return;
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');
}
$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);
'$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')
{{$desc}}
</p>
-<form action="{{$post}}" method="post" >
+<form id="event-edit-form" action="{{$post}}" method="post" >
<input type="hidden" name="event_id" value="{{$eid}}" />
<input type="hidden" name="cid" value="{{$cid}}" />
<input type="hidden" name="uri" value="{{$uri}}" />
+<input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}} {{$s_tsel}}
<div id="event-location-text">{{$l_text}}</div>
<textarea id="event-location-textarea" name="location">{{$l_orig}}</textarea>
+<div id="event-location-break"></div>
+
<input type="checkbox" name="share" value="1" id="event-share-checkbox" {{$sh_checked}} /> <div id="event-share-text">{{$sh_text}}</div>
<div id="event-share-break"></div>
{{$acl}}
<div class="clear"></div>
+<input id="event-edit-preview" type="submit" name="preview" value="{{$preview|escape:'html'}}" onclick="doEventPreview(); return false;" />
<input id="event-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
</form>
}
);
}
+
+ 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({
</script>
+{{if $editselect != 'none'}}
<script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
}
});
+ {{else}}
+ <script language="javascript" type="text/javascript">
+ {{/if}}
$(document).ready(function() {