diff options
author | mrjive <mrjive@mrjive.it> | 2015-12-04 10:32:14 +0100 |
---|---|---|
committer | mrjive <mrjive@mrjive.it> | 2015-12-04 10:32:14 +0100 |
commit | 051346325609f5f2e78ef0deaf182c65d7823bbc (patch) | |
tree | f3660377b3daf6599623d2e4fb95b4d33c30d8cc /view/tpl/event_head.tpl | |
parent | 53a796afcc0cff6f9e3f51457df4506a43db1945 (diff) | |
parent | 8a9d743f6f518d3af35014130dcef8f148148113 (diff) | |
download | volse-hubzilla-051346325609f5f2e78ef0deaf182c65d7823bbc.tar.gz volse-hubzilla-051346325609f5f2e78ef0deaf182c65d7823bbc.tar.bz2 volse-hubzilla-051346325609f5f2e78ef0deaf182c65d7823bbc.zip |
Merge pull request #9 from redmatrix/master
updating from original codebase
Diffstat (limited to 'view/tpl/event_head.tpl')
-rwxr-xr-x | view/tpl/event_head.tpl | 145 |
1 files changed, 69 insertions, 76 deletions
diff --git a/view/tpl/event_head.tpl b/view/tpl/event_head.tpl index fd0ef0d9b..dc98d14b3 100755 --- a/view/tpl/event_head.tpl +++ b/view/tpl/event_head.tpl @@ -1,6 +1,7 @@ <link rel='stylesheet' type='text/css' href='{{$baseurl}}/library/fullcalendar/fullcalendar.css' /> -<script language="javascript" type="text/javascript" - src="{{$baseurl}}/library/fullcalendar/fullcalendar.min.js"></script> +<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/moment/moment.min.js"></script> +<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/fullcalendar/fullcalendar.min.js"></script> +<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/fullcalendar/lang-all.js"></script> <script> function showEvent(eventid) { @@ -20,75 +21,92 @@ $('#event-edit-preview').val(0); } + function exportDate() { + var moment = $('#events-calendar').fullCalendar('getDate'); + var sT = 'events/' + moment.year() + '/' + (moment.month() + 1) + '/export'; + window.location.href=sT; + } + + function changeView(action, viewName) { + $('#events-calendar').fullCalendar(action, viewName); + var view = $('#events-calendar').fullCalendar('getView'); + $('#title').text(view.title); + } + $(document).ready(function() { $('#events-calendar').fullCalendar({ - events: '{{$baseurl}}/events/json/', - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - }, + events: '{{$baseurl}}/events/json', + header: false, + lang: '{{$lang}}', + firstDay: {{$first_day}}, + + eventLimit: 3, + height: 'auto', + monthNames: aStr['monthNames'], monthNamesShort: aStr['monthNamesShort'], dayNames: aStr['dayNames'], dayNamesShort: aStr['dayNamesShort'], - buttonText: { - prev: "<span class='fc-text-arrow'>‹</span>", - next: "<span class='fc-text-arrow'>›</span>", - prevYear: "<span class='fc-text-arrow'>«</span>", - nextYear: "<span class='fc-text-arrow'>»</span>", - today: aStr['today'], - month: aStr['month'], - week: aStr['week'], - day: aStr['day'] - }, + allDayText: aStr['allday'], - timeFormat: 'H(:mm)', + timeFormat: 'HH:mm', eventClick: function(calEvent, jsEvent, view) { showEvent(calEvent.id); }, loading: function(isLoading, view) { + $('#events-spinner').spin('tiny'); + $('#events-spinner > i').css('color', 'transparent'); if(!isLoading) { - $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); + $('#events-spinner').spin(false); + $('#events-spinner > i').css('color', ''); + $('td.fc-day').dblclick(function() { + openMenu('form'); + //window.location.href='/events/new?start='+$(this).data('date'); + }); } }, eventRender: function(event, element, view) { + //console.log(view.name); if (event.item['author']['xchan_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( + element.find(".fc-title").html( + "<img src='{0}' style='height:12px;width:12px;' title='{1}'> <span title='{3}{4}'>{2}</span>".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], - event.title + event.title, + event.item.description ? event.item.description + "\r\n\r\n" : '', + event.item.location ? aStr['location'] + ': ' + event.item.location.replace(/(<([^>]+)>)/ig,"") : '' )); 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( + element.find(".fc-title").html( + "<img src='{0}' style='height:12px;width:12px;'> {1}: <span title='{3}{4}'>{2}</span>".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], - event.item.desc, - event.item.location + event.title, + event.item.description ? event.item.description + "\r\n\r\n" : '', + event.item.location ? aStr['location'] + ': ' + event.item.location.replace(/(<([^>]+)>)/ig,"") : '' )); 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( + element.find(".fc-title").html( + "<img src='{0}' style='height:12px;width:12px;'> {1}: <span title='{3}{4}'>{2}</span>".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], - event.item.desc, - event.item.location + event.title, + event.item.description ? event.item.description + "\r\n\r\n" : '', + event.item.location ? aStr['location'] + ': ' + event.item.location.replace(/(<([^>]+)>)/ig,"") : '' )); break; } } - }) + }); // center on date var args=location.href.replace(baseurl,"").split("/"); @@ -100,59 +118,34 @@ var hash = location.hash.split("-") if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]); - }); -</script> - -{{if $editselect != 'none'}} -<script language="javascript" type="text/javascript" - src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script> -<script language="javascript" type="text/javascript"> - - - tinyMCE.init({ - theme : "advanced", - mode : "{{$editselect}}", - plugins : "bbcode,paste", - theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code", - theme_advanced_buttons2 : "", - theme_advanced_buttons3 : "", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "center", - theme_advanced_blockformats : "blockquote,code", - gecko_spellcheck : true, - paste_text_sticky : true, - entity_encoding : "raw", - add_unload_trigger : false, - remove_linebreaks : false, - force_p_newlines : false, - force_br_newlines : true, - forced_root_block : '', - content_css: "{{$baseurl}}/view/custom_tinymce.css", - theme_advanced_path : false, - setup : function(ed) { - ed.onInit.add(function(ed) { - ed.pasteAsPlainText = true; - }); - } - - }); - {{else}} - <script language="javascript" type="text/javascript"> - {{/if}} - - $(document).ready(function() { + // echo the title + var view = $('#events-calendar').fullCalendar('getView'); + $('#title').text(view.title); + + // shift the finish time date on start time date change automagically + var origsval = $('#id_start_text').val(); + $('#id_start_text').change(function() { + var origfval = $('#id_finish_text').val(); + if(origfval) { + var sval = $('#id_start_text').val(); + var diff = moment(sval).diff(origsval); + var fval = moment(origfval).add(diff, 'millisecond').format("YYYY-MM-DD HH:mm"); + $('#id_finish_text').val(fval); + origsval = sval; + } + }); + // ACL $('#id_share').change(function() { if ($('#id_share').is(':checked')) { - $('#event-permissions-button').show(); + $('#dbtn-acl').show(); } else { - $('#event-permissions-button').hide(); + $('#dbtn-acl').hide(); } }).trigger('change'); - $('#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() { |