month.tpl 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. <style>
  2. .fc-day-grid-event > .fc-content {
  3. white-space: normal;
  4. }
  5. </style>
  6. <script>
  7. function checkLength( o, n, min, max ) {
  8. if ( o.val().length > max || o.val().length < min ) {
  9. o.addClass( "ui-state-error" );
  10. /*updateTips( "Length of " + n + " must be between " +
  11. min + " and " + max + "." );*/
  12. return false;
  13. } else {
  14. return true;
  15. }
  16. }
  17. function clean_user_select() {
  18. //Cleans the selected attr
  19. $("#users_to_send").val('').trigger("chosen:updated");
  20. /*$('#users_to_send')
  21. .find('option')
  22. .removeAttr('selected')
  23. .end();*/
  24. }
  25. var region_value = '{{ region_value }}';
  26. $(document).ready(function() {
  27. // Reset button.
  28. $("button[type=reset]").click(function() {
  29. $("#session_id").find('option').removeAttr("selected");
  30. });
  31. $("#dialog-form").dialog({
  32. autoOpen : false,
  33. modal : false,
  34. width : 580,
  35. height : 480,
  36. zIndex : 20000 // added because of qtip2
  37. });
  38. $("#simple-dialog-form").dialog({
  39. autoOpen : false,
  40. modal : false,
  41. width : 580,
  42. height : 480,
  43. zIndex : 20000 // added because of qtip2
  44. });
  45. var title = $("#title"),
  46. content = $("#content"),
  47. allFields = $([]).add( title ).add( content ), tips = $(".validateTips");
  48. $("#select_form_id_search").change(function() {
  49. var temp ="&user_id="+$("#select_form_id_search").val();
  50. var position =String(window.location).indexOf("&user");
  51. var url = String(window.location).substring(0,position)+temp;
  52. if (position > 0) {
  53. window.location.replace(url);
  54. } else {
  55. url = String(window.location)+temp;
  56. window.location.replace(url);
  57. }
  58. });
  59. var CustomListViewGrid = ListViewGrid.extend({
  60. fgSegHtml: function(seg) {
  61. var view = this.view;
  62. var classes = [ 'fc-list-item' ].concat(this.getSegCustomClasses(seg));
  63. var bgColor = this.getSegBackgroundColor(seg);
  64. var event = seg.event;
  65. var url = event.url;
  66. var timeHtml;
  67. if (event.allDay) {
  68. timeHtml = view.getAllDayHtml();
  69. }
  70. else if (view.isMultiDayEvent(event)) { // if the event appears to span more than one day
  71. if (seg.isStart || seg.isEnd) { // outer segment that probably lasts part of the day
  72. timeHtml = htmlEscape(this.getEventTimeText(seg));
  73. }
  74. else { // inner segment that lasts the whole day
  75. timeHtml = view.getAllDayHtml();
  76. }
  77. }
  78. else {
  79. // Display the normal time text for the *event's* times
  80. timeHtml = htmlEscape(this.getEventTimeText(event));
  81. }
  82. if (url) {
  83. classes.push('fc-has-url');
  84. }
  85. return '<tr class="' + classes.join(' ') + '">' +
  86. (this.displayEventTime ?
  87. '<td class="fc-list-item-time ' + view.widgetContentClass + '">' +
  88. (timeHtml || '') +
  89. '</td>' :
  90. '') +
  91. '<td class="fc-list-item-marker ' + view.widgetContentClass + '">' +
  92. '<span class="fc-event-dot"' +
  93. (bgColor ?
  94. ' style="background-color:' + bgColor + '"' :
  95. '') +
  96. '></span>' +
  97. '</td>' +
  98. '<td class="fc-list-item-title ' + view.widgetContentClass + '">' +
  99. '<a' + (url ? ' href="' + htmlEscape(url) + '"' : '') + '>' +
  100. htmlEscape(seg.event.title || '') + (seg.event.description || '')
  101. '</a>' +
  102. '</td>' +
  103. '</tr>';
  104. },
  105. // render the event segments in the view
  106. renderSegList: function(allSegs) {
  107. var segsByDay = this.groupSegsByDay(allSegs); // sparse array
  108. var dayIndex;
  109. var daySegs;
  110. var i;
  111. var tableEl = $('<table class="fc-list-table"><tbody/></table>');
  112. var tbodyEl = tableEl.find('tbody');
  113. var eventList = new Array;
  114. for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
  115. daySegs = segsByDay[dayIndex];
  116. if (daySegs) { // sparse array, so might be undefined
  117. this.sortEventSegs(daySegs);
  118. for (i = 0; i < daySegs.length; i++) {
  119. var event = daySegs[i].event;
  120. if (jQuery.inArray(event.id, eventList) !== -1) {
  121. continue;
  122. }
  123. eventList.push(event.id);
  124. // append a day header
  125. tbodyEl.append(this.dayHeaderHtml(
  126. this.view.start.clone().add(dayIndex, 'days'),
  127. event
  128. ));
  129. tbodyEl.append(daySegs[i].el); // append event row
  130. }
  131. }
  132. }
  133. this.el.empty().append(tableEl);
  134. },
  135. // generates the HTML for the day headers that live amongst the event rows
  136. dayHeaderHtml: function(dayDate, event) {
  137. var view = this.view;
  138. var mainFormat = 'LL';
  139. var altFormat = 'dddd';
  140. var checkIfSame = true;
  141. if (event.end) {
  142. checkIfSame = event.end.format(mainFormat) == dayDate.format(mainFormat);
  143. }
  144. return '<tr class="fc-list-heading" data-date="' + dayDate.format('YYYY-MM-DD') + '">' +
  145. '<td class="' + view.widgetHeaderClass + '" colspan="3">' +
  146. (mainFormat ?
  147. view.buildGotoAnchorHtml(
  148. dayDate,
  149. { 'class': 'fc-list-heading-main' },
  150. htmlEscape(dayDate.format(mainFormat)) // inner HTML
  151. ) :
  152. '') +
  153. ((checkIfSame == false && mainFormat) ?
  154. view.buildGotoAnchorHtml(
  155. dayDate,
  156. { 'class': 'fc-list-heading-main' },
  157. '&nbsp;-&nbsp; ' + htmlEscape(event.end.format(mainFormat)) // inner HTML
  158. ) :
  159. '') +
  160. (altFormat ?
  161. view.buildGotoAnchorHtml(
  162. dayDate,
  163. { 'class': 'fc-list-heading-alt' },
  164. htmlEscape(dayDate.format(altFormat)) // inner HTML
  165. ) :
  166. '') +
  167. '</td>' +
  168. '</tr>';
  169. },
  170. });
  171. var FC = $.fullCalendar; // a reference to FullCalendar's root namespace
  172. var View = ListView; // the class that all views must inherit from
  173. var CustomView; // our subclass
  174. CustomView = View.extend({ // make a subclass of View
  175. initialize: function() {
  176. this.grid = new CustomListViewGrid(this);
  177. this.scroller = new Scroller({
  178. overflowX: 'hidden',
  179. overflowY: 'auto'
  180. });
  181. }
  182. });
  183. FC.views.CustomView = CustomView; // register our class with the view system
  184. var calendar = $('#calendar').fullCalendar({
  185. header: {
  186. left: 'today,prev,next',
  187. center: 'title',
  188. right: 'month,agendaWeek,agendaDay,CustomView'
  189. },
  190. views: {
  191. CustomView: { // name of view
  192. buttonText: '{{ 'AgendaList' | get_lang | escape('js') }}',
  193. duration: { month: 1 },
  194. defaults: {
  195. 'listDayAltFormat': 'dddd' // day-of-week is nice-to-have
  196. }
  197. },
  198. month: {
  199. 'displayEventEnd' : true
  200. }
  201. },
  202. locale: region_value,
  203. {% if use_google_calendar == 1 %}
  204. eventSources: [
  205. // if you want to add more just add URL in this array
  206. '{{ google_calendar_url }}',
  207. {
  208. className: 'gcal-event' // an option!
  209. }
  210. ],
  211. {% endif %}
  212. defaultView: '{{ default_view }}',
  213. firstHour: 8,
  214. firstDay: 1,
  215. selectable : true,
  216. selectHelper: true,
  217. viewDisplay: function(view) {
  218. /* When changing the view update the qtips */
  219. /*var api = $('.qtip').qtip('api'); // Access the API of the first tooltip on the page
  220. if (api) {
  221. api.destroy();
  222. //api.render();
  223. }*/
  224. },
  225. // Add event
  226. select: function(start, end, jsEvent, view) {
  227. var start_date = start.format("YYYY-MM-DD h:mm");
  228. var end_date = end.format("YYYY-MM-DD h:mm");
  229. var diffDays = moment(end).diff(start, 'days');
  230. var allDay = true;
  231. if (end.hasTime()) {
  232. allDay = false;
  233. }
  234. $('#visible_to_input').show();
  235. $('#add_as_announcement_div').show();
  236. $('#visible_to_read_only').hide();
  237. // Cleans the selected attr
  238. clean_user_select();
  239. // Sets the 1st item selected by default
  240. $('#users_to_send option').eq(0).attr('selected', 'selected');
  241. // Update chz-select
  242. //$("#users_to_send").trigger("chosen:updated");
  243. if ({{ can_add_events }} == 1) {
  244. var url = '{{ web_agenda_ajax_url }}&a=add_event&start='+start.format("YYYY-MM-DD HH:mm:00")+'&end='+end.format("YYYY-MM-DD HH:mm:00")+'&all_day='+allDay+'&view='+view.name;
  245. var start_date_value = start.format('{{ js_format_date }}');
  246. $('#start_date').html(start_date_value);
  247. if (diffDays > 1) {
  248. $('#start_date').html('');
  249. var end_date_value = '';
  250. if (end) {
  251. var clone = end.clone();
  252. end_date_value = clone.subtract(1, 'days').format('{{ js_format_date }}');
  253. }
  254. $('#end_date').html(start_date_value + " - " + end_date_value);
  255. } else if (diffDays == 0) {
  256. var start_date_value = start.format('ll');
  257. var startTime = start.format('LT');
  258. var endTime = end.format('LT');
  259. $('#start_date').html('');
  260. $('#end_date').html(start_date_value + " (" + startTime + " - " + endTime+") ");
  261. } else {
  262. $('#end_date').html('');
  263. }
  264. $('#color_calendar').html('{{ type_label | escape('js')}}');
  265. $('#color_calendar').removeClass('group_event');
  266. $('#color_calendar').addClass('label_tag');
  267. $('#color_calendar').addClass('{{ type_event_class | escape('js') }}');
  268. //It shows the CKEDITOR while Adding an Event
  269. $('#cke_content').show();
  270. //It Fixing a minor bug with textarea ckeditor.remplace
  271. $('#content').css('display','none');
  272. //Reset the CKEditor content that persist in memory
  273. CKEDITOR.instances['content'].setData('');
  274. allFields.removeClass("ui-state-error");
  275. $("#dialog-form").dialog("open");
  276. $("#dialog-form").dialog({
  277. buttons: {
  278. '{{ "Add" | get_lang }}' : function() {
  279. var bValid = true;
  280. bValid = bValid && checkLength(title, "title", 1, 255);
  281. //Update the CKEditor Instance to the remplaced textarea, ready to be serializable
  282. for ( instance in CKEDITOR.instances ) {
  283. CKEDITOR.instances[instance].updateElement();
  284. }
  285. var params = $("#add_event_form").serialize();
  286. $.ajax({
  287. url: url+'&'+params,
  288. success:function(data) {
  289. var user = $('#users_to_send').val();
  290. if (user) {
  291. if (user.length > 1) {
  292. user = 0;
  293. } else {
  294. user = user[0];
  295. }
  296. var user_length = String(user).length;
  297. if (String(user).substring(0,1) == 'G') {
  298. var user_id = String(user).substring(6,user_length);
  299. var user_id = "G:"+user_id;
  300. } else {
  301. var user_id = String(user).substring(5,user_length);
  302. }
  303. var temp = "&user_id="+user_id;
  304. var position = String(window.location).indexOf("&user");
  305. var url = String(window.location).substring(0, position)+temp;
  306. /*if (position > 0) {
  307. window.location.replace(url);
  308. } else {
  309. url = String(window.location)+temp;
  310. window.location.replace(url);
  311. }*/
  312. }
  313. $("#title").val('');
  314. $("#content").val('');
  315. $("#comment").val('');
  316. calendar.fullCalendar('refetchEvents');
  317. calendar.fullCalendar('rerenderEvents');
  318. $("#dialog-form").dialog('close');
  319. }
  320. });
  321. }
  322. },
  323. close: function() {
  324. $("#title").val('');
  325. $("#content").val('');
  326. $("#comment").val('');
  327. }
  328. });
  329. calendar.fullCalendar('unselect');
  330. //Reload events
  331. calendar.fullCalendar("refetchEvents");
  332. calendar.fullCalendar("rerenderEvents");
  333. }
  334. },
  335. eventRender: function(event, element) {
  336. if (event.attachment) {
  337. /*element.qtip({
  338. hide: {
  339. delay: 2000
  340. },
  341. content: event.attachment,
  342. position: { at:'top right' , my:'bottom right'}
  343. }).removeData('qtip'); // this is an special hack to add multiple qtip in the same target
  344. */
  345. }
  346. if (event.description) {
  347. var comment = '';
  348. if (event.comment) {
  349. comment = event.comment;
  350. }
  351. element.qtip({
  352. hide: {
  353. delay: 2000
  354. },
  355. content: event.description + ' ' + comment,
  356. position: { at:'top left' , my:'bottom left'}
  357. });
  358. }
  359. },
  360. eventClick: function(calEvent, jsEvent, view) {
  361. var start = calEvent.start;
  362. var end = calEvent.end;
  363. var diffDays = moment(end).diff(start, 'days');
  364. var endDateMinusOne = '';
  365. if (end) {
  366. var clone = end.clone();
  367. endDateMinusOne = clone.subtract(1, 'days').format('{{ js_format_date }}');
  368. }
  369. var startDateToString = start.format("{{ js_format_date }}");
  370. // Edit event.
  371. if (calEvent.editable) {
  372. $('#visible_to_input').hide();
  373. $('#add_as_announcement_div').hide();
  374. {% if type != 'admin' %}
  375. $('#visible_to_read_only').show();
  376. $("#visible_to_read_only_users").html(calEvent.sent_to);
  377. {% endif %}
  378. $('#color_calendar').html('{{ type_label | escape('js') }}');
  379. $('#color_calendar').addClass('label_tag');
  380. $('#color_calendar').removeClass('course_event');
  381. $('#color_calendar').removeClass('personal_event');
  382. $('#color_calendar').removeClass('group_event');
  383. $('#color_calendar').addClass(calEvent.type+'_event');
  384. // It hides the CKEDITOR while clicking an existing Event
  385. $('#cke_content').hide();
  386. $('#start_date').html(startDateToString);
  387. if (diffDays > 1) {
  388. $('#end_date').html(' - ' + endDateMinusOne);
  389. } else if (diffDays == 0) {
  390. var start_date_value = start.format('ll');
  391. var startTime = start.format('LT');
  392. var endTime = end.format('LT');
  393. $('#start_date').html('');
  394. $('#end_date').html(start_date_value + " (" + startTime + " - " + endTime+") ");
  395. } else {
  396. $('#end_date').html('');
  397. }
  398. if ($("#title").parent().find('#title_edit').length == 0) {
  399. $("#title").parent().append('<div id="title_edit"></div>');
  400. }
  401. $("#title_edit").html(calEvent.title);
  402. if ($("#content").parent().find('#content_edit').length == 0) {
  403. $("#content").parent().append('<div id="content_edit"></div>');
  404. }
  405. $("#content_edit").html(calEvent.description);
  406. if ($("#comment").parent().find('#comment_edit').length == 0) {
  407. $("#comment").parent().append('<div id="comment_edit"></div>');
  408. }
  409. if (calEvent.course_name) {
  410. $("#calendar_course_info").html(
  411. '<div class="form-group"><label class="col-sm-2 control-label">{{ 'Course' | get_lang }}</label>' +
  412. '<div class="class="col-sm-8">' + calEvent.course_name+"</div></div>"
  413. );
  414. } else {
  415. $("#calendar_course_info").html('');
  416. }
  417. if (calEvent.session_name) {
  418. $("#calendar_session_info").html(
  419. '<div class="form-group"><label class="col-sm-2 control-label">{{ 'Session' | get_lang }}</label>'+
  420. '<div class="class="col-sm-8">' + calEvent.session_name+"</div></div>"
  421. );
  422. } else {
  423. $("#calendar_session_info").html('');
  424. }
  425. $("#comment_edit").html(calEvent.comment);
  426. $("#title_edit").show();
  427. $("#content_edit").show();
  428. $("#comment_edit").show();
  429. $("#title").hide();
  430. $("#content").hide();
  431. $("#comment").hide();
  432. allFields.removeClass( "ui-state-error" );
  433. $("#dialog-form").dialog("open");
  434. var url = '{{ web_agenda_ajax_url }}&a=edit_event&id='+calEvent.id+'&start='+calEvent.start.unix()+'&end='+calEvent.end.unix()+'&all_day='+calEvent.allDay+'&view='+view.name;
  435. var delete_url = '{{ web_agenda_ajax_url }}&a=delete_event&id='+calEvent.id;
  436. $("#dialog-form").dialog({
  437. buttons: {
  438. '{{ "ExportiCalConfidential"|get_lang }}' : function() {
  439. url = "{{ _p.web_main }}calendar/ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=confidential";
  440. window.location.href = url;
  441. },
  442. '{{ "ExportiCalPrivate"|get_lang }}': function() {
  443. url = "{{ _p.web_main }}calendar/ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=private";
  444. window.location.href = url;
  445. },
  446. '{{ "ExportiCalPublic"|get_lang }}': function() {
  447. url = "{{ _p.web_main }}calendar/ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=public";
  448. window.location.href = url;
  449. },
  450. {% if type == 'not_available' %}
  451. '{{ "Edit" | get_lang }}' : function() {
  452. var bValid = true;
  453. bValid = bValid && checkLength( title, "title", 1, 255 );
  454. var params = $("#add_event_form").serialize();
  455. $.ajax({
  456. url: url+'&'+params,
  457. success:function() {
  458. calEvent.title = $("#title").val();
  459. calEvent.start = calEvent.start;
  460. calEvent.end = calEvent.end;
  461. calEvent.allDay = calEvent.allDay;
  462. calEvent.description = $("#content").val();
  463. calendar.fullCalendar('updateEvent',
  464. calEvent,
  465. true // make the event "stick"
  466. );
  467. $("#dialog-form").dialog("close");
  468. }
  469. });
  470. },
  471. {% endif %}
  472. '{{ "Edit"|get_lang }}' : function() {
  473. url = "{{ _p.web_main }}calendar/agenda.php?action=edit&type=fromjs&id=" + calEvent.id+'&course_id='+calEvent.course_id+"";
  474. window.location.href = url;
  475. $("#dialog-form").dialog( "close" );
  476. },
  477. '{{ "Delete"|get_lang }}': function() {
  478. if (calEvent.parent_event_id || calEvent.has_children != '') {
  479. var newDiv = $('<div>');
  480. newDiv.dialog({
  481. modal: true,
  482. title: "{{ 'DeleteThisItem' | get_lang }}",
  483. buttons: []
  484. });
  485. var buttons = newDiv.dialog("option", "buttons");
  486. if (calEvent.has_children == '0') {
  487. buttons.push({
  488. text: '{{ "DeleteThisItem" | get_lang }}',
  489. click: function() {
  490. $.ajax({
  491. url: delete_url,
  492. success:function() {
  493. calendar.fullCalendar('removeEvents',
  494. calEvent
  495. );
  496. calendar.fullCalendar("refetchEvents");
  497. calendar.fullCalendar("rerenderEvents");
  498. $("#dialog-form").dialog("close");
  499. newDiv.dialog( "destroy" );
  500. }
  501. });
  502. }
  503. });
  504. newDiv.dialog("option", "buttons", buttons);
  505. }
  506. var buttons = newDiv.dialog("option", "buttons");
  507. buttons.push({
  508. text: '{{ "DeleteAllItems" | get_lang }}',
  509. click: function() {
  510. $.ajax({
  511. url: delete_url+'&delete_all_events=1',
  512. success:function() {
  513. calendar.fullCalendar('removeEvents',
  514. calEvent
  515. );
  516. calendar.fullCalendar('refetchEvents');
  517. calendar.fullCalendar('rerenderEvents');
  518. $("#dialog-form").dialog('close');
  519. newDiv.dialog( "destroy" );
  520. }
  521. });
  522. }
  523. });
  524. newDiv.dialog("option", "buttons", buttons);
  525. return true;
  526. }
  527. $.ajax({
  528. url: delete_url,
  529. success:function() {
  530. calendar.fullCalendar('removeEvents',
  531. calEvent
  532. );
  533. calendar.fullCalendar('refetchEvents');
  534. calendar.fullCalendar('rerenderEvents');
  535. $("#dialog-form").dialog('close');
  536. }
  537. });
  538. }
  539. },
  540. close: function() {
  541. $("#title_edit").hide();
  542. $("#content_edit").hide();
  543. $("#comment_edit").hide();
  544. $("#title").show();
  545. $("#content").show();
  546. $("#comment").show();
  547. $("#title_edit").html('');
  548. $("#content_edit").html('');
  549. $("#comment_edit").html('');
  550. $("#title").val('');
  551. $("#content").val('');
  552. $("#comment").val('');
  553. }
  554. });
  555. } else {
  556. // Simple form
  557. $('#simple_start_date').html(startDateToString);
  558. if (diffDays > 1) {
  559. $('#simple_end_date').html(' - ' + endDateMinusOne);
  560. } else if (diffDays == 0) {
  561. var start_date_value = start.format('ll');
  562. var startTime = start.format('LT');
  563. var endTime = end.format('LT');
  564. $('#simple_start_date').html('');
  565. $('#simple_end_date').html(start_date_value + " (" + startTime + " - " + endTime+") ");
  566. } else {
  567. $('#simple_end_date').html('');
  568. }
  569. if (calEvent.course_name) {
  570. $("#calendar_course_info_simple").html(
  571. '<div class="form-group"><label class="col-sm-3 control-label">{{ 'Course' | get_lang }}</label>' +
  572. '<div class="col-sm-9">' + calEvent.course_name+"</div></div>"
  573. );
  574. } else {
  575. $("#calendar_course_info_simple").html('');
  576. }
  577. if (calEvent.session_name) {
  578. $("#calendar_session_info").html(
  579. '<div class="form-group"><label class="col-sm-3 control-label">{{ 'Session' | get_lang }}</label>' +
  580. '<div class="col-sm-9">' + calEvent.session_name+"</div></div>"
  581. );
  582. } else {
  583. $("#calendar_session_info").html('');
  584. }
  585. $("#simple_title").html(calEvent.title);
  586. $("#simple_content").html(calEvent.description);
  587. $("#simple_comment").html(calEvent.comment);
  588. $("#simple-dialog-form").dialog("open");
  589. $("#simple-dialog-form").dialog({
  590. buttons: {
  591. '{{"ExportiCalConfidential"|get_lang}}' : function() {
  592. url = "ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=confidential";
  593. window.location.href = url;
  594. },
  595. '{{"ExportiCalPrivate"|get_lang}}': function() {
  596. url = "ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=private";
  597. window.location.href = url;
  598. },
  599. '{{"ExportiCalPublic"|get_lang}}': function() {
  600. url = "ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=public";
  601. window.location.href = url;
  602. }
  603. }
  604. });
  605. }
  606. },
  607. editable: true,
  608. events: "{{web_agenda_ajax_url}}&a=get_events",
  609. eventDrop: function(event, delta, revert_func) {
  610. var allDay = 0;
  611. if (event.allDay == true) {
  612. allDay = 1;
  613. }
  614. $.ajax({
  615. url: '{{ web_agenda_ajax_url }}',
  616. data: {
  617. a: 'move_event',
  618. id: event.id,
  619. all_day: allDay,
  620. minute_delta: delta.asMinutes()
  621. }
  622. });
  623. },
  624. eventResize: function(event, delta, revert_func) {
  625. $.ajax({
  626. url: '{{ web_agenda_ajax_url }}',
  627. data: {
  628. a: 'resize_event',
  629. id: event.id,
  630. minute_delta: delta.asMinutes()
  631. }
  632. });
  633. },
  634. axisFormat: 'H(:mm)', // pm-am format -> h(:mm)a
  635. timeFormat: 'H:mm', // pm-am format -> h:mm
  636. loading: function(bool) {
  637. if (bool) $('#loading').show();
  638. else $('#loading').hide();
  639. }
  640. });
  641. });
  642. </script>
  643. {{ actions_div }}
  644. {{ toolbar }}
  645. <div id="simple-dialog-form" style="display:none;">
  646. <div style="width:500px">
  647. <form name="form-simple" class="form-horizontal">
  648. <span id="calendar_course_info_simple"></span>
  649. <span id="calendar_session_info"></span>
  650. <div class="form-group">
  651. <label class="col-sm-3 control-label">
  652. <b>{{ "Date" |get_lang}}</b>
  653. </label>
  654. <div class="col-sm-9">
  655. <span id="simple_start_date"></span>
  656. <span id="simple_end_date"></span>
  657. </div>
  658. </div>
  659. <div class="form-group">
  660. <label class="col-sm-3 control-label">
  661. <b>{{ "Title" |get_lang}}</b>
  662. </label>
  663. <div class="col-sm-9">
  664. <div id="simple_title"></div>
  665. </div>
  666. </div>
  667. <div class="form-group">
  668. <label class="col-sm-3 control-label">
  669. <b>{{ "Description" |get_lang}}</b>
  670. </label>
  671. <div class="col-sm-9">
  672. <div id="simple_content"></div>
  673. </div>
  674. </div>
  675. <div class="form-group">
  676. <label class="col-sm-3 control-label">
  677. <b>{{ "Comment" |get_lang}}</b>
  678. </label>
  679. <div class="col-sm-9">
  680. <div id="simple_comment"></div>
  681. </div>
  682. </div>
  683. </form>
  684. </div>
  685. </div>
  686. <div id="dialog-form" style="display:none;">
  687. <div class="dialog-form-content">
  688. {{ form_add }}
  689. </div>
  690. </div>
  691. {% if legend_list %}
  692. {% for color, text in legend_list %}
  693. <span style="background-color: {{ color }}" class="label label-default">&nbsp;</span> {{ text }} &nbsp;&nbsp;
  694. {% endfor %}
  695. <br /><br />
  696. {% endif %}
  697. <div id="loading" style="margin-left:150px;position:absolute;display:none">
  698. {{ "Loading" | get_lang }}...
  699. </div>
  700. <div id="calendar"></div>