From 73fa74620da3f2bc59f113c7c7582710af795118 Mon Sep 17 00:00:00 2001 From: duergner Date: Thu, 9 Sep 2004 07:10:14 +0000 Subject: [PATCH] help is now using an instance of the appropriate module and accesses help als meta information --- lam/lib/baseModule.inc | 8 +++-- lam/lib/modules.inc | 25 +++++++++------ lam/lib/modules/account.inc | 11 ------- lam/lib/modules/inetOrgPerson.inc | 44 --------------------------- lam/lib/modules/main.inc | 6 ++++ lam/lib/modules/posixAccount.inc | 38 ----------------------- lam/lib/modules/posixGroup.inc | 33 -------------------- lam/lib/modules/quota.inc | 2 +- lam/lib/modules/sambaAccount.inc | 2 +- lam/lib/modules/sambaGroupMapping.inc | 17 ----------- lam/lib/modules/sambaSamAccount.inc | 2 +- lam/lib/modules/shadowAccount.inc | 23 -------------- lam/templates/help.php | 4 +-- 13 files changed, 32 insertions(+), 183 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index bc48b107..a8f22011 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -394,15 +394,17 @@ class baseModule { * This function return the help entry array for a specific help id. Normally this->meta can be used. * * @param string $id The id string for the help entry needed. + * @param string $scope The scope for which the help entry should be retrieved. May be empty when + * there is now difference of the help entry depending on the actual scope. * * @return array The desired help entry. */ - function get_help($id) { + function get_help($id,$scope) { if(isset($this->meta['help'][$id])) { return $this->meta['help'][$id]; } - elseif(isset($this->meta['help'][$this->scope][$id])) { - return $this->meta['help'][$this->scope][$id]; + elseif(isset($this->meta['help'][$scope][$id])) { + return $this->meta['help'][$scope][$id]; } else { return false; diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index fe2546d5..ab0b9beb 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -313,8 +313,9 @@ function checkConfigOptions($scopes, $options) { * @param string $module module name * @return array help entry */ -function getHelp($module,$helpID) { - return call_user_func(array($module, "get_help"), $helpID); +function getHelp($module,$helpID,$scope='') { + $moduleObject = new $module((($scope != '') ? $scope : 'none')); + return $moduleObject->get_help($helpID,$scope); } /** @@ -758,7 +759,7 @@ class accountContainer { echo "\n"; - echo "" . _('Help') . "\n"; + echo "" . _('Help') . "\n"; $z++; break; case 'message': @@ -1363,6 +1364,13 @@ class accountContainer { return $output_array; } + /** + * + * + * @param string account_type + * + * @return + */ function get_pdfEntries($acount_type) { $return = array(); while(($current = current($this->module)) != null) { @@ -1373,11 +1381,14 @@ class accountContainer { return $return; } - // Dummy implementation + /** + * + * + * @return + */ function getAvailablePDFFields() { $return = array(); foreach($this->module as $moduleName => $module) { - //echo "
moduleName: $moduleName\n
"; $return[$moduleName] = $module->get_pdfFields($this->type); } $return['main'] = array( 'dn'); @@ -1405,9 +1416,5 @@ class accountContainer { } return $return; } - - function getHelp($module,$id) { - return $this->module[$module]->get_help($id); - } } ?> diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index ba16023d..6c1db6bf 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -103,17 +103,6 @@ class account extends baseModule { return array('attributes'); } - /* - */ - /*function get_help($id) { - switch ($id) { - case "description": - return array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Host description. If left empty host name will be used.")); - break; - } - return false; - }*/ - /* This function returns all ldap attributes * which are part of account and returns * also their values. diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 243d702a..10369ad8 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -194,50 +194,6 @@ class inetOrgPerson extends baseModule { return array('attributes'); } - /* - */ - /*function get_help($id) { - switch ($id) { - case 'description': - return array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Host description. If left empty host name will be used.")); - break; - case 'title': - return array ("ext" => "FALSE", "Headline" => _("Title"), "Text" => _("Title of user, Mr., Ms., ...")); - break; - case 'givenName': - return array ("ext" => "FALSE", "Headline" => _("Given name"), "Text" => _("Given name of user. Only letters, - and spaces are allowed.")); - break; - case 'sn': - return array ("ext" => "FALSE", "Headline" => _("Surname"), "Text" => _("Surname of user. Only letters, - and spaces are allowed.")); - break; - case 'employeeType': - return array ("ext" => "FALSE", "Headline" => _("Employee type"), "Text" => _("Employee type: worker, student, nurse, ...")); - break; - case 'street': - return array ("ext" => "FALSE", "Headline" => _("Street"), "Text" => _("Street")); - break; - case 'postalCode': - return array ("ext" => "FALSE", "Headline" => _("Postal code"), "Text" => _("Postal code")); - break; - case 'postalAddress': - return array ("ext" => "FALSE", "Headline" => _("Postal address"), "Text" => _("Postal address, city")); - break; - case 'telephoneNumber': - return array ("ext" => "FALSE", "Headline" => _("Telephone number"), "Text" => _("Telephone number")); - break; - case 'mobileTelephoneNumber': - return array ("ext" => "FALSE", "Headline" => _("Mobile number"), "Text" => _("Mobile number")); - break; - case 'facsimileTelephoneNumber': - return array ("ext" => "FALSE", "Headline" => _("Fax number"), "Text" => _("Fax number")); - break; - case 'mail': - return array ("ext" => "FALSE", "Headline" => _("eMail address"), "Text" => _("eMail address")); - break; - } - return false; - }*/ - /* This function returns all ldap attributes * which are part of inetOrgPerson and returns * also their values. diff --git a/lam/lib/modules/main.inc b/lam/lib/modules/main.inc index 55c3c6f7..e87f7f5d 100644 --- a/lam/lib/modules/main.inc +++ b/lam/lib/modules/main.inc @@ -56,6 +56,12 @@ class main extends baseModule { $return["account_types"] = array(); // alias name $return["alias"] = _('Main'); + // help Entries + $return['help'] = array ( 'user' => array( 'suffix' => array ("ext" => "FALSE", "Headline" => _("Suffix"), "Text" => _("Position in ldap-tree where the user should be created."))), + 'group' => array( 'suffix' => array ("ext" => "FALSE", "Headline" => _("Suffix"), "Text" => _("Position in ldap-tree where the group should be created."))), + 'host' => array( 'suffix' => array ("ext" => "FALSE", "Headline" => _("Suffix"), "Text" => _("Position in ldap-tree where the host should be created."))), + 'selectLoadProfile' => array ("ext" => "FALSE", "Headline" => _("Load profile"), "Text" => _("You can select a previous defined profile here. This will set all fields to the profile values.")), + 'saveProfile' => array ("ext" => "FALSE", "Headline" => _("Save profile"), "Text" => _("This will make a profile of the current account. The saved values are the same as in the profile editor. Profile names may contain the letters a-z, 0-9 and -_."))); return $return; } diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index d21f8641..5753fcc8 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -261,44 +261,6 @@ class posixAccount extends baseModule { return array('attributes', 'group'); } - /* - */ - /*function get_help($id) { - switch ($id) { - case 'uid': - return array ("ext" => "FALSE", "Headline" => _("Username"), "Text" => _("Username of the user who should be created. Valid characters are: a-z,0-9, .-_. Lam does not allow a number as first character because useradd also does not allow it. Lam does not allow capital letters A-Z because it can cause several problems. If username is already used username will be expanded with a number. The next free number will be used. Warning: Older systems have problems with usernames longer than 8 characters. You can not log in to Windows if username is longer than 16 characters.")); - break; - case 'uidNumber': - return array ("ext" => "FALSE", "Headline" => _("UID number"), "Text" => _("If empty UID number will be generated automaticly.")); - break; - case 'gecos': - return array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("User description. If left empty sur- and give name will be used.")); - break; - case 'gidNumber': - return array ("ext" => "FALSE", "Headline" => _("Primary group"), "Text" => _("The Primary Group the user should be member of.")); - break; - case 'addgroup': - return array ("ext" => "FALSE", "Headline" => _("Additional groups"), "Text" => _("Hold the CTRL-key to (de)select multiple groups."). ' '. _("Can be left empty.")); - break; - case 'homeDirectory': - return array ("ext" => "FALSE", "Headline" => _("Home directory"), "Text" => _("$user and $group are replaced with username or primary groupname.")); - break;*/ - /*case 'userPassword': - return ; - break;*/ - /*case 'userPassword_no': - return array ("ext" => "FALSE", "Headline" => _("Use no password"), "Text" => _("If checked no password will be used.")); - break;*/ - /*case 'userPassword_lock': - return ; - break;*/ - /*case 'loginShell': - return array ("ext" => "FALSE", "Headline" => _("Login shell"), "Text" => _("To disable login use /bin/false. List of shells is read from lam/config/shells")); - break; - } - return false; - }*/ - /* This function returns all ldap attributes * which are part of posixAccount and returns * also their values. diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 24826ce0..921d4aaa 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -257,39 +257,6 @@ class posixGroup extends baseModule { return array('attributes', 'user'); } - /* - */ - /*function get_help($id) { - switch ($id) { - case "description": - return array ("ext" => "FALSE", "Headline" => _("Description"), - "Text" => _("Host Description.")); - break; - case 'cn': - return array ("ext" => "FALSE", "Headline" => _("Groupname"), "Text" => _("Group name of the group which should be created. Valid characters are: a-z,0-9, .-_. Lam does not allow a number as first character because groupadd also does not allow it. Lam does not allow capital letters A-Z because it can cause several problems. If groupname is already used groupname will be expanded with a number. The next free number will be used.")); - break; - case 'gidNumber': - return array ("ext" => "FALSE", "Headline" => _("GID number"), "Text" => _("If empty GID number will be generated automaticly depending on your configuration settings.")); - break; - case 'description': - return array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Group description. If left empty group name will be used.")); - break; - case 'adduser': - return array ("ext" => "FALSE", "Headline" => _("Group members"), "Text" => _("Users also being member of the current group."). ' '. _("Can be left empty.")); - break;*/ - /*case 'userPassword': - return ; - break;*/ - /*case 'userPassword_no': - return array ("ext" => "FALSE", "Headline" => _("Use no password"), "Text" => _("If checked no password will be used.")); - break;*/ - /*case 'userPassword_lock': - return ; - break;*/ - /*} - return false; - }*/ - /* This function returns all ldap attributes * which are part of posixGroup and returns * also their values. diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index e1f5c401..fbd7aa11 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -130,7 +130,7 @@ class quota extends baseModule { /* */ - function get_help($id) { + function get_help($id,$scope) { switch ($id) { case "description": return array ("ext" => "FALSE", "Headline" => _("Description"), diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index f71e061e..f24c3969 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -276,7 +276,7 @@ class sambaAccount extends baseModule { /* */ - function get_help($id) { + function get_help($id,$scope) { switch ($id) { case "description": return array ("ext" => "FALSE", "Headline" => _("Description"), diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 919b3e47..f9e7ed80 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -162,23 +162,6 @@ class sambaGroupMapping extends baseModule { return array('attributes'); } - /* - */ - /*function get_help($id) { - switch ($id) { - case 'displayName': - return array ("ext" => "FALSE", "Headline" => _("Display name"), "Text" => _("Windows clients will show display name as group description.")); - break; - case 'sambaSID': - return array ("ext" => "FALSE", "Headline" => _("Windows groupname"), "Text" => _("If you want to use a well known RID you can selcet a well known group.")); - break; - case 'sambaDomainName': - return array ("ext" => "FALSE", "Headline" => _("Domain"), "Text" => _("Windows-Domain of group."). ' '. _("Can be left empty.")); - break; - } - return false; - }*/ - /* This function returns all ldap attributes * which are part of sambaGroupMapping and returns * also their values. diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 17232587..8df02ea5 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -208,7 +208,7 @@ class sambaSamAccount extends baseModule { /* */ - function get_help($id) { + function get_help($id,$scope) { switch ($id) { case "description": return array ("ext" => "FALSE", "Headline" => _("Description"), diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 59f648c9..a6346f17 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -207,29 +207,6 @@ class shadowAccount extends baseModule { return array('attributes'); } - /* - */ - /*function get_help($id) { - switch ($id) { - case 'shadowWarning': - return array ("ext" => "FALSE", "Headline" => _("Password warn"), "Text" => _("Days before password is to expire that user is warned of pending password expiration. If set value must be 0<."). ' '. _("Can be left empty.")); - break; - case 'shadowInactive': - return array ("ext" => "FALSE", "Headline" => _("Password expire"), "Text" => _("Number of days a user can login even his password has expired. -1=always."). ' '. _("Can be left empty.")); - break; - case 'shadowMin': - return array ("ext" => "FALSE", "Headline" => _("Minimum password age"), "Text" => _("Number of days a user has to wait until he\'s allowed to change his password again. If set value must be 0<."). ' '. _("Can be left empty.")); - break; - case 'shadowMax': - return array ("ext" => "FALSE", "Headline" => _("Maximum password age"), "Text" => _("Number of days after a user has to change his password again. If set value must be 0<."). ' '. _("Can be left empty.")); - break; - case 'shadowExpire': - return array ("ext" => "FALSE", "Headline" => _("Expire date"), "Text" => _("Account expire date. Format: DD-MM-YYYY")); - break; - } - return false; - }*/ - /* This function returns all ldap attributes * which are part of shadowAccount and returns * also their values. diff --git a/lam/templates/help.php b/lam/templates/help.php index 9e477cbe..e581488c 100644 --- a/lam/templates/help.php +++ b/lam/templates/help.php @@ -97,8 +97,8 @@ $helpEntry = array(); if(isset($_GET['module'])) { include_once("../lib/modules.inc"); - //$helpEntry = getHelp($_GET['module'],$_GET['item']); - $helpEntry = $_SESSION['account']->getHelp($_GET['module'],$_GET['item']); + $helpEntry = getHelp($_GET['module'],$_GET['item'],$_GET['scope']); + //$helpEntry = $_SESSION['account']->getHelp($_GET['module'],$_GET['item']); if(!$helpEntry) { $variables = array(); array_push($variables,$_GET['item']);