some event heavy lifting - please test and report issues

This commit is contained in:
Mario Vavti 2015-11-24 14:15:28 +01:00
parent e485ecb3b4
commit 987619130b
12 changed files with 321 additions and 496 deletions

View File

@ -198,7 +198,7 @@ function timesel($format, $h, $m, $id='timepicker') {
* @todo Once browser support is better this could probably be replaced with * @todo Once browser support is better this could probably be replaced with
* native HTML5 date picker. * native HTML5 date picker.
*/ */
function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false, $first_day = 0) { function datetimesel($format, $min, $max, $default = 'bla', $label, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false, $first_day = 0) {
$o = ''; $o = '';
$dateformat = ''; $dateformat = '';
@ -207,11 +207,11 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
if($pickdate && $picktime) $dateformat .= ' '; if($pickdate && $picktime) $dateformat .= ' ';
if($picktime) $dateformat .= 'H:i'; if($picktime) $dateformat .= 'H:i';
$minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : ''; $minjs = $min->getTimestamp() ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : '';
$maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : ''; $maxjs = $max->getTimestamp() ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : '';
$input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : ''; $input_text = $default->getTimestamp() ? date($dateformat, $default->getTimestamp()) : '';
$defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : ''; $defaultdatejs = $default->getTimestamp() ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : '';
$pickers = ''; $pickers = '';
if(!$pickdate) $pickers .= ',datepicker: false'; if(!$pickdate) $pickers .= ',datepicker: false';
@ -219,10 +219,10 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
$extra_js = ''; $extra_js = '';
if($minfrom != '') if($minfrom != '')
$extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})"; $extra_js .= "\$('#id_$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
if($maxfrom != '') if($maxfrom != '')
$extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})"; $extra_js .= "\$('#id_$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
$readable_format = $dateformat; $readable_format = $dateformat;
$readable_format = str_replace('Y','yyyy',$readable_format); $readable_format = str_replace('Y','yyyy',$readable_format);
@ -231,10 +231,11 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
$readable_format = str_replace('H','HH',$readable_format); $readable_format = str_replace('H','HH',$readable_format);
$readable_format = str_replace('i','MM',$readable_format); $readable_format = str_replace('i','MM',$readable_format);
$o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />"; $tpl = get_markup_template('field_input.tpl');
$o .= (($required) ? '<span class="required" title="' . t('Required') . '" >*</span>' : ''); $o .= replace_macros($tpl,array(
$o .= '</div>'; '$field' => array($id, $label, $input_text, (($required) ? t('Required') : ''), (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'),
$o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs,dayOfWeekStart:$first_day}); $extra_js})</script>"; ));
$o .= "<script>\$(function () {var picker = \$('#id_$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs,dayOfWeekStart:$first_day}); $extra_js})</script>";
return $o; return $o;
} }

View File

@ -33,7 +33,7 @@ function editpost_content(&$a) {
} }
if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) { if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) {
goaway(z_root() . '/events/event/' . $itm[0]['resource_id']); goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
} }

View File

