When deleting an event through the list context menu, if it is part of a series ask if you want to delete the single event or the whole series

This commit is contained in:
Nathan Gray 2013-01-09 21:38:18 +00:00
parent 270d8a9145
commit e016bcec71
4 changed files with 80 additions and 7 deletions

View File

@ -580,6 +580,11 @@ class calendar_uilist extends calendar_ui
{ {
case 'delete': case 'delete':
$action_msg = lang('deleted'); $action_msg = lang('deleted');
if($settings == 'series')
{
// Delete the whole thing
$recur_date = 0;
}
if ($id && $this->bo->delete($id, $recur_date,false,$skip_notification)) if ($id && $this->bo->delete($id, $recur_date,false,$skip_notification))
{ {
$success++; $success++;
@ -834,6 +839,7 @@ class calendar_uilist extends calendar_ui
'caption' => 'Delete', 'caption' => 'Delete',
'confirm' => 'Delete this event', 'confirm' => 'Delete this event',
'confirm_multiple' => 'Delete these entries', 'confirm_multiple' => 'Delete these entries',
'onExecute' => 'javaScript:cal_delete',
'group' => $group, 'group' => $group,
'disableClass' => 'rowNoDelete', 'disableClass' => 'rowNoDelete',
); );

View File

@ -83,3 +83,56 @@ function cal_open(_action, _senders)
_action.data = backup; // restore url, width, height, nm_action _action.data = backup; // restore url, width, height, nm_action
} }
/**
* Delete calendar entry, asking if you want to delete series or exception
*
*
* @param _action
* @param _senders
*/
function cal_delete(_action, _senders)
{
var id = _senders[0].id;
var matches = id.match(/^(?:calendar::)?([0-9]+):([0-9]+)$/);
var backup = _action.data;
if (matches)
{
var id = matches[1];
var date = matches[2];
var popup = jQuery(document.getElementById(_action.getManager().etemplate_var_prefix + '[' + _action.id + '_popup]'));
var row = null;
// Cancel normal confirm
delete _action.data.confirm;
delete _action.data.confirm_multiple;
// nm action - show popup
nm_open_popup(_action,_senders);
if(!popup)
{
return;
}
if (row = jQuery("#"+id+"\\:"+date)) {
// Open at row
popup.css({
position: "absolute",
top: row.position().top + row.height() -popup.height()/2,
left: $j(window).width()/2-popup.width()/2
});
} else {
// Open popup in the middle
popup.css({
position: "absolute",
top: $j(window).height()/2-popup.height()/2,
left: $j(window).width()/2-popup.width()/2
});
}
return;
}
console.log(_action);
nm_action(_action, _senders, null, {ids: []});
_action.data = backup; // restore url, width, height, nm_action
}

View File

