Prefix control fields with underline

This commit is contained in:
Thomas 2011-09-19 10:03:38 +02:00
parent c6506a0d91
commit cc0cf05c9f
6 changed files with 28 additions and 28 deletions

View file

@ -563,11 +563,11 @@ class calendar extends rcube_plugin
$success = $reload = $got_msg = false;
// don't notify if modifying a recurring instance (really?)
if ($event['savemode'] && $event['savemode'] != 'all' && $event['notify'])
unset($event['notify']);
if ($event['_savemode'] && $event['_savemode'] != 'all' && $event['_notify'])
unset($event['_notify']);
// read old event data in order to find changes
if (($event['notify'] || $event['decline']) && $action != 'new')
if (($event['_notify'] || $event['decline']) && $action != 'new')
$old = $this->driver->get_event($event);
switch ($action) {
@ -586,17 +586,17 @@ class calendar extends rcube_plugin
$this->prepare_event($event, $action);
if ($success = $this->driver->edit_event($event))
$this->cleanup_event($event);
$reload = $success && ($event['recurrence'] || $event['savemode'] || $event['fromcalendar']) ? 2 : 1;
$reload = $success && ($event['recurrence'] || $event['_savemode'] || $event['_fromcalendar']) ? 2 : 1;
break;
case "resize":
$success = $this->driver->resize_event($event);
$reload = $event['savemode'] ? 2 : 1;
$reload = $event['_savemode'] ? 2 : 1;
break;
case "move":
$success = $this->driver->move_event($event);
$reload = $success && $event['savemode'] ? 2 : 1;
$reload = $success && $event['_savemode'] ? 2 : 1;
break;
case "remove":
@ -613,7 +613,7 @@ class calendar extends rcube_plugin
}
$success = $this->driver->remove_event($event, $undo_time < 1);
$reload = (!$success || $event['savemode']) ? 2 : 1;
$reload = (!$success || $event['_savemode']) ? 2 : 1;
if ($undo_time > 0 && $success) {
$_SESSION['calendar_event_undo'] = array('ts' => time(), 'data' => $event);
@ -728,7 +728,7 @@ class calendar extends rcube_plugin
}
// send out notifications
if ($success && $event['notify'] && ($event['attendees'] || $old['attendees'])) {
if ($success && $event['_notify'] && ($event['attendees'] || $old['attendees'])) {
// make sure we have the complete record
$event = $action == 'remove' ? $old : $this->driver->get_event($event);

View file

@ -603,7 +603,7 @@ function rcube_calendar_ui(settings)
// tell server to send notifications
if (data.attendees.length && organizer && ((event.id && notify.checked) || (!event.id && invite.checked))) {
data.notify = 1;
data._notify = 1;
}
// gather recurrence settings
@ -651,9 +651,9 @@ function rcube_calendar_ui(settings)
if (event.id) {
data.id = event.id;
if (event.recurrence)
data.savemode = $('input.edit-recurring-savemode:checked').val();
data._savemode = $('input.edit-recurring-savemode:checked').val();
if (data.calendar && data.calendar != event.calendar)
data.fromcalendar = event.calendar;
data._fromcalendar = event.calendar;
}
update_event(action, data);
@ -1527,9 +1527,9 @@ function rcube_calendar_ui(settings)
var $dialog = $('<div>').html(html);
$dialog.find('a.button').button().click(function(e){
data.savemode = String(this.href).replace(/.+#/, '');
data._savemode = String(this.href).replace(/.+#/, '');
if ($dialog.find('input.confirm-attendees-donotify').get(0))
data.notify = notify && $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0;
data._notify = notify && $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0;
if (decline && $dialog.find('input.confirm-attendees-decline:checked'))
data.decline = 1;
update_event(action, data);
@ -1548,7 +1548,7 @@ function rcube_calendar_ui(settings)
buttons.push({
text: rcmail.gettext((action == 'remove' ? 'remove' : 'save'), 'calendar'),
click: function() {
data.notify = notify && $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0;
data._notify = notify && $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0;
data.decline = decline && $dialog.find('input.confirm-attendees-decline:checked').length ? 1 : 0;
update_event(action, data);
$(this).dialog("close");

View file

@ -66,11 +66,11 @@
* 'role' => 'ORGANIZER|REQ-PARTICIPANT|OPT-PARTICIPANT|CHAIR',
* 'status' => 'NEEDS-ACTION|UNKNOWN|ACCEPTED|TENTATIVE|DECLINED'
* 'rsvp' => true|false,
*
* 'savemode' => 'all|future|current|new', // How changes on recurring event should be handled
* 'notify' => true|false, // whether to notify event attendees about changes
* 'fromcalendar' => 'Calendar identifier where the event was stored before',
* ),
*
* '_savemode' => 'all|future|current|new', // How changes on recurring event should be handled
* '_notify' => true|false, // whether to notify event attendees about changes
* '_fromcalendar' => 'Calendar identifier where the event was stored before',
* );
*/

View file

@ -281,7 +281,7 @@ class database_driver extends calendar_driver
if ($old['recurrence']['EXDATE'])
$event['recurrence']['EXDATE'] = $old['recurrence']['EXDATE'];
switch ($event['savemode']) {
switch ($event['_savemode']) {
case 'new':
$event['uid'] = $this->cal->generate_uid();
return $this->new_event($event);
@ -440,7 +440,7 @@ class database_driver extends calendar_driver
$sql_set[] = $this->rc->db->quote_identifier($col) . '=' . $this->rc->db->quote($event[$col]);
}
if ($event['fromcalendar'] && $event['fromcalendar'] != $event['calendar'])
if ($event['_fromcalendar'] && $event['_fromcalendar'] != $event['calendar'])
$sql_set[] = 'calendar_id=' . $this->rc->db->quote($event['calendar']);
$query = $this->rc->db->query(sprintf(
@ -580,7 +580,7 @@ class database_driver extends calendar_driver
// read master if deleting a recurring event
if ($event['recurrence'] || $event['recurrence_id']) {
$master = $event['recurrence_id'] ? $this->get_event(array('id' => $old['recurrence_id'])) : $event;
$savemode = $event['savemode'];
$savemode = $event['_savemode'];
}
switch ($savemode) {

View file

@ -479,7 +479,7 @@ class kolab_driver extends calendar_driver
// read master if deleting a recurring event
if ($event['recurrence'] || $event['recurrence_id']) {
$master = $event['recurrence_id'] ? $storage->get_event($event['recurrence_id']) : $event;
$savemode = $event['savemode'];
$savemode = $event['_savemode'];
}
switch ($savemode) {
@ -538,11 +538,11 @@ class kolab_driver extends calendar_driver
return false;
// move event to another folder/calendar
if ($event['fromcalendar'] && $event['fromcalendar'] != $event['calendar']) {
if (!($fromcalendar = $this->calendars[$event['fromcalendar']]))
if ($event['_fromcalendar'] && $event['_fromcalendar'] != $event['calendar']) {
if (!($fromcalendar = $this->calendars[$event['_fromcalendar']]))
return false;
if ($event['savemode'] != 'new') {
if ($event['_savemode'] != 'new') {
if (!$fromcalendar->storage->move($event['id'], $storage->get_realname()))
return false;
@ -592,7 +592,7 @@ class kolab_driver extends calendar_driver
// modify a recurring event, check submitted savemode to do the right things
if ($old['recurrence'] || $old['recurrence_id']) {
$master = $old['recurrence_id'] ? $fromcalendar->get_event($old['recurrence_id']) : $old;
$savemode = $event['savemode'];
$savemode = $event['_savemode'];
}
// keep saved exceptions (not submitted by the client)

View file

@ -346,7 +346,7 @@ class calendar_ui
*/
function edit_attendees_notify($attrib = array())
{
$checkbox = new html_checkbox(array('name' => 'notify', 'id' => 'edit-attendees-donotify', 'value' => 1));
$checkbox = new html_checkbox(array('name' => '_notify', 'id' => 'edit-attendees-donotify', 'value' => 1));
return html::div($attrib, html::label(null, $checkbox->show(1) . ' ' . $this->cal->gettext('sendnotifications')));
}
@ -357,7 +357,7 @@ class calendar_ui
{
$attrib['id'] = 'edit-recurring-warning';
$radio = new html_radiobutton(array('name' => 'savemode', 'class' => 'edit-recurring-savemode'));
$radio = new html_radiobutton(array('name' => '_savemode', 'class' => 'edit-recurring-savemode'));
$form = html::label(null, $radio->show('', array('value' => 'current')) . $this->cal->gettext('currentevent')) . ' ' .
html::label(null, $radio->show('', array('value' => 'future')) . $this->cal->gettext('futurevents')) . ' ' .
html::label(null, $radio->show('all', array('value' => 'all')) . $this->cal->gettext('allevents')) . ' ' .