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