@ -2,7 +2,7 @@
/** /**
* EGroupware - eTemplates for Application calendar * EGroupware - eTemplates for Application calendar
* http://www.egroupware.org * http://www.egroupware.org
* generated by soetemplate::dump4setup() 2012-11-14 13:31 * generated by soetemplate::dump4setup() 2013-01-09 14:15
* *
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package calendar * @package calendar
@ -55,7 +55,7 @@ $templ_data[] = array('name' => 'calendar.freetimesearch.rows','template' => '',
$templ_data[] = array('name' => 'calendar.import','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";s:5:"align";s:6:"center";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"iCal file";}s:1:"B";a:3:{s:4:"type";s:4:"file";s:4:"name";s:9:"ical_file";s:6:"needed";s:1:"1";}}i:3;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Import";s:4:"name";s:6:"import";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:4;s:4:"cols";i:2;s:5:"align";s:6:"center";s:7:"options";a:0:{}}}','size' => '','style' => '','modified' => '1131469789',); $templ_data[] = array('name' => 'calendar.import','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";s:5:"align";s:6:"center";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"iCal file";}s:1:"B";a:3:{s:4:"type";s:4:"file";s:4:"name";s:9:"ical_file";s:6:"needed";s:1:"1";}}i:3;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Import";s:4:"name";s:6:"import";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:4;s:4:"cols";i:2;s:5:"align";s:6:"center";s:7:"options";a:0:{}}}','size' => '','style' => '','modified' => '1131469789',);
$templ_data[] = array('name' => 'calendar.list','template' => '','lang' => '','group' => '0','version' => '1.9.002','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:5:{s:2:"h2";s:6:",!@msg";s:2:"h1";s:6:",!@css";s:2:"c4";s:7:"noPrint";s:1:"B";s:3:"30%";s:2:"h4";s:34:",!@nm[selectcols]=/legacy_actions/";}i:1;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:4:"html";s:4:"span";s:3:"all";s:4:"name";s:3:"css";}}i:2;a:2:{s:1:"A";a:5:{s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";}s:1:"B";a:5:{s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:10:",redItalic";}}i:3;a:2:{s:1:"A";a:4:{s:4:"name";s:2:"nm";s:4:"size";s:18:"calendar.list.rows";s:4:"type";s:9:"nextmatch";s:4:"span";s:3:"all";}s:1:"B";a:3:{s:4:"name";s:2:"nm";s:4:"size";s:18:"calendar.list.rows";s:4:"type";s:9:"nextmatch";}}i:4;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:5:{s:5:"label";s:13:"Select action";s:7:"onclick";s:183:"if (!egw_globalObjectManager.getObjectById(\'calendar.list.rows\').executeActionImplementation(this, \'popup\')) alert(egw::lang(\'You need to select some entries first!\')); return false;;";s:4:"name";s:14:"legacy_actions";s:4:"type";s:10:"buttononly";s:4:"help";s:13:"Select action";}i:2;a:8:{s:5:"label";s:9:"Check all";s:7:"onclick";s:94:"egw_globalObjectManager.getObjectById(\'calendar.list.rows\').toggleAllSelected(); return false;";s:6:"needed";s:1:"1";s:4:"name";s:9:"check_all";s:4:"type";s:6:"button";s:4:"size";s:9:"arrow_ltr";s:4:"help";s:9:"Check all";s:4:"span";s:14:",checkAllArrow";}s:5:"align";s:5:"right";}}}s:4:"cols";i:2;s:4:"rows";i:4;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '.noWrap { white-space: nowrap; } $templ_data[] = array('name' => 'calendar.list','template' => '','lang' => '','group' => '0','version' => '1.9.003','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:5:{s:2:"h2";s:6:",!@msg";s:2:"h1";s:6:",!@css";s:2:"c4";s:7:"noPrint";s:1:"B";s:3:"30%";s:2:"h4";s:34:",!@nm[selectcols]=/legacy_actions/";}i:1;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:4:"html";s:4:"span";s:3:"all";s:4:"name";s:3:"css";}}i:2;a:2:{s:1:"A";a:5:{s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";}s:1:"B";a:5:{s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:10:",redItalic";}}i:3;a:2:{s:1:"A";a:4:{s:4:"name";s:2:"nm";s:4:"size";s:18:"calendar.list.rows";s:4:"type";s:9:"nextmatch";s:4:"span";s:3:"all";}s:1:"B";a:3:{s:4:"name";s:2:"nm";s:4:"size";s:18:"calendar.list.rows";s:4:"type";s:9:"nextmatch";}}i:4;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:5:{s:5:"label";s:13:"Select action";s:7:"onclick";s:183:"if (!egw_globalObjectManager.getObjectById(\'calendar.list.rows\').executeActionImplementation(this, \'popup\')) alert(egw::lang(\'You need to select some entries first!\')); return false;;";s:4:"name";s:14:"legacy_actions";s:4:"type";s:10:"buttononly";s:4:"help";s:13:"Select action";}i:2;a:8:{s:5:"label";s:9:"Check all";s:7:"onclick";s:94:"egw_globalObjectManager.getObjectById(\'calendar.list.rows\').toggleAllSelected(); return false;";s:6:"needed";s:1:"1";s:4:"name";s:9:"check_all";s:4:"type";s:6:"button";s:4:"size";s:9:"arrow_ltr";s:4:"help";s:9:"Check all";s:4:"span";s:14:",checkAllArrow";}s:5:"align";s:5:"right";}}i:5;a:2:{s:1:"A";a:6:{s:5:"class";s:12:"action_popup";s:4:"name";s:12:"delete_popup";s:4:"type";s:3:"box";s:4:"size";s:1:"1";i:1;a:6:{s:5:"class";s:6:"prompt";s:4:"type";s:4:"vbox";s:4:"size";s:1:"3";i:1;a:3:{s:4:"type";s:5:"label";s:5:"label";s:6:"Delete";s:4:"span";s:13:",promptheader";}i:2;a:2:{s:4:"type";s:5:"label";s:5:"label";s:77:"Do you want to delete this event as an exception, or delete the whole series?";}i:3;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:4:{s:5:"label";s:16:"Delete exception";s:7:"onclick";s:36:"nm_submit_popup(this); return false;";s:4:"name";s:6:"delete";s:4:"type";s:6:"button";}i:2;a:4:{s:5:"label";s:13:"Delete series";s:7:"onclick";s:74:"nm_popup_action.id = \'delete_series\'; nm_submit_popup(this); return false;";s:4:"name";s:13:"delete_series";s:4:"type";s:6:"button";}i:3;a:3:{s:5:"label";s:6:"Cancel";s:7:"onclick";s:35:"nm_hide_popup(this,\'delete_popup\');";s:4:"type";s:10:"buttononly";}}}s:4:"span";s:20:",action_popup prompt";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"cols";i:2;s:4:"rows";i:5;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '.noWrap { white-space: nowrap; }
.image16 img { .image16 img {
height: 16px; height: 16px;
@ -63,7 +63,7 @@ $templ_data[] = array('name' => 'calendar.list','template' => '','lang' => '','g
.listVbox { .listVbox {
width: 100%; width: 100%;
}','modified' => '1299691693',); }','modified' => '1357766044',);
$templ_data[] = array('name' => 'calendar.list.dates','template' => '','lang' => '','group' => '0','version' => '1.3.001','data' => 'a:1:{i:0;a:10:{s:4:"type";s:4:"hbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"4";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Start";}i:2;a:2:{s:4:"type";s:4:"date";s:4:"name";s:9:"startdate";}i:3;a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"End";}i:4;a:2:{s:4:"type";s:4:"date";s:4:"name";s:7:"enddate";}s:4:"span";s:12:",custom_hide";}}','size' => '','style' => '.custom_hide { visibility: hidden; }','modified' => '1173420675',); $templ_data[] = array('name' => 'calendar.list.dates','template' => '','lang' => '','group' => '0','version' => '1.3.001','data' => 'a:1:{i:0;a:10:{s:4:"type";s:4:"hbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"4";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Start";}i:2;a:2:{s:4:"type";s:4:"date";s:4:"name";s:9:"startdate";}i:3;a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"End";}i:4;a:2:{s:4:"type";s:4:"date";s:4:"name";s:7:"enddate";}s:4:"span";s:12:",custom_hide";}}','size' => '','style' => '.custom_hide { visibility: hidden; }','modified' => '1173420675',);

View File

@ -57,8 +57,8 @@
</vbox> </vbox>
<vbox class="listVbox"> <vbox class="listVbox">
<hbox no_lang="1" readonly="true"> <hbox no_lang="1" readonly="true">
<description id="${row}[title]" no_lang="1" readonly="true" options="b"/> <description id="${row}[title]" no_lang="1" readonly="true" font_style="b"/>
<description align="right" value="#%s" id="${row}[id]" options="b"/> <description align="right" value="#%s" id="${row}[id]" font_style="b"/>
</hbox> </hbox>
<box no_lang="1" class="listDescription"> <box no_lang="1" class="listDescription">
<description id="${row}[description]" no_lang="1"/> <description id="${row}[description]" no_lang="1"/>
@ -67,7 +67,7 @@
</vbox> </vbox>
<hbox> <hbox>
<description id="${row}[title]"/> <description id="${row}[title]"/>
<description align="right" value="#%s" id="${row}[id]" options="b"/> <description align="right" value="#%s" id="${row}[id]" font_style="b"/>
</hbox> </hbox>
<description id="${row}[description]" no_lang="1"/> <description id="${row}[description]" no_lang="1"/>
<description id="${row}[recure]"/> <description id="${row}[recure]"/>
@ -110,7 +110,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="calendar.list" template="" lang="" group="0" version="1.9.002"> <template id="calendar.list" template="" lang="" group="0" version="1.9.003">
<grid width="100%"> <grid width="100%">
<columns> <columns>
<column/> <column/>
@ -135,6 +135,20 @@
<button statustext="Check all" label="Check all" id="check_all" needed="1" onclick="egw_globalObjectManager.getObjectById('calendar.list.rows').toggleAllSelected(); return false;" image="arrow_ltr" class="checkAllArrow"/> <button statustext="Check all" label="Check all" id="check_all" needed="1" onclick="egw_globalObjectManager.getObjectById('calendar.list.rows').toggleAllSelected(); return false;" image="arrow_ltr" class="checkAllArrow"/>
</hbox> </hbox>
</row> </row>
<row>
<box class="action_popup prompt" id="delete_popup">
<vbox class="prompt">
<description value="Delete" class="promptheader"/>
<description value="Do you want to delete this event as an exception, or delete the whole series?"/>
<hbox>
<button label="Delete exception" id="delete" onclick="nm_submit_popup(this); return false;"/>
<button label="Delete series" id="delete_series" onclick="nm_popup_action.id = 'delete_series'; nm_submit_popup(this); return false;"/>
<buttononly label="Cancel" onclick="nm_hide_popup(this,'delete_popup');"/>
</hbox>
</vbox>
</box>
<description/>
</row>
</rows> </rows>
</grid> </grid>
<styles> <styles>