diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-11-24 14:15:28 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-11-24 14:15:28 +0100 |
commit | 987619130b99bf4548d5d31ac453cdf48c818eff (patch) | |
tree | c9a00e4dbea487a93725d539c04d78fa1cadd38f | |
parent | e485ecb3b453a50a1974992b5ccf5122e154a5dc (diff) | |
download | volse-hubzilla-987619130b99bf4548d5d31ac453cdf48c818eff.tar.gz volse-hubzilla-987619130b99bf4548d5d31ac453cdf48c818eff.tar.bz2 volse-hubzilla-987619130b99bf4548d5d31ac453cdf48c818eff.zip |
some event heavy lifting - please test and report issues
-rw-r--r-- | include/datetime.php | 23 | ||||
-rw-r--r-- | mod/editpost.php | 2 | ||||
-rwxr-xr-x | mod/events.php | 334 | ||||
-rw-r--r-- | view/css/conversation.css | 1 | ||||
-rw-r--r-- | view/css/mod_events.css | 55 | ||||
-rw-r--r-- | view/js/mod_events.js | 34 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 25 | ||||
-rwxr-xr-x | view/tpl/event.tpl | 24 | ||||
-rwxr-xr-x | view/tpl/event_form.tpl | 291 | ||||
-rwxr-xr-x | view/tpl/event_head.tpl | 13 | ||||
-rwxr-xr-x | view/tpl/events-js.tpl | 7 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 10 |
12 files changed, 322 insertions, 497 deletions
diff --git a/include/datetime.php b/include/datetime.php index 63287d023..22232fe24 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -198,7 +198,7 @@ function timesel($format, $h, $m, $id='timepicker') { * @todo Once browser support is better this could probably be replaced with * 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 = ''; $dateformat = ''; @@ -207,11 +207,11 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic if($pickdate && $picktime) $dateformat .= ' '; if($picktime) $dateformat .= 'H:i'; - $minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : ''; - $maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : ''; + $minjs = $min->getTimestamp() ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : ''; + $maxjs = $max->getTimestamp() ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : ''; - $input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : ''; - $defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : ''; + $input_text = $default->getTimestamp() ? date($dateformat, $default->getTimestamp()) : ''; + $defaultdatejs = $default->getTimestamp() ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : ''; $pickers = ''; if(!$pickdate) $pickers .= ',datepicker: false'; @@ -219,10 +219,10 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic $extra_js = ''; 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 != '') - $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 = 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('i','MM',$readable_format); - $o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />"; - $o .= (($required) ? '<span class="required" title="' . t('Required') . '" >*</span>' : ''); - $o .= '</div>'; - $o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs,dayOfWeekStart:$first_day}); $extra_js})</script>"; + $tpl = get_markup_template('field_input.tpl'); + $o .= replace_macros($tpl,array( + '$field' => array($id, $label, $input_text, (($required) ? t('Required') : ''), (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'), + )); + $o .= "<script>\$(function () {var picker = \$('#id_$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs,dayOfWeekStart:$first_day}); $extra_js})</script>"; return $o; } diff --git a/mod/editpost.php b/mod/editpost.php index bd46ac14a..030d8d671 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -33,7 +33,7 @@ function editpost_content(&$a) { } 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'); } diff --git a/mod/events.php b/mod/events.php index 7220a3d42..fcacacd6f 100755 --- a/mod/events.php +++ b/mod/events.php @@ -166,7 +166,7 @@ function events_post(&$a) { 'otype' => TERM_OBJ_POST, 'term' => trim($cat), 'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat)) - ); + ); } } @@ -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 = (($first_day) ? $first_day : 0); $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => $a->get_baseurl(), - '$editselect' => (($plaintext) ? 'none' : 'textareas'), '$lang' => $a->language, '$first_day' => $first_day )); - $o =""; + $o = ''; $channel = $a->get_channel(); @@ -301,10 +293,6 @@ function events_content(&$a) { $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); if(argc() > 1) { - if(argc() > 2 && argv(1) == 'event') { - $mode = 'edit'; - $event_id = argv(2); - } if(argc() > 2 && argv(1) === 'add') { $mode = 'add'; $item_id = intval(argv(2)); @@ -313,15 +301,15 @@ function events_content(&$a) { $mode = 'drop'; $event_id = argv(2); } - if(argv(1) === 'new') { - $mode = 'new'; - $event_id = ''; - } if(argc() > 2 && intval(argv(1)) && intval(argv(2))) { $mode = 'view'; $y = intval(argv(1)); $m = intval(argv(2)); } + if(argc() > 1) { + $mode = 'view'; + $event_id = argv(1); + } } if($mode === 'add') { @@ -329,13 +317,148 @@ function events_content(&$a) { killme(); } + 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 */ - if($mode == 'view') { - - $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); if(! $y) @@ -347,7 +470,6 @@ function events_content(&$a) { if(argc() === 4 && argv(3) === 'export') $export = true; - // 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. @@ -424,9 +546,6 @@ function events_content(&$a) { } - - - $links = array(); if($r && ! $export) { @@ -469,7 +588,7 @@ function events_content(&$a) { $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'),'',''); @@ -524,24 +643,24 @@ function events_content(&$a) { $o = replace_macros($tpl, array( '$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'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), - '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), - '$calendar' => cal($y,$m,$links, ' eventcal'), + '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), + '$calendar' => cal($y,$m,$links, ' eventcal'), '$events' => $events, - '$upload' => t('Import'), - '$submit' => t('Submit'), - '$prev' => t('Previous'), - '$next' => t('Next'), - '$today' => t('Today') + '$upload' => t('Import'), + '$submit' => t('Submit'), + '$prev' => t('Previous'), + '$next' => t('Next'), + '$today' => t('Today'), + '$form' => $form, + '$expandform' => ((x($_GET,'expandform')) ? true : false), )); if (x($_GET,'id')){ echo $o; killme(); } return $o; - } 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; - } } diff --git a/view/css/conversation.css b/view/css/conversation.css index 6f1d4b899..08b51d2fa 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -178,7 +178,6 @@ a.wall-item-name-link { /* comment_item */ .comment-edit-text-empty, .comment-edit-text-full { - float: left; width: 100%; } diff --git a/view/css/mod_events.css b/view/css/mod_events.css index ef8a0c4f7..86776f400 100644 --- a/view/css/mod_events.css +++ b/view/css/mod_events.css @@ -3,58 +3,3 @@ margin-left: -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; -} - diff --git a/view/js/mod_events.js b/view/js/mod_events.js index 270bf798b..0b7b3d24c 100644 --- a/view/js/mod_events.js +++ b/view/js/mod_events.js @@ -2,33 +2,15 @@ * JavaScript for mod/events */ -$(document).ready( function() { showHideFinishDate(); }); +$(document).ready( function() { -function showHideFinishDate() { + enableDisableFinishDate(); + +}); + +function enableDisableFinishDate() { if( $('#id_nofinish').is(':checked')) - $('#event-finish-wrapper').hide(); + $('#id_finish_text').prop("disabled", true); else - $('#event-finish-wrapper').show(); -} -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'); - } - }); + $('#id_finish_text').prop("disabled", false); } -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'); - } - }); -}
\ No newline at end of file diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 0b5b6ef80..74d106fe3 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1123,31 +1123,6 @@ nav .acpopup { 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 { margin-top: 30px; } diff --git a/view/tpl/event.tpl b/view/tpl/event.tpl index 5dfc91ebe..c1793c3e7 100755 --- a/view/tpl/event.tpl +++ b/view/tpl/event.tpl @@ -1,16 +1,16 @@ {{foreach $events as $event}} <div class="event-wrapper"> - <div class="event"> - <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}} - </div> - {{$event.html}} - <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.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}} - </div> - </div> - <div class="clear"></div> + <div class="event"> + <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}} + </div> + {{$event.html}} + <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.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}} + </div> + <div class="clear"></div> + </div> </div> {{/foreach}} diff --git a/view/tpl/event_form.tpl b/view/tpl/event_form.tpl index 15505397b..e74aabc68 100755 --- a/view/tpl/event_form.tpl +++ b/view/tpl/event_form.tpl @@ -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" > -<input type="hidden" name="event_id" value="{{$eid}}" /> -<input type="hidden" name="event_hash" value="{{$event_hash}}" /> -<input type="hidden" name="xchan" value="{{$xchan}}" /> -<input type="hidden" name="mid" value="{{$mid}}" /> -<input type="hidden" name="type" value="{{$type}}" /> -<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> - - - -{{if $catsenabled}} -<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}} - - - -<div id="event-desc-text">{{$d_text}}</div> - -<textarea id="comment-edit-text-desc" class="comment-edit-text-full" name="desc" >{{$d_orig}}</textarea> -<div class="clear"></div> -<div id="comment-tools-desc" class="comment-tools" style="display: block;" > - <div id="comment-edit-bb-desc" class="btn-toolbar pull-left"> - <div class='btn-group'> - <button class="btn btn-default btn-xs" title="{{$edbold}}" onclick="insertbbcomment('{{$comment}}','b', 'desc'); return false;"> - <i class="icon-bold comment-icon"></i> - </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 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> + <input type="hidden" name="event_id" value="{{$eid}}" /> + <input type="hidden" name="event_hash" value="{{$event_hash}}" /> + <input type="hidden" name="xchan" value="{{$xchan}}" /> + <input type="hidden" name="mid" value="{{$mid}}" /> + <input type="hidden" name="type" value="{{$type}}" /> + <input type="hidden" name="preview" id="event-edit-preview" value="0" /> + + + {{include file="field_input.tpl" field=$summary}} + + {{$s_dsel}} + + {{$f_dsel}} + + {{include file="field_checkbox.tpl" field=$nofinish}} + + <div id="advanced" style="display:none"> + + {{include file="field_checkbox.tpl" field=$adjust}} + + {{if $catsenabled}} + <div id="event-category-text"><b>{{$c_text}}</b></div> + <div id="events-category-wrap"> + <input name="category" id="event-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" class="event-cats form-control" data-role="cat-tagsinput" /> + </div> + {{/if}} + + <div class="form-group"> + <div id="event-desc-text"><b>{{$d_text}}</b></div> + + <textarea id="comment-edit-text-desc" class="comment-edit-text-full" name="desc" >{{$d_orig}}</textarea> + + <div id="comment-tools-desc" class="comment-tools" style="display: block;" > + <div id="comment-edit-bb-desc" class="btn-toolbar pull-left"> + <div class='btn-group'> + <button class="btn btn-default btn-xs" title="{{$edbold}}" onclick="insertbbcomment('{{$comment}}','b', 'desc'); return false;"> + <i class="icon-bold comment-icon"></i> + </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> - - - -<br /> -<div class="clear event-form-location-end"></div> + <div class="clear"></div> -{{if ! $eid}} + {{if ! $eid}} + {{include file="field_checkbox.tpl" field=$share}} + {{$acl}} + {{/if}} - <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 class="clear"></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}}" /> + <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> </form> - -</div> diff --git a/view/tpl/event_head.tpl b/view/tpl/event_head.tpl index ae5f21234..0fc3da5bc 100755 --- a/view/tpl/event_head.tpl +++ b/view/tpl/event_head.tpl @@ -110,22 +110,13 @@ var view = $('#events-calendar').fullCalendar('getView'); $('#title').text(view.title); - - - }); -</script> - - -<script> - $(document).ready(function() { - $('#id_share').change(function() { if ($('#id_share').is(':checked')) { - $('#event-permissions-button').show(); + $('#dbtn-acl').show(); } else { - $('#event-permissions-button').hide(); + $('#dbtn-acl').hide(); } }).trigger('change'); diff --git a/view/tpl/events-js.tpl b/view/tpl/events-js.tpl index d481af2e9..b2de90da1 100755 --- a/view/tpl/events-js.tpl +++ b/view/tpl/events-js.tpl @@ -1,8 +1,8 @@ <div class="generic-content-wrapper"> <div class="section-title-wrapper"> <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-success btn-xs" onclick="window.location.href='{{$new_event.0}}'; return false;" >{{$new_event.1}}</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="openClose('form'); closeMenu('event-tools');">{{$new_event.1}}</button> <div class="btn-group"> <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> <div class="clear"></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 class="form-group"> <button class="btn btn-primary btn-xs" onclick="exportDate(); return false;"><i class="icon-download"></i> {{$export.1}}</button> diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 75f6b0027..e7edb7e64 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -142,16 +142,16 @@ <div id="profile-rotator"></div> </div> <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}} <i class="icon-exclamation jot-icons"></i>{{/if}} - </button> - {{/if}} {{if $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> </button> {{/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}} <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> </div> <div id="profile-jot-perms-end"></div> |