From 5e98f27fcd99f0431a5f62ca7a825a5ad6a2f8a3 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Mon, 13 Jun 2016 10:19:38 +0200 Subject: [PATCH] frio: events - work on event_form.tpl + datetime.php --- include/datetime.php | 20 ++++---- mod/events.php | 7 ++- view/theme/frio/templates/event_form.tpl | 59 ++++++++++++++++++------ view/theme/frio/templates/events-js.tpl | 2 +- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 89305a2406..bbb60ba72c 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -202,7 +202,7 @@ function dob($dob) { * @return string Parsed HTML output. */ function datesel($format, $min, $max, $default, $id = 'datepicker') { - return datetimesel($format,$min,$max,$default,$id,true,false, '',''); + return datetimesel($format,$min,$max,$default,'',$id,true,false, '',''); } /** @@ -220,7 +220,7 @@ function datesel($format, $min, $max, $default, $id = 'datepicker') { * @return string Parsed HTML output. */ function timesel($format, $h, $m, $id='timepicker') { - return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),$id,false,true); + return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),'',$id,false,true); } /** @@ -251,7 +251,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) { +function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) { // First day of the week (0 = Sunday) $firstDay = get_pconfig(local_user(),'system','first_day_of_week'); @@ -283,9 +283,9 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic $extra_js = ''; $pickers .= ",dayOfWeekStart: ".$firstDay.",lang:'".$lang."'"; 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); @@ -294,10 +294,14 @@ 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 .= "
"; - $o .= '
'; + $tpl = get_markup_template('field_input.tpl'); + $o .= replace_macros($tpl,array( + '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '" '), + )); +// $o .= "
"; +// $o .= '
'; $o .= ""; return $o; diff --git a/mod/events.php b/mod/events.php index 46f33355b9..f6872a6162 100644 --- a/mod/events.php +++ b/mod/events.php @@ -561,11 +561,11 @@ function events_content(&$a) { '$title' => t('Event details'), '$desc' => t('Starting date and Title are required.'), '$s_text' => t('Event Starts:') . ' *', - '$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), + '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),t('Event Starts:'),'start_text',true,true,'','',true), '$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'), + '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),t('Event Finishes:'),'finish_text',true,true,'start_text'), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, '$d_text' => t('Description:'), @@ -574,8 +574,11 @@ function events_content(&$a) { '$l_orig' => $l_orig, '$t_text' => t('Title:') . ' *', '$t_orig' => $t_orig, + '$summary' => array('summary', t('Title:'), $t_orig, '', '*'), '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, + '$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked), + '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked), '$preview' => t('Preview'), '$acl' => $acl, '$submit' => t('Submit') diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index ff59833b55..ebe4faa357 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -12,28 +12,59 @@ -
{{$s_text}}
{{$s_dsel}} -
{{$f_text}}
{{$f_dsel}} -
+{{include file="field_checkbox.tpl" field=$nofinish}} -
{{$n_text}}
+{{include file="field_checkbox.tpl" field=$adjust}} -
+{{include file="field_input.tpl" field=$summary}} -
{{$a_text}}
+
+
{{$d_text}}
+ + +
+
{{$l_text}}
diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl index dcd522c586..93c131b36b 100644 --- a/view/theme/frio/templates/events-js.tpl +++ b/view/theme/frio/templates/events-js.tpl @@ -1,7 +1,7 @@
{{$tabs}} {{include file="section_title.tpl" title=$title}} - +