]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/templates/event_head.tpl
dc1457a87d1e63f0012f92abce0974abd6433f30
[friendica.git] / view / theme / frio / templates / event_head.tpl
1
2 <link rel='stylesheet' type='text/css' href='{{$baseurl}}/library/fullcalendar/fullcalendar.css' />
3 <script language="javascript" type="text/javascript"
4           src="{{$baseurl}}/library/fullcalendar/fullcalendar.min.js"></script>
5
6 <script>
7
8         // loads the event into a modal
9         function showEvent(eventid) {
10                         addToModal('{{$baseurl}}/events/?id='+eventid);
11         
12         }
13
14         // Load the html of the actual event and incect the output to the
15         // event-edit section
16         function doEventPreview() {
17                 $('#event-edit-preview').val(1);
18                 $.post('events',$('#event-edit-form').serialize(), function(data) {
19                         $("#event-preview").append(data);
20                 });
21                 $('#event-edit-preview').val(0);
22         }
23
24         function changeView(action, viewName) {
25                 $('#events-calendar').fullCalendar(action, viewName);
26                 var view = $('#events-calendar').fullCalendar('getView');
27                 $('#fc-title').text(view.title);
28         }
29
30         $(document).ready(function() {
31                 // start the fullCalendar
32                 $('#events-calendar').fullCalendar({
33                         firstDay: {{$i18n.firstDay}},
34                         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}}'],
35                         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}}'],
36                         dayNames: ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'],
37                         dayNamesShort: ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'],
38                         buttonText: {
39                                 prev: "<span class='fc-text-arrow'>&lsaquo;</span>",
40                                 next: "<span class='fc-text-arrow'>&rsaquo;</span>",
41                                 prevYear: "<span class='fc-text-arrow'>&laquo;</span>",
42                                 nextYear: "<span class='fc-text-arrow'>&raquo;</span>",
43                                 today: '{{$i18n.today}}',
44                                 month: '{{$i18n.month}}',
45                                 week: '{{$i18n.week}}',
46                                 day: '{{$i18n.day}}'
47                         },
48                         events: '{{$baseurl}}/events/json/',
49                         header: {
50                                 left: '',
51                         //      center: 'title',
52                                 right: ''
53                         },                      
54                         timeFormat: 'H(:mm)',
55                         eventClick: function(calEvent, jsEvent, view) {
56                                 showEvent(calEvent.id);
57                         },
58                         loading: function(isLoading, view) {
59                                 if(!isLoading) {
60                                         $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); });
61                                 }
62                         },
63                         
64                         eventRender: function(event, element, view) {
65                                 //console.log(view.name);
66                                 if (event.item['author-name']==null) return;
67                                 switch(view.name){
68                                         case "month":
69                                         element.find(".fc-event-title").html(
70                                                 "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
71                                                         event.item['author-avatar'],
72                                                         event.item['author-name'],
73                                                         event.title
74                                         ));
75                                         break;
76                                         case "agendaWeek":
77                                         element.find(".fc-event-title").html(
78                                                 "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
79                                                         event.item['author-avatar'],
80                                                         event.item['author-name'],
81                                                         event.item.desc,
82                                                         event.item.location
83                                         ));
84                                         break;
85                                         case "agendaDay":
86                                         element.find(".fc-event-title").html(
87                                                 "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
88                                                         event.item['author-avatar'],
89                                                         event.item['author-name'],
90                                                         event.item.desc,
91                                                         event.item.location
92                                         ));
93                                         break;
94                                 }
95                         }
96                         
97                 })
98                 
99                 // center on date
100                 var args=location.href.replace(baseurl,"").split("/");
101                 if (args.length>=4) {
102                         $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
103                 } 
104
105                 // echo the title
106                 var view = $('#events-calendar').fullCalendar('getView');
107                 $('#fc-title').text(view.title);
108
109                 // show event popup
110                 var hash = location.hash.split("-")
111                 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
112                 
113         });
114 </script>
115
116
117 {{if $editselect != 'none'}}
118 <script language="javascript" type="text/javascript"
119           src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
120 <script language="javascript" type="text/javascript">
121
122
123         tinyMCE.init({
124                 theme : "advanced",
125                 mode : "textareas",
126                 plugins : "bbcode,paste",
127                 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
128                 theme_advanced_buttons2 : "",
129                 theme_advanced_buttons3 : "",
130                 theme_advanced_toolbar_location : "top",
131                 theme_advanced_toolbar_align : "center",
132                 theme_advanced_blockformats : "blockquote,code",
133                 theme_advanced_resizing : true,
134                 gecko_spellcheck : true,
135                 paste_text_sticky : true,
136                 entity_encoding : "raw",
137                 add_unload_trigger : false,
138                 remove_linebreaks : false,
139                 //force_p_newlines : false,
140                 //force_br_newlines : true,
141                 forced_root_block : 'div',
142                 content_css: "{{$baseurl}}/view/custom_tinymce.css",
143                 theme_advanced_path : false,
144                 setup : function(ed) {
145                         ed.onInit.add(function(ed) {
146                                 ed.pasteAsPlainText = true;
147                         });
148                 }
149
150         });
151
152         $(document).ready(function() { 
153                 $('.comment-edit-bb').hide();
154         });
155         {{else}}
156         <script language="javascript" type="text/javascript">
157         {{/if}}
158
159
160         $(document).ready(function() { 
161                 {{if $editselect = 'none'}}
162                 $("#comment-edit-text-desc").bbco_autocomplete('bbcode');
163                 {{/if}}
164
165                 // go to the permissions tab if the checkbox is checked
166                 $('body').change("#id_share", function() {
167
168                         if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) { 
169                                 $('#acl-wrapper').show();
170                                 $("a#event-perms-lnk").parent("li").show();
171                                 toggleEventNav("a#event-perms-lnk");
172                                 eventAclActive();
173                         }
174                         else {
175                                 $('#acl-wrapper').hide();
176                                 $("a#event-perms-lnk").parent("li").hide();
177                         }
178                 }).trigger('change');
179
180                 // disable the finish time input if the user disable it
181                 $('body').change("#id_nofinish", function() {
182                         enableDisableFinishDate()
183                 }).trigger('change');
184
185                 // js for the permission sextion
186                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
187                         var selstr;
188                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
189                                 selstr = $(this).text();
190                                 $('#jot-public').hide();
191                         });
192                         if(selstr == null) {
193                                 $('#jot-public').show();
194                         }
195
196                 }).trigger('change');
197
198                 // Change the event nav menu.tabs on click
199                 $("body").on("click", "#event-nav > li > a", function(e){
200                         e.preventDefault();
201                         toggleEventNav(this);
202                 });
203
204                 // this is experimental. We maybe can make use of it to inject
205                 // some js code while the event modal opens
206                 //$('body').on('show.bs.modal', function () {
207                 //      enableDisableFinishDate();
208                 //});
209
210                 // clear some elements (e.g. the event-preview container) when
211                 // selecting a event nav link so it don't appear more than once
212                 $('body').on("click", "#event-nav a", function(e) {
213                         $("#event-preview").empty();
214                         e.preventDefault();
215                 });
216
217
218         });
219
220 </script>
221
222 <script>
223         // the following functions show/hide the specific event-edit content 
224         // in dependence of the selected nav
225         function eventAclActive() {
226                 $("#event-edit-wrapper, #event-preview").hide();
227                 $("#event-acl-wrapper").show();
228         }
229
230
231         function eventPreviewActive() {
232                 $("#event-acl-wrapper, #event-edit-wrapper").hide();
233                 $("#event-preview").show();
234                 doEventPreview();
235         }
236
237         function eventEditActive() {
238                 $("#event-acl-wrapper, #event-preview").hide();
239                 $("#event-edit-wrapper").show();
240
241                 //make sure jot text does have really the active class (we do this because there are some
242                 // other events which trigger jot text
243                 toggleEventNav($("#event-edit-lnk"));
244         }
245
246         // Give the active "event-nav" list element the class "active"
247         function toggleEventNav (elm) {
248                 // select all li of #event-nav and remove the active class
249                 $(elm).closest("#event-nav").children("li").removeClass("active");
250                 // add the active class to the parent of the link which was selected
251                 $(elm).parent("li").addClass("active");
252         }
253
254         // this function load the content of the edit url into a modal
255         function eventEdit(url) {
256                 var char = qOrAmp(url);
257                 url = url + char + 'mode=none';
258
259                 $.get(url, function(data) {
260                         $("#modal-body").empty();
261                         $("#modal-body").append(data);
262                 }).done(function() {
263                         loadModalTitle();
264                 });
265         }
266
267         // disable the input for the finish date if it is not available
268         function enableDisableFinishDate() {
269                 if( $('#id_nofinish').is(':checked'))
270                         $('#id_finish_text').prop("disabled", true);
271                 else
272                         $('#id_finish_text').prop("disabled", false);
273         }
274 </script>