forked from extern/egroupware
Changes for Policy
- Add tab to edit category dialog - Change delete context menu action to use popup instead of dialog
This commit is contained in:
parent
7e0663cd91
commit
25f073a0b7
@ -29,6 +29,7 @@ class admin_categories
|
|||||||
public $public_functions = array(
|
public $public_functions = array(
|
||||||
'index' => true,
|
'index' => true,
|
||||||
'edit' => true,
|
'edit' => true,
|
||||||
|
'delete' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,7 +164,7 @@ class admin_categories
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$cmd = new admin_cmd_category($appname, $content, $cats->read($content['id']));
|
$cmd = new admin_cmd_category($appname, $content, $cats->read($content['id']), $content['admin_cmd']);
|
||||||
$msg = $cmd->run();
|
$msg = $cmd->run();
|
||||||
}
|
}
|
||||||
catch (Api\Exception\WrongUserinput $e)
|
catch (Api\Exception\WrongUserinput $e)
|
||||||
@ -620,6 +621,49 @@ class admin_categories
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dialog to delete a category
|
||||||
|
*
|
||||||
|
* @param array $content =null
|
||||||
|
*/
|
||||||
|
public function delete(array $content=null)
|
||||||
|
{
|
||||||
|
if (!is_array($content))
|
||||||
|
{
|
||||||
|
if (isset($_GET['cat_id']))
|
||||||
|
{
|
||||||
|
$content = array(
|
||||||
|
'cat_id'=>(int)$_GET['cat_id'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//error_log(__METHOD__."() \$_GET[account_id]=$_GET[account_id], \$_GET[contact_id]=$_GET[contact_id] content=".array2string($content));
|
||||||
|
}
|
||||||
|
$cats = new Categories('', Categories::id2name($content['cat_id'],'appname'));
|
||||||
|
if(!$cats->check_perms(Acl::DELETE, $content['cat_id']) || !self::$acl_delete ||
|
||||||
|
// Only admins can delete globals
|
||||||
|
$cats->is_global($content['cat_id']) && !$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||||
|
|
||||||
|
{
|
||||||
|
Framework::window_close(lang('Permission denied!!!'));
|
||||||
|
}
|
||||||
|
if ($content['button'])
|
||||||
|
{
|
||||||
|
if($cats->check_perms(Acl::DELETE, $content['cat_id'], (boolean)$GLOBALS['egw_info']['user']['apps']['admin']))
|
||||||
|
{
|
||||||
|
$cmd = new admin_cmd_delete_category(
|
||||||
|
$content['cat_id'],
|
||||||
|
key($content['button']) == 'delete_sub',
|
||||||
|
$content['admin_cmd']
|
||||||
|
);
|
||||||
|
$cmd->run();
|
||||||
|
Framework::refresh_opener(lang('Deleted'), 'admin', $content['cat_id'], 'delete');
|
||||||
|
Framework::window_close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tpl = new Etemplate('admin.categories.delete');
|
||||||
|
$tpl->exec('admin.admin_categories.delete', $content, array(), array(), $content, 2);
|
||||||
|
}
|
||||||
|
|
||||||
protected function get_actions($appname=Api\Categories::GLOBAL_APPNAME) {
|
protected function get_actions($appname=Api\Categories::GLOBAL_APPNAME) {
|
||||||
|
|
||||||
$actions = array(
|
$actions = array(
|
||||||
@ -660,7 +704,8 @@ class admin_categories
|
|||||||
'allowOnMultiple' => true,
|
'allowOnMultiple' => true,
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'disableClass' => 'rowNoDelete',
|
'disableClass' => 'rowNoDelete',
|
||||||
'onExecute' => 'javaScript:app.admin.delete_category'
|
'popup' => '450x400',
|
||||||
|
'url' => 'menuaction=admin.admin_categories.delete&cat_id=$id',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -895,49 +895,6 @@ app.classes.admin = AppJS.extend(
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete confirmation dialog
|
|
||||||
*
|
|
||||||
* @param {egw action} _action
|
|
||||||
*/
|
|
||||||
delete_category: function (_action)
|
|
||||||
{
|
|
||||||
var _buttons = [
|
|
||||||
{"button_id": "delete[cancel]","text": this.egw.lang('Cancel'), id: 'delete[cancel]', image: 'cancel', "default":true},
|
|
||||||
{"button_id": "delete[delete]","text": this.egw.lang('Delete'), id: 'delete[delete]', image: 'delete'},
|
|
||||||
{"button_id": "delete[subs]","text": this.egw.lang('Delete including sub-entries'), id: 'delete[subs]', image: 'delete'}
|
|
||||||
];
|
|
||||||
var action = _action;
|
|
||||||
var self = this;
|
|
||||||
var delDialog_callBack = function (_buttons)
|
|
||||||
{
|
|
||||||
if (_buttons != "delete[cancel]")
|
|
||||||
{
|
|
||||||
if (self.et2._inst.name == "admin.categories.index")
|
|
||||||
{
|
|
||||||
var nm_widget = self.et2.getWidgetById('nm');
|
|
||||||
if (nm_widget)
|
|
||||||
{
|
|
||||||
if (_buttons == "delete[delete]")
|
|
||||||
{
|
|
||||||
nm_action(action);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
action.id = 'delete_sub';
|
|
||||||
nm_action(action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
self.et2.getInstanceManager().submit(_buttons);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
et2_dialog.show_dialog(delDialog_callBack,this.egw.lang("Are you sure you want to delete this category ?"),this.egw.lang("Delete"),{},_buttons,et2_dialog.WARNING_MESSAGE,null,'admin');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change handler for when you change the type of a custom field.
|
* Change handler for when you change the type of a custom field.
|
||||||
* It toggles options / attributes as appropriate.
|
* It toggles options / attributes as appropriate.
|
||||||
|
25
admin/templates/default/categories.delete.xet
Normal file
25
admin/templates/default/categories.delete.xet
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||||
|
<!-- $Id$ -->
|
||||||
|
<overlay>
|
||||||
|
<template id="admin.categories.delete.delete">
|
||||||
|
<description value="Are you sure you want to delete this category?"/>
|
||||||
|
</template>
|
||||||
|
<template id="admin.categories.delete">
|
||||||
|
<vbox>
|
||||||
|
<tabbox id="tabs" span="all" tab_height="150">
|
||||||
|
<tabs>
|
||||||
|
<tab id="main" label="Category"/>
|
||||||
|
</tabs>
|
||||||
|
<tabpanels>
|
||||||
|
<template id="admin.categories.delete.delete"/>
|
||||||
|
</tabpanels>
|
||||||
|
</tabbox>
|
||||||
|
<hbox class="dialogFooterToolbar" id="button">
|
||||||
|
<button id="cancel" label="Cancel" onclick="window.close()"/>
|
||||||
|
<button id="delete" label="Delete"/>
|
||||||
|
<button id="delete_sub" label="Delete including sub-entries"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
</template>
|
||||||
|
</overlay>
|
@ -34,17 +34,13 @@
|
|||||||
</grid>
|
</grid>
|
||||||
<textbox id="delete[cat_id]" class="globalCat_hiddenCatid"/>
|
<textbox id="delete[cat_id]" class="globalCat_hiddenCatid"/>
|
||||||
</template>
|
</template>
|
||||||
<template id="admin.categories.edit" template="" lang="" group="0" version="1.9.001">
|
<template id="admin.categories.edit.category" template="" lang="" group="0" version="1.9.001">
|
||||||
<grid width="100%">
|
<grid width="100%">
|
||||||
<columns>
|
<columns>
|
||||||
<column width="90"/>
|
<column width="90"/>
|
||||||
<column width="300"/>
|
<column width="300"/>
|
||||||
</columns>
|
</columns>
|
||||||
<rows>
|
<rows>
|
||||||
<row class="dialogHeader">
|
|
||||||
<description value="Name" for="name"/>
|
|
||||||
<textbox id="name" needed="1" size="50" maxlength="150" class="et2_fullWidth"/>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<description value="Parent category" for="parent"/>
|
<description value="Parent category" for="parent"/>
|
||||||
<menulist>
|
<menulist>
|
||||||
@ -82,6 +78,32 @@
|
|||||||
<description value="Category owner" for="owner"/>
|
<description value="Category owner" for="owner"/>
|
||||||
<taglist statustext="Limit global category to members of a certain group" id="owner" needed="1" height="190" class="et2_fullWidth" rows="4" />
|
<taglist statustext="Limit global category to members of a certain group" id="owner" needed="1" height="190" class="et2_fullWidth" rows="4" />
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<template id="admin.categories.delete" class="globalCat_hiddenCatid"/>
|
||||||
|
</template>
|
||||||
|
<template id="admin.categories.edit" template="" lang="" group="0" version="1.9.001">
|
||||||
|
<grid width="100%">
|
||||||
|
<columns>
|
||||||
|
<column width="90"/>
|
||||||
|
<column width="300"/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row class="dialogHeader">
|
||||||
|
<description value="Name" for="name"/>
|
||||||
|
<textbox id="name" needed="1" size="50" maxlength="150" class="et2_fullWidth"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<tabbox id="tabs" span="all" tab_height="350">
|
||||||
|
<tabs>
|
||||||
|
<tab id="category" label="Category"/>
|
||||||
|
</tabs>
|
||||||
|
<tabpanels>
|
||||||
|
<template id="admin.categories.edit.category"/>
|
||||||
|
</tabpanels>
|
||||||
|
</tabbox>
|
||||||
|
</row>
|
||||||
<row disabled="!@last_mod">
|
<row disabled="!@last_mod">
|
||||||
<description value="Modified"/>
|
<description value="Modified"/>
|
||||||
<date-time id="last_mod" readonly="true"/>
|
<date-time id="last_mod" readonly="true"/>
|
||||||
@ -96,7 +118,5 @@
|
|||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<template id="admin.categories.delete" class="globalCat_hiddenCatid"/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
Loading…
Reference in New Issue
Block a user