Fix not being able to move a series event. Additionally, brings a confirmation message for moving series event

This commit is contained in:
Hadi Nategh 2014-01-23 17:15:49 +00:00
parent 996f9cd2b7
commit fccd3f8d89
3 changed files with 49 additions and 28 deletions

View File

@ -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
*

View File

@ -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
*

View File

@ -363,8 +363,8 @@
</row>
<row class="dialog-footer-toolbar">
<hbox span="3">
<button statustext="saves the changes made" label="Save" id="button[save]" image="save" background_image="1"/>
<button statustext="apply the changes" label="Apply" id="button[apply]" image="apply" background_image="1"/>
<button statustext="saves the changes made" label="Save" id="button[save]" image="save" background_image="1" onclick="app.calendar.move_edit_series"/>
<button statustext="apply the changes" label="Apply" id="button[apply]" image="apply" background_image="1" onclick="app.calendar.move_edit_series"/>
<button statustext="Close the window" label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/>
<menulist>
<menupopup statustext="Execute a further action for this entry" id="action" onchange="app.calendar.actions_change" options="Actions..."/>