From 550c1360630683945c958342a4416b0c6dd5fa2a Mon Sep 17 00:00:00 2001 From: duergner Date: Wed, 8 Sep 2004 18:26:00 +0000 Subject: [PATCH] changed help to use the accountContainer object in session --- lam/lib/baseModule.inc | 3 +++ lam/lib/modules.inc | 4 ++++ lam/lib/modules/account.inc | 4 ++-- lam/lib/modules/inetOrgPerson.inc | 4 ++-- lam/lib/modules/posixAccount.inc | 29 +++++++++++++++------------ lam/lib/modules/posixGroup.inc | 12 +++++------ lam/lib/modules/sambaGroupMapping.inc | 4 ++-- lam/lib/modules/shadowAccount.inc | 4 ++-- lam/templates/help.php | 3 ++- 9 files changed, 39 insertions(+), 28 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index 60aca7dd..bc48b107 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -401,6 +401,9 @@ class baseModule { 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]; + } else { return false; } diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 575c6f16..0b47f700 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -1360,5 +1360,9 @@ class accountContainer { $return['main'] = array( 'dn'); 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 1f12c8b7..ba16023d 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -105,14 +105,14 @@ class account extends baseModule { /* */ - function get_help($id) { + /*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 diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 36af8915..243d702a 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -196,7 +196,7 @@ class inetOrgPerson extends baseModule { /* */ - function get_help($id) { + /*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.")); @@ -236,7 +236,7 @@ class inetOrgPerson extends baseModule { break; } return false; - } + }*/ /* This function returns all ldap attributes * which are part of inetOrgPerson and returns diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 08bacfb5..d21f8641 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -149,10 +149,13 @@ class posixAccount extends baseModule { 'userPassword', 'loginShell'); // help Entries - $return['help'] = array ( 'uid' => 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.")), + $return['help'] = array ( 'user' => array( 'uid' => 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.")), + 'gecos' => array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("User description. If left empty sur- and give name will be used.")), + 'gidNumber' => array ("ext" => "FALSE", "Headline" => _("Primary group"), "Text" => _("The Primary Group the user should be member of."))), + 'host' => array( 'uid' => array ("ext" => "FALSE", "Headline" => _("Host name"), "Text" => _("Host name of the host which 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. Hostnames are always ending with $. If last character is not $ it will be added. If hostname is already used hostname will be expanded with a number. The next free number will be used.")), + 'gecos' => array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Host description. If left empty host name will be used.")), + 'gidNumber' => array ("ext" => "FALSE", "Headline" => _("Primary group"), "Text" => _("The Primary group the host should be member of."))), 'uidNumber' => array ("ext" => "FALSE", "Headline" => _("UID number"), "Text" => _("If empty UID number will be generated automaticly.")), - 'gecos' => array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("User description. If left empty sur- and give name will be used.")), - 'gidNumber' => array ("ext" => "FALSE", "Headline" => _("Primary group"), "Text" => _("The Primary Group the user should be member of.")), 'addgroup' => array ("ext" => "FALSE", "Headline" => _("Additional groups"), "Text" => _("Hold the CTRL-key to (de)select multiple groups."). ' '. _("Can be left empty.")), 'homeDirectory' => array ("ext" => "FALSE", "Headline" => _("Home directory"), "Text" => _("$user and $group are replaced with username or primary groupname.")), /*'userPassword' =>*/ @@ -260,7 +263,7 @@ class posixAccount extends baseModule { /* */ - function get_help($id) { + /*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.")); @@ -279,22 +282,22 @@ class posixAccount extends baseModule { break; case 'homeDirectory': return array ("ext" => "FALSE", "Headline" => _("Home directory"), "Text" => _("$user and $group are replaced with username or primary groupname.")); - break; + break;*/ /*case 'userPassword': - return ;*/ - break; - case 'userPassword_no': + return ; + break;*/ + /*case 'userPassword_no': return array ("ext" => "FALSE", "Headline" => _("Use no password"), "Text" => _("If checked no password will be used.")); - break; + break;*/ /*case 'userPassword_lock': - return ;*/ - break; - case 'loginShell': + 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 diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index ae937c89..24826ce0 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -259,7 +259,7 @@ class posixGroup extends baseModule { /* */ - function get_help($id) { + /*function get_help($id) { switch ($id) { case "description": return array ("ext" => "FALSE", "Headline" => _("Description"), @@ -276,19 +276,19 @@ class posixGroup extends baseModule { break; case 'adduser': return array ("ext" => "FALSE", "Headline" => _("Group members"), "Text" => _("Users also being member of the current group."). ' '. _("Can be left empty.")); - break; + break;*/ /*case 'userPassword': return ; break;*/ - case 'userPassword_no': + /*case 'userPassword_no': return array ("ext" => "FALSE", "Headline" => _("Use no password"), "Text" => _("If checked no password will be used.")); - break; + break;*/ /*case 'userPassword_lock': return ; break;*/ - } + /*} return false; - } + }*/ /* This function returns all ldap attributes * which are part of posixGroup and returns diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 4708779e..919b3e47 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -164,7 +164,7 @@ class sambaGroupMapping extends baseModule { /* */ - function get_help($id) { + /*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.")); @@ -177,7 +177,7 @@ class sambaGroupMapping extends baseModule { break; } return false; - } + }*/ /* This function returns all ldap attributes * which are part of sambaGroupMapping and returns diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index cb9a88c4..59f648c9 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -209,7 +209,7 @@ class shadowAccount extends baseModule { /* */ - function get_help($id) { + /*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.")); @@ -228,7 +228,7 @@ class shadowAccount extends baseModule { break; } return false; - } + }*/ /* This function returns all ldap attributes * which are part of shadowAccount and returns diff --git a/lam/templates/help.php b/lam/templates/help.php index 608fd7c9..9e477cbe 100644 --- a/lam/templates/help.php +++ b/lam/templates/help.php @@ -97,7 +97,8 @@ $helpEntry = array(); if(isset($_GET['module'])) { include_once("../lib/modules.inc"); - $helpEntry = getHelp($_GET['module'],$_GET['item']); + //$helpEntry = getHelp($_GET['module'],$_GET['item']); + $helpEntry = $_SESSION['account']->getHelp($_GET['module'],$_GET['item']); if(!$helpEntry) { $variables = array(); array_push($variables,$_GET['item']);