frio - event - code clean up + docu

This commit is contained in:
rabuzarus 2016-06-17 14:27:33 +02:00
parent 606f42701c
commit 4313982e02
4 changed files with 22 additions and 159 deletions

View File

@ -298,8 +298,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke
$o .= replace_macros($tpl,array(
'$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'),
));
// $o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />";
// $o .= '</div>';
$o .= "<script type='text/javascript'>";
$o .= "\$(function () {var picker = \$('#id_$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs}); $extra_js})";
$o .= "</script>";

View File

@ -481,160 +481,3 @@ String.prototype.rtrim = function() {
var trimmed = this.replace(/\s+$/g, '');
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: "<span class='fc-text-arrow'>&lsaquo;</span>",
// next: "<span class='fc-text-arrow'>&rsaquo;</span>",
// prevYear: "<span class='fc-text-arrow'>&laquo;</span>",
// nextYear: "<span class='fc-text-arrow'>&raquo;</span>",
// 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(
// "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
// event.item['author-avatar'],
// event.item['author-name'],
// event.title
// ));
// break;
// case "agendaWeek":
// element.find(".fc-event-title").html(
// "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
// event.item['author-avatar'],
// event.item['author-name'],
// event.item.desc,
// event.item.location
// ));
// break;
// case "agendaDay":
// element.find(".fc-event-title").html(
// "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".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(
// "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
// event.item['author-avatar'],
// event.item['author-name'],
// event.title
// ));
// break;
// case "agendaWeek":
// element.find(".fc-event-title").html(
// "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
// event.item['author-avatar'],
// event.item['author-name'],
// event.item.desc,
// event.item.location
// ));
// break;
// case "agendaDay":
// element.find(".fc-event-title").html(
// "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".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]);
//
// });

View File

@ -24,32 +24,42 @@
<input type="hidden" name="uri" value="{{$uri}}" />
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
{{* The tab conten with the necessary basic settings *}}
<div id="event-edit-wrapper">
{{* The event title *}}
{{include file="field_input.tpl" field=$summary}}
<div id="event-edit-time">
{{* The field for event starting time *}}
{{$s_dsel}}
{{* The field for event finish time *}}
{{$f_dsel}}
{{* checkbox if the the event doesn't have a finish time *}}
{{include file="field_checkbox.tpl" field=$nofinish}}
{{* checkbox for adjusting the event time to the timezone of the user *}}
{{include file="field_checkbox.tpl" field=$adjust}}
</div>
{{* checkbox to enable event sharing and the permissions tab *}}
{{if ! $eid}}
{{include file="field_checkbox.tpl" field=$share}}
{{/if}}
{{* The submit button - saves the event *}}
<div class="pull-right" >
<button id="event-submit" type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>
</div>
<div class="clear"></div>
</div>
{{* The advanced tab *}}
<div id="event-desc-wrapper" style="display: none">
{{* The textarea for the event description *}}
<div class="form-group">
<div id="event-desc-text"><b>{{$d_text}}</b></div>
<textarea id="comment-edit-text-desc" class="form-control" name="desc" >{{$d_orig}}</textarea>
@ -96,6 +106,7 @@
<div class="clear"></div>
</div>
{{* The textarea for the event location *}}
<div class="form-group">
<div id="event-location-text"><b>{{$l_text}}</b></div>
<textarea id="comment-edit-text-loc" class="form-control" name="location">{{$l_orig}}</textarea>
@ -143,10 +154,12 @@
</div>
</div>
{{* The tab for the permissions (if event sharing is enabled) *}}
<div id="event-acl-wrapper" style="display: none">
{{$acl}}
</div>
{{* The tab for the event preview (content is inserted by js) *}}
<div id="event-preview" style="display: none"></div>
<div class="clear"></div>

View File

@ -2,10 +2,13 @@
{{$tabs}}
{{include file="section_title.tpl" title=$title}}
{{* The link to create a new event *}}
<div id="new-event-link"><a onclick="addToModal('{{$new_event.0}}')" >{{$new_event.1}}</a></div>
{{* We create our own fullcallendar header (with title & calendar view *}}
<div id="fc-header">
<div id="fc-header-right" class="pull-right">
{{* The dropdown to change the callendar view *}}
<ul class="nav nav-pills">
<li class="dropdown pull-right">
<a class="btn btn-link btn-sm dropdown-toggle" type="button" id="event-calendar-views" data-toggle="dropdown" aria-expanded="true">
@ -28,14 +31,19 @@
</li>
</ul>
</div>
{{* The buttons to change the month/weeks/days *}}
<div id="fc-fc-header-left" class="btn-group">
<button class="btn btn-eventnav" onclick="changeView('prev', false);" title="{{$prev}}"><i class="fa fa-angle-up" aria-hidden="true"></i></i></button>
<button class="btn btn-eventnav btn-separator" onclick="changeView('next', false);" title="{{$next}}"><i class="fa fa-angle-down" aria-hidden="true"></i></i></button>
<button class="btn btn-eventnav btn-separator" onclick="changeView('today', false);" title="{{$today}}"><i class="fa fa-bullseye"></i></button>
</div>
{{* The title (e.g. name of the mont/week/day) *}}
<div id="event-calendar-title"><h4 id="fc-title"></h4></div>
</div>
{{* This is the container where the fullCalendar is inserted through js *}}
<div id="events-calendar"></div>
</div>