]> git.mxchange.org Git - friendica.git/blob - view/templates/calendar/calendar_head.tpl
Move vier version of calendat/calendar_head template to base
[friendica.git] / view / templates / calendar / calendar_head.tpl
1 <link rel="stylesheet" type="text/css" href="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" />
2 <link rel="stylesheet" type="text/css" href="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.print.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" media="print" />
3 <script type="text/javascript" src="{{$baseurl}}/view/asset/moment/min/moment-with-locales.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
4 <script type="text/javascript" src="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
5
6 <script>
7         function showEvent(eventid) {
8                 $.get(
9                         '{{$event_api}}/' + eventid,
10                         function(data){
11                                 $.colorbox({html:data});
12                         }
13                 );
14         }
15
16         function doEventPreview() {
17                 $('#event-edit-preview').val(1);
18                 $.post('events', $('#event-edit-form').serialize(), function(data) {
19                         $.colorbox({ html: data });
20                 });
21                 $('#event-edit-preview').val(0);
22         }
23
24         // disable the input for the finish date if it is not available
25         function enableDisableFinishDate() {
26                 if( $('#id_nofinish').is(':checked'))
27                         $('#id_finish_text').prop("disabled", true);
28                 else
29                         $('#id_finish_text').prop("disabled", false);
30         }
31
32         $(document).ready(function() {
33                 $('#events-calendar').fullCalendar({
34                         firstDay: '{{$i18n.firstDay|escape:'quotes'}}',
35                         monthNames: [
36                                 '{{$i18n.January|escape:'quotes'}}',
37                                 '{{$i18n.February|escape:'quotes'}}',
38                                 '{{$i18n.March|escape:'quotes'}}',
39                                 '{{$i18n.April|escape:'quotes'}}',
40                                 '{{$i18n.May|escape:'quotes'}}',
41                                 '{{$i18n.June|escape:'quotes'}}',
42                                 '{{$i18n.July|escape:'quotes'}}',
43                                 '{{$i18n.August|escape:'quotes'}}',
44                                 '{{$i18n.September|escape:'quotes'}}',
45                                 '{{$i18n.October|escape:'quotes'}}',
46                                 '{{$i18n.November|escape:'quotes'}}',
47                                 '{{$i18n.December|escape:'quotes'}}'
48                         ],
49                         monthNamesShort: [
50                                 '{{$i18n.Jan|escape:'quotes'}}',
51                                 '{{$i18n.Feb|escape:'quotes'}}',
52                                 '{{$i18n.Mar|escape:'quotes'}}',
53                                 '{{$i18n.Apr|escape:'quotes'}}',
54                                 '{{$i18n.May|escape:'quotes'}}',
55                                 '{{$i18n.Jun|escape:'quotes'}}',
56                                 '{{$i18n.Jul|escape:'quotes'}}',
57                                 '{{$i18n.Aug|escape:'quotes'}}',
58                                 '{{$i18n.Sep|escape:'quotes'}}',
59                                 '{{$i18n.Oct|escape:'quotes'}}',
60                                 '{{$i18n.Nov|escape:'quotes'}}',
61                                 '{{$i18n.Dec|escape:'quotes'}}'
62                         ],
63                         dayNames: [
64                                 '{{$i18n.Sunday|escape:'quotes'}}',
65                                 '{{$i18n.Monday|escape:'quotes'}}',
66                                 '{{$i18n.Tuesday|escape:'quotes'}}',
67                                 '{{$i18n.Wednesday|escape:'quotes'}}',
68                                 '{{$i18n.Thursday|escape:'quotes'}}',
69                                 '{{$i18n.Friday|escape:'quotes'}}',
70                                 '{{$i18n.Saturday|escape:'quotes'}}'
71                         ],
72                         dayNamesShort: [
73                                 '{{$i18n.Sun|escape:'quotes'}}',
74                                 '{{$i18n.Mon|escape:'quotes'}}',
75                                 '{{$i18n.Tue|escape:'quotes'}}',
76                                 '{{$i18n.Wed|escape:'quotes'}}',
77                                 '{{$i18n.Thu|escape:'quotes'}}',
78                                 '{{$i18n.Fri|escape:'quotes'}}',
79                                 '{{$i18n.Sat|escape:'quotes'}}'
80                         ],
81                         allDayText: '{{$i18n.allday|escape:'quotes'}}',
82                         noEventsMessage: '{{$i18n.noevent|escape:'quotes'}}',
83                         buttonText: {
84                                 today: '{{$i18n.today|escape:'quotes'}}',
85                                 month: '{{$i18n.month|escape:'quotes'}}',
86                                 week: '{{$i18n.week|escape:'quotes'}}',
87                                 day: '{{$i18n.day|escape:'quotes'}}'
88                         },
89                         events: '{{$calendar_api}}',
90                         header: {
91                                 left: 'prev,next today',
92                                 center: 'title',
93                                 right: 'month,agendaWeek,agendaDay'
94                         },
95                         timeFormat: 'H:mm',
96                         eventClick: function(calEvent) {
97                                 showEvent(calEvent.id);
98                         },
99                         loading: function(isLoading) {
100                                 if(!isLoading) {
101                                         $('td.fc-day').dblclick(function() { window.location.href='/calendar/event/new?start=' + $(this).data('date'); });
102                                 }
103                         },
104
105                         eventRender: function(event, element, view) {
106                                 if (event.item['author-name']==null) return;
107                                 switch(view.name){
108                                         case "month":
109                                                 element.find(".fc-title").html(
110                                                         "{0}".format(
111                                                                 event.title
112                                                         ));
113                                                 break;
114                                         case "agendaWeek":
115                                                 element.find(".fc-title").html(
116                                                         "{0}<p>{1}</p><p>{2}</p>".format(
117                                                                 event.item['author-name'],
118                                                                 event.item.desc,
119                                                                 event.item.location
120                                                         ));
121                                                 break;
122                                         case "agendaDay":
123                                                 element.find(".fc-title").html(
124                                                         "{0}<p>{1}</p><p>{2}</p>".format(
125                                                                 event.item['author-name'],
126                                                                 event.item.desc,
127                                                                 event.item.location
128                                                         ));
129                                                 break;
130                                 }
131                         }
132
133                 })
134
135                 // show event popup
136                 let hash = location.hash.split("-");
137                 if (hash.length === 2 && hash[0] === "#link") showEvent(hash[1]);
138         });
139 </script>
140
141 <script language="javascript" type="text/javascript">
142         $(document).ready(function() {
143                 $("#comment-edit-text-desc").bbco_autocomplete('bbcode');
144
145                 $('#id_share').change(function() {
146
147                         if ($('#id_share').is(':checked')) {
148                                 $('#acl-wrapper').show();
149                         }
150                         else {
151                                 $('#acl-wrapper').hide();
152                         }
153                 }).trigger('change');
154
155                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
156                         let selstr;
157                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
158                                 selstr = $(this).html();
159                                 $('#jot-public').hide();
160                         });
161                         if(selstr == null) {
162                                 $('#jot-public').show();
163                         }
164                 }).trigger('change');
165
166                 // disable the finish time input if the user disable it
167                 $('#id_nofinish').change(function() {
168                         enableDisableFinishDate()
169                 }).trigger('change');
170         });
171 </script>
172