Page MenuHomePhabricator

No OneTemporary

diff --git a/script.js b/script.js
--- a/script.js
+++ b/script.js
@@ -1,866 +1,955 @@
/* DOKUWIKI:include_once fullcalendar-3.7.0/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/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;
+ var calendarpage1 = jQuery('#fullCalendar').data('calendarpage');
+ if(calendarpage1)
+ {
+ dw_davcal__modals.page = calendarpage1;
+
+ jQuery('div.fullCalendarSettings a').each(function() {
+ var $link = jQuery(this);
+ var href = $link.attr('href');
+ if (!href) return;
- 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 '';
+ $link.click(
+ function(e) {
+ dw_davcal__modals.showSettingsDialog();
+ e.preventDefault();
+ return '';
+ }
+ );
}
);
+ }
+
+ // Attach to event view links
+ var calendarpage2 = jQuery('div.davcalevents').data('calendarpage');
+ if(calendarpage2)
+ {
+ dw_davcal__modals.page = calendarpage2;
+
+ jQuery('a.davcalEventsAddNew').each(function() {
+ var $link = jQuery(this);
+ var href = $link.attr('href');
+ if (!href) return;
+
+ $link.click(
+ function(e) {
+ dw_davcal__modals.showEditEventDialog(null, dw_davcal__modals.reasonParams.CreateEvent);
+ e.preventDefault();
+ return '';
+ }
+ );
}
- );
+ );
+ }
+
+ if(!calendarpage1 && !calendarpage2)
+ 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,
sectok: JSINFO.plugin.davcal['sectok']
},
function(data)
{
var result = data['result'];
if(result === true)
{
dw_davcal__modals.settings = data['settings'];
var tz = false;
if(data['settings']['timezone'] !== '')
tz = data['settings']['timezone'];
// Force-overwrite thhe timezone setting if requested
if(data['settings']['meta']['forcetimezone'] !== 'no')
tz = data['settings']['meta']['forcetimezone'];
var fcOptions = {
dayClick: function(date, jsEvent, view) {
- dw_davcal__modals.showEditEventDialog(date, false);
+ dw_davcal__modals.showEditEventDialog(date, dw_davcal__modals.reasonParams.EditEntry);
},
eventClick: function(calEvent, jsEvent, view) {
- dw_davcal__modals.showEditEventDialog(calEvent, true);
+ dw_davcal__modals.showEditEventDialog(calEvent, dw_davcal__modals.reasonParams.CreateEntry);
},
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,
sectok: JSINFO.plugin.davcal['sectok']
},
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,listWeek'
},
locale: JSINFO.plugin.davcal['language'],
weekNumbers: (data['settings']['weeknumbers'] == 1) ? true : false,
timezone: tz,
weekends: (data['settings']['workweek'] == 1) ? false : true,
firstDay: (data['settings']['monday'] == 1) ? 1 : 0,
defaultView: data['settings']['meta']['view'],
};
var timeformat = data['settings']['timeformat'];
// Force-overwrite the user's timezone setting if requested by the calendar
if(data['settings']['meta']['forcetimeformat'] !== 'no')
timeformat = data['settings']['meta']['forcetimeformat'];
if(timeformat !== 'lang')
{
// If the time format is language-based, we don't need to pass
// the timeFormat option to fullCalendar
if(timeformat == '24h')
{
fcOptions.timeFormat = 'H:mm';
}
if(timeformat == '12h')
{
fcOptions.timeFormat = 'h:mmt';
}
}
for (var key in data['settings']['meta']['fcoptions'])
{
if(!data['settings']['meta']['fcoptions'].hasOwnProperty(key)) continue;
var val = data['settings']['meta']['fcoptions'][key];
fcOptions[key] = val;
}
var detectedTz = jstz.determine().name();
dw_davcal__modals.detectedTz = detectedTz;
// The current TZ value holds either the uers's selection or
// the force timezone value
dw_davcal__modals.currentTz = (tz === false) ? '' : tz;
// Initialize the davcal popup
var res = jQuery('#fullCalendar').fullCalendar(fcOptions);
}
}
);
});
/**
* This holds all modal windows that DAVCal uses.
*/
var dw_davcal__modals = {
$editEventDialog: null,
$dialog: null,
$settingsDialog: null,
$inputDialog: null,
msg: null,
completeCb: null,
action: null,
uid: null,
settings: null,
page: null,
detectedTz: null,
currentTz: null,
+ reasonParams : {
+ EditEntry : 0,
+ CreateEntry : 1,
+ EditEvent : 2,
+ CreateEvent : 3,
+ },
/**
* 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,
sectok: JSINFO.plugin.davcal['sectok']
},
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['timeformat'] + '</td><td><select name="timeformat" id="dw_davcal__settings_timeformat" 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_edit" class="dw_davcal__text" value="' + dw_davcal__modals.settings['syncurl'] + '"></td></tr>';
settingsHtml += '<tr id="dw_davcal__settings_principalurl"><td>' + LANG.plugins.davcal['sync_ical'] + '</td><td><input type="text" name="principalurl" readonly="readonly" id="dw_davcal__settings_principalurl_edit" class="dw_davcal__text" value="' + dw_davcal__modals.settings['principalurl'] + '"></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_edit" 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,
// fix for dragging: http://stackoverflow.com/questions/17247486/jquery-ui-dialog-dragging-issues
drag: function(event, ui) {
var fixPix = jQuery(document).scrollTop();
iObj = ui.position;
iObj.top = iObj.top - fixPix;
jQuery(this).closest(".ui-dialog").css("top", iObj.top + "px");
},
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);
});
var $tfdropdown = jQuery('#dw_davcal__settings_timeformat');
jQuery('<option />', {value: 'lang', text: LANG.plugins.davcal['language_specific']}).appendTo($tfdropdown);
jQuery('<option />', {value: '24h', text: '24h'}).appendTo($tfdropdown);
jQuery('<option />', {value: '12h', text: '12h'}).appendTo($tfdropdown);
if(!JSINFO.plugin.davcal['disable_sync'])
{
jQuery('#dw_davcal__settings_syncurl_edit').on('click', function() {
jQuery(this).select();
});
jQuery('#dw_davcal__settings_principalurl_edit').on('click', function() {
jQuery(this).select();
});
}
if(!JSINFO.plugin.davcal['disable_ics'])
{
jQuery('#dw_davcal__settings_privateurl_edit').on('click', function() {
jQuery(this).select();
});
}
if(dw_davcal__modals.settings)
{
if(dw_davcal__modals.settings['timeformat'] !== '')
jQuery('#dw_davcal__settings_timeformat').val(dw_davcal__modals.settings['timeformat']);
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);
if(dw_davcal__modals.settings['meta']['forcetimezone'] !== 'no')
jQuery('#dw_davcal__settings_timezone').prop('disabled', true);
if(dw_davcal__modals.settings['meta']['forcetimeformat'] !== 'no')
jQuery('#dw_davcal__settings_timeformat').prop('disabled', true);
}
}
// 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)
+ * @param {Object} reason The reason for calling the function
*/
- showEditEventDialog : function(event, edit) {
+ showEditEventDialog : function(event, reason) {
if(dw_davcal__modals.$editEventDialog)
return;
var readonly = true;
for(var i=0; i<dw_davcal__modals.settings['calids'].length; i++)
{
- if(edit)
+ if(reason == dw_davcal__modals.reasonParams.EditEvent ||
+ reason == dw_davcal__modals.reasonParams.EditEntry)
{
// Use the specific calendar setting if we edit an event
if(event.page == dw_davcal__modals.settings['calids'][i]['page'])
readonly = !dw_davcal__modals.settings['calids'][i]['write'];
}
else
{
// If there is at least one writable calendar,
// we set readonly to false
- if(dw_davcal__modals.settings['calids'][i]['write'])
+ if(dw_davcal__modals.settings['calids'][i]['write'] == true)
readonly = false;
}
}
var title = '';
var dialogButtons = {};
var calEvent = [];
var recurringWarning = '';
+ var action = '';
// 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))
+ // FIXME
+ switch(reason)
{
+ case dw_davcal__modals.reasonParams.EditEntry:
+ if((event.recurring != true) && (readonly == false))
+ {
+ action = 'editNotRecurringEntry';
+ }
+ else if((event.recurring == true) && (readonly == false))
+ {
+ action = 'editRecurringEntry';
+ }
+ else
+ {
+ action = 'editReadonlyEntry';
+ }
+ break;
+ case dw_davcal__modals.reasonParams.EditEvent:
+
+ break;
+ case dw_davcal__modals.reasonParams.CreateEntry:
+ if(readonly == true)
+ {
+ action = 'createReadonlyEntry';
+ }
+ else
+ {
+ action = 'createEntry';
+ }
+ break;
+ case dw_davcal__modals.reasonParams.CreateEvent:
+ if(readonly == true)
+ {
+ action = 'createReadonlyEvent';
+ }
+ else
+ {
+ action = 'createEvent';
+ }
+ break;
+ default:
+
+ }
+ alert(action);
+ switch(action)
+ {
+ case "editNotRecurringEntry":
+
calEvent = event;
title = LANG.plugins.davcal['edit_event'];
dialogButtons[LANG.plugins.davcal['edit']] = function() {
if(!dw_davcal__modals.checkEvents())
return;
var postArray = { };
var attachArr = new Array();
var pageid = calEvent.page;
jQuery('.dw_davcal__editevent_attachment_link').each(function() {
var attachment = jQuery(this).attr('href');
if(attachment != undefined)
{
attachArr.push(attachment);
}
});
postArray['attachments'] = attachArr;
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,
sectok: JSINFO.plugin.davcal['sectok']
},
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))
- {
+ break;
+ case "editRecurringEntry":
calEvent = event;
title = LANG.plugins.davcal['edit_event'];
recurringWarning = LANG.plugins.davcal['recurring_cant_edit'];
- }
- else if(edit && (readonly === true))
- {
+ break;
+ case "editReadonlyEntry":
calEvent = event;
title = LANG.plugins.davcal['edit_event'];
recurringWarning = LANG.plugins.davcal['no_permission'];
- }
- else if(readonly === true)
- {
+ break;
+ case "createReadonlyEvent":
+ event = moment();
+ // There is intentionally no break!
+ case "createReadonlyEntry":
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.location = '';
calEvent.page = dw_davcal__modals.page;
title = LANG.plugins.davcal['create_new_event'];
recurringWarning = LANG.plugins.davcal['no_permission'];
- }
- else
- {
+ break;
+ case "createEvent":
+ event = moment();
+ // There is intentionally no break!
+ case "createEntry":
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.location = '';
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 attachArr = new Array();
var 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__editevent_attachment_link').each(function() {
var attachment = jQuery(this).attr('href');
if(attachment != undefined)
{
attachArr.push(attachment);
}
});
postArray['attachments'] = attachArr;
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,
sectok: JSINFO.plugin.davcal['sectok']
},
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();
}
}
);
};
+ break;
+ default:
+ alert('unknown action');
}
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,
// fix for dragging: http://stackoverflow.com/questions/17247486/jquery-ui-dialog-dragging-issues
drag: function(event, ui) {
var fixPix = jQuery(document).scrollTop();
iObj = ui.position;
iObj.top = iObj.top - fixPix;
jQuery(this).closest(".ui-dialog").css("top", iObj.top + "px");
},
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['location'] + '</td><td><input type="text" id="dw_davcal__eventlocation_edit" name="eventlocation" class="dw_davcal__editevent"></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>' +
'<tr><td>' + LANG.plugins.davcal['attachments'] + '</td><td><table id="dw_davcal__editevent_attachments"><tbody><tr><td><input type="text" id="dw_davcal__editevent_attachment" value="http://"></td><td><a href="#" id="dw_davcal__editevent_attach">' + LANG.plugins.davcal['add_attachment'] + '</a></td></tr></tbody></table></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">' +
'<input type="hidden" name="currenttz" id="dw_davcal__currenttz_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 = '';
// When creating an event, do not show read-only calendars
- if(!edit && (dw_davcal__modals.settings['calids'][i]['write'] === false))
- continue;
+ if((action == "createEvent" || action == "createEntry")
+ && (dw_davcal__modals.settings['calids'][i]['write'] == false))
+ continue;
+ //if(!edit && (dw_davcal__modals.settings['calids'][i]['write'] === false))
+ // continue;
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))
+ if((action == "editEvent") || (action == "editEntry") || (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__currenttz_edit').val(dw_davcal__modals.currentTz);
jQuery('#dw_davcal__uid_edit').val(calEvent.id);
jQuery('#dw_davcal__eventname_edit').val(calEvent.title);
jQuery('#dw_davcal__eventlocation_edit').val(calEvent.location);
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.attachments && (calEvent.attachments !== null))
{
for(var i=0; i<calEvent.attachments.length; i++)
{
var url = calEvent.attachments[i];
var row = '<tr><td><a href="' + url + '" class="dw_davcal__editevent_attachment_link">' + url + '</a></td><td><a class="deleteLink" href="#">' + LANG.plugins.davcal['delete'] + '</a></td></tr>';
jQuery('#dw_davcal__editevent_attachments > tbody:last').append(row);
}
}
dw_davcal__modals.attachAttachmentDeleteHandlers();
jQuery('#dw_davcal__editevent_attach').on("click", function(e)
{
e.preventDefault();
var url = jQuery('#dw_davcal__editevent_attachment').val();
if(url == '')
return false;
jQuery('#dw_davcal__editevent_attachment').val('http://');
var row = '<tr><td><a href="' + url + '" class="dw_davcal__editevent_attachment_link">' + url + '</a></td><td><a class="deleteLink" href="#">' + LANG.plugins.davcal['delete'] + '</a></td></tr>';
jQuery('#dw_davcal__editevent_attachments > tbody:last').append(row);
dw_davcal__modals.attachAttachmentDeleteHandlers();
return false;
});
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,
lang: JSINFO.plugin.davcal['language'],
});
jQuery('#dw_davcal__eventfromtime_edit').datetimepicker({format:'HH:mm',
formatTime:'HH:mm',
datepicker: false,
timepicker: true,
lang: JSINFO.plugin.davcal['language'],
step: 15});
jQuery('#dw_davcal__eventto_edit').datetimepicker({format:'YYYY-MM-DD',
formatDate:'YYYY-MM-DD',
datepicker: true,
timepicker: false,
lang: JSINFO.plugin.davcal['language'],
});
jQuery('#dw_davcal__eventtotime_edit').datetimepicker({format:'HH:mm',
formatTime:'HH:mm',
datepicker: false,
timepicker: true,
lang: JSINFO.plugin.davcal['language'],
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();
},
/**
* Attach handles to delete the attachments to all 'delete' links
*/
attachAttachmentDeleteHandlers: function()
{
jQuery("#dw_davcal__editevent_attachments .deleteLink").on("click", function(e)
{
e.preventDefault();
var tr = jQuery(this).closest('tr');
tr.css("background-color", "#FF3700");
tr.fadeOut(400, function()
{
tr.remove();
});
return false;
});
},
/**
* 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 = 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
},
sectok: JSINFO.plugin.davcal['sectok']
},
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,
//fix for dragging: http://stackoverflow.com/questions/17247486/jquery-ui-dialog-dragging-issues
drag: function(event, ui) {
var fixPix = jQuery(document).scrollTop();
iObj = ui.position;
iObj.top = iObj.top - fixPix;
jQuery(this).closest(".ui-dialog").css("top", iObj.top + "px");
},
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;
}
};
diff --git a/syntax/calendar.php b/syntax/calendar.php
--- a/syntax/calendar.php
+++ b/syntax/calendar.php
@@ -1,211 +1,229 @@
<?php
/**
* DokuWiki Plugin DAVCal (Calendar Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Böhler <dev@aboehler.at>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
class syntax_plugin_davcal_calendar extends DokuWiki_Syntax_Plugin {
protected $hlp = null;
// Load the helper plugin
public function syntax_plugin_davcal_calendar() {
$this->hlp =& plugin_load('helper', 'davcal');
}
/**
* What kind of syntax are we?
*/
function getType(){
return 'substition';
}
/**
* What about paragraphs?
*/
function getPType(){
return 'normal';
}
/**
* Where to sort in?
*/
function getSort(){
return 165;
}
/**
* Connect pattern to lexer
*/
function connectTo($mode) {
$this->Lexer->addSpecialPattern('\{\{davcal>[^}]*\}\}',$mode,'plugin_davcal_calendar');
$this->Lexer->addSpecialPattern('\{\{davcalclient>[^}]*\}\}',$mode,'plugin_davcal_calendar');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, Doku_Handler $handler){
global $ID;
$data = array('name' => $ID,
'description' => $this->getLang('created_by_davcal'),
'id' => array(),
'settings' => 'show',
'view' => 'month',
'forcetimezone' => 'no',
'forcetimeformat' => 'no',
'fcoptions' => array(),
);
if(strpos($match, '{{davcalclient') === 0)
{
$options = trim(substr($match,15,-2));
$defaultId = $this->getConf('default_client_id');
if(isset($defaultId) && ($defaultId != ''))
{
$data['id'][$defaultId] = null;
$lastid = $defaultId;
}
}
else
{
$options = trim(substr($match,9,-2));
$lastid = $ID;
}
$options = explode(',', $options);
foreach($options as $option)
{
list($key, $val) = explode('=', $option);
$key = strtolower(trim($key));
$val = trim($val);
switch($key)
{
case 'id':
$lastid = $val;
if(!in_array($val, $data['id']))
$data['id'][$val] = null;
break;
case 'color':
$data['id'][$lastid] = $val;
break;
case 'view':
if(in_array($val, array('month', 'basicDay', 'basicWeek', 'agendaWeek', 'agendaDay', 'listWeek', 'listDay', 'listMonth', 'listYear')))
$data['view'] = $val;
else
$data['view'] = 'month';
break;
case 'fcoptions':
$fcoptions = explode(';', $val);
foreach($fcoptions as $opt)
{
list($o, $v) = explode(':', $opt, 2);
$data['fcoptions'][$o] = $v;
}
break;
case 'forcetimezone':
$tzlist = \DateTimeZone::listIdentifiers(DateTimeZone::ALL);
if(in_array($val, $tzlist) || $val === 'no')
$data['forcetimezone'] = $val;
else
msg($this->getLang('error_timezone_not_in_list'), -1);
break;
case 'forcetimeformat':
$tfopt = array('lang', '24h', '12h');
if(in_array($val, $tfopt) || $val === 'no')
$data['forcetimeformat'] = $val;
else
msg($this->getLang('error_option_error'), -1);
break;
default:
$data[$key] = $val;
}
}
// Handle the default case when the user didn't enter a different ID
if(empty($data['id']))
{
$data['id'] = array($ID => null);
}
// Fix up the colors, if no color information is given
foreach($data['id'] as $id => $color)
{
if(is_null($color))
{
// If this is the current calendar or a WebDAV calendar, use the
// default color
if(($id === $ID) || (strpos($id, 'webdav://') === 0))
{
$data['id'][$id] = '#3a87ad';
}
// Otherwise, retrieve the color information from the calendar settings
else
{
$calid = $this->hlp->getCalendarIdForPage($ID);
$settings = $this->hlp->getCalendarSettings($calid);
$color = $settings['calendarcolor'];
$data['id'][$id] = $color;
}
}
}
// Only update the calendar name/description if the ID matches the page ID.
// Otherwise, the calendar is included in another page and we don't want
// to interfere with its data.
if(in_array($ID, array_keys($data['id'])))
{
if(isset($_SERVER['REMOTE_USER']) && !is_null($_SERVER['REMOTE_USER']))
$username = $_SERVER['REMOTE_USER'];
else
$username = uniqid('davcal-');
$this->hlp->setCalendarNameForPage($data['name'], $data['description'], $ID, $username);
$this->hlp->setCalendarColorForPage($data['id'][$ID], $ID);
$this->hlp->enableCalendarForPage($ID);
}
- p_set_metadata($ID, array('plugin_davcal' => $data));
+ // FIXME
+ //p_set_metadata($ID, array('plugin_davcal' => $data));
return $data;
}
/**
* Create output
*/
function render($format, Doku_Renderer $R, $data) {
+ if($format == 'metadata')
+ {
+ if(isset($R->persistent['plugin_davcal']))
+ {
+ unset($R->persistent['plugin_davcal']);
+ $R->meta['plugin_davcal'] = array();
+ }
+
+ if(isset($R->meta['plugin_davcal']))
+ {
+ $R->meta['plugin_davcal'] = array_merge_recursive($R->meta['plugin_davcal'], $data);
+ }
+ else
+ {
+ $R->meta['plugin_davcal'] = $data;
+ }
+ }
if($format != 'xhtml') return false;
global $ID;
$tzlist = \DateTimeZone::listIdentifiers(DateTimeZone::ALL);
// Render the Calendar. Timezone list is within a hidden div,
// the calendar ID is in a data-calendarid tag.
if($data['forcetimezone'] !== 'no')
$R->doc .= '<div id="fullCalendarTimezoneWarning">'.sprintf($this->getLang('this_calendar_uses_timezone'), $data['forcetimezone']).'</div>';
$R->doc .= '<div id="fullCalendar" data-calendarpage="'.$ID.'"></div>';
$R->doc .= '<div id="fullCalendarTimezoneList" class="fullCalendarTimezoneList" style="display:none">';
$R->doc .= '<select id="fullCalendarTimezoneDropdown">';
$R->doc .= '<option value="local">'.$this->getLang('local_time').'</option>';
foreach($tzlist as $tz)
{
$R->doc .= '<option value="'.$tz.'">'.$tz.'</option>';
}
$R->doc .= '</select></div>';
if(($this->getConf('hide_settings') !== 1) && ($data['settings'] !== 'hide'))
{
$R->doc .= '<div class="fullCalendarSettings"><a href="#" class="fullCalendarSettings"><img src="'.DOKU_URL.'lib/plugins/davcal/images/settings.png'.'">'.$this->getLang('settings').'</a></div>';
}
}
}
// vim:ts=4:sw=4:et:enc=utf-8:
diff --git a/syntax/events.php b/syntax/events.php
--- a/syntax/events.php
+++ b/syntax/events.php
@@ -1,309 +1,309 @@
<?php
/**
* DokuWiki Plugin DAVCal (Events Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Böhler <dev@aboehler.at>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
class syntax_plugin_davcal_events extends DokuWiki_Syntax_Plugin {
protected $hlp = null;
// Load the helper plugin
public function syntax_plugin_davcal_events() {
$this->hlp =& plugin_load('helper', 'davcal');
}
/**
* What kind of syntax are we?
*/
function getType(){
return 'substition';
}
/**
* What about paragraphs?
*/
function getPType(){
return 'normal';
}
/**
* Where to sort in?
*/
function getSort(){
return 165;
}
/**
* Connect pattern to lexer
*/
function connectTo($mode) {
$this->Lexer->addSpecialPattern('\{\{davcalevents>[^}]*\}\}',$mode,'plugin_davcal_events');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, Doku_Handler $handler){
global $ID;
$data = array('id' => array(),
'startdate' => 'today',
'numdays' => 30,
'startisend' => false,
'dateformat' => 'Y-m-d H:i',
'alldayformat' => 'Y-m-d',
'onlystart' => false,
'sort' => 'desc',
'timezone' => 'local',
'timeformat' => null,
);
$lastid = $ID;
$options = trim(substr($match,15,-2));
$options = explode(',', $options);
foreach($options as $option)
{
list($key, $val) = explode('=', $option);
$key = strtolower(trim($key));
$val = trim($val);
switch($key)
{
case 'id':
$lastid = $val;
if(!in_array($val, $data['id']))
$data['id'][$val] = null;
break;
case 'color':
$data['id'][$lastid] = $val;
break;
case 'onlystart':
if(($val === 'on') || ($val === 'true'))
$data['onlystart'] = true;
break;
case 'startisend':
if(($val === 'on') || ($val === 'true'))
$data['startisend'] = true;
break;
case 'timezone':
$tzlist = \DateTimeZone::listIdentifiers(DateTimeZone::ALL);
if(in_array($val, $tzlist) || $val === 'no')
$data['timezone'] = $val;
else
msg($this->getLang('error_timezone_not_in_list'), -1);
break;
default:
$data[$key] = $val;
}
}
// Handle the default case when the user didn't enter a different ID
if(empty($data['id']))
{
$data['id'] = array($ID => '#3a87ad');
}
// Fix up the colors, if no color information is given
foreach($data['id'] as $id => $color)
{
if(is_null($color))
{
// If this is the current calendar or a WebDAV calendar, use the
// default color
if(($id === $ID) || (strpos($id, 'webdav://') === 0))
{
$data['id'][$id] = '#3a87ad';
}
// Otherwise, retrieve the color information from the calendar settings
else
{
$calid = $this->hlp->getCalendarIdForPage($ID);
$settings = $this->hlp->getCalendarSettings($calid);
$color = $settings['calendarcolor'];
$data['id'][$id] = $color;
}
}
}
return $data;
}
private static function sort_events_asc($a, $b)
{
$from1 = new \DateTime($a['start']);
$from2 = new \DateTime($b['start']);
return $from2 < $from1;
}
private static function sort_events_desc($a, $b)
{
$from1 = new \DateTime($a['start']);
$from2 = new \DateTime($b['start']);
return $from1 < $from2;
}
/**
* Create output
*/
function render($format, Doku_Renderer $R, $data) {
if($format == 'metadata')
{
$R->meta['plugin_davcal']['events'] = true;
- return true;
+ $R->meta['plugin_davcal'] = array_merge_recursive($R->meta['plugin_davcal'], $data);
}
if(($format != 'xhtml') && ($format != 'odt')) return false;
global $ID;
$events = array();
$from = $data['startdate'];
$toStr = null;
// Handle the various options to 'startDate'
if($from === 'today')
{
$from = new \DateTime();
}
elseif(strpos($from, 'today-') === 0)
{
$days = intval(str_replace('today-', '', $from));
$from = new \DateTime();
$from->sub(new \DateInterval('P'.$days.'D'));
}
elseif(strpos($from, 'today+') === 0)
{
$days = intval(str_replace('today+', '', $from));
$from = new \DateTime();
$from->add(new \DateInterval('P'.$days.'D'));
}
else
{
$from = new \DateTime($from);
}
// Handle the option 'startisend'
if($data['startisend'] === true)
{
if($data['numdays'] > 0)
{
$to = clone $from;
$to->sub(new \DateInterval('P'.$data['numdays'].'D'));
$fromStr = $to->format('Y-m-d');
}
else
{
$fromStr = null;
}
$toStr = $from->format('Y-m-d');
}
else
{
if($data['numdays'] > 0)
{
$to = clone $from;
$to->add(new \DateInterval('P'.$data['numdays'].'D'));
$toStr = $to->format('Y-m-d');
}
else
{
$toStr = null;
}
$fromStr = $from->format('Y-m-d');
}
// Support for timezone
$timezone = $data['timezone'];
// Filter events by user permissions
$userEvents = $this->hlp->filterCalendarPagesByUserPermission($data['id']);
$perms = array();
// Fetch the events
foreach($userEvents as $calPage => $color)
{
$events = array_merge($events, $this->hlp->getEventsWithinDateRange($calPage,
$user, $fromStr, $toStr, $timezone, null,
array('URL', 'X-COST')));
$perms[$calPage] = $this->hlp->checkCalendarPermission($calPage);
}
// Sort the events
if($data['sort'] === 'desc')
usort($events, array("syntax_plugin_davcal_events", "sort_events_desc"));
else
usort($events, array("syntax_plugin_davcal_events", "sort_events_asc"));
$R->doc .= '<div class="davcalevents" data-calendarpage="'.$ID.'">';
foreach($perms as $page => $perm)
{
if($perm > AUTH_READ)
{
$R->doc .= '<a href="#" class="davcalEventsAddNew">'.$this->getLang('add_new').'</a><br>';
break;
}
}
foreach($events as $event)
{
$from = new \DateTime($event['start']);
$color = $data['id'][$event['page']];
$R->doc .= '<div class="tile" style="background-color:'.$color.'">';
$R->doc .= '<div class="text">';
if($timezone !== 'local')
{
$from->setTimezone(new \DateTimeZone($timezone));
$to->setTimezone(new \DateTimeZone($timezone));
}
if($event['allDay'] === true)
$R->doc .= '<h1>'.$from->format($data['alldayformat']).'</h1>';
else
$R->doc .= '<h1>'.$from->format($data['dateformat']).'</h1>';
if(!is_null($data['timeformat']) && $event['allDay'] != true)
{
$R->doc .= '<h2>'.$from->format($data['timeformat']).'</h2>';
}
$R->doc .= hsc($event['title']).'<br>';
if(isset($event['X-COST']) && $event['X-COST'] !== '')
{
$R->doc .= '<span class="costs">'.$this->getLang('costs').': '.hsc($event['X-COST']).'</span>';
}
$R->doc .= '</div>';
$R->doc .= '<div class="dots">';
$R->doc .= '<span></span>';
$R->doc .= '<span></span>';
$R->doc .= '<span></span>';
$R->doc .= '</div>';
if(isset($event['URL']) && $event['URL'] !== '')
{
$R->doc .= '<div class="more">';
$R->doc .= '<span><a href="'.hsc($event['URL']).'" target="_blank">'.$this->getLang('more_info').'</a></span>';
$R->doc .= '</div>';
}
if(isset($perms[$event['page']]) && ($perms[$event['page']] > AUTH_READ))
{
$R->doc .= '<div class="edit">';
- $R->doc .= '<span><a href="#" data-calendarid="'.$event['page'].'" data-uid="'.$event['uid'].'" class="davcalEventsEdit">'.$this->getLang('edit').'</a></span>';
+ $R->doc .= '<span><a href="#" data-calendarid="'.$event['page'].'" data-uid="'.$event['id'].'" class="davcalEventsEdit">'.$this->getLang('edit').'</a></span>';
$R->doc .= '</div>';
}
$R->doc .= '</div>';
}
$R->doc .= '</div>';
}
}
// vim:ts=4:sw=4:et:enc=utf-8:

File Metadata

Mime Type
text/x-diff
Expires
Wed, Dec 4, 4:25 PM (10 h, 50 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
532029
Default Alt Text
(62 KB)

Event Timeline