port of red's event editing preview
This commit is contained in:
parent
5837fd4f81
commit
de197405d0
|
@ -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')
|
||||
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
{{$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}}
|
||||
|
@ -38,12 +39,15 @@
|
|||
<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>
|
||||
|
||||
|
|
|
@ -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 @@
|
|||
</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">
|
||||
|
@ -108,6 +118,9 @@
|
|||
}
|
||||
|
||||
});
|
||||
{{else}}
|
||||
<script language="javascript" type="text/javascript">
|
||||
{{/if}}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
Loading…
Reference in a new issue