From fccd3f8d89c3b737c5c049e6ea0dc56050c991fe Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 23 Jan 2014 17:15:49 +0000 Subject: [PATCH] Fix not being able to move a series event. Additionally, brings a confirmation message for moving series event --- calendar/inc/class.calendar_uiforms.inc.php | 30 ++------------ calendar/js/app.js | 43 +++++++++++++++++++++ calendar/templates/default/edit.xet | 4 +- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index eb8c1ec6a9..136af412cc 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -466,7 +466,7 @@ class calendar_uiforms extends calendar_ui //error_log(__METHOD__.$button.'#'.array2string($content['edit_single']).'#'); - $ignore_conflicts = $edit_series_confirmed = $status_reset_to_unknown = false; + $ignore_conflicts = $status_reset_to_unknown = false; switch((string)$button) { @@ -475,11 +475,7 @@ class calendar_uiforms extends calendar_ui $button = $event['button_was']; // save or apply unset($event['button_was']); break; - - case 'confirm_edit_series': - $edit_series_confirmed = true; - $button = $event['button_was']; // save or apply - unset($event['button_was']); + } switch((string)$button) @@ -643,9 +639,8 @@ class calendar_uiforms extends calendar_ui break; } // splitting of series confirmed or first event clicked (no confirmation necessary) - if ($edit_series_confirmed || $old_event['start'] == $event['actual_date']) + if ($old_event['start'] == $event['actual_date']) { - $edit_series_confirmed = true; $orig_event = $event; // calculate offset against old series start or clicked recurrance, @@ -782,8 +777,6 @@ class calendar_uiforms extends calendar_ui } elseif ($conflicts > 0) { - if ($edit_series_confirmed) // series moved by splitting in two - { foreach ((array)$old_alarms as $alarm) { // check if alarms still needed in old event, if not delete it @@ -834,7 +827,7 @@ class calendar_uiforms extends calendar_ui $this->bo->update($exception, true, true, true, true, $msg=null, $content['no_notifications']); } } - } + $message = lang('Event saved'); if ($status_reset_to_unknown) @@ -1804,21 +1797,6 @@ class calendar_uiforms extends calendar_ui $etpl->exec('calendar.calendar_uiforms.process_edit',$content,array(),array(),array_merge($event,$preserv),$preserv['no_popup'] ? 0 : 2); } - /** - * displays a confirmation window for changed start dates of series events - * - * @param array $event - * @param array $preserv data to preserv - */ - function confirm_edit_series($event,$preserv) - { - $etpl = CreateObject('etemplate.etemplate','calendar.confirm_edit_series'); - - $GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('Start of Series Event Changed'); - - $etpl->exec('calendar.calendar_uiforms.process_edit',$content,false,false,array_merge($event,$preserv),$preserv['no_popup'] ? 0 : 2); - } - /** * Callback for freetimesearch button in edit * diff --git a/calendar/js/app.js b/calendar/js/app.js index 72c4560db6..fc3d38d7cb 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -724,6 +724,49 @@ app.classes.calendar = AppJS.extend( _action.data = backup; // restore url, width, height, nm_action }, + /** + * Confirmation dialog for moving a series entry + * + * @param {widget object} widget button Save | Apply + * @param {type} _DOM + */ + move_edit_series: function(_DOM,_button) + { + var content = this.et2.getArrayMgr('content').data; + var start_date = this.et2.getWidgetById('start').get_value(); + var whole_day = this.et2.getWidgetById('whole_day').get_value(); + var button = _button; + var that = this; + if (typeof content != 'undefined' && typeof content.recur_type != 'undefined' && content.recur_type != 0) + { + if (content.start != start_date || content.whole_day.toString() != whole_day) + { + et2_dialog.show_dialog(function(_button_id) + { + if (_button_id == et2_dialog.OK_BUTTON) + { + that.et2._inst.submit(button); + + } + else + { + return false; + } + }, + this.egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created."), + this.egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE); + } + else + { + return true; + } + } + else + { + return true; + } + }, + /** * Create edit exception dialog for recurrence entries * diff --git a/calendar/templates/default/edit.xet b/calendar/templates/default/edit.xet index 919684f260..61bd336a44 100644 --- a/calendar/templates/default/edit.xet +++ b/calendar/templates/default/edit.xet @@ -363,8 +363,8 @@ -