help is now using an instance of the appropriate module and accesses help als meta information

This commit is contained in:
duergner 2004-09-09 07:10:14 +00:00
parent 6b5f602719
commit 73fa74620d
13 changed files with 32 additions and 183 deletions

View File

@ -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;

View File

@ -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 "<td";
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
echo ">\n";
echo "<a href=../help.php?module=$module&item=". $input[$i][$j]['value'] . " target=\"help\" tabindex=$z>" . _('Help') . "</a></td>\n";
echo "<a href=../help.php?module=$module&item=". $input[$i][$j]['value'] . "&scope=" . $this->type . " target=\"help\" tabindex=$z>" . _('Help') . "</a></td>\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 "<pre>moduleName: $moduleName\n</pre>";
$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);
}
}
?>

View File

@ -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.

View File

@ -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.

View File

@ -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;
}

View File

@ -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.

View File

@ -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.

View File

@ -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"),

View File

@ -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"),

View File

@ -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.

View File

@ -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"),

View File

@ -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.

View File

@ -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']);