diff --git a/admin/editaccount.php b/admin/editaccount.php index 8b9dd12d91..385727bb6f 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -23,7 +23,7 @@ // creates the html for the user data function createPageBody($_account_id,$_userData='',$_errors='') { - global $phpgw, $phpgw_info, $t; + global $phpgw, $phpgw_info; $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $t->set_unknowns('remove'); @@ -258,8 +258,10 @@ 'permissions_list' => $appRightsOutput ); $t->set_var($var); - - $phpgw->common->hook('edit_account'); + + // create the menu on the left, if needed + $menuClass = CreateObject('admin.uimenuclass'); + $t->set_var('rows',$menuClass->createHTMLCode('edit_account')); echo $t->fp('out','form'); } @@ -280,10 +282,7 @@ $apps = CreateObject('phpgwapi.applications',array(intval($_userData['account_id']),'u')); - $apps->account_type = 'u'; $apps->account_id = $_userData['account_id']; - $apps->account_apps = Array(Array()); - $apps_before = $apps->read_account_specific(); if ($_userData['account_permissions']) { while($app = each($_userData['account_permissions'])) @@ -291,10 +290,6 @@ if($app[1]) { $apps->add($app[0]); - if(!@$apps_before[$app[0]] || @$apps_before == False) - { - $apps_after[] = $app[0]; - } } } } @@ -408,44 +403,6 @@ } } - function section_item($pref_link='',$pref_text='', $bgcolor) - { - global $phpgw, $phpgw_info, $t; - - $t->set_var('row_link',$pref_link); - $t->set_var('row_text',$pref_text); - $t->set_var('tr_color',$bgcolor); - $t->parse('rows','link_row',True); - } - - // $file must be in the follow format: - // $file = Array( - // 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list') - // ); - // This allows extra data to be sent along - function display_section($appname,$title,$file) - { - global $phpgw, $phpgw_info, $account_id; - - $i = 0; - $color[1] = $phpgw_info['theme']['row_off']; - $color[0] = $phpgw_info['theme']['row_on']; - while(list($text,$_url) = each($file)) - { - list($url,$extra_data) = $_url; - if ($extra_data) - { - $link = $phpgw->link($url,'account_id=' . $account_id . '&' . $extra_data); - } - else - { - $link = $phpgw->link($url,'account_id=' . $account_id); - } - section_item($link,lang($text),$color[$i%2]); - $i++; - } - } - // todo // not needed if i use the same file for new users too if (! $account_id) @@ -475,10 +432,27 @@ ); if (!$errors = userDataInvalid($userData)) - { + { saveUserData($userData); - Header('Location: ' . $phpgw->link('/admin/accounts.php', 'cd='.$cd)); - $phpgw->common->phpgw_exit(); + // check if would create a menu + // if we do, we can't return to the users list, because + // there are also some other plugins + $menuClass = CreateObject('admin.uimenuclass'); + if (!$menuClass->createHTMLCode('edit_account')) + { + Header('Location: ' . $phpgw->link('/admin/accounts.php', 'cd='.$cd)); + $phpgw->common->phpgw_exit(); + } + else + { + $linkdata = array + ( + 'cd' => $cd, + 'account_id' => $account_id + ); + Header('Location: ' . $phpgw->link('/admin/editaccount.php', $linkdata)); + $phpgw->common->phpgw_exit(); + } } else { diff --git a/admin/inc/class.uiaccess_history.inc.php b/admin/inc/class.uiaccess_history.inc.php index a1207568f7..28d3c55f62 100644 --- a/admin/inc/class.uiaccess_history.inc.php +++ b/admin/inc/class.uiaccess_history.inc.php @@ -75,14 +75,14 @@ $this->template->set_var('row_lo',$record['lo']); $this->template->set_var('row_total',$record['total']); - $this->template->fp('rows','row',True); + $this->template->fp('rows_access','row',True); } if (! $total_records && $account_id) { $this->nextmatchs->template_alternate_row_color(&$this->template); $this->template->set_var('row_message',lang('No login history exists for this user')); - $this->template->fp('rows','row_empty',True); + $this->template->fp('rows_access','row_empty',True); } $loggedout = $this->bo->return_logged_out($account_id); @@ -106,6 +106,10 @@ { $this->template->set_var('lang_percent',lang('Percent of users that logged out') . ': ' . $percent . '%'); } + + // create the menu on the left, if needed + $menuClass = CreateObject('admin.uimenuclass'); + $this->template->set_var('rows',$menuClass->createHTMLCode('view_account')); $this->template->pfp('out','list'); } diff --git a/admin/inc/class.uimenuclass.inc.php b/admin/inc/class.uimenuclass.inc.php new file mode 100644 index 0000000000..f69520062e --- /dev/null +++ b/admin/inc/class.uimenuclass.inc.php @@ -0,0 +1,118 @@ +t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); + + $this->t->set_file(array('menurow' => 'menurow.tpl')); + $this->t->set_block('menurow','menu_links','menu_links'); + $this->t->set_block('menurow','link_row','link_row'); + + $this->rowColor[0] = $phpgw_info["theme"]["row_on"]; + $this->rowColor[1] = $phpgw_info["theme"]["row_off"]; + } + + function section_item($pref_link='',$pref_text='', $bgcolor) + { + global $phpgw, $phpgw_info, $t; + + $this->t->set_var('row_link',$pref_link); + $this->t->set_var('row_text',$pref_text); + $this->t->set_var('tr_color',$bgcolor); + $this->t->parse('all_rows','link_row',True); + } + + // $file must be in the following format: + // $file = Array( + // 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list') + // ); + // This allows extra data to be sent along + function display_section($_menuData) + { + global $phpgw, $phpgw_info, $account_id; + + $i=0; + + while(list($key,$value) = each($_menuData)) + { + if (!empty($value['extradata'])) + { + $link = $phpgw->link($value['url'],'account_id=' . $account_id . '&' . $value['extradata']); + } + else + { + $link = $phpgw->link($value['url'],'account_id=' . $account_id); + } + $this->section_item($link,lang($value['description']),$this->rowColor[$i%2]); + $i++; + } + + $this->t->set_var('th_bg',$phpgw_info["theme"]["th_bg"]); + + $this->t->set_var('link_done',$phpgw->link('/admin/accounts.php')); + $this->t->set_var('lang_done',lang('back')); + $this->t->set_var('row_on',$this->rowColor[0]); + + $this->t->parse("out","menu_links"); + + return $this->t->get('out','menu_links'); + } + + // create the html code for the menu + function createHTMLCode($_hookname) + { + global $phpgw, $menuData; + + switch ($_hookname) + { + case 'edit_account': + $menuData[] = Array + ( + 'description' => 'userdata', + 'url' => '/admin/editaccount.php', + 'extradata' => '' + ); + break; + case 'view_account': + $menuData[] = Array + ( + 'description' => 'userdata', + 'url' => '/admin/viewaccount.php', + 'extradata' => '' + ); + break; + } + + $phpgw->common->hook($_hookname); + + if (count($menuData) > 1) + { + $result = $this->display_section($menuData); + //clear $menuData + $menuData = ''; + return $result; + } + else + { + // clear $menuData + $menuData = ''; + return ''; + } + } + } +?> \ No newline at end of file diff --git a/admin/inc/hook_view_account.inc.php b/admin/inc/hook_view_account.inc.php index ed98aa3c6d..c03614b1b3 100644 --- a/admin/inc/hook_view_account.inc.php +++ b/admin/inc/hook_view_account.inc.php @@ -1,8 +1,14 @@ array('/index.php','menuaction=admin.uiaccess_history.list_history') + // Only Modify the $file and $title variables..... + $data = Array + ( + 'description' => 'Login History', + 'url' => '/index.php', + 'extradata' => 'menuaction=admin.uiaccess_history.list_history' ); - display_section($appname,$title,$file); + //Do not modify below this line + global $menuData; + + $menuData[] = $data; ?> \ No newline at end of file diff --git a/admin/templates/default/accesslog.tpl b/admin/templates/default/accesslog.tpl index 03430b8a39..15f85daeed 100644 --- a/admin/templates/default/accesslog.tpl +++ b/admin/templates/default/accesslog.tpl @@ -1,44 +1,46 @@

