diff --git a/plugin.info.txt b/plugin.info.txt --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base davcal author Andreas Boehler email dev@aboehler.at -date 2015-09-18 +date 2015-09-21 name Calendar PlugIn with CalDAV sharing support desc Create one calendar per page and share/subscribe via CalDAV url http://www.dokuwiki.org/plugin:davcal diff --git a/script.js b/script.js --- a/script.js +++ b/script.js @@ -1,607 +1,607 @@ /* DOKUWIKI:include_once fullcalendar-2.4.0/moment.js */ /* DOKUWIKI:include_once fullcalendar-2.4.0/fullcalendar.js */ /* DOKUWIKI:include_once fullcalendar-2.4.0/lang/de.js */ /* DOKUWIKI:include_once fullcalendar-2.4.0/lang/en.js */ /* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */ /* DOKUWIKI:include_once jstz.js */ /** * Initialize the DAVCal script, attaching some event handlers and triggering * the initial load of the fullcalendar JS */ jQuery(function() { // Redefine functions for using moment.js with datetimepicker Date.parseDate = function( input, format ){ return moment(input,format).toDate(); }; Date.prototype.dateFormat = function( format ){ return moment(this).format(format); }; // Attach to event links var calendarid = jQuery('#fullCalendar').data('calendarid'); if(!calendarid) return; dw_davcal__modals.calid = calendarid; jQuery('div.fullCalendarSettings a').each(function() { var $link = jQuery(this); var href = $link.attr('href'); if (!href) return; $link.click( function(e) { dw_davcal__modals.showSettingsDialog(); e.preventDefault(); return ''; } ); } ); // First, retrieve the current settings. // Upon success, initialize fullcalendar. var postArray = { }; jQuery.post( DOKU_BASE + 'lib/exe/ajax.php', { call: 'plugin_davcal', id: dw_davcal__modals.calid, action: 'getSettings', params: postArray }, function(data) { var result = data['result']; if(result === true) { dw_davcal__modals.settings = data['settings']; var wknum = false; var tz = false; var we = true; var detectedTz = jstz.determine().name(); dw_davcal__modals.detectedTz = detectedTz; if(data['settings']['weeknumbers'] == 1) wknum = true; if(data['settings']['timezone'] !== '') tz = data['settings']['timezone']; if(data['settings']['workweek'] == 1) we = false; // Initialize the davcal popup var res = jQuery('#fullCalendar').fullCalendar({ dayClick: function(date, jsEvent, view) { dw_davcal__modals.showEditEventDialog(date, false); }, eventClick: function(calEvent, jsEvent, view) { dw_davcal__modals.showEditEventDialog(calEvent, true); }, events: { url: DOKU_BASE + 'lib/exe/ajax.php', type: 'POST', data: { call: 'plugin_davcal', action: 'getEvents', id: dw_davcal__modals.calid }, error: function() { dw_davcal__modals.msg = LANG.plugins.davcal['error_retrieving_data']; dw_davcal__modals.showDialog(false); } }, header: { left: 'title', center: 'today prev,next', right: 'month,agendaWeek,agendaDay' }, lang: JSINFO.plugin.davcal['language'], weekNumbers: wknum, timezone: tz, weekends: we, }); } } ); }); /** * This holds all modal windows that DAVCal uses. */ var dw_davcal__modals = { $editEventDialog: null, $dialog: null, $settingsDialog: null, msg: null, completeCb: null, action: null, uid: null, settings: null, calid: null, detectedTz: null, /** * Show the settings dialog */ showSettingsDialog : function() { if(dw_davcal__modals.$settingsDialog) return; // Dialog buttons are language-dependent and defined here. // Attach event handlers for save and cancel. var dialogButtons = {}; dialogButtons[LANG.plugins.davcal['save']] = function() { var postArray = { }; jQuery("input[class=dw_davcal__settings], select[class=dw_davcal__settings]").each(function() { if(jQuery(this).attr('type') == 'checkbox') { postArray[jQuery(this).prop('name')] = jQuery(this).prop('checked') ? 1 : 0; } else { postArray[jQuery(this).prop('name')] = jQuery(this).val(); } }); jQuery('#dw_davcal__ajaxsettings').html(''); jQuery.post( DOKU_BASE + 'lib/exe/ajax.php', { call: 'plugin_davcal', id: dw_davcal__modals.calid, action: 'saveSettings', params: postArray }, function(data) { var result = data['result']; var html = data['html']; jQuery('#dw_davcal__ajaxsettings').html(html); if(result === true) { location.reload(); } } ); }; dialogButtons[LANG.plugins.davcal['cancel']] = function () { dw_davcal__modals.hideSettingsDialog(); }; dw_davcal__modals.$settingsDialog = jQuery(document.createElement('div')) .dialog({ autoOpen: false, draggable: true, title: LANG.plugins.davcal['settings'], resizable: true, buttons: dialogButtons, }) .html( '
' + //'' + '' + '' + '' + '' + '' + '
' + LANG.plugins.davcal['use_lang_tz'] + '
' + LANG.plugins.davcal['timezone'] + '
' + LANG.plugins.davcal['weeknumbers'] + '
' + LANG.plugins.davcal['only_workweek'] + '
' + LANG.plugins.davcal['sync_url'] + '
' + LANG.plugins.davcal['private_url'] + '
' + '
' + '
' ) .parent() .attr('id','dw_davcal__settings') .show() .appendTo('.dokuwiki:first'); jQuery('#dw_davcal__settings').position({ my: "center", at: "center", of: window }); // Initialize current settings jQuery('#dw_davcal__settings_syncurl').on('click', function() { jQuery(this).select(); }); jQuery('#dw_davcal__settings_privateurl').on('click', function() { jQuery(this).select(); }); var $tzdropdown = jQuery('#dw_davcal__settings_timezone'); jQuery('#fullCalendarTimezoneList option').each(function() { jQuery('