From 0af572ffbaca04ac757a76ced22ab48a90e29a4a Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sun, 12 Jun 2016 18:23:10 +0200 Subject: [PATCH] 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}} + + + +
+
+ +
+
+ + + +
+ +

+ +
+
+