From e59b6f6418cce6eff9b50c8c08d62dbbd66e6d3f Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 1 Jun 2004 13:00:09 +0000 Subject: [PATCH] moved atrribute descriptions to lists.inc --- lam/lib/ldap.inc | 63 ----------------------------- lam/lib/lists.inc | 54 ++++++++++++++++++++++++- lam/templates/lists/listdomains.php | 16 +++++++- lam/templates/lists/listgroups.php | 21 ++++++++-- lam/templates/lists/listhosts.php | 21 ++++++++-- lam/templates/lists/listusers.php | 23 ++++++++--- 6 files changed, 119 insertions(+), 79 deletions(-) diff --git a/lam/lib/ldap.inc b/lam/lib/ldap.inc index ffb5dcf0..f596f3a7 100644 --- a/lam/lib/ldap.inc +++ b/lam/lib/ldap.inc @@ -220,13 +220,6 @@ class Ldap{ /** LDAP password used for bind */ var $password; - /** Contains LDAP attributes for user list and their descriptions */ - var $ldapUserAttributes; - /** Contains LDAP attributes for group list and their descriptions */ - var $ldapGroupAttributes; - /** Contains LDAP attributes for host list and their descriptions */ - var $ldapHostAttributes; - /** Array with all objectClass strings from the LDAP server */ var $objectClasses; @@ -248,35 +241,6 @@ class Ldap{ setlanguage(); if (is_object($config)) $this->conf = $config; else return false; - // construct arrays with known LDAP attributes - $this->ldapUserAttributes = array ( - "uid" => _("User ID"), - "uidnumber" => _("UID number"), - "gidnumber" => _("GID number"), - "cn" => _("Username"), - "host" => _("Allowed hosts"), - "givenname" => _("First name"), - "sn" => _("Last name"), - "homedirectory" => _("Home directory"), - "loginshell" => _("Login shell"), - "mail" => _("E-Mail"), - "gecos" => _("Description") - ); - $this->ldapGroupAttributes = array ( - "cn" => _("Group name"), - "gidnumber" => _("GID number"), - "memberuid" => _("Group members"), - "member" => _("Group member DNs"), - "description" => _("Group description") - ); - $this->ldapHostAttributes = array ( - "uid" => _("Host username"), - "cn" => _("Host name"), - "rid" => _("RID (Windows UID)"), - "description" => _("Host description"), - "uidnumber" => _("UID number"), - "gidnumber" => _("GID number") - ); mt_srand((double)microtime()*1000000); $this->rand = mt_rand(); return true; @@ -582,33 +546,6 @@ class Ldap{ $this->password="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; } - /** - * Returns the LDAP attribute names and their description for the user list - * - * @return array list of LDAP attributes and descriptions - */ - function attributeUserArray() { - return $this->ldapUserAttributes; - } - - /** - * Returns the LDAP attribute names and their description for the group list - * - * @return array list of LDAP attributes and descriptions - */ - function attributeGroupArray() { - return $this->ldapGroupAttributes; - } - - /** - * Returns the LDAP attribute names and their description for the host list - * - * @return array list of LDAP attributes and descriptions - */ - function attributeHostArray() { - return $this->ldapHostAttributes; - } - /** * Helper function to sort the unit DNs diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index 1150b7da..e9fdbd1f 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -76,7 +76,7 @@ function listSort($sort, $attr_array, $info) { /** -* @brief draws a navigation bar to switch between pages +* Draws a navigation bar to switch between pages * * @param integer $count number of account entries * @param integer $max_page_entries maximum number of account per page @@ -125,5 +125,57 @@ function listDrawNavigationBar($count, $max_page_entries, $page, $sort, $searchF } +/** +* Returns the LDAP attribute names and their description for the user list +* +* @return array list of LDAP attributes and descriptions +*/ +function listGetAttributeUserArray() { + return array ( + "uid" => _("User ID"), + "uidnumber" => _("UID number"), + "gidnumber" => _("GID number"), + "cn" => _("Username"), + "host" => _("Allowed hosts"), + "givenname" => _("First name"), + "sn" => _("Last name"), + "homedirectory" => _("Home directory"), + "loginshell" => _("Login shell"), + "mail" => _("E-Mail"), + "gecos" => _("Description") + ); +} + +/** +* Returns the LDAP attribute names and their description for the group list +* +* @return array list of LDAP attributes and descriptions +*/ +function listGetAttributeGroupArray() { + return array ( + "cn" => _("Group name"), + "gidnumber" => _("GID number"), + "memberuid" => _("Group members"), + "member" => _("Group member DNs"), + "description" => _("Group description") + ); +} + +/** +* Returns the LDAP attribute names and their description for the host list +* +* @return array list of LDAP attributes and descriptions +*/ +function listGetAttributeHostArray() { + return array ( + "uid" => _("Host username"), + "cn" => _("Host name"), + "rid" => _("RID (Windows UID)"), + "description" => _("Host description"), + "uidnumber" => _("UID number"), + "gidnumber" => _("GID number") + ); +} + ?> \ No newline at end of file diff --git a/lam/templates/lists/listdomains.php b/lam/templates/lists/listdomains.php index 1290803e..c1e08594 100644 --- a/lam/templates/lists/listdomains.php +++ b/lam/templates/lists/listdomains.php @@ -19,12 +19,24 @@ $Id$ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - This code displays a list of all Samba domains. - */ + + +/** +* This page displays a list of all Samba domains. +* +* @package lists +* @author Roland Gruber +*/ + + +/** Access to configuration options */ include_once("../../lib/config.inc"); +/** Access to LDAP connection */ include_once("../../lib/ldap.inc"); +/** Used to print status messages */ include_once("../../lib/status.inc"); +/** Basic list functions */ include_once("../../lib/lists.inc"); // start session diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index 87654281..7c807115 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -19,15 +19,28 @@ $Id$ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - This code displays a list of all groups. - */ + + +/** +* This page displays a list of all groups. +* +* @package lists +* @author Roland Gruber +*/ + + +/** Access to configuration options */ include_once ("../../lib/config.inc"); +/** Access to LDAP connection */ include_once ("../../lib/ldap.inc"); +/** Used to print status messages */ include_once ("../../lib/status.inc"); -include_once("../../lib/account.inc"); +/** Used to create PDF files */ include_once("../../lib/pdf.inc"); +/** Access to account modules */ include_once("../../lib/modules.inc"); +/** Basic list functions */ include_once("../../lib/lists.inc"); // start session @@ -104,7 +117,7 @@ $attr_array = array(); // list of LDAP attributes to show $desc_array = array(); // list of descriptions for the attributes $attr_string = $_SESSION["config"]->get_grouplistAttributes(); $temp_array = explode(";", $attr_string); -$hash_table = $_SESSION["ldap"]->attributeGroupArray(); +$hash_table = listGetAttributeGroupArray(); // get current page $page = $_GET["page"]; diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index 5556264d..4c71e4cc 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -19,15 +19,28 @@ $Id$ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - This code displays a list of all Samba hosts. - */ + + +/** +* This page displays a list of all hosts. +* +* @package lists +* @author Roland Gruber +*/ + + +/** Access to configuration options */ include_once ("../../lib/config.inc"); +/** Access to LDAP connection */ include_once ("../../lib/ldap.inc"); +/** Used to print status messages */ include_once ("../../lib/status.inc"); -include_once("../../lib/account.inc"); +/** Used to create PDF files */ include_once("../../lib/pdf.inc"); +/** Access to account modules */ include_once("../../lib/modules.inc"); +/** Basic list functions */ include_once("../../lib/lists.inc"); // start session @@ -100,7 +113,7 @@ $attr_array = array(); // list of LDAP attributes to show $desc_array = array(); // list of descriptions for the attributes $attr_string = $_SESSION["config"]->get_hostlistAttributes(); $temp_array = explode(";", $attr_string); -$hash_table = $_SESSION["ldap"]->attributeHostArray(); +$hash_table = listGetAttributeHostArray(); // get current page $page = $_GET["page"]; diff --git a/lam/templates/lists/listusers.php b/lam/templates/lists/listusers.php index 12617ba5..54235835 100644 --- a/lam/templates/lists/listusers.php +++ b/lam/templates/lists/listusers.php @@ -22,15 +22,28 @@ $Id$ */ + +/** +* This page displays a list of all users. +* +* @package lists +* @author Roland Gruber +*/ + + +/** Access to configuration options */ include_once ("../../lib/config.inc"); -include_once("../../lib/ldap.inc"); +/** Access to LDAP connection */ +include_once ("../../lib/ldap.inc"); +/** Used to print status messages */ +include_once ("../../lib/status.inc"); +/** Used to create PDF files */ include_once("../../lib/pdf.inc"); -include_once("../../lib/account.inc"); +/** Access to account modules */ include_once("../../lib/modules.inc"); +/** Basic list functions */ include_once("../../lib/lists.inc"); -// used to display status messages -include_once ("../../lib/status.inc"); // start session session_save_path("../../sess"); @@ -138,7 +151,7 @@ $attr_array = array(); // list of LDAP attributes to show $desc_array = array(); // list of descriptions for the attributes $attr_string = $_SESSION["config"]->get_userlistAttributes(); $temp_array = explode(";", $attr_string); -$hash_table = $_SESSION["ldap"]->attributeUserArray(); +$hash_table = listGetAttributeUserArray(); // generate column attributes and descriptions for ($i = 0; $i < sizeof($temp_array); $i++) {