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