diff --git a/script.js b/script.js --- a/script.js +++ b/script.js @@ -1,523 +1,523 @@ /* 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 */ 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 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 ''; } ); } ); var postArray = { }; jQuery.post( DOKU_BASE + 'lib/exe/ajax.php', { call: 'plugin_davcal', id: JSINFO.id, 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; 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: JSINFO.id }, 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, }); } } ); }); var dw_davcal__modals = { $editEventDialog: null, $dialog: null, $settingsDialog: null, msg: null, completeCb: null, action: null, uid: null, settings: null, showSettingsDialog : function() { if(dw_davcal__modals.$settingsDialog) return; 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: JSINFO.id, 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'] + '
' + '
' + '
' ) .parent() .attr('id','dw_davcal__settings') .show() .appendTo('.dokuwiki:first'); jQuery('#dw_davcal__settings_syncurl').on('click', function() { jQuery(this).select(); }); // attach event handlers jQuery('#dw_davcal__settings .ui-dialog-titlebar-close').click(function(){ dw_davcal__modals.hideSettingsDialog(); }); var $tzdropdown = jQuery('#dw_davcal__settings_timezone'); jQuery('#fullCalendarTimezoneList option').each(function() { jQuery('