]> git.mxchange.org Git - friendica.git/blob - view/templates/event_head.tpl
Merge develop into 1206-events-template
[friendica.git] / view / 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         function showEvent(eventid) {
8                 $.get(
9                         '{{$baseurl}}/events/?id='+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
33         $(document).ready(function() {
34                 $('#events-calendar').fullCalendar({
35                         firstDay: {{$i18n.firstDay}},
36                         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}}'],
37                         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}}'],
38                         dayNames: ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'],
39                         dayNamesShort: ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'],
40                         buttonText: {
41                                 prev: "<span class='fc-text-arrow'>&lsaquo;</span>",
42                                 next: "<span class='fc-text-arrow'>&rsaquo;</span>",
43                                 prevYear: "<span class='fc-text-arrow'>&laquo;</span>",
44                                 nextYear: "<span class='fc-text-arrow'>&raquo;</span>",
45                                 today: '{{$i18n.today}}',
46                                 month: '{{$i18n.month}}',
47                                 week: '{{$i18n.week}}',
48                                 day: '{{$i18n.day}}'
49                         },
50                         events: '{{$baseurl}}/events/json/',
51                         header: {
52                                 left: 'prev,next today',
53                                 center: 'title',
54                                 right: 'month,agendaWeek,agendaDay'
55                         },                      
56                         timeFormat: 'H(:mm)',
57                         eventClick: function(calEvent, jsEvent, view) {
58                                 showEvent(calEvent.id);
59                         },
60                         loading: function(isLoading, view) {
61                                 if(!isLoading) {
62                                         $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); });
63                                 }
64                         },
65                         
66                         eventRender: function(event, element, view) {
67                                 //console.log(view.name);
68                                 if (event.item['author-name']==null) return;
69                                 switch(view.name){
70                                         case "month":
71                                         element.find(".fc-event-title").html(
72                                                 "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
73                                                         event.item['author-avatar'],
74                                                         event.item['author-name'],
75                                                         event.title
76                                         ));
77                                         break;
78                                         case "agendaWeek":
79                                         element.find(".fc-event-title").html(
80                                                 "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
81                                                         event.item['author-avatar'],
82                                                         event.item['author-name'],
83                                                         event.item.desc,
84                                                         event.item.location
85                                         ));
86                                         break;
87                                         case "agendaDay":
88                                         element.find(".fc-event-title").html(
89                                                 "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
90                                                         event.item['author-avatar'],
91                                                         event.item['author-name'],
92                                                         event.item.desc,
93                                                         event.item.location
94                                         ));
95                                         break;
96                                 }
97                         }
98                         
99                 })
100                 
101                 // center on date
102                 var args=location.href.replace(baseurl,"").split("/");
103                 if (args.length>=4) {
104                         $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
105                 } 
106                 
107                 // show event popup
108                 var hash = location.hash.split("-")
109                 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
110                 
111         });
112 </script>
113
114
115 {{if $editselect != 'none'}}
116 <script language="javascript" type="text/javascript"
117           src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
118 <script language="javascript" type="text/javascript">
119
120
121         tinyMCE.init({
122                 theme : "advanced",
123                 mode : "textareas",
124                 plugins : "bbcode,paste",
125                 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
126                 theme_advanced_buttons2 : "",
127                 theme_advanced_buttons3 : "",
128                 theme_advanced_toolbar_location : "top",
129                 theme_advanced_toolbar_align : "center",
130                 theme_advanced_blockformats : "blockquote,code",
131                 theme_advanced_resizing : true,
132                 gecko_spellcheck : true,
133                 paste_text_sticky : true,
134                 entity_encoding : "raw",
135                 add_unload_trigger : false,
136                 remove_linebreaks : false,
137                 //force_p_newlines : false,
138                 //force_br_newlines : true,
139                 forced_root_block : 'div',
140                 content_css: "{{$baseurl}}/view/custom_tinymce.css",
141                 theme_advanced_path : false,
142                 setup : function(ed) {
143                         ed.onInit.add(function(ed) {
144                                 ed.pasteAsPlainText = true;
145                         });
146                 }
147
148         });
149
150         $(document).ready(function() { 
151                 $('.comment-edit-bb').hide();
152         });
153         {{else}}
154         <script language="javascript" type="text/javascript">
155         {{/if}}
156
157
158         $(document).ready(function() { 
159                 {{if $editselect = 'none'}}
160                 $("#comment-edit-text-desc").bbco_autocomplete('bbcode');
161                 {{/if}}
162
163                 $('#id_share').change(function() {
164
165                         if ($('#id_share').is(':checked')) { 
166                                 $('#acl-wrapper').show();
167                         }
168                         else {
169                                 $('#acl-wrapper').hide();
170                         }
171                 }).trigger('change');
172
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