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