From 0af572ffbaca04ac757a76ced22ab48a90e29a4a Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sun, 12 Jun 2016 18:23:10 +0200 Subject: [PATCH 01/16] 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}} ++{{$desc}} +
+ + + 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 @@ +' . $o . '
');
+}
diff --git a/library/Text_Highlighter/README b/library/Text_Highlighter/README
new file mode 100644
index 000000000..88f71aed2
--- /dev/null
+++ b/library/Text_Highlighter/README
@@ -0,0 +1,455 @@
+# $Id$
+
+Introduction
+============
+
+Text_Highlighter is a class for syntax highlighting. The main idea is to
+simplify creation of subclasses implementing syntax highlighting for
+particular language. Subclasses do not implement any new functioanality, they
+just provide syntax highlighting rules. The rules sources are in XML format.
+To create a highlighter for a language, there is no need to code a new class
+manually. Simply describe the rules in XML file and use Text_Highlighter_Generator
+to create a new class.
+
+
+This document does not contain a formal description of API - it is very
+simple, and I believe providing some examples of code is sufficient.
+
+
+Highlighter XML source
+======================
+
+Basics
+------
+
+Creating a new syntax highlighter begins with describing the highlighting
+rules. There are two basic elements: block and region. A block is just a
+portion of text matching a regular expression and highlighted with a single
+color. Keyword is an example of a block. A region is defined by two regular
+expressions: one for start of region, and another for the end. The main
+difference from a block is that a region can contain blocks and regions
+(including same-named regions). An example of a region is a group of
+statements enclosed in curly brackets (this is used in many languages, for
+example PHP and C). Also, characters matching start and end of a region may be
+highlighted with their own color, and region contents with another.
+
+Blocks and regions may be declared as contained. Contained blocks and regions
+can only appear inside regions. If a region or a block is not declared as
+contained, it can appear both on top level and inside regions. Block or region
+declared as not-contained can only appear on top level.
+
+For any region, a list of blocks and regions that can appear inside this
+region can be specified.
+
+In this document, the term "color group" is used. Chunks of text assigned to
+same color group will be highlighted with same color. Note that in versions
+prior 0.5.0 color goups were refered as CSS classes, but since 0.5.0 not only
+HTML output is supported, so "color group" is more appropriate term.
+
+Elements
+--------
+
+The toplevel element is
+ *require_once 'Text/Highlighter.php';
+ *$hlSQL = Text_Highlighter::factory('SQL',array('numbers'=>true));
+ *echo $hlSQL->highlight('SELECT * FROM table a WHERE id = 12');
+ *
+ *
+ * @author Andrey Demenev -{{$desc}} -
+{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} + 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 05/16] 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 @@ -