forked from extern/egroupware
first version of new account editing via accounts tab in addressbook (not yet saving!)
This commit is contained in:
parent
9e05cc7274
commit
6a55295b77
@ -5,7 +5,7 @@
|
|||||||
* @link www.egroupware.org
|
* @link www.egroupware.org
|
||||||
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @copyright (c) 2005-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2005-14 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @copyright (c) 2005/6 by Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* @copyright (c) 2005/6 by Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
* @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
|
||||||
@ -1776,6 +1776,7 @@ window.egw_LAB.wait(function() {
|
|||||||
{
|
{
|
||||||
$view = true;
|
$view = true;
|
||||||
}
|
}
|
||||||
|
$content['jpegphoto'] = !empty($content['jpegphoto']); // unused and messes up json encoding (not utf-8)
|
||||||
}
|
}
|
||||||
else // not found
|
else // not found
|
||||||
{
|
{
|
||||||
@ -1997,7 +1998,41 @@ window.egw_LAB.wait(function() {
|
|||||||
$content['msg'] .= lang('Please update the templatename in your customfields section!');
|
$content['msg'] .= lang('Please update the templatename in your customfields section!');
|
||||||
$this->tmpl->read('addressbook.edit');
|
$this->tmpl->read('addressbook.edit');
|
||||||
}
|
}
|
||||||
return $this->tmpl->exec('addressbook.addressbook_ui.edit',$content,$sel_options,$readonlys,$content, 2);
|
|
||||||
|
// allow other apps to add tabs to addressbook edit
|
||||||
|
$preserve = $content;
|
||||||
|
$this->tmpl->setElementAttribute('tabs', 'add_tabs', true);
|
||||||
|
$tabs =& $this->tmpl->getElementAttribute('tabs', 'tabs');
|
||||||
|
if (true) $tabs = array();
|
||||||
|
$hook_data = $GLOBALS['egw']->hooks->process(array('location' => 'addressbook_edit')+$content);
|
||||||
|
//error_log(__METHOD__."() hook_data=".array2string($hook_data));
|
||||||
|
foreach($hook_data as $extra_tabs)
|
||||||
|
{
|
||||||
|
if (!$extra_tabs) continue;
|
||||||
|
|
||||||
|
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
|
||||||
|
{
|
||||||
|
$tabs[] = array(
|
||||||
|
'label' => $extra_tab['label'],
|
||||||
|
'template' => $extra_tab['name'],
|
||||||
|
'prepend' => $extra_tab['prepend'],
|
||||||
|
);
|
||||||
|
//error_log(__METHOD__."() changed tabs=".array2string($tabs));
|
||||||
|
if ($extra_tab['data'] && is_array($extra_tab['data']))
|
||||||
|
{
|
||||||
|
$content = array_merge($content, $extra_tab['data']);
|
||||||
|
}
|
||||||
|
if ($extra_tab['preserve'] && is_array($extra_tab['preserve']))
|
||||||
|
{
|
||||||
|
$preserve = array_merge($preserve, $extra_tab['preserve']);
|
||||||
|
}
|
||||||
|
if ($extra_tab['readonlys'] && is_array($extra_tab['readonlys']))
|
||||||
|
{
|
||||||
|
$readonlys = array_merge($readonlys, $extra_tab['readonlys']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->tmpl->exec('addressbook.addressbook_ui.edit', $content, $sel_options, $readonlys, $preserve, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
65
admin/inc/class.admin_account.inc.php
Normal file
65
admin/inc/class.admin_account.inc.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* EGroupware: Admin app UI: edit/add account
|
||||||
|
*
|
||||||
|
* @link http://www.egroupware.org
|
||||||
|
* @author Ralf Becker <rb@stylite.de>
|
||||||
|
* @package admin
|
||||||
|
* @copyright (c) 2014 by Ralf Becker <rb@stylite.de>
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI for admin: edit/add account
|
||||||
|
*/
|
||||||
|
class admin_account
|
||||||
|
{
|
||||||
|
public function addressbook_edit(array $content)
|
||||||
|
{
|
||||||
|
if ((string)$content['owner'] === '0')
|
||||||
|
{
|
||||||
|
// load our translations
|
||||||
|
translation::add_app('admin');
|
||||||
|
|
||||||
|
if ($content['id']) // existing account
|
||||||
|
{
|
||||||
|
if (!($account = $GLOBALS['egw']->accounts->read($content['account_id'])))
|
||||||
|
{
|
||||||
|
throw new egw_exception_not_found('Account data NOT found!');
|
||||||
|
}
|
||||||
|
if ($account['account_expires'] == -1) $account['account_expires'] = '';
|
||||||
|
unset($account['account_pwd']); // do NOT send to client
|
||||||
|
$account['memberships'] = array_keys($account['memberships']);
|
||||||
|
$acl = new acl($content['account_id']);
|
||||||
|
$acl->read_repository();
|
||||||
|
$account['anonymous'] = $acl->check('anonymous', 1, 'phpgwapi');
|
||||||
|
$account['changepassword'] = !$acl->check('nopasswordchange', 1, 'preferences');
|
||||||
|
$auth = new auth();
|
||||||
|
if (($account['account_lastpwd_change'] = $auth->getLastPwdChange($account['account_lid'])) === false)
|
||||||
|
{
|
||||||
|
$account['account_lastpwd_change'] = null;
|
||||||
|
}
|
||||||
|
$account['mustchangepassword'] = isset($account['account_lastpwd_change']) &&
|
||||||
|
(string)$account['account_lastpwd_change'] === '0';
|
||||||
|
}
|
||||||
|
else // new account
|
||||||
|
{
|
||||||
|
$account = array(
|
||||||
|
'account_status' => 'A',
|
||||||
|
'memberships' => array(),
|
||||||
|
'anonymous' => false,
|
||||||
|
'changepassword' => (bool)$GLOBALS['egw_info']['server']['change_pwd_every_x_days'],
|
||||||
|
'mustchangepassword' => false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return array(
|
||||||
|
'name' => 'admin.account?'.filemtime(EGW_SERVER_ROOT.'/admin/templates/default/account.xet'),
|
||||||
|
'prepend' => true,
|
||||||
|
'label' => 'Account',
|
||||||
|
'data' => $account,
|
||||||
|
'callback' => 'admin_account::addressbook_save',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,8 +42,11 @@ $setup_info['admin']['hooks'] = array(
|
|||||||
'group_manager' => 'admin.uiaccounts.edit_group_hook',
|
'group_manager' => 'admin.uiaccounts.edit_group_hook',
|
||||||
'topmenu_info'
|
'topmenu_info'
|
||||||
);
|
);
|
||||||
$setup_info['admin']['hooks']['admin'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks';
|
$setup_info['admin']['hooks']['admin'] = 'admin.admin_prefs_sidebox_hooks.all_hooks';
|
||||||
$setup_info['admin']['hooks']['sidebox_menu'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks';
|
$setup_info['admin']['hooks']['sidebox_menu'] = 'admin.admin_prefs_sidebox_hooks.all_hooks';
|
||||||
|
|
||||||
|
// add account tab to addressbook.edit
|
||||||
|
$setup_info['admin']['hooks']['addressbook_edit'] = 'admin.admin_account.addressbook_edit';
|
||||||
|
|
||||||
/* Dependencies for this app to work */
|
/* Dependencies for this app to work */
|
||||||
$setup_info['admin']['depends'][] = array(
|
$setup_info['admin']['depends'][] = array(
|
||||||
|
66
admin/templates/default/account.xet
Normal file
66
admin/templates/default/account.xet
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||||
|
<!-- $Id$ -->
|
||||||
|
<overlay>
|
||||||
|
<template id="admin.account" template="" lang="" group="0" version="1.9.003">
|
||||||
|
<grid width="100%" height="200">
|
||||||
|
<columns>
|
||||||
|
<column width="82"/>
|
||||||
|
<column width="300"/>
|
||||||
|
<column width="28"/>
|
||||||
|
<column width="85"/>
|
||||||
|
<column width="300"/>
|
||||||
|
<column/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<description value="Login ID" for="account_lid"/>
|
||||||
|
<textbox id="account_lid" class="et2_fullWidth"/>
|
||||||
|
<description/>
|
||||||
|
<description value="Expires" for="account_expires"/>
|
||||||
|
<hbox>
|
||||||
|
<date id="account_expires"/>
|
||||||
|
<checkbox id="account_status" selected_value="A" label="Account active"/>
|
||||||
|
</hbox>
|
||||||
|
<description/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<description value="Password" for="account_passwd"/>
|
||||||
|
<textbox id="account_passwd" class="et2_fullWidth"/>
|
||||||
|
<description/>
|
||||||
|
<description value="Re-enter password" for="account_passwd2"/>
|
||||||
|
<textbox id="account_passwd2" class="et2_fullWidth"/>
|
||||||
|
<description/>
|
||||||
|
</row>
|
||||||
|
<row valign="top">
|
||||||
|
<description/>
|
||||||
|
<vbox span="3">
|
||||||
|
<checkbox id="mustchangepassword" label="Must change password upon next login"/>
|
||||||
|
<checkbox id="changepassword" label="Can change password"/>
|
||||||
|
</vbox>
|
||||||
|
<checkbox id="anonymous" label="Anonymous user. Not shown in list sessions."/>
|
||||||
|
<description/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<description value="Groups" for="groups"/>
|
||||||
|
<taglist-account account_type="groups" id="memberships" multiple="true" class="et2_fullWidth"/>
|
||||||
|
<description/>
|
||||||
|
<description value="Primary group" for="account_primary_group"/>
|
||||||
|
<select-account id="account_primary_group" account_type="groups" class="et2_fullWidth"/>
|
||||||
|
<description/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<description value="Last login"/>
|
||||||
|
<hbox>
|
||||||
|
<date-time id="account_lastlogin" readonly="true"/>
|
||||||
|
<description id="account_lastloginfrom" readonly="true" align="right"/>
|
||||||
|
</hbox>
|
||||||
|
<description/>
|
||||||
|
<description value="Last password change"/>
|
||||||
|
<date-time id="account_lastpwd_change" readonly="true"/>
|
||||||
|
<description/>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
</template>
|
||||||
|
</overlay>
|
Loading…
Reference in New Issue
Block a user