added self service fields

This commit is contained in:
Roland Gruber 2006-07-16 17:15:37 +00:00
parent 240e9a1990
commit a70d24afce
3 changed files with 44 additions and 1 deletions

View File

@ -665,6 +665,16 @@ class baseModule {
else return array();
}
/**
* Returns a list of possible input fields and their descriptions
* Format: array(<field identifier> => <field description>)
*
* @return array fields
*/
function getSelfServiceFields() {
if (isset($this->meta['selfServiceFieldSettings']) && is_array($this->meta['selfServiceFieldSettings'])) return $this->meta['selfServiceFieldSettings'];
else return array();
}
}

View File

@ -108,6 +108,11 @@ class inetOrgPerson extends baseModule {
'sn', 'userPassword', 'description');
// self service search attributes
$return['selfServiceSearchAttributes'] = array('uid', 'mail', 'cn', 'surname', 'givenName');
// self service field settings
$return['selfServiceFieldSettings'] = array('firstName' => _('First name'), 'lastName' => _('Last name'),
'mail' => _('eMail address'), 'telephoneNumber' => _('Telephone number'), 'mobile' => _('Mobile number'),
'faxNumber' => _('Fax number'), 'street' => _('Street'), 'postalAddress' => _('Postal address'),
'postalCode' => _('Postal code'), 'postOfficeBox' => _('Post office box'));
// profile elements
$return['profile_options'] = array(
array(

View File

@ -54,6 +54,24 @@ function getSelfServiceSearchAttributes($scope) {
}
/**
* Returns the field settings for the self service.
*
* @param string $scope account type
* @return array settings
*/
function getSelfServiceFieldSettings($scope) {
$return = array();
$modules = getAvailableModules($scope);
for ($i = 0; $i < sizeof($modules); $i++) {
$m = new $modules[$i]($scope);
$settings = $m->getSelfServiceFields();
if (sizeof($settings) > 0) $return[$modules[$i]] = $settings;
}
return $return;
}
/**
* Returns a list of all available self service profiles (without .conf)
*
@ -87,7 +105,6 @@ function loadSelfServiceProfile($name, $scope) {
if (!eregi("^[0-9a-z _-]+$", $name)) return false;
if (!eregi("^[0-9a-z _-]+$", $scope)) return false;
$profile = new selfServiceProfile();
$settings = new selfServiceProfile();
$file = substr(__FILE__, 0, strlen(__FILE__) - 20) . "/config/selfService/" . $name . "." . $scope;
if (is_file($file) === True) {
$file = @fopen($file, "r");
@ -167,6 +184,15 @@ class selfServiceProfile {
/** describing text for search attribute */
var $loginAttributeText;
/** describing text for self service main page */
var $mainPageText;
/** input fields
* Format: array(<module> => array(array('name' => <group name>, 'fields' => array(<field1>, <field2>))))
*
*/
var $inputFields;
/**
* Constructor
*
@ -181,6 +207,8 @@ class selfServiceProfile {
$this->searchAttribute = "uid";
$this->loginCaption = "Welcome to LAM self service. Please enter your user name and password.";
$this->loginAttributeText = "User name";
$this->mainPageText = "<h1>LAM self service</h1>\nHere you can change your personal settings.";
$this->inputFields = array();
}
}