From 0af572ffbaca04ac757a76ced22ab48a90e29a4a Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sun, 12 Jun 2016 18:23:10 +0200 Subject: [PATCH 01/10] frio: first part for event template work --- mod/events.php | 10 +- view/theme/frio/css/style.css | 62 ++++++++ view/theme/frio/js/modal.js | 11 +- view/theme/frio/js/theme.js | 156 +++++++++++++++++++ view/theme/frio/templates/event.tpl | 19 +++ view/theme/frio/templates/event_form.tpl | 53 +++++++ view/theme/frio/templates/event_head.tpl | 188 +++++++++++++++++++++++ view/theme/frio/templates/events-js.tpl | 41 +++++ 8 files changed, 537 insertions(+), 3 deletions(-) create mode 100644 view/theme/frio/templates/event.tpl create mode 100644 view/theme/frio/templates/event_form.tpl create mode 100644 view/theme/frio/templates/event_head.tpl create mode 100644 view/theme/frio/templates/events-js.tpl diff --git a/mod/events.php b/mod/events.php index 633aaf0c1..46f33355b 100644 --- a/mod/events.php +++ b/mod/events.php @@ -67,9 +67,9 @@ function events_post(&$a) { $action = ($event_id == '') ? 'new' : "event/" . $event_id; $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; - if(strcmp($finish,$start) < 0 && !$nofinish) { + if(strcmp($finish,$start) < 0 && !$nofinish) { notice( t('Event can not end before it has started.') . EOL); - if(intval($_REQUEST['preview'])) { + if(intval($_REQUEST['preview'])) { echo( t('Event can not end before it has started.')); killme(); } @@ -462,6 +462,12 @@ function events_content(&$a) { '$events' => $events, + // eignene + "today" => t("today"), + "month" => t("month"), + "week" => t("week"), + "day" => t("day"), + )); diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 49d78e131..185888b71 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -163,6 +163,15 @@ a#item-delete-selected { .btn-link:focus, .btn-link:hover { color: #23527c; } +.btn-eventnav, btn-eventnav:hover { + font-size: 16px; + background: none; + background-color: transparent; + padding: 0 14px; +} +.btn-separator { + border-left: 1px solid #777; +} /*.btn-info { background: #6fdbe8; color: #fff!important; @@ -1901,6 +1910,59 @@ ul li:hover .contact-wrapper a.contact-action-link:hover { #poke-wrapper-end { clear: both; } + +/* Events page */ +#fc-header { + margin-top: 20px; + margin-bottom: 10px; +} +#fc-header-left, +#fc-header-right, +#event-calendar-title { + display: inline-block; +} +#fc-title { + margin: 0; + padding-left: 20px; + +} +#fc-header-right { + margin-top: -4px; +} +#event-calendar-title { + vertical-align: middle; +} +a#event-calendar-views { + padding: 6px 9px; + font-size: 14px +} +tr.fc-first, +tr.fc-first th { + border-left: none; + border-right: none; + border-top: none; +} +td.fc-day { + border-left: none; + border-right: none; + padding: 0 6px; +} +#events-calendar .fc-grid .fc-day-number { + float: left; + font-size: 0.9em; +} +.event-wrapper .event-owner { + margin-bottom: 15px; +} +.event-owner img { + margin-right: 5px; + height: 48px; + width: 48; + border-radius: 3px; +} +.event-wrapper .event-buttons { + margin-top: 15px; +} /* * Overwriting for transparency and other colors */ diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 0a881f10f..f99946019 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -158,8 +158,17 @@ function loadModalTitle() { // hide the first element with the class "heading" of the modal body $("#modal-body .heading").first().hide(); + var title = ""; + // get the text of the first element with "heading" class - var title = $("#modal-body .heading").first().text(); + title = $("#modal-body .heading").first().text(); + + // for event modals we need some speacial handling + if($("#modal-body .event-wrapper .event-summary").length) { + title = ' '; + var eventsum = $("#modal-body .event-wrapper .event-summary").text(); + title = title + eventsum; + } // and append it to modal title if (title!=="") { diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 28221dcd0..414df7c1a 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -482,3 +482,159 @@ String.prototype.rtrim = function() { return trimmed; }; + + +// $(document).ready(function() { +// $('#events-calendar').fullCalendar({ +// firstDay: {{$i18n.firstDay}}, +// monthNames: ['{{$i18n.January}}','{{$i18n.February}}','{{$i18n.March}}','{{$i18n.April}}','{{$i18n.May}}','{{$i18n.June}}','{{$i18n.July}}','{{$i18n.August}}','{{$i18n.September}}','{{$i18n.October}}','{{$i18n.November}}','{{$i18n.December}}'], +// monthNamesShort: ['{{$i18n.Jan}}','{{$i18n.Feb}}','{{$i18n.Mar}}','{{$i18n.Apr}}','{{$i18n.May}}','{{$i18n.Jun}}','{{$i18n.Jul}}','{{$i18n.Aug}}','{{$i18n.Sep}}','{{$i18n.Oct}}','{{$i18n.Nov}}','{{$i18n.Dec}}'], +// dayNames: ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'], +// dayNamesShort: ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'], +// buttonText: { +// prev: "", +// next: "", +// prevYear: "«", +// nextYear: "»", +// today: '{{$i18n.today}}', +// month: '{{$i18n.month}}', +// week: '{{$i18n.week}}', +// day: '{{$i18n.day}}' +// }, +// events: '{{$baseurl}}/events/json/', +// header: { +// left: '', +// // center: 'title', +// right: '' +// }, +// timeFormat: 'H(:mm)', +// eventClick: function(calEvent, jsEvent, view) { +// showEvent(calEvent.id); +// }, +// loading: function(isLoading, view) { +// if(!isLoading) { +// $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); +// } +// }, +// +// eventRender: function(event, element, view) { +// //console.log(view.name); +// if (event.item['author-name']==null) return; +// switch(view.name){ +// case "month": +// element.find(".fc-event-title").html( +// "{1} : {2}".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.title +// )); +// break; +// case "agendaWeek": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// case "agendaDay": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// } +// } +// +// }) +// +// // center on date +// var args=location.href.replace(baseurl,"").split("/"); +// if (args.length>=4) { +// $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1); +// } +// +// // echo the title +// var view = $('#events-calendar').fullCalendar('getView'); +// $('#fc-title').text(view.title); +// +// // show event popup +// var hash = location.hash.split("-") +// if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]); +// +// }); + +// $(document).ready(function() { +// $('#events-calendar').fullCalendar({ +// +// events: '{{$baseurl}}/events/json/', +// header: { +// left: '', +// // center: 'title', +// right: '' +// }, +// timeFormat: 'H(:mm)', +// eventClick: function(calEvent, jsEvent, view) { +// showEvent(calEvent.id); +// }, +// loading: function(isLoading, view) { +// if(!isLoading) { +// $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); +// } +// }, +// +// eventRender: function(event, element, view) { +// //console.log(view.name); +// if (event.item['author-name']==null) return; +// switch(view.name){ +// case "month": +// element.find(".fc-event-title").html( +// "{1} : {2}".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.title +// )); +// break; +// case "agendaWeek": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// case "agendaDay": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// } +// } +// +// }) +// +// // center on date +// var args=location.href.replace(baseurl,"").split("/"); +// if (args.length>=4) { +// $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1); +// } +// +// // echo the title +// var view = $('#events-calendar').fullCalendar('getView'); +// $('#fc-title').text(view.title); +// +// // show event popup +// var hash = location.hash.split("-") +// if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]); +// +// }); + \ No newline at end of file diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl new file mode 100644 index 000000000..380bc7cb1 --- /dev/null +++ b/view/theme/frio/templates/event.tpl @@ -0,0 +1,19 @@ + +{{foreach $events as $event}} +
+
+
+ {{if $event.item.author_name}} + {{$event.item.author_name}} + {{/if}} +
+ {{$event.html}} + +
+ {{if $event.item.plink}}{{/if}} + {{if $event.edit}}{{/if}} +
+
+
+
+{{/foreach}} diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl new file mode 100644 index 000000000..ff59833b5 --- /dev/null +++ b/view/theme/frio/templates/event_form.tpl @@ -0,0 +1,53 @@ + +

{{$title}}

+ +

+{{$desc}} +

+ +
+ + + + + + +
{{$s_text}}
+{{$s_dsel}} + +
{{$f_text}}
+{{$f_dsel}} + +
+ +
{{$n_text}}
+ +
+ +
{{$a_text}}
+ +
+ +
{{$t_text}}
+ + + +
{{$d_text}}
+ + + +
{{$l_text}}
+ + +
+ +
{{$sh_text}}
+
+ +{{$acl}} + +
+ + +
+ diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl new file mode 100644 index 000000000..e11f93ea7 --- /dev/null +++ b/view/theme/frio/templates/event_head.tpl @@ -0,0 +1,188 @@ + + + + + + + +{{if $editselect != 'none'}} + + + diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl new file mode 100644 index 000000000..dcd522c58 --- /dev/null +++ b/view/theme/frio/templates/events-js.tpl @@ -0,0 +1,41 @@ +
+ {{$tabs}} + {{include file="section_title.tpl" title=$title}} + + + +
+
+ +
+
+ + + +
+ +

+ +
+
+
From 5e98f27fcd99f0431a5f62ca7a825a5ad6a2f8a3 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Mon, 13 Jun 2016 10:19:38 +0200 Subject: [PATCH 02/10] 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 89305a240..bbb60ba72 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 46f33355b..f6872a616 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 ff59833b5..ebe4faa35 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 dcd522c58..93c131b36 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}} - +
From 8b4c41671372a074750798080d8e2d262552bee4 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 16 Jun 2016 20:16:16 +0200 Subject: [PATCH 03/10] frio: events - split event form in different sections --- include/datetime.php | 6 +- view/theme/frio/templates/event_form.tpl | 189 +++++++++++++++-------- view/theme/frio/templates/event_head.tpl | 45 +++++- 3 files changed, 168 insertions(+), 72 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index bbb60ba72..4b0bbb576 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -273,7 +273,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : ''; $maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : ''; - $input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : ''; + $input_text = $default ? date($dateformat, $default->getTimestamp()) : ''; $defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : ''; $pickers = ''; @@ -283,7 +283,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $extra_js = ''; $pickers .= ",dayOfWeekStart: ".$firstDay.",lang:'".$lang."'"; if($minfrom != '') - $extra_js .= "\$('id_#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$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 .= "\$('#id_$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})"; @@ -296,7 +296,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $tpl = get_markup_template('field_input.tpl'); $o .= replace_macros($tpl,array( - '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '" '), + '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'), )); // $o .= "
"; // $o .= '
'; diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index ebe4faa35..3a6161198 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,84 +1,139 @@