@ -273,25 +273,17 @@ function events_content(&$a) {
); );
} }
$plaintext = true;
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
$first_day = get_pconfig(local_channel(),'system','cal_first_day'); $first_day = get_pconfig(local_channel(),'system','cal_first_day');
$first_day = (($first_day) ? $first_day : 0); $first_day = (($first_day) ? $first_day : 0);
$htpl = get_markup_template('event_head.tpl'); $htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl,array( $a->page['htmlhead'] .= replace_macros($htpl,array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$editselect' => (($plaintext) ? 'none' : 'textareas'),
'$lang' => $a->language, '$lang' => $a->language,
'$first_day' => $first_day '$first_day' => $first_day
)); ));
$o =""; $o = '';
$channel = $a->get_channel(); $channel = $a->get_channel();
@ -301,10 +293,6 @@ function events_content(&$a) {
$ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
if(argc() > 1) { if(argc() > 1) {
if(argc() > 2 && argv(1) == 'event') {
$mode = 'edit';
$event_id = argv(2);
}
if(argc() > 2 && argv(1) === 'add') { if(argc() > 2 && argv(1) === 'add') {
$mode = 'add'; $mode = 'add';
$item_id = intval(argv(2)); $item_id = intval(argv(2));
@ -313,15 +301,15 @@ function events_content(&$a) {
$mode = 'drop'; $mode = 'drop';
$event_id = argv(2); $event_id = argv(2);
} }
if(argv(1) === 'new') {
$mode = 'new';
$event_id = '';
}
if(argc() > 2 && intval(argv(1)) && intval(argv(2))) { if(argc() > 2 && intval(argv(1)) && intval(argv(2))) {
$mode = 'view'; $mode = 'view';
$y = intval(argv(1)); $y = intval(argv(1));
$m = intval(argv(2)); $m = intval(argv(2));
} }
if(argc() > 1) {
$mode = 'view';
$event_id = argv(1);
}
} }
if($mode === 'add') { if($mode === 'add') {
@ -329,12 +317,147 @@ function events_content(&$a) {
killme(); killme();
} }
if($mode == 'view') { if($mode == 'view') {
/* edit/create form */
if($event_id) {
$r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
dbesc($event_id),
intval(local_channel())
);
if(count($r))
$orig_event = $r[0];
}
$channel = $a->get_channel();
// Passed parameters overrides anything found in the DB
if(!x($orig_event))
$orig_event = array();
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
/*
if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
if(x($_REQUEST,'type')) $orig_event['type'] = $_REQUEST['type'];
*/
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
$d_orig = ((x($orig_event)) ? $orig_event['description'] : '');
$l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
$eid = ((x($orig_event)) ? $orig_event['id'] : 0);
$event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
$mid = ((x($orig_event)) ? $orig_event['mid'] : '');
if(! x($orig_event))
$sh_checked = '';
else
$sh_checked = ((($orig_event['allow_cid'] === '<' . $channel['channel_hash'] . '>' || (! $orig_event['allow_cid'])) && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
if($orig_event['event_xchan'])
$sh_checked .= ' disabled="disabled" ';
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
$tz = date_default_timezone_get();
if(x($orig_event))
$tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
$syear = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'Y') : '00');
$smonth = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'm') : '00');
$sday = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'd') : '00');
$shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : '00');
$sminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'i') : '00');
$stext = datetime_convert('UTC',$tz,$sdt);
$stext = substr($stext,0,14) . "00:00";
$fyear = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'Y') : '00');
$fmonth = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'm') : '00');
$fday = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'd') : '00');
$fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : '00');
$fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : '00');
$ftext = datetime_convert('UTC',$tz,$fdt);
$ftext = substr($ftext,0,14) . "00:00";
$type = ((x($orig_event)) ? $orig_event['type'] : 'event');
$f = get_config('system','event_input_format');
if(! $f)
$f = 'ymd';
$catsenabled = feature_enabled(local_channel(),'categories');
$category = '';
if($catsenabled && x($orig_event)){
$itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1",
dbesc($orig_event['event_hash']),
intval(local_channel())
);
$itm = fetch_post_tags($itm);
if($itm) {
$cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
foreach ($cats as $cat) {
if(strlen($category))
$category .= ', ';
$category .= $cat['term'];
}
}
}
require_once('include/acl_selectors.php');
$acl = new AccessList($channel);
$perm_defaults = $acl->get();
$tpl = get_markup_template('event_form.tpl');
$form = replace_macros($tpl,array(
'$post' => $a->get_baseurl() . '/events',
'$eid' => $eid,
'$type' => $type,
'$xchan' => $event_xchan,
'$mid' => $mid,
'$event_hash' => $event_id,
'$summary' => array('summary', t('Event Title'), $t_orig, t('Required'), '*'),
'$catsenabled' => $catsenabled,
'$placeholdercategory' => t('Categories (comma-separated list)'),
'$c_text' => t('Category'),
'$category' => $category,
'$required' => '<span class="required" title="' . t('Required') . '">*</span>',
'$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"), t('Start date and time'), 'start_text',true,true,'','',true,$first_day),
'$n_text' => t('Finish date and time are not known or not relevant'),
'$n_checked' => $n_checked,
'$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"), t('Finish date and time'),'finish_text',true,true,'start_text','',false,$first_day),
'$nofinish' => array('nofinish', t('Finish date and time are not known or not relevant'), $n_checked, '', array(t('No'),t('Yes')), 'onclick="enableDisableFinishDate();"'),
'$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'), array(t('No'),t('Yes'))),
'$a_text' => t('Adjust for viewer timezone'),
'$d_text' => t('Description'),
'$d_orig' => $d_orig,
'$l_text' => t('Location'),
'$l_orig' => $l_orig,
'$t_orig' => $t_orig,
'$sh_text' => t('Share this event'),
'$sh_checked' => $sh_checked,
'$share' => array('share', t('Share this event'), $sh_checked, '', array(t('No'),t('Yes'))),
'$preview' => t('Preview'),
'$permissions' => t('Permission settings'),
'$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)),
'$submit' => t('Submit'),
'$advanced' => t('Advanced Options')
));
/* end edit/create form */
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
@ -347,7 +470,6 @@ function events_content(&$a) {
if(argc() === 4 && argv(3) === 'export') if(argc() === 4 && argv(3) === 'export')
$export = true; $export = true;
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900. // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
// An upper limit was chosen to keep search engines from exploring links millions of years in the future. // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
@ -424,9 +546,6 @@ function events_content(&$a) {
} }
$links = array(); $links = array();
if($r && ! $export) { if($r && ! $export) {
@ -469,7 +588,7 @@ function events_content(&$a) {
$last_date = $d; $last_date = $d;
$edit = (intval($rr['item_wall']) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null); $edit = array($a->get_baseurl().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','');
$drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); $drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
@ -524,24 +643,24 @@ function events_content(&$a) {
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$title' => t('Events'), '$new_event' => array($a->get_baseurl().'/events/new',t('New Event'),'',''),
'$new_event'=> array($a->get_baseurl().'/events/new',t('New Event'),'',''),
'$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
'$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'), '$calendar' => cal($y,$m,$links, ' eventcal'),
'$events' => $events, '$events' => $events,
'$upload' => t('Import'), '$upload' => t('Import'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$prev' => t('Previous'), '$prev' => t('Previous'),
'$next' => t('Next'), '$next' => t('Next'),
'$today' => t('Today') '$today' => t('Today'),
'$form' => $form,
'$expandform' => ((x($_GET,'expandform')) ? true : false),
)); ));
if (x($_GET,'id')){ echo $o; killme(); } if (x($_GET,'id')){ echo $o; killme(); }
return $o; return $o;
} }
if($mode === 'drop' && $event_id) { if($mode === 'drop' && $event_id) {
@ -574,147 +693,4 @@ function events_content(&$a) {
} }
} }
if($mode === 'edit' && $event_id) {
$r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
dbesc($event_id),
intval(local_channel())
);
if(count($r))
$orig_event = $r[0];
}
$channel = $a->get_channel();
// Passed parameters overrides anything found in the DB
if($mode === 'edit' || $mode === 'new') {
if(!x($orig_event)) $orig_event = array();
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
if(x($_REQUEST,'type')) $orig_event['type'] = $_REQUEST['type'];
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
$d_orig = ((x($orig_event)) ? $orig_event['description'] : '');
$l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
$eid = ((x($orig_event)) ? $orig_event['id'] : 0);
$event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
$mid = ((x($orig_event)) ? $orig_event['mid'] : '');
if(! x($orig_event))
$sh_checked = '';
else
$sh_checked = ((($orig_event['allow_cid'] === '<' . $channel['channel_hash'] . '>' || (! $orig_event['allow_cid'])) && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
if($orig_event['event_xchan'])
$sh_checked .= ' disabled="disabled" ';
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
$tz = date_default_timezone_get();
if(x($orig_event))
$tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
$smonth = datetime_convert('UTC', $tz, $sdt, 'm');
$sday = datetime_convert('UTC', $tz, $sdt, 'd');
$shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : 0);
$sminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'i') : 0);
$stext = datetime_convert('UTC',$tz,$sdt);
$stext = substr($stext,0,14) . "00:00";
$fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
$fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
$fday = datetime_convert('UTC', $tz, $fdt, 'd');
$fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0);
$fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0);
$ftext = datetime_convert('UTC',$tz,$fdt);
$ftext = substr($ftext,0,14) . "00:00";
$type = ((x($orig_event)) ? $orig_event['type'] : 'event');
$f = get_config('system','event_input_format');
if(! $f)
$f = 'ymd';
$catsenabled = feature_enabled(local_channel(),'categories');
$category = '';
if($catsenabled && x($orig_event)){
$itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1",
dbesc($orig_event['event_hash']),
intval(local_channel())
);
$itm = fetch_post_tags($itm);
if($itm) {
$cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
foreach ($cats as $cat) {
if(strlen($category))
$category .= ', ';
$category .= $cat['term'];
}
}
}
require_once('include/acl_selectors.php');
$acl = new AccessList($channel);
$perm_defaults = $acl->get();
$tpl = get_markup_template('event_form.tpl');
$o .= replace_macros($tpl,array(
'$post' => $a->get_baseurl() . '/events',
'$eid' => $eid,
'$type' => $type,
'$xchan' => $event_xchan,
'$mid' => $mid,
'$event_hash' => $event_id,
'$title' => t('Event details'),
'$desc' => t('Starting date and Title are required.'),
'$catsenabled' => $catsenabled,
'$placeholdercategory' => t('Categories (comma-separated list)'),
'$category' => $category,
'$s_text' => t('Event Starts:'),
'$stext' => $stext,
'$ftext' => $ftext,
'$required' => '<span class="required" title="' . t('Required') . '">*</span>',
'$ModalCANCEL' => t('Cancel'),
'$ModalOK' => t('OK'),
'$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true,$first_day),
'$n_text' => t('Finish date/time is not known or not relevant'),
'$n_checked' => $n_checked,
'$f_text' => t('Event Finishes:'),
'$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text','',false,$first_day),
'$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'),),
'$a_text' => t('Adjust for viewer timezone'),
'$d_text' => t('Description:'),
'$d_orig' => $d_orig,
'$l_text' => t('Location:'),
'$l_orig' => $l_orig,
'$t_text' => t('Title:'),
'$t_orig' => $t_orig,
'$sh_text' => t('Share this event'),
'$sh_checked' => $sh_checked,
'$preview' => t('Preview'),
'$permissions' => t('Permissions'),
'$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)),
'$submit' => t('Submit')
));
return $o;
}
} }

