[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [18608] applying a variation of the patch attached to
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] [18608] applying a variation of the patch attached to sv bug #23396 and some other code clean ups |
Date: |
Mon, 09 Jun 2008 06:43:55 +0000 |
Revision: 18608
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18608
Author: skwashd
Date: 2008-06-09 06:43:54 +0000 (Mon, 09 Jun 2008)
Log Message:
-----------
applying a variation of the patch attached to sv bug #23396 and some other code
clean ups
Ticket Links:
:-----------
http://savannah.gnu.org/bugs/?23396
Modified Paths:
--------------
trunk/admin/inc/class.uimenuclass.inc.php
trunk/admin/templates/base/menurow.tpl
Modified: trunk/admin/inc/class.uimenuclass.inc.php
===================================================================
--- trunk/admin/inc/class.uimenuclass.inc.php 2008-06-09 06:08:55 UTC (rev
18607)
+++ trunk/admin/inc/class.uimenuclass.inc.php 2008-06-09 06:43:54 UTC (rev
18608)
@@ -2,6 +2,7 @@
/**************************************************************************\
* phpGroupWare - Administration *
* http://www.phpgroupware.org *
+ * edited by jason king *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@@ -11,77 +12,44 @@
/* $Id$ */
- class uimenuclass
+ class admin_uimenuclass
{
- var $t;
- var $rowColor = Array();
-
- function uimenuclass()
+ /**
+ * @var object $t reference to the global template object
+ */
+ protected $t;
+
+ /**
+ * @var object $nextmatchs paging object
+ */
+ protected $nextmatchs;
+
+ /**
+ * Constructor
+ *
+ * @return void
+ */
+ public function __construct()
{
- $this->t =
CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('admin'));
+ $this->t =& $GLOBALS['phpgw']->template;
+ $this->t->set_root(PHPGW_APP_TPL);
+ $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
+
$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] =
$GLOBALS['phpgw_info']['theme']['row_on'];
- $this->rowColor[1] =
$GLOBALS['phpgw_info']['theme']['row_off'];
}
- function section_item($pref_link='',$pref_text='', $bgcolor)
+ /**
+ * Create the html markup for the menu
+ *
+ * @param string $hookname the name of the hook to call to get
the items
+ *
+ * @return string the menu
+ */
+ public function createHTMLCode($_hookname)
{
- $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)
- {
- $i=0;
-
- while(list($key,$value) = each($_menuData))
- {
- if (!empty($value['extradata']))
- {
- $link =
$GLOBALS['phpgw']->link($value['url'],'account_id=' . $GLOBALS['account_id'] .
'&' . $value['extradata']);
- }
- else
- {
- $link =
$GLOBALS['phpgw']->link($value['url'],'account_id=' . $GLOBALS['account_id']);
- }
-
$this->section_item($link,lang($value['description']),$this->rowColor[($i %
2)]);
- $i++;
- }
-
-
$this->t->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
-
- if(strpos($_menuData[0]['extradata'],'user'))
- {
- $destination = 'users';
- }
- else
- {
- $destination = 'groups';
- }
-
$this->t->set_var('link_done',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'admin.uiaccounts.list_').$destination));
- $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)
- {
switch ($_hookname)
{
case 'edit_user':
@@ -116,19 +84,84 @@
$GLOBALS['phpgw']->hooks->process($_hookname);
- if (count($GLOBALS['menuData']) >= 1)
+ if ( isset($GLOBALS['menuData']) &&
count($GLOBALS['menuData']) >= 1)
{
$result =
$this->display_section($GLOBALS['menuData']);
//clear $menuData
- $GLOBALS['menuData'] = '';
+ unset($GLOBALS['menuData']);
return $result;
}
- else
+
+ // clear $menuData
+ unset($GLOBALS['menuData']);
+ return '';
+ }
+
+ /**
+ * Display an item in the menu
+ *
+ * @param string $pref_link the url for the item
+ * @param string $pref_text the text for the item
+ * @param string $row_class the css class to apply to the table
cell
+ *
+ * @return void
+ *
+ * @todo TODO this current generates a table row, we should
switch to list items <li>s
+ */
+ protected function section_item($pref_link, $pref_text,
$row_class)
+ {
+ $this->t->set_var(array
+ (
+ 'row_link' => $pref_link,
+ 'row_text' => $pref_text,
+ 'tr_class' => $row_class
+ ));
+
+ $this->t->parse('all_rows','link_row',True);
+ }
+
+ /**
+ * Generate the menu itesms
+ *
+ * @param array $_menuData the data for the menu
+ *
+ * @return string the rendered menu items
+ */
+ protected function display_section($_menuData)
+ {
+ $tr_class = 'row_on';
+ foreach($_menuData as $key => $value)
{
- // clear $menuData
- $GLOBALS['menuData'] = '';
- return '';
+ if (!empty($value['extradata']))
+ {
+ $link = $GLOBALS['phpgw']->link(
$value['url'],
+ array(
'account_id' => $GLOBALS['account_id'].'&'.$value['extradata'])
+ );
+ }
+ else
+ {
+ $link =
$GLOBALS['phpgw']->link($value['url'],array('account_id' =>
$GLOBALS['account_id']));
+ }
+
+ $tr_class =
$this->nextmatchs->alternate_row_class($tr_class);
+ $this->section_item($link,
lang($value['description']), $tr_class);
}
+
+ $dest = 'users';
+ if ( strpos($_menuData[0]['extradata'],'user') !==
false)
+ {
+ $dest = 'groups';
+ }
+
+ $link_done = $GLOBALS['phpgw']->link('/index.php',
+ array('menuaction' =>
"admin.uiaccounts.list_{$dest}"));
+
+ $this->t->set_var('link_done', $link_done);
+ $this->t->set_var('lang_done', lang('Back'));
+
+ $this->t->parse('out', 'menu_links');
+
+ return $this->t->get('out', 'menu_links');
}
}
-?>
+
Modified: trunk/admin/templates/base/menurow.tpl
===================================================================
--- trunk/admin/templates/base/menurow.tpl 2008-06-09 06:08:55 UTC (rev
18607)
+++ trunk/admin/templates/base/menurow.tpl 2008-06-09 06:43:54 UTC (rev
18608)
@@ -1,19 +1,21 @@
<!-- BEGIN menu_links -->
- <table border="0" width="100%">
- <tr class="th">
- <td> </td>
- </tr>
- {all_rows}
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td
class="row_on"> <a href="{link_done}">{lang_done}</a></td>
- </tr>
- </table>
+<table border="0" width="100%">
+ <thead>
+ <tr>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ </tr>
+ {all_rows}
+ <tr>
+ <td class="row_on"> <a
href="{link_done}">{lang_done}</a></td>
+ </tr>
+ </tbody>
+</table>
<!-- END menu_links -->
<!-- BEGIN link_row -->
- <tr class="{tr_color}">
- <td> <a
href="{row_link}">{row_text}</a></td>
- </tr>
+ <tr class="{tr_class}">
+ <td><a href="{row_link}">{row_text}</a></td>
+ </tr>
<!-- END link_row -->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [18608] applying a variation of the patch attached to sv bug #23396 and some other code clean ups,
Dave Hall <=