{{$title}}

-

-{{$desc}} -

+{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} +
- - - - + + + + -{{$s_dsel}} +
+

+ {{$desc}} +

-{{$f_dsel}} + {{$s_dsel}} -{{include file="field_checkbox.tpl" field=$nofinish}} + {{$f_dsel}} -{{include file="field_checkbox.tpl" field=$adjust}} + {{include file="field_checkbox.tpl" field=$nofinish}} -{{include file="field_input.tpl" field=$summary}} + {{include file="field_checkbox.tpl" field=$adjust}} -
-
{{$d_text}}
- -
+ + -
  • - - - -
  • -
  • - - - -
  • -
  • - - - -
  • -
  • - - - -
  • -
    -
    - -
    {{$l_text}}
    - - -
    - -
    {{$sh_text}}
    -
    - -{{$acl}} - -
    - -
    diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index e11f93ea7..e0cfceec9 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -159,13 +159,17 @@ $("#comment-edit-text-desc").bbco_autocomplete('bbcode'); {{/if}} - $('#event-share-checkbox').change(function() { + $('body').change("#event-share-checkbox", function() { - if ($('#event-share-checkbox').is(':checked')) { + if ($('#event-share-checkbox').is(':checked') && !( $('#event-share-checkbox').attr("disabled"))) { $('#acl-wrapper').show(); + $("a#event-perms-lnk").parent("li").show(); + toggleEventNav("a#event-perms-lnk"); + eventAclActive(); } else { $('#acl-wrapper').hide(); + $("a#event-perms-lnk").parent("li").hide(); } }).trigger('change'); @@ -182,7 +186,44 @@ }).trigger('change'); + // Event nav menu. + $("body").on("click", "#event-nav li a", function(e){ + e.preventDefault(); + toggleEventNav(this); + }); + }); + From c99da380cf3d22f023e7526881d78027f8f41acf Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 10:33:12 +0200 Subject: [PATCH 04/10] frio: events - adapt changes to the templates of the other themes --- mod/events.php | 1 + view/templates/event_form.tpl | 20 +- view/templates/event_head.tpl | 17 +- view/theme/frio/js/modal.js | 2 +- view/theme/frio/templates/event.tpl | 2 +- view/theme/frio/templates/event_form.tpl | 259 +++++++++++--------- view/theme/frio/templates/event_head.tpl | 69 +++++- view/theme/frio/templates/events-js.tpl | 2 +- view/theme/frost/js/theme.js | 4 +- view/theme/frost/templates/event_form.tpl | 20 +- view/theme/quattro/templates/event_form.tpl | 20 +- view/theme/vier/templates/event_form.tpl | 20 +- 12 files changed, 247 insertions(+), 189 deletions(-) diff --git a/mod/events.php b/mod/events.php index f6872a616..778613609 100644 --- a/mod/events.php +++ b/mod/events.php @@ -576,6 +576,7 @@ function events_content(&$a) { '$t_orig' => $t_orig, '$summary' => array('summary', t('Title:'), $t_orig, '', '*'), '$sh_text' => t('Share this event'), + '$share' => array('share', t('Share this event'), $sh_checked, ''), '$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), diff --git a/view/templates/event_form.tpl b/view/templates/event_form.tpl index 1c065477b..de8de44e8 100644 --- a/view/templates/event_form.tpl +++ b/view/templates/event_form.tpl @@ -12,24 +12,15 @@ -
    {{$s_text}}
    {{$s_dsel}} -
    {{$f_text}}
    {{$f_dsel}} -
    +{{include file="field_checkbox.tpl" field=$nofinish}} -
    {{$n_text}}
    +{{include file="field_checkbox.tpl" field=$adjust}} -
    - -
    {{$a_text}}
    - -
    - -
    {{$t_text}}
    - +{{include file="field_input.tpl" field=$summary}}
    {{$d_text}}
    @@ -41,8 +32,9 @@
    -
    {{$sh_text}}
    -
    +{{if ! $eid}} +{{include file="field_checkbox.tpl" field=$share}} +{{/if}} {{$acl}} diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index de5ad6070..0c015f4bf 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -21,6 +21,14 @@ $('#event-edit-preview').val(0); } + // disable the input for the finish date if it is not available + function enableDisableFinishDate() { + if( $('#id_nofinish').is(':checked')) + $('#id_finish_text').prop("disabled", true); + else + $('#id_finish_text').prop("disabled", false); + } + $(document).ready(function() { $('#events-calendar').fullCalendar({ @@ -152,9 +160,9 @@ $("#comment-edit-text-desc").bbco_autocomplete('bbcode'); {{/if}} - $('#event-share-checkbox').change(function() { + $('#id_share').change(function() { - if ($('#event-share-checkbox').is(':checked')) { + if ($('#id_share').is(':checked')) { $('#acl-wrapper').show(); } else { @@ -175,6 +183,11 @@ }).trigger('change'); + // disable the finish time input if the user disable it + $('body').change("#id_nofinish", function() { + enableDisableFinishDate() + }).trigger('change'); + }); diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index f99946019..d27048e2d 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -153,7 +153,7 @@ Dialog._load = function(url) { */ function loadModalTitle() { // clear the text of the title - //$("#modal-title").empty(); + $("#modal-title").empty(); // hide the first element with the class "heading" of the modal body $("#modal-body .heading").first().hide(); diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl index 380bc7cb1..27965bb59 100644 --- a/view/theme/frio/templates/event.tpl +++ b/view/theme/frio/templates/event.tpl @@ -11,7 +11,7 @@
    {{if $event.item.plink}}{{/if}} - {{if $event.edit}}{{/if}} + {{if $event.edit}}{{/if}}
    diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index 3a6161198..df97e01ff 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,139 +1,162 @@ -

    {{$title}}

    +
    +

    {{$title}}

    -{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} - + {{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} + -
    +
    + - - - - + + + + -
    -

    - {{$desc}} -

    +
    +

    + {{$desc}} +

    - {{$s_dsel}} + {{$s_dsel}} - {{$f_dsel}} + {{$f_dsel}} - {{include file="field_checkbox.tpl" field=$nofinish}} + {{include file="field_checkbox.tpl" field=$nofinish}} - {{include file="field_checkbox.tpl" field=$adjust}} + {{include file="field_checkbox.tpl" field=$adjust}} - {{include file="field_input.tpl" field=$summary}} + {{include file="field_input.tpl" field=$summary}} -
    -
    {{$d_text}}
    - - +
    +
    + +
    +
    {{$l_text}}
    + + +
    +
    + + {{if ! $eid}} + {{include file="field_checkbox.tpl" field=$share}} + {{/if}} + +
    + +
    -
    -
    {{$l_text}}
    - - -
    + -
    {{$sh_text}}
    -
    + - - +
    + +
    +
    - - -
    - - - + \ No newline at end of file diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index e0cfceec9..dc1457a87 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -5,16 +5,18 @@ @@ -200,18 +223,19 @@ // the following functions show/hide the specific event-edit content // in dependence of the selected nav function eventAclActive() { - $("#event-edit-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide(); + $("#event-edit-wrapper, #event-preview").hide(); $("#event-acl-wrapper").show(); } - function previewActive() { - $(".modal-body #profile-jot-wrapper, .modal-body #profile-jot-acl-wrapper,.modal-body #jot-fbrowser-wrapper").hide(); - preview_post(); + function eventPreviewActive() { + $("#event-acl-wrapper, #event-edit-wrapper").hide(); + $("#event-preview").show(); + doEventPreview(); } function eventEditActive() { - $("#event-acl-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide(); + $("#event-acl-wrapper, #event-preview").hide(); $("#event-edit-wrapper").show(); //make sure jot text does have really the active class (we do this because there are some @@ -226,4 +250,25 @@ // add the active class to the parent of the link which was selected $(elm).parent("li").addClass("active"); } + + // this function load the content of the edit url into a modal + function eventEdit(url) { + var char = qOrAmp(url); + url = url + char + 'mode=none'; + + $.get(url, function(data) { + $("#modal-body").empty(); + $("#modal-body").append(data); + }).done(function() { + loadModalTitle(); + }); + } + + // disable the input for the finish date if it is not available + function enableDisableFinishDate() { + if( $('#id_nofinish').is(':checked')) + $('#id_finish_text').prop("disabled", true); + else + $('#id_finish_text').prop("disabled", false); + } diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl index 93c131b36..dcd522c58 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}} - +
    diff --git a/view/theme/frost/js/theme.js b/view/theme/frost/js/theme.js index fc1bb643c..038f83e0e 100644 --- a/view/theme/frost/js/theme.js +++ b/view/theme/frost/js/theme.js @@ -70,9 +70,9 @@ $(document).ready(function() { return false; });*/ - $('#event-share-checkbox').change(function() { + $('#id_share').change(function() { - if ($('#event-share-checkbox').is(':checked')) { + if ($('#id_share').is(':checked')) { $('#acl-wrapper').show(); } else { diff --git a/view/theme/frost/templates/event_form.tpl b/view/theme/frost/templates/event_form.tpl index 43f2a782f..27631d9f7 100644 --- a/view/theme/frost/templates/event_form.tpl +++ b/view/theme/frost/templates/event_form.tpl @@ -12,24 +12,15 @@ -
    {{$s_text}}
    {{$s_dsel}} -
    {{$f_text}}
    {{$f_dsel}} -
    +{{include file="field_checkbox.tpl" field=$nofinish}} -
    {{$n_text}}
    +{{include file="field_checkbox.tpl" field=$adjust}} -
    - -
    {{$a_text}}
    - -
    - -
    {{$t_text}}
    - +{{include file="field_input.tpl" field=$summary}}
    {{$d_text}}
    @@ -40,8 +31,9 @@
    -
    {{$sh_text}}
    -
    +{{if ! $eid}} +{{include file="field_checkbox.tpl" field=$share}} +{{/if}} {{$acl}} diff --git a/view/theme/quattro/templates/event_form.tpl b/view/theme/quattro/templates/event_form.tpl index 098b57850..484fe6744 100644 --- a/view/theme/quattro/templates/event_form.tpl +++ b/view/theme/quattro/templates/event_form.tpl @@ -10,23 +10,23 @@ - {{include file="field_custom.tpl" field=array('start_text', $s_text, $s_dsel, "")}} - {{include file="field_custom.tpl" field=array('finish_text', $f_text, $f_dsel, "")}} + {{$s_dsel}} - {{include file="field_checkbox.tpl" field=array('nofinish', $n_text, $n_checked, "")}} - {{include file="field_checkbox.tpl" field=array('adjust', $a_text, $a_checked, "")}} + {{$f_dsel}} + + {{include file="field_checkbox.tpl" field=$nofinish}} + + {{include file="field_checkbox.tpl" field=$adjust}}
    - {{include file="field_input.tpl" field=array('summary', $t_text, $t_orig, "")}} + {{include file="field_input.tpl" field=$summary}} {{include file="field_textarea.tpl" field=array('desc', $d_text, $d_orig, "")}} {{include file="field_textarea.tpl" field=array('location', $l_text, $l_orig, "")}}
    -
    - - - -
    + {{if ! $eid}} + {{include file="field_checkbox.tpl" field=$share}} + {{/if}} {{$acl}} diff --git a/view/theme/vier/templates/event_form.tpl b/view/theme/vier/templates/event_form.tpl index 4f3240de8..0507c36aa 100644 --- a/view/theme/vier/templates/event_form.tpl +++ b/view/theme/vier/templates/event_form.tpl @@ -13,24 +13,15 @@ -
    {{$s_text}}
    {{$s_dsel}} -
    {{$f_text}}
    {{$f_dsel}} -
    +{{include file="field_checkbox.tpl" field=$nofinish}} -
    {{$n_text}}
    +{{include file="field_checkbox.tpl" field=$adjust}} -
    - -
    {{$a_text}}
    - -
    - -
    {{$t_text}}
    - +{{include file="field_input.tpl" field=$summary}}
    {{$d_text}}
    @@ -61,8 +52,9 @@
    -
    {{$sh_text}}
    -
    +{{if ! $eid}} +{{include file="field_checkbox.tpl" field=$share}} +{{/if}} {{$acl}} From 0148d0e5d2676d174305930110850ce74f2fa474 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 11:18:54 +0200 Subject: [PATCH 05/10] frio - event - correct some js --- view/templates/event_head.tpl | 2 +- view/theme/frio/templates/event_head.tpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index 0c015f4bf..01c69b8b3 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -184,7 +184,7 @@ }).trigger('change'); // disable the finish time input if the user disable it - $('body').change("#id_nofinish", function() { + $('#id_nofinish').change(function() { enableDisableFinishDate() }).trigger('change'); diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index dc1457a87..ee60f183e 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -163,7 +163,7 @@ {{/if}} // go to the permissions tab if the checkbox is checked - $('body').change("#id_share", function() { + $('body').on("change", "#id_share", function() { if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) { $('#acl-wrapper').show(); @@ -178,7 +178,7 @@ }).trigger('change'); // disable the finish time input if the user disable it - $('body').change("#id_nofinish", function() { + $('body').on("change", "#id_nofinish", function() { enableDisableFinishDate() }).trigger('change'); From 606f42701ccd545a04fdf0b2a6bea3bce2ee9dd0 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:09:18 +0200 Subject: [PATCH 06/10] frio - event - some js and template refactoring + event view css styling --- mod/events.php | 6 +- view/theme/frio/css/style.css | 20 ++++ view/theme/frio/js/event.js | 124 +++++++++++++++++++++++ view/theme/frio/templates/event.tpl | 19 ++-- view/theme/frio/templates/event_form.tpl | 47 +++++---- view/theme/frio/templates/event_head.tpl | 119 ---------------------- view/theme/frio/templates/events-js.tpl | 2 +- 7 files changed, 187 insertions(+), 150 deletions(-) create mode 100644 view/theme/frio/js/event.js diff --git a/mod/events.php b/mod/events.php index 778613609..e4526ac59 100644 --- a/mod/events.php +++ b/mod/events.php @@ -455,6 +455,7 @@ function events_content(&$a) { '$baseurl' => $a->get_baseurl(), '$tabs' => $tabs, '$title' => t('Events'), + '$view' => t('View'), '$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''), '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), @@ -462,7 +463,6 @@ function events_content(&$a) { '$events' => $events, - // eignene "today" => t("today"), "month" => t("month"), "week" => t("week"), @@ -582,7 +582,9 @@ function events_content(&$a) { '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked), '$preview' => t('Preview'), '$acl' => $acl, - '$submit' => t('Submit') + '$submit' => t('Submit'), + '$basic' => t("Basic"), + '$advanced' => t("Advanced") )); diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 185888b71..deb3436de 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1954,15 +1954,35 @@ td.fc-day { .event-wrapper .event-owner { margin-bottom: 15px; } +.event-wrapper .event-owner img { + display: block; +} .event-owner img { margin-right: 5px; height: 48px; width: 48; border-radius: 3px; } +.event-wrapper .vevent { + margin-left: 0; + margin-right: 0; + box-shadow: 1.5px 0 0 0 rgba(0, 0, 0, .1) inset; +} .event-wrapper .event-buttons { margin-top: 15px; } +#event-form-wrapper { + padding-top: 5px; +} +#event-edit-form-wrapper { + padding-top: 15px; +} +#event-nav a { + color: #555; +} +#event-edit-form-wrapper #event-edit-time { + padding: 10px 0; +} /* * Overwriting for transparency and other colors */ diff --git a/view/theme/frio/js/event.js b/view/theme/frio/js/event.js new file mode 100644 index 000000000..c6a3541f6 --- /dev/null +++ b/view/theme/frio/js/event.js @@ -0,0 +1,124 @@ +$(document).ready(function() { + // go to the permissions tab if the checkbox is checked + $('body').on("change", "#id_share", function() { + + if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) { + $('#acl-wrapper').show(); + $("a#event-perms-lnk").parent("li").show(); + toggleEventNav("a#event-perms-lnk"); + eventAclActive(); + } + else { + $('#acl-wrapper').hide(); + $("a#event-perms-lnk").parent("li").hide(); + } + }).trigger('change'); + + // disable the finish time input if the user disable it + $('body').on("change", "#id_nofinish", function() { + enableDisableFinishDate() + }).trigger('change'); + + // js for the permission sextion + $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() { + var selstr; + $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() { + selstr = $(this).text(); + $('#jot-public').hide(); + }); + if(selstr == null) { + $('#jot-public').show(); + } + + }).trigger('change'); + + // Change the event nav menu.tabs on click + $("body").on("click", "#event-nav > li > a", function(e){ + e.preventDefault(); + toggleEventNav(this); + }); + + // this is experimental. We maybe can make use of it to inject + // some js code while the event modal opens + //$('body').on('show.bs.modal', function () { + // enableDisableFinishDate(); + //}); + + // clear some elements (e.g. the event-preview container) when + // selecting a event nav link so it don't appear more than once + $('body').on("click", "#event-nav a", function(e) { + $("#event-preview").empty(); + e.preventDefault(); + }); + +}); + +// Load the html of the actual event and incect the output to the +// event-edit section +function doEventPreview() { + $('#event-edit-preview').val(1); + $.post('events',$('#event-edit-form').serialize(), function(data) { + $("#event-preview").append(data); + }); + $('#event-edit-preview').val(0); +} + + +// this function load the content of the edit url into a modal +function eventEdit(url) { + var char = qOrAmp(url); + url = url + char + 'mode=none'; + + $.get(url, function(data) { + $("#modal-body").empty(); + $("#modal-body").append(data); + }).done(function() { + loadModalTitle(); + }); +} + +// the following functions show/hide the specific event-edit content +// in dependence of the selected nav +function eventAclActive() { + $("#event-edit-wrapper, #event-preview, #event-desc-wrapper").hide(); + $("#event-acl-wrapper").show(); +} + + +function eventPreviewActive() { + $("#event-acl-wrapper, #event-edit-wrapper, #event-desc-wrapper").hide(); + $("#event-preview").show(); + doEventPreview(); +} + +function eventEditActive() { + $("#event-acl-wrapper, #event-preview, #event-desc-wrapper").hide(); + $("#event-edit-wrapper").show(); + + //make sure jot text does have really the active class (we do this because there are some + // other events which trigger jot text + toggleEventNav($("#event-edit-lnk")); +} + +function eventDescActive() { + $("#event-edit-wrapper, #event-preview, #event-acl-wrapper").hide(); + $("#event-desc-wrapper").show(); +} + +// Give the active "event-nav" list element the class "active" +function toggleEventNav (elm) { + // select all li of #event-nav and remove the active class + $(elm).closest("#event-nav").children("li").removeClass("active"); + // add the active class to the parent of the link which was selected + $(elm).parent("li").addClass("active"); +} + + + +// disable the input for the finish date if it is not available +function enableDisableFinishDate() { + if( $('#id_nofinish').is(':checked')) + $('#id_finish_text').prop("disabled", true); + else + $('#id_finish_text').prop("disabled", false); +} diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl index 27965bb59..32e740581 100644 --- a/view/theme/frio/templates/event.tpl +++ b/view/theme/frio/templates/event.tpl @@ -1,16 +1,23 @@ + {{foreach $events as $event}}
    -
    - {{if $event.item.author_name}} - {{$event.item.author_name}} - {{/if}} +
    +
    + {{if $event.item.author_name}} + + {{$event.item.author_name}} + {{/if}} +
    +
    + {{$event.html}} +
    - {{$event.html}}
    - {{if $event.item.plink}}{{/if}} + {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}}
    diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index df97e01ff..6ccce703b 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,4 +1,5 @@ - +

    {{$title}}

    @@ -6,7 +7,8 @@
    - - {{if ! $eid}} - {{include file="field_checkbox.tpl" field=$share}} - {{/if}} - -
    - -
    -
    From d0900c5389dc2b0a753d7d022928f569951b81e2 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:35:24 +0200 Subject: [PATCH 08/10] Merge develop into 1206-events-template - restore gitignore --- .gitignore | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index 77151060d..b300f579e 100644 --- a/.gitignore +++ b/.gitignore @@ -42,16 +42,3 @@ nbproject #ignore local folder /local/ - -#other stuff -.directory -.gitignore - -/view/theme/Friendiboot -/view/theme/Viereinhalb -/view/theme/blog -/view/theme/boheme -/view/theme/clean -/view/theme/suckerberg - -/addon/frio_hovercard From 134d5949d5d1ddb3c03c5f6aa294edf73b027350 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:39:59 +0200 Subject: [PATCH 09/10] frio - events - restore lost css bracket after merging develop branch --- view/theme/frio/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index eda0b3d71..edc4a55a7 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2040,6 +2040,7 @@ td.fc-day { } #event-edit-form-wrapper #event-edit-time { padding: 10px 0; +} /* Profiles Page */ .profile-listing-table { display: table; From 48a77af49d51a203b95e6fb07fcb5a78d40bee1b Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:52:42 +0200 Subject: [PATCH 10/10] frio - events - delete unneeded css --- view/theme/frio/css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index edc4a55a7..bfce21a65 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1769,8 +1769,8 @@ ul.dropdown-menu li:hover { .contacts-content-wrapper, .suggest-content-wrapper, .common-content-wrapper, .allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper, .directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper, -.events-content-wrapper, .message-content-wrapper, .apps-content-wrapper, -.notifications-content-wrapper, .admin-content-wrapper, .group-content-wrapper { +.message-content-wrapper, .apps-content-wrapper, .notifications-content-wrapper, +.admin-content-wrapper, .group-content-wrapper { min-height: calc(100vh - 150px); padding: 15px; padding-bottom: 20px;