View File

@ -178,7 +178,6 @@ a.wall-item-name-link {
/* comment_item */ /* comment_item */
.comment-edit-text-empty, .comment-edit-text-full { .comment-edit-text-empty, .comment-edit-text-full {
float: left;
width: 100%; width: 100%;
} }

View File

@ -3,58 +3,3 @@
margin-left: -1px; margin-left: -1px;
margin-bottom: -1px; margin-bottom: -1px;
} }
#event-desc-textarea, #event-location-textarea {
width: 400px;
}
#event-summary-text, #event-start-text, #event-finish-text {
width: 200px;
float: left;
}
#event-summary, #start_text {
width: 95%;
float: left;
}
#finish_text {
width: 100%;
float: left;
}
#event-category-wrap {
margin-top: 15px;
}
.event-cats {
margin-top: 15px;
}
.bootstrap-tagsinput {
width: 100%;
}
.required {
float: left;
cursor: default;
}
#event-datetime-break {
clear: both;
}
#event-nofinish-break {
margin-bottom: 10px;
}
#event-desc-text, #event-location-text, .event-form-location-end {
margin-top: 15px;
}
#event-edit-preview-btn {
margin-right: 15px;
}

View File

@ -2,33 +2,15 @@
* JavaScript for mod/events * JavaScript for mod/events
*/ */
$(document).ready( function() { showHideFinishDate(); }); $(document).ready( function() {
function showHideFinishDate() { enableDisableFinishDate();
});
function enableDisableFinishDate() {
if( $('#id_nofinish').is(':checked')) if( $('#id_nofinish').is(':checked'))
$('#event-finish-wrapper').hide(); $('#id_finish_text').prop("disabled", true);
else else
$('#event-finish-wrapper').show(); $('#id_finish_text').prop("disabled", false);
}
function eventGetStart() {
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
$('#startModal').modal();
$('#start-modal-OKButton').on('click', function() {
reply=$('#start-date').val();
if(reply && reply.length) {
$('#start-text').val(reply);
$('#startModal').modal('hide');
}
});
}
function eventGetFinish() {
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
$('#finishModal').modal();
$('#finish-modal-OKButton').on('click', function() {
reply=$('#finish-date').val();
if(reply && reply.length) {
$('#finish-text').val(reply);
$('#finishModal').modal('hide');
}
});
} }

