From a70d24afcee4ab3c1e0c0338f3ac79232c4c5ecc Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 16 Jul 2006 17:15:37 +0000 Subject: [PATCH] added self service fields --- lam/lib/baseModule.inc | 10 ++++++++++ lam/lib/modules/inetOrgPerson.inc | 5 +++++ lam/lib/selfService.inc | 30 +++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index 9581db05..9f1ec441 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -665,6 +665,16 @@ class baseModule { else return array(); } + /** + * Returns a list of possible input fields and their descriptions + * Format: array( => ) + * + * @return array fields + */ + function getSelfServiceFields() { + if (isset($this->meta['selfServiceFieldSettings']) && is_array($this->meta['selfServiceFieldSettings'])) return $this->meta['selfServiceFieldSettings']; + else return array(); + } } diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 7a844547..b08ae01e 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -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( diff --git a/lam/lib/selfService.inc b/lam/lib/selfService.inc index 3fbacbe9..bf1e200b 100644 --- a/lam/lib/selfService.inc +++ b/lam/lib/selfService.inc @@ -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( => array(array('name' => , 'fields' => array(, )))) + * + */ + 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 = "

LAM self service

\nHere you can change your personal settings."; + $this->inputFields = array(); } }