mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-22 21:30:54 +01:00
run addaccount hook for new accounts and set account_id in menuclass links (left menu) after account-creation
This commit is contained in:
parent
f98770409a
commit
f0a6c30faf
@ -220,13 +220,17 @@
|
|||||||
|
|
||||||
if(!$errors)
|
if(!$errors)
|
||||||
{
|
{
|
||||||
|
$new_user = !$userData['account_id'];
|
||||||
|
$passwd = $userData['account_passwd'];
|
||||||
$errors = $this->save_user($userData);
|
$errors = $this->save_user($userData);
|
||||||
$GLOBALS['hook_values'] = $userData;
|
$GLOBALS['hook_values'] = $userData + ($new_user ? array(
|
||||||
|
'new_password' => $passwd,
|
||||||
|
) : array());
|
||||||
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
||||||
'location' => 'editaccount'
|
'location' => $new_user ? 'addaccount' : 'editaccount',
|
||||||
),False,True); // called for every app now, not only enabled ones)
|
),False,True); // called for every app now, not only enabled ones)
|
||||||
}
|
}
|
||||||
error_log(__METHOD__."(".array2string($userData).") returning ".array2string($errors ? $errors : true));
|
//error_log(__METHOD__."(".array2string($userData).") returning ".array2string($errors ? $errors : true));
|
||||||
return $errors ? $errors : true;
|
return $errors ? $errors : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1561,7 +1561,7 @@
|
|||||||
// $menuClass =& CreateObject('admin.uimenuclass');
|
// $menuClass =& CreateObject('admin.uimenuclass');
|
||||||
// This is now using ExecMethod()
|
// This is now using ExecMethod()
|
||||||
$GLOBALS['account_id'] = $_account_id;
|
$GLOBALS['account_id'] = $_account_id;
|
||||||
$t->set_var('rows', $_account_id ? ExecMethod('admin.uimenuclass.createHTMLCode','edit_user') : '');
|
$t->set_var('rows', $_account_id ? ExecMethod2('admin.uimenuclass.createHTMLCode','edit_user',$_account_id) : '');
|
||||||
|
|
||||||
echo $t->fp('out','form');
|
echo $t->fp('out','form');
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||||
* option) any later version. *
|
* option) any later version. *
|
||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
class uimenuclass
|
class uimenuclass
|
||||||
{
|
{
|
||||||
var $t;
|
var $t;
|
||||||
var $rowColor = Array();
|
var $rowColor = Array();
|
||||||
|
|
||||||
function uimenuclass()
|
function uimenuclass()
|
||||||
{
|
{
|
||||||
$this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('admin'));
|
$this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('admin'));
|
||||||
@ -42,7 +42,7 @@
|
|||||||
// 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list')
|
// 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list')
|
||||||
// );
|
// );
|
||||||
// This allows extra data to be sent along
|
// This allows extra data to be sent along
|
||||||
function display_section($_menuData)
|
function display_section($_menuData, $_account_id)
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
@ -53,11 +53,11 @@
|
|||||||
{
|
{
|
||||||
if (!empty($value['extradata']))
|
if (!empty($value['extradata']))
|
||||||
{
|
{
|
||||||
$link = $GLOBALS['egw']->link($value['url'],'account_id=' . get_var('account_id',array('GET','POST')) . '&' . $value['extradata']);
|
$link = egw::link($value['url'],'account_id=' . $_account_id . '&' . $value['extradata']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$link = $GLOBALS['egw']->link($value['url'],'account_id=' . get_var('account_id',array('GET','POST')));
|
$link = egw::link($value['url'],'account_id=' . get_var('account_id',array('GET','POST')));
|
||||||
}
|
}
|
||||||
$this->section_item($link,lang($value['description']),($i%2) ? "row_on": "row_off",$value['options']);
|
$this->section_item($link,lang($value['description']),($i%2) ? "row_on": "row_off",$value['options']);
|
||||||
$i++;
|
$i++;
|
||||||
@ -77,14 +77,17 @@
|
|||||||
$this->t->set_var('row_on',$this->rowColor[0]);
|
$this->t->set_var('row_on',$this->rowColor[0]);
|
||||||
|
|
||||||
$this->t->parse('out','menu_links');
|
$this->t->parse('out','menu_links');
|
||||||
|
|
||||||
return $this->t->get('out','menu_links');
|
return $this->t->get('out','menu_links');
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the html code for the menu
|
// create the html code for the menu
|
||||||
function createHTMLCode($_hookname)
|
function createHTMLCode($_hookname, $_account_id=null)
|
||||||
{
|
{
|
||||||
$hook['location'] = $_hookname;
|
$hook = array('location' => $_hookname);
|
||||||
|
if (!$_account_id) $_account_id = get_var('account_id',array('GET','POST'));
|
||||||
|
if ($_account_id) $hook['account_id'] = $_account_id;
|
||||||
|
|
||||||
switch ($_hookname)
|
switch ($_hookname)
|
||||||
{
|
{
|
||||||
case 'edit_user':
|
case 'edit_user':
|
||||||
@ -93,7 +96,6 @@
|
|||||||
'url' => '/index.php',
|
'url' => '/index.php',
|
||||||
'extradata' => 'menuaction=admin.uiaccounts.edit_user'
|
'extradata' => 'menuaction=admin.uiaccounts.edit_user'
|
||||||
);
|
);
|
||||||
if (get_var('account_id',array('GET','POST'))) $hook['account_id'] = get_var('account_id',array('GET','POST'));
|
|
||||||
break;
|
break;
|
||||||
case 'view_user':
|
case 'view_user':
|
||||||
$GLOBALS['menuData'][] = array(
|
$GLOBALS['menuData'][] = array(
|
||||||
@ -101,7 +103,6 @@
|
|||||||
'url' => '/index.php',
|
'url' => '/index.php',
|
||||||
'extradata' => 'menuaction=admin.uiaccounts.view_user'
|
'extradata' => 'menuaction=admin.uiaccounts.view_user'
|
||||||
);
|
);
|
||||||
//if (get_var('account_id',array('GET','POST'))) $hook['account_id'] = get_var('account_id',array('GET','POST'));
|
|
||||||
break;
|
break;
|
||||||
case 'edit_group':
|
case 'edit_group':
|
||||||
$GLOBALS['menuData'][] = array(
|
$GLOBALS['menuData'][] = array(
|
||||||
@ -120,9 +121,9 @@
|
|||||||
}
|
}
|
||||||
//_debug_array($hook);
|
//_debug_array($hook);
|
||||||
$GLOBALS['egw']->hooks->process($hook);
|
$GLOBALS['egw']->hooks->process($hook);
|
||||||
if (count($GLOBALS['menuData']) >= 1)
|
if (count($GLOBALS['menuData']) >= 1)
|
||||||
{
|
{
|
||||||
$result = $this->display_section($GLOBALS['menuData']);
|
$result = $this->display_section($GLOBALS['menuData'], $_account_id);
|
||||||
//clear $menuData
|
//clear $menuData
|
||||||
$GLOBALS['menuData'] = '';
|
$GLOBALS['menuData'] = '';
|
||||||
return $result;
|
return $result;
|
||||||
@ -135,4 +136,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user