View File

@ -1123,31 +1123,6 @@ nav .acpopup {
color: #ff0000; color: #ff0000;
} }
#event-start-text, #event-finish-text {
margin-top: 10px;
margin-bottom: 5px;
}
#event-nofinish-checkbox, #event-nofinish-text, #event-adjust-checkbox, #event-adjust-text {
float: left;
}
#event-datetime-break {
margin-bottom: 10px;
}
#event-nofinish-break, #event-adjust-break {
clear: both;
}
#event-desc-text, #event-location-text {
margin-top: 15px;
margin-bottom: 5px;
}
#event-submit {
margin-top: 10px;
}
#item-delete-selected { #item-delete-selected {
margin-top: 30px; margin-top: 30px;
} }

View File

@ -1,16 +1,16 @@
{{foreach $events as $event}} {{foreach $events as $event}}
<div class="event-wrapper"> <div class="event-wrapper">
<div class="event"> <div class="event">
<div class="event-owner"> <div class="event-owner">
{{if $event.item.author.xchan_name}}<a href="{{$event.item.author.xchan_url}}" ><img src="{{$event.item.author.xchan_photo_s}}" height="64" width="64" />{{$event.item.author.xchan_name}}</a>{{/if}} {{if $event.item.author.xchan_name}}<a href="{{$event.item.author.xchan_url}}" ><img src="{{$event.item.author.xchan_photo_s}}" height="64" width="64" />{{$event.item.author.xchan_name}}</a>{{/if}}
</div> </div>
{{$event.html}} {{$event.html}}
<div class="event-buttons"> <div class="event-buttons">
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link"><i class="icon-external-link btn btn-default" ></i></a>{{/if}} {{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link"><i class="icon-external-link btn btn-default" ></i></a>{{/if}}
{{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link"><i class="icon-pencil btn btn-default"></i></a>{{/if}} {{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link"><i class="icon-pencil btn btn-default"></i></a>{{/if}}
{{if $event.drop}}<a href="{{$event.drop.0}}" title="{{$event.drop.1}}" class="drop-event-link"><i class="icon-trash btn btn-default"></i></a>{{/if}} {{if $event.drop}}<a href="{{$event.drop.0}}" title="{{$event.drop.1}}" class="drop-event-link"><i class="icon-trash btn btn-default"></i></a>{{/if}}
</div> </div>
</div> <div class="clear"></div>
<div class="clear"></div> </div>
</div> </div>
{{/foreach}} {{/foreach}}

View File

@ -1,177 +1,130 @@
<div class="generic-content-wrapper-styled">
<h3>{{$title}}</h3>
<p>
{{$desc}}
</p>
<form id="event-edit-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="event_id" value="{{$eid}}" />
<input type="hidden" name="event_hash" value="{{$event_hash}}" /> <input type="hidden" name="event_hash" value="{{$event_hash}}" />
<input type="hidden" name="xchan" value="{{$xchan}}" /> <input type="hidden" name="xchan" value="{{$xchan}}" />
<input type="hidden" name="mid" value="{{$mid}}" /> <input type="hidden" name="mid" value="{{$mid}}" />
<input type="hidden" name="type" value="{{$type}}" /> <input type="hidden" name="type" value="{{$type}}" />
<input type="hidden" name="preview" id="event-edit-preview" value="0" /> <input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-summary-text">{{$t_text}}</div>
<input type="text" id="event-summary" name="summary" value="{{$t_orig}}" />{{$required}}
<div class="clear"></div>
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}}
<div class="clear"></div><br />
<div class='field checkbox'>
<label class="mainlabel" for='id_nofinish'>{{$n_text}}</label>
<div class="pull-right"><input type="checkbox" name='nofinish' id='id_nofinish' value="1" {{$n_checked}} onclick="showHideFinishDate(); return true;" >
<label class="switchlabel" for='id_nofinish'> <span class="onoffswitch-inner" data-on='' data-off='' ></span>
<span class="onoffswitch-switch"></span> </label></div><span class='field_help'></span>
</div>
<div id="event-nofinish-break"></div>
<div id="event-finish-wrapper">
<div id="event-finish-text">{{$f_text}}</div>
{{$f_dsel}}
</div>
<div id="event-datetime-break"></div>
{{include file="field_checkbox.tpl" field=$adjust}}
<div id="event-adjust-break"></div>
{{include file="field_input.tpl" field=$summary}}
{{if $catsenabled}} {{$s_dsel}}
<div id="event-category-wrap">
<input name="category" id="event-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" class="event-cats" style="display: block;" data-role="cat-tagsinput" />
</div>
{{/if}}
{{$f_dsel}}
{{include file="field_checkbox.tpl" field=$nofinish}}
<div id="event-desc-text">{{$d_text}}</div> <div id="advanced" style="display:none">
<textarea id="comment-edit-text-desc" class="comment-edit-text-full" name="desc" >{{$d_orig}}</textarea> {{include file="field_checkbox.tpl" field=$adjust}}
<div class="clear"></div>
<div id="comment-tools-desc" class="comment-tools" style="display: block;" > {{if $catsenabled}}
<div id="comment-edit-bb-desc" class="btn-toolbar pull-left"> <div id="event-category-text"><b>{{$c_text}}</b></div>
<div class='btn-group'> <div id="events-category-wrap">
<button class="btn btn-default btn-xs" title="{{$edbold}}" onclick="insertbbcomment('{{$comment}}','b', 'desc'); return false;"> <input name="category" id="event-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" class="event-cats form-control" data-role="cat-tagsinput" />
<i class="icon-bold comment-icon"></i> </div>
</button> {{/if}}
<button class="btn btn-default btn-xs" title="{{$editalic}}" onclick="insertbbcomment('{{$comment}}','i', 'desc'); return false;">
<i class="icon-italic comment-icon"></i> <div class="form-group">
</button> <div id="event-desc-text"><b>{{$d_text}}</b></div>
<button class="btn btn-default btn-xs" title="{{$eduline}}" onclick="insertbbcomment('{{$comment}}','u', 'desc'); return false;">
<i class="icon-underline comment-icon"></i> <textarea id="comment-edit-text-desc" class="comment-edit-text-full" name="desc" >{{$d_orig}}</textarea>
</button>
<button class="btn btn-default btn-xs" title="{{$edquote}}" onclick="insertbbcomment('{{$comment}}','quote','desc'); return false;"> <div id="comment-tools-desc" class="comment-tools" style="display: block;" >
<i class="icon-quote-left comment-icon"></i> <div id="comment-edit-bb-desc" class="btn-toolbar pull-left">
</button> <div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edcode}}" onclick="insertbbcomment('{{$comment}}','code', 'desc'); return false;"> <button class="btn btn-default btn-xs" title="{{$edbold}}" onclick="insertbbcomment('{{$comment}}','b', 'desc'); return false;">
<i class="icon-terminal comment-icon"></i> <i class="icon-bold comment-icon"></i>
</button> </button>
<button class="btn btn-default btn-xs" title="{{$editalic}}" onclick="insertbbcomment('{{$comment}}','i', 'desc'); return false;">
<i class="icon-italic comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$eduline}}" onclick="insertbbcomment('{{$comment}}','u', 'desc'); return false;">
<i class="icon-underline comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edquote}}" onclick="insertbbcomment('{{$comment}}','quote','desc'); return false;">
<i class="icon-quote-left comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edcode}}" onclick="insertbbcomment('{{$comment}}','code', 'desc'); return false;">
<i class="icon-terminal comment-icon"></i>
</button>
</div>
<div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', 'desc'); return false;">
<i class="icon-camera comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertbbcomment('{{$comment}}','url', 'desc'); return false;">
<i class="icon-link comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', 'desc'); return false;">
<i class="icon-facetime-video comment-icon"></i>
</button>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<div class="form-group">
<div id="event-location-text"><b>{{$l_text}}</b></div>
<textarea id="comment-edit-text-loc" class="comment-edit-text-full" name="location">{{$l_orig}}</textarea>
<div id="comment-tools-loc" class="comment-tools" style="display: block;" >
<div id="comment-edit-bb-loc" class="btn-toolbar pull-left">
<div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edbold}}" onclick="insertbbcomment('{{$comment}}','b', 'loc'); return false;">
<i class="icon-bold comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$editalic}}" onclick="insertbbcomment('{{$comment}}','i', 'loc'); return false;">
<i class="icon-italic comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$eduline}}" onclick="insertbbcomment('{{$comment}}','u', 'loc'); return false;">
<i class="icon-underline comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edquote}}" onclick="insertbbcomment('{{$comment}}','quote','loc'); return false;">
<i class="icon-quote-left comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edcode}}" onclick="insertbbcomment('{{$comment}}','code', 'loc'); return false;">
<i class="icon-terminal comment-icon"></i>
</button>
</div>
<div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', 'loc'); return false;">
<i class="icon-camera comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertbbcomment('{{$comment}}','url', 'loc'); return false;">
<i class="icon-link comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', 'loc'); return false;">
<i class="icon-facetime-video comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$mapper}}" onclick="insertbbcomment('{{$comment}}','map','loc'); return false;">
<i class="icon-globe comment-icon"></i>
</button>
</div>
</div>
</div>
</div>
</div> </div>
<div class='btn-group'> <div class="clear"></div>
<button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', 'desc'); return false;">
<i class="icon-camera comment-icon"></i> {{if ! $eid}}
</button> {{include file="field_checkbox.tpl" field=$share}}
<button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertbbcomment('{{$comment}}','url', 'desc'); return false;"> {{$acl}}
<i class="icon-link comment-icon"></i> {{/if}}
</button>
<button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', 'desc'); return false;"> <div class="clear"></div>
<i class="icon-facetime-video comment-icon"></i>
</button> <button type="button" class="btn btn-default" onclick="openClose('advanced');">{{$advanced}}</button>
<div class="btn-group pull-right">
<button id="event-edit-preview-btn" class="btn btn-default" type="button" title="{{$preview}}" onclick="doEventPreview(); return false;"><i class="icon-eye-open" ></i></button>
{{if ! $eid}}
<button id="dbtn-acl" class="btn btn-default" type="button" data-toggle="modal" data-target="#aclModal" title="{{$permissions}}"><i id="jot-perms-icon"></i></button>
{{/if}}
<button id="event-submit" class="btn btn-primary" type="submit" name="submit">{{$submit}}</button>
</div> </div>
</div>
</div>
<div class="clear"></div>
<div id="event-location-text">{{$l_text}}</div>
<textarea id="comment-edit-text-loc" class="comment-edit-text-full" name="location">{{$l_orig}}</textarea>
<div class="clear"></div>
<div id="comment-tools-loc" class="comment-tools" style="display: block;" >
<div id="comment-edit-bb-loc" class="btn-toolbar pull-left">
<div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edbold}}" onclick="insertbbcomment('{{$comment}}','b', 'loc'); return false;">
<i class="icon-bold comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$editalic}}" onclick="insertbbcomment('{{$comment}}','i', 'loc'); return false;">
<i class="icon-italic comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$eduline}}" onclick="insertbbcomment('{{$comment}}','u', 'loc'); return false;">
<i class="icon-underline comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edquote}}" onclick="insertbbcomment('{{$comment}}','quote','loc'); return false;">
<i class="icon-quote-left comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edcode}}" onclick="insertbbcomment('{{$comment}}','code', 'loc'); return false;">
<i class="icon-terminal comment-icon"></i>
</button>
</div>
<div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', 'loc'); return false;">
<i class="icon-camera comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertbbcomment('{{$comment}}','url', 'loc'); return false;">
<i class="icon-link comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', 'loc'); return false;">
<i class="icon-facetime-video comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$mapper}}" onclick="insertbbcomment('{{$comment}}','map','loc'); return false;">
<i class="icon-globe comment-icon"></i>
</button>
</div>
</div>
</div>
<br />
<div class="clear event-form-location-end"></div>
{{if ! $eid}}
<div class='field checkbox'>
<label class="mainlabel" for='id_share'>{{$sh_text}}</label>
<div class="pull-right"><input type="checkbox" name='share' id='id_share' value="1" {{$sh_checked}} >
<label class="switchlabel" for='id_share'> <span class="onoffswitch-inner" data-on='' data-off='' ></span>
<span class="onoffswitch-switch"></span> </label></div><span class='field_help'></span>
</div>
<div id="event-share-break"></div>
<button id="event-permissions-button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
{{$acl}}
{{/if}}
<div class="clear"></div>
<button id="event-edit-preview-btn" class="btn btn-default" title="{{$preview}}" onclick="doEventPreview(); return false;"><i class="icon-eye-open" ></i></button>
<input id="event-submit" type="submit" name="submit" value="{{$submit}}" />
</form> </form>
</div>

