mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-03 03:49:33 +01:00
new deleting of accounts
This commit is contained in:
parent
f2e997d445
commit
e476a3ed82
@ -660,6 +660,19 @@ class addressbook_ui extends addressbook_bo
|
|||||||
'disableClass' => 'rowNoDelete',
|
'disableClass' => 'rowNoDelete',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if ($this->grants[0] & EGW_ACL_DELETE)
|
||||||
|
{
|
||||||
|
$actions['delete_account'] = array(
|
||||||
|
'caption' => 'Delete',
|
||||||
|
'icon' => 'delete',
|
||||||
|
'group' => $group,
|
||||||
|
'enableClass' => 'rowAccount',
|
||||||
|
'hideOnDisabled' => true,
|
||||||
|
'popup' => '400x200',
|
||||||
|
'url' => 'menuaction=admin.admin_account.delete&contact_id=$id',
|
||||||
|
);
|
||||||
|
$actions['delete']['hideOnDisabled'] = true;
|
||||||
|
}
|
||||||
if($tid_filter == 'D')
|
if($tid_filter == 'D')
|
||||||
{
|
{
|
||||||
$actions['undelete'] = array(
|
$actions['undelete'] = array(
|
||||||
@ -1030,7 +1043,7 @@ window.egw_LAB.wait(function() {
|
|||||||
elseif (count($checked) == 1 && $contact['account_id'])
|
elseif (count($checked) == 1 && $contact['account_id'])
|
||||||
{
|
{
|
||||||
egw::redirect_link('/index.php',array(
|
egw::redirect_link('/index.php',array(
|
||||||
'menuaction' => 'admin.uiaccounts.delete_user',
|
'menuaction' => 'admin.admin_account.delete',
|
||||||
'account_id' => $contact['account_id'],
|
'account_id' => $contact['account_id'],
|
||||||
));
|
));
|
||||||
// this does NOT return!
|
// this does NOT return!
|
||||||
@ -1518,7 +1531,11 @@ window.egw_LAB.wait(function() {
|
|||||||
{
|
{
|
||||||
$row['tel_prefered'] = $row[$row['tel_prefer']].$prefer_marker;
|
$row['tel_prefered'] = $row[$row['tel_prefer']].$prefer_marker;
|
||||||
}
|
}
|
||||||
if (!$this->check_perms(EGW_ACL_DELETE,$row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == addressbook_so::DELETED_TYPE))
|
if (!$row['owner'])
|
||||||
|
{
|
||||||
|
$row['class'] .= 'rowAccount rowNoDelete';
|
||||||
|
}
|
||||||
|
elseif (!$this->check_perms(EGW_ACL_DELETE,$row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == addressbook_so::DELETED_TYPE))
|
||||||
{
|
{
|
||||||
$row['class'] .= 'rowNoDelete ';
|
$row['class'] .= 'rowNoDelete ';
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,22 @@
|
|||||||
*/
|
*/
|
||||||
class admin_account
|
class admin_account
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Functions callable via menuaction
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $public_functions = array(
|
||||||
|
'delete' => true,
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook to edit account data via "Account" tab in addressbook edit dialog
|
||||||
|
*
|
||||||
|
* @param array $content
|
||||||
|
* @return array
|
||||||
|
* @throws egw_exception_not_found
|
||||||
|
*/
|
||||||
public function addressbook_edit(array $content)
|
public function addressbook_edit(array $content)
|
||||||
{
|
{
|
||||||
if ((string)$content['owner'] === '0' && $GLOBALS['egw_info']['user']['apps']['admin'])
|
if ((string)$content['owner'] === '0' && $GLOBALS['egw_info']['user']['apps']['admin'])
|
||||||
@ -144,4 +160,49 @@ class admin_account
|
|||||||
$content = array_merge($contact, $content);
|
$content = array_merge($contact, $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an account
|
||||||
|
*
|
||||||
|
* @param array $content=null
|
||||||
|
*/
|
||||||
|
public static function delete(array $content=null)
|
||||||
|
{
|
||||||
|
if (!is_array($content))
|
||||||
|
{
|
||||||
|
if (isset($_GET['contact_id']) && ($account_id = $GLOBALS['egw']->accounts->name2id((int)$_GET['contact_id'], 'person_id')))
|
||||||
|
{
|
||||||
|
$content = array(
|
||||||
|
'account_id' => $account_id,
|
||||||
|
'contact_id' => (int)$_GET['contact_id'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$content = array('account_id' => (int)$_GET['account_id']);
|
||||||
|
}
|
||||||
|
error_log(__METHOD__."() \$_GET[account_id]=$_GET[account_id], \$_GET[contact_id]=$_GET[contact_id] content=".array2string($content));
|
||||||
|
}
|
||||||
|
if ($GLOBALS['egw']->acl->check('account_access',32,'admin') || !($content['account_id'] > 0) ||
|
||||||
|
$GLOBALS['egw_info']['user']['account_id'] == $content['account_id'])
|
||||||
|
{
|
||||||
|
egw_framework::window_close(lang('Permission denied!!!'));
|
||||||
|
}
|
||||||
|
if ($content['delete'])
|
||||||
|
{
|
||||||
|
$cmd = new admin_cmd_delete_account(accounts::id2name($content['account_id']), $content['new_owner'], true);
|
||||||
|
$msg = $cmd->run();
|
||||||
|
if ($content['contact_id'])
|
||||||
|
{
|
||||||
|
egw_framework::refresh_opener($msg, 'addressbook', $content['contact_id'], 'delete');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
egw_framework::refresh_opener($msg, 'admin', $content['account_id'], 'delete');
|
||||||
|
}
|
||||||
|
egw_framework::window_close();
|
||||||
|
}
|
||||||
|
$tpl = new etemplate_new('admin.account.delete');
|
||||||
|
$tpl->exec('admin_account::delete', $content, array(), array(), $content, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,8 +200,8 @@ if ($app == 'felamimail') continue; // disabled fmail for now, as it break whole
|
|||||||
$actions['delete'] = array(
|
$actions['delete'] = array(
|
||||||
'caption' => 'Delete',
|
'caption' => 'Delete',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'url' => 'menuaction=admin.uiaccounts.delete_user&account_id=$id',
|
'popup' => '400x200',
|
||||||
'onExecute' => 'javaScript:app.admin.iframe_location',
|
'url' => 'menuaction=admin.admin_account.delete&account_id=$id',
|
||||||
);
|
);
|
||||||
//error_log(__METHOD__."() actions=".array2string($actions));
|
//error_log(__METHOD__."() actions=".array2string($actions));
|
||||||
return $actions;
|
return $actions;
|
||||||
|
18
admin/templates/default/account.delete.xet
Normal file
18
admin/templates/default/account.delete.xet
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||||
|
<!-- $Id$ -->
|
||||||
|
<overlay>
|
||||||
|
<template id="admin.account.delete" template="" lang="" group="0" version="1.9.003">
|
||||||
|
<vbox class="admin_account_delete">
|
||||||
|
<box class="dialogHeader">
|
||||||
|
<select-account id="account_id" readonly="true" label="Delete account %1"/>
|
||||||
|
</box>
|
||||||
|
<description value="Who would you like to transfer ALL records owned by the deleted user to?" class="dialogHeader2"/>
|
||||||
|
<select-account id="new_owner" empty_label="Delete all records" class="dialogHeader3"/>
|
||||||
|
<hbox class="dialogFooterToolbar">
|
||||||
|
<button id="delete" label="Delete"/>
|
||||||
|
<button id="cancel" label="Cancel" onclick="window.close()"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
</template>
|
||||||
|
</overlay>
|
@ -50,3 +50,7 @@ td.admin_userAgent span {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin_account_delete > * {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||||
<!-- $Id$ -->
|
<!-- $Id$ -->
|
||||||
<overlay>
|
<overlay>
|
||||||
<template id="admin.index.rows" template="" lang="" group="0" version="1.9.001">
|
<template id="admin.index.rows" template="" lang="" group="0" version="1.9.001">
|
||||||
@ -44,10 +45,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template id="admin.index" template="" lang="" group="0" version="1.9.001">
|
<template id="admin.index" template="" lang="" group="0" version="1.9.001">
|
||||||
<tree autoloading="admin_ui::ajax_tree" id="tree" onclick="app.admin.run" parent_node="admin_tree_target" std_images="bullet"/>
|
<tree autoloading="admin_ui::ajax_tree" id="tree" onclick="app.admin.run" parent_node="admin_tree_target" std_images="bullet"/>
|
||||||
<description id="msg" class="message"/>
|
|
||||||
<split dock_side="topDock" id="splitter" orientation="h">
|
<split dock_side="topDock" id="splitter" orientation="h">
|
||||||
<nextmatch id="nm" template="admin.index.rows"/>
|
<nextmatch id="nm" template="admin.index.rows"/>
|
||||||
<iframe frameborder="1" height="500px" id="iframe" scrolling="auto" width="100%"/>
|
<iframe frameborder="1" height="100%" id="iframe" scrolling="auto" width="100%"/>
|
||||||
</split>
|
</split>
|
||||||
</template>
|
</template>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -59,6 +59,9 @@ td.admin_userAgent span {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
.admin_account_delete > * {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
@media all {
|
@media all {
|
||||||
/* #############################################################################
|
/* #############################################################################
|
||||||
// iframe
|
// iframe
|
||||||
|
Loading…
Reference in New Issue
Block a user