- {link_return_to_view_account} - - - - - - - - - - - - - - - {rows} - - - - - - - - -
- {lang_last_x_logins} - - {showing} - - - - - {nextmatchs_left} -   - {nextmatchs_right} - -
- -
{lang_loginid}{lang_ip}{lang_login}{lang_logout}{lang_total}
{footer_total}
{lang_percent}
+ + + {rows} + + +
+ + + + + + + + + + + + + + + {rows_access} + + + + + + + + +
+ {lang_last_x_logins} + + {showing} + + + + {nextmatchs_left} {nextmatchs_right} + +
+
{lang_loginid}{lang_ip}{lang_login}{lang_logout}{lang_total}
{footer_total}
{lang_percent}
+
diff --git a/admin/templates/default/account_form.tpl b/admin/templates/default/account_form.tpl index a508f053b1..08b0fffbd9 100644 --- a/admin/templates/default/account_form.tpl +++ b/admin/templates/default/account_form.tpl @@ -5,16 +5,7 @@

- + {rows}
- - - - - - {rows} -
 
- -
diff --git a/admin/templates/default/account_form_ldap.tpl b/admin/templates/default/account_form_ldap.tpl index 9246c5a1f9..793279e109 100644 --- a/admin/templates/default/account_form_ldap.tpl +++ b/admin/templates/default/account_form_ldap.tpl @@ -5,34 +5,36 @@
- -
+ {rows} + - + + + + + + + + + + + + + + + - {rows} -
  + {lang_action} +
+ {lang_loginid} + + {account_lid}  + + {lang_account_active}: + + {account_status} +
{lang_firstname}{account_firstname} {lang_lastname}{account_lastname} 
-
- - - - - - - - - - - - - - - - - - - @@ -88,8 +90,3 @@ - - - - - diff --git a/admin/templates/default/menurow.tpl b/admin/templates/default/menurow.tpl new file mode 100644 index 0000000000..8ec045e637 --- /dev/null +++ b/admin/templates/default/menurow.tpl @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/admin/viewaccount.php b/admin/viewaccount.php index 5df809c506..1caf7d56f4 100755 --- a/admin/viewaccount.php +++ b/admin/viewaccount.php @@ -225,7 +225,10 @@ $t->set_var('permissions_list',$appRightsOutput); - $phpgw->common->hook('view_account'); + // create the menu on the left, if needed + $menuClass = CreateObject('admin.uimenuclass'); + $t->set_var('rows',$menuClass->createHTMLCode('view_account')); + $t->pfp('out','form'); $phpgw->common->phpgw_footer(); ?>
{lang_action}
{lang_loginid}{account_lid} {lang_account_active}:{account_status}
{lang_firstname}{account_firstname} {lang_lastname}{account_lastname} 
{lang_homedir}
  {row_text}
+ + + + + + {all_rows} + + + + + + +
 
+   +
+   {lang_done} +
+ +
  {row_text}