View File

@ -110,22 +110,13 @@
var view = $('#events-calendar').fullCalendar('getView'); var view = $('#events-calendar').fullCalendar('getView');
$('#title').text(view.title); $('#title').text(view.title);
});
</script>
<script>
$(document).ready(function() {
$('#id_share').change(function() { $('#id_share').change(function() {
if ($('#id_share').is(':checked')) { if ($('#id_share').is(':checked')) {
$('#event-permissions-button').show(); $('#dbtn-acl').show();
} }
else { else {
$('#event-permissions-button').hide(); $('#dbtn-acl').hide();
} }
}).trigger('change'); }).trigger('change');

View File

@ -1,8 +1,8 @@
<div class="generic-content-wrapper"> <div class="generic-content-wrapper">
<div class="section-title-wrapper"> <div class="section-title-wrapper">
<div class="pull-right"> <div class="pull-right">
<button class="btn btn-default btn-xs" onclick="openClose('event-tools');"><i class="icon-cog"></i></button> <button class="btn btn-default btn-xs" onclick="openClose('event-tools'); closeMenu('form');"><i class="icon-cog"></i></button>
<button class="btn btn-success btn-xs" onclick="window.location.href='{{$new_event.0}}'; return false;" >{{$new_event.1}}</button> <button class="btn btn-success btn-xs" onclick="openClose('form'); closeMenu('event-tools');">{{$new_event.1}}</button>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-default btn-xs" onclick="changeView('prev', false);" title="{{$prev}}"><i class="icon-backward"></i></button> <button class="btn btn-default btn-xs" onclick="changeView('prev', false);" title="{{$prev}}"><i class="icon-backward"></i></button>
@ -13,6 +13,9 @@
<h2 id="title"></h2> <h2 id="title"></h2>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div id="form" class="section-content-tools-wrapper"{{if !$expandform}} style="display:none;"{{/if}}>
{{$form}}
</div>
<div id="event-tools" class="section-content-tools-wrapper" style="display:none;"> <div id="event-tools" class="section-content-tools-wrapper" style="display:none;">
<div class="form-group"> <div class="form-group">
<button class="btn btn-primary btn-xs" onclick="exportDate(); return false;"><i class="icon-download"></i>&nbsp;{{$export.1}}</button> <button class="btn btn-primary btn-xs" onclick="exportDate(); return false;"><i class="icon-download"></i>&nbsp;{{$export.1}}</button>

View File

@ -142,16 +142,16 @@
<div id="profile-rotator"></div> <div id="profile-rotator"></div>
</div> </div>
<div id="profile-jot-submit-right" class="btn-group pull-right"> <div id="profile-jot-submit-right" class="btn-group pull-right">
{{if $showacl}}
<button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;">
<i id="jot-perms-icon" class="icon-{{$lockstate}} jot-icons"></i>{{if $bang}}&nbsp;<i class="icon-exclamation jot-icons"></i>{{/if}}
</button>
{{/if}}
{{if $preview}} {{if $preview}}
<button class="btn btn-default btn-sm hidden-xs" onclick="preview_post();return false;" title="{{$preview}}"> <button class="btn btn-default btn-sm hidden-xs" onclick="preview_post();return false;" title="{{$preview}}">
<i class="icon-eye-open jot-icons" ></i> <i class="icon-eye-open jot-icons" ></i>
</button> </button>
{{/if}} {{/if}}
{{if $showacl}}
<button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;">
<i id="jot-perms-icon" class="icon-{{$lockstate}} jot-icons"></i>{{if $bang}}&nbsp;<i class="icon-exclamation jot-icons"></i>{{/if}}
</button>
{{/if}}
<button id="dbtn-submit" class="btn btn-primary btn-sm" type="submit" tabindex=3 name="button-submit" >{{$share}}</button> <button id="dbtn-submit" class="btn btn-primary btn-sm" type="submit" tabindex=3 name="button-submit" >{{$share}}</button>
</div> </div>
<div id="profile-jot-perms-end"></div> <div id="profile-jot-perms-end"></div>