Fix delete confirmation dialog in Global categories edit popup

This commit is contained in:
Hadi Nategh 2014-07-14 15:58:50 +00:00
parent 051befced5
commit 92e8ce7d0d
4 changed files with 31 additions and 9 deletions

View File

@ -127,10 +127,10 @@ class admin_categories
{ {
$cats = new categories($content['owner'] ? $content['owner'] : categories::GLOBAL_ACCOUNT,$content['appname']); $cats = new categories($content['owner'] ? $content['owner'] : categories::GLOBAL_ACCOUNT,$content['appname']);
if ($content['delete']['delete']) if ($content['delete']['delete'] || $content['delete']['subs'])
{ {
$button = 'delete'; $button = 'delete';
$delete_subs = $content['delete']['subs']; $delete_subs = $content['delete']['subs']?true:false;
} }
else else
{ {

View File

@ -767,5 +767,27 @@ app.classes.admin = AppJS.extend(
} }
return true; return true;
},
/**
* Delete confirmation dialog
*
*/
delete_category: function ()
{
var _buttons = [
{"button_id": "delete[cancel]","text": 'Cancel', id: 'delete[cancel]', image: 'cancel', "default":true},
{"button_id": "delete[delete]","text": 'Delete', id: 'delete[delete]', image: 'delete'},
{"button_id": "delete[subs]","text": 'Delete including sub-enteries', id: 'delete[subs]', image: 'delete'},
];
var self = this;
var delDialog_callBack = function (_buttons)
{
if (_buttons != "delete[cancel]")
{
self.et2.getInstanceManager().submit(_buttons);
}
};
et2_dialog.show_dialog(delDialog_callBack,"Are you sure you want to delete this category ?","Delete",{},_buttons);
} }
}); });

View File

@ -17,14 +17,13 @@
</columns> </columns>
<rows> <rows>
<row height="30"> <row height="30">
<description align="center" value="Are you sure you want to delete this category ?" span="all"/> <description span="all"/>
</row> </row>
<row> <row>
<checkbox align="center" label="Do you also want to delete all global subcategories ?" id="delete[subs]" span="all"/> <checkbox align="center" id="delete[subs]" span="all"/>
</row> </row>
<row height="40"> <row height="40">
<button align="center" label="Delete" id="delete[delete]" image="delete" background_image="1"/> <button align="center" label="Delete" id="delete[delete]" image="delete" background_image="1"/>
<buttononly align="center" label="Cancel" id="delete[cancel]" onclick="set_style_by_class('fieldset','confirmDelete','display','none');" image="cancel" background_image="1"/>
</row> </row>
</rows> </rows>
</grid> </grid>
@ -41,7 +40,6 @@
<column width="300"/> <column width="300"/>
</columns> </columns>
<rows> <rows>
<row class="dialogHeader"> <row class="dialogHeader">
<description value="Name" for="name"/> <description value="Name" for="name"/>
<textbox id="name" needed="1" size="50" maxlength="150" class="et2_fullWidth"/> <textbox id="name" needed="1" size="50" maxlength="150" class="et2_fullWidth"/>
@ -92,11 +90,12 @@
<button label="Save" id="button[save]" onclick="return app.admin.check_owner(widget);" image="save" background_image="1"/> <button label="Save" id="button[save]" onclick="return app.admin.check_owner(widget);" image="save" background_image="1"/>
<button label="Apply" id="button[apply]" onclick="return app.admin.check_owner(widget);" image="apply" background_image="1"/> <button label="Apply" id="button[apply]" onclick="return app.admin.check_owner(widget);" image="apply" background_image="1"/>
<buttononly label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/> <buttononly label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/>
<buttononly align="right" statustext="Delete this category" label="Delete" id="button[delete]" onclick="et2_dialog.confirm(widget,'Are you sure you want to delete this category ?'); return false;" image="delete" background_image="1"/> <buttononly align="right" statustext="Delete this category" label="Delete" id="button[delete]" onclick="app.admin.delete_category" image="delete" background_image="1"/>
</hbox> </hbox>
</row> </row>
</rows> </rows>
</grid> </grid>
<template id="admin.categories.delete"/> <template id="admin.categories.delete" class="globalCat_hiddenCatid"/>
</template> </template>
</overlay> </overlay>

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Preferences UI for regular users * Preferences UI for regular users
* *
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Nathan Gray * @author Nathan Gray
* @package preferences * @package preferences
@ -23,6 +23,7 @@ class preferences_categories_ui extends admin_categories {
protected $add_link = 'preferences.preferences_categories_ui.edit'; protected $add_link = 'preferences.preferences_categories_ui.edit';
function __construct() { function __construct() {
egw_framework::includeCSS('/admin/templates/default/app.css');
} }
public function get_rows(&$query, &$rows, &$readonlys) { public function get_rows(&$query, &$rows, &$readonlys) {