Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1880350
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
41 KB
Subscribers
None
View Options
diff --git a/action/jsinfo.php b/action/jsinfo.php
--- a/action/jsinfo.php
+++ b/action/jsinfo.php
@@ -1,46 +1,50 @@
<?php
/**
* DokuWiki DAVCal PlugIn - JSINFO component
*/
if(!defined('DOKU_INC')) die();
class action_plugin_davcal_jsinfo extends DokuWiki_Action_Plugin {
function register(Doku_Event_Handler $controller) {
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'add_jsinfo_information');
}
/**
* Add the language variable to the JSINFO variable
*/
function add_jsinfo_information(&$event, $param) {
global $conf;
global $JSINFO;
$lang = $conf['lang'];
- if(strpos($lang, "de") === 0)
+ switch($lang)
{
- $lc = 'de';
- }
- else
- {
- $lc = 'en';
+ case 'de':
+ case 'de-informal':
+ $lc = 'de';
+ break;
+ case 'nl':
+ $lc = 'nl';
+ break;
+ default:
+ $lc = 'en';
}
$JSINFO['plugin']['davcal']['language'] = $lc;
if(isset($_SERVER['REMOTE_USER']) && !is_null($_SERVER['REMOTE_USER']))
{
$JSINFO['plugin']['davcal']['disable_sync'] = $this->getConf('disable_sync');
$JSINFO['plugin']['davcal']['disable_settings'] = $this->getConf('hide_settings');
}
else
{
$JSINFO['plugin']['davcal']['disable_settings'] = 1;
$JSINFO['plugin']['davcal']['disable_sync'] = 1;
}
$JSINFO['plugin']['davcal']['disable_ics'] = $this->getConf('disable_ics');
}
}
diff --git a/lang/de-informal/lang.php b/lang/de-informal/lang.php
new file mode 100644
--- /dev/null
+++ b/lang/de-informal/lang.php
@@ -0,0 +1,50 @@
+<?php
+$lang['created_by_davcal'] = 'Erstellt von DAVCal für DokuWiki';
+$lang['unknown_error'] = 'Unbekannter Fehler';
+$lang['event_added'] = 'Eintrag hinzugefügt';
+$lang['event_edited'] = 'Eintrag bearbeitet';
+$lang['event_deleted'] = 'Eintrag entfernt';
+$lang['no_permission'] = 'Du hast nicht die erforderlichen Rechte, um den Eintrag zu bearbeiten';
+$lang['settings'] = 'Einstellungen/Sync';
+$lang['settings_saved'] = 'Einstellungen erfolgreich gespeichert';
+$lang['error_saving'] = 'Fehler beim Speichern der Einstellungen.';
+$lang['local_time'] = 'Lokale Zeit (Browser-basierend)';
+$lang['from'] = 'Von';
+$lang['to'] = 'Bis';
+$lang['at'] = 'Am';
+$lang['description'] = 'Beschreibung';
+$lang['title'] = 'Titel';
+$lang['js']['create_new_event'] = 'Neuen Eintrag anlegen';
+$lang['js']['cancel'] = 'Abbrechen';
+$lang['js']['create'] = 'Anlegen';
+$lang['js']['save'] = 'Speichern';
+$lang['js']['settings'] = 'Einstellungen';
+$lang['js']['edit'] = 'Bearbeiten';
+$lang['js']['delete'] = 'Löschen';
+$lang['js']['edit_event'] = 'Eintrag bearbeiten';
+$lang['js']['allday'] = 'Ganzer Tag';
+$lang['js']['title'] = 'Titel';
+$lang['js']['from'] = 'Von';
+$lang['js']['to'] = 'Bis';
+$lang['js']['yes'] = 'Ja';
+$lang['js']['confirmation'] = 'Bestätigung';
+$lang['js']['ok'] = 'OK';
+$lang['js']['info'] = 'Info';
+$lang['js']['really_delete_this_event'] = 'Diesen Eintrag wirklich löschen?';
+$lang['js']['timezone'] = 'Zeitzone';
+$lang['js']['weeknumbers'] = 'Wochennummern';
+$lang['js']['use_lang_tz'] = 'Zeitzone der Spracheinstellung verwenden';
+$lang['js']['only_workweek'] = 'Zeige nur die Arbeitswoche';
+$lang['js']['sync_url'] = 'CalDAV URL';
+$lang['js']['error_retrieving_data'] = 'Beim Abfragen der Daten vom Kalenderserver ist ein Fehler aufgetreten.';
+$lang['js']['start_date_invalid'] = 'Beginnzeit/-datum ist ungültig';
+$lang['js']['end_date_invalid'] = 'Endzeit/-datum ist ungültig';
+$lang['js']['end_date_before_start_date'] = 'Endzeit/-datum liegt vor Startzeit/-datum';
+$lang['js']['end_date_is_same_as_start_date'] = 'Endzeit/-datum ist gleich wie Startzeit/-datum';
+$lang['js']['description'] = 'Beschreibung';
+$lang['js']['private_url'] = 'Private URL';
+$lang['js']['recurring_cant_edit'] = 'Das Bearbeiten wiederkehrender Einträge wird derzeit nicht unterstützt';
+$lang['js']['no_permission'] = 'Du hast nicht die erforderlichen Rechte, diesen Kalender zu bearbeiten';
+$lang['js']['calendar'] = 'Kalender';
+$lang['js']['start_monday'] = 'Die Woche beginnt am Montag';
+$lang['js']['nothing_to_show'] = 'Nichts anzuzeigen';
diff --git a/lang/de-informal/settings.php b/lang/de-informal/settings.php
new file mode 100644
--- /dev/null
+++ b/lang/de-informal/settings.php
@@ -0,0 +1,9 @@
+<?php
+
+$lang['hide_settings'] = 'Verstecke den Knopf Einstellungen unterhalb des Kalenders';
+$lang['disable_sync'] = 'Deaktiviere CalDAV Synchronisation (aber erlaube Private URL)';
+$lang['disable_ics'] = 'Deaktiviere Private URL Synchronisation (aber erlaube CalDAV Synchronisierung)';
+$lang['monday'] = 'Wochenbeginn ist am Montag statt am Sonntag';
+$lang['timezone'] = 'Setze die Zeitzone des Kalenders (zB "Europe/Vienna" oder "local" für Browser-basierende Zeit)';
+$lang['workweek'] = 'Zeige nur die Arbeitswoche';
+$lang['weeknumbers'] = 'Zeige Wochennummern';
diff --git a/lang/de/lang.php b/lang/de/lang.php
--- a/lang/de/lang.php
+++ b/lang/de/lang.php
@@ -1,1 +1,50 @@
<?php
+$lang['created_by_davcal'] = 'Erstellt von DAVCal für DokuWiki';
+$lang['unknown_error'] = 'Unbekannter Fehler';
+$lang['event_added'] = 'Eintrag hinzugefügt';
+$lang['event_edited'] = 'Eintrag bearbeitet';
+$lang['event_deleted'] = 'Eintrag entfernt';
+$lang['no_permission'] = 'Sie haben nicht die erforderlichen Rechte, um den Eintrag zu bearbeiten';
+$lang['settings'] = 'Einstellungen/Sync';
+$lang['settings_saved'] = 'Einstellungen erfolgreich gespeichert';
+$lang['error_saving'] = 'Fehler beim Speichern der Einstellungen.';
+$lang['local_time'] = 'Lokale Zeit (Browser-basierend)';
+$lang['from'] = 'Von';
+$lang['to'] = 'Bis';
+$lang['at'] = 'Am';
+$lang['description'] = 'Beschreibung';
+$lang['title'] = 'Titel';
+$lang['js']['create_new_event'] = 'Neuen Eintrag anlegen';
+$lang['js']['cancel'] = 'Abbrechen';
+$lang['js']['create'] = 'Anlegen';
+$lang['js']['save'] = 'Speichern';
+$lang['js']['settings'] = 'Einstellungen';
+$lang['js']['edit'] = 'Bearbeiten';
+$lang['js']['delete'] = 'Löschen';
+$lang['js']['edit_event'] = 'Eintrag bearbeiten';
+$lang['js']['allday'] = 'Ganzer Tag';
+$lang['js']['title'] = 'Titel';
+$lang['js']['from'] = 'Von';
+$lang['js']['to'] = 'Bis';
+$lang['js']['yes'] = 'Ja';
+$lang['js']['confirmation'] = 'Bestätigung';
+$lang['js']['ok'] = 'OK';
+$lang['js']['info'] = 'Info';
+$lang['js']['really_delete_this_event'] = 'Diesen Eintrag wirklich löschen?';
+$lang['js']['timezone'] = 'Zeitzone';
+$lang['js']['weeknumbers'] = 'Wochennummern';
+$lang['js']['use_lang_tz'] = 'Zeitzone der Spracheinstellung verwenden';
+$lang['js']['only_workweek'] = 'Zeige nur die Arbeitswoche';
+$lang['js']['sync_url'] = 'CalDAV URL';
+$lang['js']['error_retrieving_data'] = 'Beim Abfragen der Daten vom Kalenderserver ist ein Fehler aufgetreten.';
+$lang['js']['start_date_invalid'] = 'Beginnzeit/-datum ist ungültig';
+$lang['js']['end_date_invalid'] = 'Endzeit/-datum ist ungültig';
+$lang['js']['end_date_before_start_date'] = 'Endzeit/-datum liegt vor Startzeit/-datum';
+$lang['js']['end_date_is_same_as_start_date'] = 'Endzeit/-datum ist gleich wie Startzeit/-datum';
+$lang['js']['description'] = 'Beschreibung';
+$lang['js']['private_url'] = 'Private URL';
+$lang['js']['recurring_cant_edit'] = 'Das Bearbeiten wiederkehrender Einträge wird derzeit nicht unterstützt';
+$lang['js']['no_permission'] = 'Sie haben nicht die erforderlichen Rechte, diesen Kalender zu bearbeiten';
+$lang['js']['calendar'] = 'Kalender';
+$lang['js']['start_monday'] = 'Die Woche beginnt am Montag';
+$lang['js']['nothing_to_show'] = 'Nichts anzuzeigen';
diff --git a/lang/de/settings.php b/lang/de/settings.php
new file mode 100644
--- /dev/null
+++ b/lang/de/settings.php
@@ -0,0 +1,9 @@
+<?php
+
+$lang['hide_settings'] = 'Verstecke den Knopf Einstellungen unterhalb des Kalenders';
+$lang['disable_sync'] = 'Deaktiviere CalDAV Synchronisation (aber erlaube Private URL)';
+$lang['disable_ics'] = 'Deaktiviere Private URL Synchronisation (aber erlaube CalDAV Synchronisierung)';
+$lang['monday'] = 'Wochenbeginn ist am Montag statt am Sonntag';
+$lang['timezone'] = 'Setze die Zeitzone des Kalenders (zB "Europe/Vienna" oder "local" für Browser-basierende Zeit)';
+$lang['workweek'] = 'Zeige nur die Arbeitswoche';
+$lang['weeknumbers'] = 'Zeige Wochennummern';
diff --git a/lang/nl/lang.php b/lang/nl/lang.php
new file mode 100644
--- /dev/null
+++ b/lang/nl/lang.php
@@ -0,0 +1,50 @@
+<?php
+$lang['created_by_davcal'] = 'Gemaakt door DAVCal for DokuWiki';
+$lang['unknown_error'] = 'Onbekende fout';
+$lang['event_added'] = 'Gebeurtenis toegevoegd';
+$lang['event_edited'] = 'Gebeurtenis gewijzigd';
+$lang['event_deleted'] = 'Gebeurtenis verwijderd';
+$lang['no_permission'] = 'U heeft onvoldoende rechten om deze kalender te wijzigen';
+$lang['settings'] = 'Instellingen/Sync';
+$lang['settings_saved'] = 'Instellingen opgeslagen';
+$lang['error_saving'] = 'Fout tijdens opslaan instellingen.';
+$lang['local_time'] = 'Lokale tijd (van browser)';
+$lang['from'] = 'Van';
+$lang['to'] = 'Tot';
+$lang['at'] = 'Op';
+$lang['description'] = 'Omschrijving';
+$lang['title'] = 'Titel';
+$lang['js']['create_new_event'] = 'Nieuwe Gebeurtenis';
+$lang['js']['cancel'] = 'Annuleer';
+$lang['js']['create'] = 'Nieuw';
+$lang['js']['save'] = 'Opslaan';
+$lang['js']['settings'] = 'Instellingen';
+$lang['js']['edit'] = 'Wijzig';
+$lang['js']['delete'] = 'Verwijder';
+$lang['js']['edit_event'] = 'Wijzig Gebeurtenis';
+$lang['js']['allday'] = 'Hele dag Gebeurtenis';
+$lang['js']['title'] = 'Titel';
+$lang['js']['from'] = 'Van';
+$lang['js']['to'] = 'Tot';
+$lang['js']['yes'] = 'Ja';
+$lang['js']['confirmation'] = 'Bevestiging';
+$lang['js']['ok'] = 'OK';
+$lang['js']['info'] = 'Info';
+$lang['js']['really_delete_this_event'] = 'Deze gebeurtenis echt verwijderen?';
+$lang['js']['timezone'] = 'Tijdzone';
+$lang['js']['weeknumbers'] = 'Week Nummers';
+$lang['js']['use_lang_tz'] = 'Zelfde Tijdzone zoals ingestelde taal';
+$lang['js']['only_workweek'] = 'Toon alleen werkdagen';
+$lang['js']['sync_url'] = 'CalDAV URL';
+$lang['js']['error_retrieving_data'] = 'Er is een fout opgetreden bij het ophalen van de gegevens van de kalender server.';
+$lang['js']['start_date_invalid'] = 'Start datum/tijd is ongeldig.';
+$lang['js']['end_date_invalid'] = 'Eind datum/tijd is ongeldig.';
+$lang['js']['end_date_before_start_date'] = 'Eind datum/tijd is voor start datum/tijd.';
+$lang['js']['end_date_is_same_as_start_date'] = 'Eind datum/tijd is gelijk aan start datum/tijd.';
+$lang['js']['description'] = 'Omschrijving';
+$lang['js']['private_url'] = 'Prive URL';
+$lang['js']['recurring_cant_edit'] = 'Wijzigen van herhalende gebeurtenissen wordt niet ondersteund';
+$lang['js']['no_permission'] = 'U heeft onvoldoende rechten om deze kalender te wijzigen';
+$lang['js']['calendar'] = 'Kalender';
+$lang['js']['start_monday'] = 'Week start op Maandag';
+$lang['js']['nothing_to_show'] = 'Niets weer te geven';
diff --git a/script.js b/script.js
--- a/script.js
+++ b/script.js
@@ -1,706 +1,707 @@
/* 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 fullcalendar-2.4.0/lang/nl.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 calendarpage = jQuery('#fullCalendar').data('calendarpage');
if(!calendarpage) return;
dw_davcal__modals.page = calendarpage;
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.page,
page: dw_davcal__modals.page,
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 ro = false;
var firstday = 0;
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;
if(data['settings']['monday'] == 1)
firstday = 1;
var defaultView = data['settings']['meta']['view'];
// 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.page,
page: dw_davcal__modals.page
},
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,
firstDay: firstday,
defaultView: defaultView
});
}
}
);
});
/**
* 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,
page: null,
detectedTz: null,
/**
* Show the settings dialog
*/
// FIXME: Hide URLs for multi-calendar
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 = {};
if(!JSINFO.plugin.davcal['disable_settings'])
{
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('<img src="'+DOKU_BASE+'lib/images/throbber.gif" alt="" width="16" height="16" />');
jQuery.post(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_davcal',
id: dw_davcal__modals.page,
page: dw_davcal__modals.page,
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();
};
var settingsHtml = '<div><table>';
if(JSINFO.plugin.davcal['disable_settings'] && JSINFO.plugin.davcal['disable_sync'] && JSINFO.plugin.davcal['disable_ics'])
{
settingsHtml += LANG.plugins.davcal['nothing_to_show'];
}
if(!JSINFO.plugin.davcal['disable_settings'])
{
settingsHtml += '<tr><td>' + LANG.plugins.davcal['timezone'] + '</td><td><select name="timezone" id="dw_davcal__settings_timezone" class="dw_davcal__settings"></select></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['weeknumbers'] + '</td><td><input type="checkbox" name="weeknumbers" id="dw_davcal__settings_weeknumbers" class="dw_davcal__settings"></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['only_workweek'] + '</td><td><input type="checkbox" name="workweek" id="dw_davcal__settings_workweek" class="dw_davcal__settings"></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['start_monday'] + '</td><td><input type="checkbox" name="monday" id="dw_davcal__settings_monday" class="dw_davcal__settings"></td></tr>';
}
if(!JSINFO.plugin.davcal['disable_sync'])
{
settingsHtml += '<tr id="dw_davcal__settings_syncurl"><td>' + LANG.plugins.davcal['sync_url'] + '</td><td><input type="text" name="syncurl" readonly="readonly" id="dw_davcal__settings_syncurl" class="dw_davcal__text" value="' + dw_davcal__modals.settings['syncurl'] + '"></td></tr>';
}
if(!JSINFO.plugin.davcal['disable_ics'])
{
settingsHtml += '<tr id="dw_davcal__settings_privateurl"><td>' + LANG.plugins.davcal['private_url'] + '</td><td><input type="text" name="privateurl" readonly="readonly" id="dw_davcal__settings_privateurl" class="dw_davcal__text" value="' + dw_davcal__modals.settings['privateurl'] + '"></td></tr>';
}
settingsHtml += '</table>' +
'</div>' +
'<div id="dw_davcal__ajaxsettings"></div>';
dw_davcal__modals.$settingsDialog = jQuery(document.createElement('div'))
.dialog({
autoOpen: false,
draggable: true,
title: LANG.plugins.davcal['settings'],
resizable: true,
buttons: dialogButtons,
})
.html(
settingsHtml
)
.parent()
.attr('id','dw_davcal__settings')
.show()
.appendTo('.dokuwiki:first');
jQuery('#dw_davcal__settings').position({
my: "center",
at: "center",
of: window
});
// Initialize current settings
if(!JSINFO.plugin.davcal['disable_settings'])
{
var $tzdropdown = jQuery('#dw_davcal__settings_timezone');
jQuery('#fullCalendarTimezoneList option').each(function() {
jQuery('<option />', {value: jQuery(this).val(),
text: jQuery(this).text()}).appendTo($tzdropdown);
});
if(dw_davcal__modals.settings)
{
if(dw_davcal__modals.settings['timezone'] !== '')
jQuery('#dw_davcal__settings_timezone').val(dw_davcal__modals.settings['timezone']);
if(dw_davcal__modals.settings['weeknumbers'] == 1)
jQuery('#dw_davcal__settings_weeknumbers').prop('checked', true);
else
jQuery('#dw_davcal__settings_weeknumbers').prop('checked', false);
if(dw_davcal__modals.settings['workweek'] == 1)
jQuery('#dw_davcal__settings_workweek').prop('checked', true);
else
jQuery('#dw_davcal__settings_workweek').prop('checked', false);
if(dw_davcal__modals.settings['monday'] == 1)
jQuery('#dw_davcal__settings_monday').prop('checked', true);
else
jQuery('#dw_davcal__settings_monday').prop('checked', false);
}
}
// attach event handlers
jQuery('#dw_davcal__settings .ui-dialog-titlebar-close').click(function(){
dw_davcal__modals.hideSettingsDialog();
});
},
/**
* Sanity-check our events.
*
* @return boolean false on failure, otherwise true
*/
checkEvents : function() {
// Retrieve dates
var allDay = jQuery('#dw_davcal__allday_edit').prop('checked');
var startDate = moment(jQuery('#dw_davcal__eventfrom_edit').val(), 'YYYY-MM-DD');
var endDate = moment(jQuery('#dw_davcal__eventto_edit').val(), 'YYYY-MM-DD');
// Do the checking
if(!allDay)
{
var startTime = moment.duration(jQuery('#dw_davcal__eventfromtime_edit').val());
var endTime = moment.duration(jQuery('#dw_davcal__eventtotime_edit').val());
startDate.add(startTime);
endDate.add(endTime);
}
if(!startDate.isValid())
{
dw_davcal__modals.msg = LANG.plugins.davcal['start_date_invalid'];
dw_davcal__modals.showDialog(false);
return false;
}
if(!endDate.isValid())
{
dw_davcal__modals.msg = LANG.plugins.davcal['end_date_invalid'];
dw_davcal__modals.showDialog(false);
return false;
}
if(endDate.isBefore(startDate))
{
dw_davcal__modals.msg = LANG.plugins.davcal['end_date_before_start_date'];
dw_davcal__modals.showDialog(false);
return false;
}
if(!allDay && endDate.isSame(startDate))
{
dw_davcal__modals.msg = LANG.plugins.davcal['end_date_is_same_as_start_date'];
dw_davcal__modals.showDialog(false);
return false;
}
return true;
},
/**
* Show the edit event dialog, which is also used to create new events
* @param {Object} event The event to create, that is the date or the calEvent
* @param {Object} edit Whether we edit (true) or create a new event (false)
*/
showEditEventDialog : function(event, edit) {
if(dw_davcal__modals.$editEventDialog)
return;
var readonly = dw_davcal__modals.settings['readonly'];
var title = '';
var dialogButtons = {};
var calEvent = [];
var recurringWarning = '';
// Buttons are dependent on edit or create
// Several possibilities:
//
// 1) Somebody tries to edit, it is not recurring and not readonly -> show
// 2) Somebody tries to edit, it is recurring and not readonly -> message
// 3) Somebody tries to edit, it is readonly -> message
// 4) Somebody tries to create and it is readonly -> message
// 5) Somebody tries to create -> show
if(edit && (event.recurring != true) && (readonly === false))
{
calEvent = event;
title = LANG.plugins.davcal['edit_event'];
dialogButtons[LANG.plugins.davcal['edit']] = function() {
if(!dw_davcal__modals.checkEvents())
return;
var postArray = { };
var pageid = dw_davcal__modals.page;
if(dw_davcal__modals.settings['multi'])
{
pageid = jQuery("#dw_davcal__editevent_calendar option:selected").val();
}
jQuery("input.dw_davcal__editevent, textarea.dw_davcal__editevent").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__ajaxedit').html('<img src="'+DOKU_BASE+'lib/images/throbber.gif" alt="" width="16" height="16" />');
jQuery.post(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_davcal',
id: pageid,
page: dw_davcal__modals.page,
action: 'editEvent',
params: postArray
},
function(data)
{
var result = data['result'];
var html = data['html'];
jQuery('#dw_davcal__ajaxedit').html(html);
if(result === true)
{
jQuery('#fullCalendar').fullCalendar('refetchEvents');
dw_davcal__modals.hideEditEventDialog();
}
}
);
};
dialogButtons[LANG.plugins.davcal['delete']] = function() {
dw_davcal__modals.action = 'deleteEvent';
dw_davcal__modals.msg = LANG.plugins.davcal['really_delete_this_event'];
dw_davcal__modals.completeCb = function(data) {
var result = data['result'];
var html = data['html'];
jQuery('#dw_davcal__ajaxedit').html(html);
if(result === true)
{
jQuery('#fullCalendar').fullCalendar('refetchEvents');
dw_davcal__modals.hideEditEventDialog();
}
};
dw_davcal__modals.showDialog(true);
};
}
else if(edit && (event.recurring == true) && (readonly === false))
{
calEvent = event;
title = LANG.plugins.davcal['edit_event'];
recurringWarning = LANG.plugins.davcal['recurring_cant_edit'];
}
else if(edit && (readonly === true))
{
calEvent = event;
title = LANG.plugins.davcal['edit_event'];
recurringWarning = LANG.plugins.davcal['no_permission'];
}
else if(readonly === true)
{
calEvent.start = event;
calEvent.end = moment(event);
calEvent.start.hour(12);
calEvent.start.minute(0);
calEvent.end.hour(13);
calEvent.end.minute(0);
calEvent.allDay = false;
calEvent.recurring = false;
calEvent.title = '';
calEvent.description = '';
calEvent.id = '0';
calEvent.page = dw_davcal__modals.page;
title = LANG.plugins.davcal['create_new_event'];
recurringWarning = LANG.plugins.davcal['no_permission'];
}
else
{
calEvent.start = event;
calEvent.end = moment(event);
calEvent.start.hour(12);
calEvent.start.minute(0);
calEvent.end.hour(13);
calEvent.end.minute(0);
calEvent.allDay = false;
calEvent.recurring = false;
calEvent.title = '';
calEvent.description = '';
calEvent.id = '0';
calEvent.page = dw_davcal__modals.settings['calids'][0]['page'];
title = LANG.plugins.davcal['create_new_event'];
dialogButtons[LANG.plugins.davcal['create']] = function() {
if(!dw_davcal__modals.checkEvents())
return;
var postArray = { };
var pageid = dw_davcal__modals.page;
if(dw_davcal__modals.settings['multi'])
{
pageid = jQuery("#dw_davcal__editevent_calendar option:selected").val();
}
jQuery("input.dw_davcal__editevent, textarea.dw_davcal__editevent").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__ajaxedit').html('<img src="'+DOKU_BASE+'lib/images/throbber.gif" alt="" width="16" height="16" />');
jQuery.post(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_davcal',
id: pageid,
page: dw_davcal__modals.page,
action: 'newEvent',
params: postArray
},
function(data)
{
var result = data['result'];
var html = data['html'];
jQuery('#dw_davcal__ajaxedit').html(html);
if(result === true)
{
jQuery('#fullCalendar').fullCalendar('refetchEvents');
dw_davcal__modals.hideEditEventDialog();
}
}
);
};
}
dialogButtons[LANG.plugins.davcal['cancel']] = function() {
dw_davcal__modals.hideEditEventDialog();
};
dw_davcal__modals.uid = calEvent.id;
dw_davcal__modals.$editEventDialog = jQuery(document.createElement('div'))
.dialog({
autoOpen: false,
draggable: true,
title: title,
resizable: true,
buttons: dialogButtons,
})
.html(
'<div><table>' +
'<tr><td>' + LANG.plugins.davcal['calendar'] + '</td><td><select id="dw_davcal__editevent_calendar"></select></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['title'] + '</td><td><input type="text" id="dw_davcal__eventname_edit" name="eventname" class="dw_davcal__editevent"></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['description'] + '</td><td><textarea name="eventdescription" id="dw_davcal__eventdescription_edit" class="dw_davcal__editevent dw_davcal__text"></textarea></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['from'] + '</td><td><input type="text" name="eventfrom" id="dw_davcal__eventfrom_edit" class="dw_davcal__editevent dw_davcal__date"><input type="text" name="eventfromtime" id="dw_davcal__eventfromtime_edit" class="dw_davcal__editevent dw_davcal__time"></td></tr>' +
'<tr><td>' + LANG.plugins.davcal['to'] + '</td><td><input type="text" name="eventto" id="dw_davcal__eventto_edit" class="dw_davcal__editevent dw_davcal__date"><input type="text" name="eventtotime" id="dw_davcal__eventtotime_edit" class="dw_davcal__editevent dw_davcal__time"></td></tr>' +
'<tr><td colspan="2"><input type="checkbox" name="allday" id="dw_davcal__allday_edit" class="dw_davcal__editevent">' + LANG.plugins.davcal['allday'] + '</td></tr>' +
'</table>' +
recurringWarning +
'<input type="hidden" name="uid" id="dw_davcal__uid_edit" class="dw_davcal__editevent">' +
'<input type="hidden" name="detectedtz" id="dw_davcal__tz_edit" class="dw_davcal__editevent">' +
'</div>' +
'<div id="dw_davcal__ajaxedit"></div>'
)
.parent()
.attr('id','dw_davcal__edit')
.show()
.appendTo('.dokuwiki:first');
jQuery('#dw_davcal__edit').position({
my: "center",
at: "center",
of: window
});
// Populate calendar dropdown
var $dropdown = jQuery("#dw_davcal__editevent_calendar");
for(var i=0; i<dw_davcal__modals.settings['calids'].length; i++)
{
var sel = '';
if(calEvent.page == dw_davcal__modals.settings['calids'][i]['page'])
sel = ' selected="selected"';
$dropdown.append('<option value="' + dw_davcal__modals.settings['calids'][i]['page'] + '"' + sel + '>' + dw_davcal__modals.settings['calids'][i]['name'] + '</option>');
}
if(edit || (dw_davcal__modals.settings['calids'].length < 1))
{
$dropdown.prop('disabled', true);
}
// Set up existing/predefined values
jQuery('#dw_davcal__tz_edit').val(dw_davcal__modals.detectedTz);
jQuery('#dw_davcal__uid_edit').val(calEvent.id);
jQuery('#dw_davcal__eventname_edit').val(calEvent.title);
jQuery('#dw_davcal__eventfrom_edit').val(calEvent.start.format('YYYY-MM-DD'));
jQuery('#dw_davcal__eventfromtime_edit').val(calEvent.start.format('HH:mm'));
jQuery('#dw_davcal__eventdescription_edit').val(calEvent.description);
if(calEvent.allDay && (calEvent.end === null))
{
jQuery('#dw_davcal__eventto_edit').val(calEvent.start.format('YYYY-MM-DD'));
jQuery('#dw_davcal__eventtotime_edit').val(calEvent.start.format('HH:mm'));
}
else if(calEvent.allDay)
{
endEvent = moment(calEvent.end);
endEvent.subtract(1, 'days');
jQuery('#dw_davcal__eventto_edit').val(endEvent.format('YYYY-MM-DD'));
jQuery('#dw_davcal__eventotime_edit').val(endEvent.format('HH:mm'));
}
else
{
jQuery('#dw_davcal__eventto_edit').val(calEvent.end.format('YYYY-MM-DD'));
jQuery('#dw_davcal__eventtotime_edit').val(calEvent.end.format('HH:mm'));
}
jQuery('#dw_davcal__allday_edit').prop('checked', calEvent.allDay);
// attach event handlers
jQuery('#dw_davcal__edit .ui-dialog-titlebar-close').click(function(){
dw_davcal__modals.hideEditEventDialog();
});
jQuery('#dw_davcal__eventfrom_edit').datetimepicker({format:'YYYY-MM-DD',
formatDate:'YYYY-MM-DD',
datepicker: true,
timepicker: false,
});
jQuery('#dw_davcal__eventfromtime_edit').datetimepicker({format:'HH:mm',
formatTime:'HH:mm',
datepicker: false,
timepicker: true,
step: 15});
jQuery('#dw_davcal__eventto_edit').datetimepicker({format:'YYYY-MM-DD',
formatDate:'YYYY-MM-DD',
datepicker: true,
timepicker: false,
});
jQuery('#dw_davcal__eventtotime_edit').datetimepicker({format:'HH:mm',
formatTime:'HH:mm',
datepicker: false,
timepicker: true,
step:15});
jQuery('#dw_davcal__allday_edit').change(function() {
if(jQuery(this).is(":checked"))
{
jQuery('#dw_davcal__eventfromtime_edit').prop('readonly', true);
jQuery('#dw_davcal__eventtotime_edit').prop('readonly', true);
}
else
{
jQuery('#dw_davcal__eventfromtime_edit').prop('readonly', false);
jQuery('#dw_davcal__eventtotime_edit').prop('readonly', false);
}
});
jQuery('#dw_davcal__allday_edit').change();
},
/**
* Show an info/confirmation dialog
* @param {Object} confirm Whether a confirmation dialog (true) or an info dialog (false) is requested
*/
showDialog : function(confirm)
{
if(dw_davcal__modals.$confirmDialog)
return;
var dialogButtons = {};
var title = '';
if(confirm)
{
title = LANG.plugins.davcal['confirmation'];
var pageid = dw_davcal__modals.page;
if(dw_davcal__modals.settings['multi'])
{
pageid = jQuery("#dw_davcal__editevent_calendar option:selected").val();
}
dialogButtons[LANG.plugins.davcal['yes']] = function() {
jQuery.post(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_davcal',
id: pageid,
page: dw_davcal__modals.page,
action: dw_davcal__modals.action,
params: {
uid: dw_davcal__modals.uid
}
},
function(data)
{
dw_davcal__modals.completeCb(data);
}
);
dw_davcal__modals.hideDialog();
};
dialogButtons[LANG.plugins.davcal['cancel']] = function() {
dw_davcal__modals.hideDialog();
};
}
else
{
title = LANG.plugins.davcal['info'];
dialogButtons[LANG.plugins.davcal['ok']] = function() {
dw_davcal__modals.hideDialog();
};
}
dw_davcal__modals.$dialog = jQuery(document.createElement('div'))
.dialog({
autoOpen: false,
draggable: true,
title: title,
resizable: true,
buttons: dialogButtons,
})
.html(
'<div>' + dw_davcal__modals.msg + '</div>'
)
.parent()
.attr('id','dw_davcal__confirm')
.show()
.appendTo('.dokuwiki:first');
jQuery('#dw_davcal__confirm').position({
my: "center",
at: "center",
of: window
});
// attach event handlers
jQuery('#dw_davcal__confirm .ui-dialog-titlebar-close').click(function(){
dw_davcal__modals.hideDialog();
});
},
/**
* Hide the edit event dialog
*/
hideEditEventDialog : function() {
dw_davcal__modals.$editEventDialog.empty();
dw_davcal__modals.$editEventDialog.remove();
dw_davcal__modals.$editEventDialog = null;
},
/**
* Hide the confirm/info dialog
*/
hideDialog: function() {
dw_davcal__modals.$dialog.empty();
dw_davcal__modals.$dialog.remove();
dw_davcal__modals.$dialog = null;
},
/**
* Hide the settings dialog
*/
hideSettingsDialog: function() {
dw_davcal__modals.$settingsDialog.empty();
dw_davcal__modals.$settingsDialog.remove();
dw_davcal__modals.$settingsDialog = null;
}
};
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Jan 24, 4:14 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
534936
Default Alt Text
(41 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment