allow hiding of fields

This commit is contained in:
Roland Gruber 2009-10-03 15:46:26 +00:00
parent ceb60ad1a3
commit 44a8e8f082
1 changed files with 463 additions and 275 deletions

View File

@ -156,28 +156,37 @@ class inetOrgPerson extends baseModule {
'location' => _('Location'), 'state' => _('State'), 'officeName' => _('Office name'), 'businessCategory' => _('Business category'), 'location' => _('Location'), 'state' => _('State'), 'officeName' => _('Office name'), 'businessCategory' => _('Business category'),
'departmentNumber' => _('Department(s)')); 'departmentNumber' => _('Department(s)'));
// profile elements // profile elements
$return['profile_options'] = array( $return['profile_options'] = array();
array( if (!$this->configOptionSet('inetOrgPerson_hideLocation')) {
$return['profile_options'][] = array(
array('kind' => 'text', 'text' => _('Location') . ":"), array('kind' => 'text', 'text' => _('Location') . ":"),
array('kind' => 'input', 'name' => 'inetOrgPerson_l', 'type' => 'text', 'size' => '30', 'maxlength' => '255'), array('kind' => 'input', 'name' => 'inetOrgPerson_l', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'l')), array('kind' => 'help', 'value' => 'l'));
array( }
if (!$this->configOptionSet('inetOrgPerson_hideDepartments')) {
$return['profile_options'][] = array(
array('kind' => 'text', 'text' => _('Department(s)') . ":"), array('kind' => 'text', 'text' => _('Department(s)') . ":"),
array('kind' => 'input', 'name' => 'inetOrgPerson_departmentNumber', 'type' => 'text', 'size' => '30', 'maxlength' => '255'), array('kind' => 'input', 'name' => 'inetOrgPerson_departmentNumber', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'departmentNumber')), array('kind' => 'help', 'value' => 'departmentNumber'));
array( }
if (!$this->configOptionSet('inetOrgPerson_hideState')) {
$return['profile_options'][] = array(
array('kind' => 'text', 'text' => _('State') . ":"), array('kind' => 'text', 'text' => _('State') . ":"),
array('kind' => 'input', 'name' => 'inetOrgPerson_st', 'type' => 'text', 'size' => '30', 'maxlength' => '255'), array('kind' => 'input', 'name' => 'inetOrgPerson_st', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'st')), array('kind' => 'help', 'value' => 'st'));
array( }
if (!$this->configOptionSet('inetOrgPerson_hideJobTitle')) {
$return['profile_options'][] = array(
array('kind' => 'text', 'text' => _('Job title') . ":"), array('kind' => 'text', 'text' => _('Job title') . ":"),
array('kind' => 'input', 'name' => 'inetOrgPerson_title', 'type' => 'text', 'size' => '30', 'maxlength' => '255'), array('kind' => 'input', 'name' => 'inetOrgPerson_title', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'title')), array('kind' => 'help', 'value' => 'title'));
array( }
if (!$this->configOptionSet('inetOrgPerson_hideEmployeeType')) {
$return['profile_options'][] = array(
array('kind' => 'text', 'text' => _('Employee type') . ":"), array('kind' => 'text', 'text' => _('Employee type') . ":"),
array('kind' => 'input', 'name' => 'inetOrgPerson_employeeType', 'type' => 'text', 'size' => '30', 'maxlength' => '255'), array('kind' => 'input', 'name' => 'inetOrgPerson_employeeType', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'employeeType')) array('kind' => 'help', 'value' => 'employeeType'));
); }
// profile checks // profile checks
$return['profile_checks']['inetOrgPerson_title'] = array( $return['profile_checks']['inetOrgPerson_title'] = array(
'type' => 'ext_preg', 'type' => 'ext_preg',
@ -194,6 +203,83 @@ class inetOrgPerson extends baseModule {
'inetOrgPerson_title' => 'title', 'inetOrgPerson_title' => 'title',
'inetOrgPerson_employeeType' => 'employeeType' 'inetOrgPerson_employeeType' => 'employeeType'
); );
// configuration settings
$return['config_options']['all'] = array(
array(
array('kind' => 'text', 'text' => '<b>' . _('Hidden options') . ":</b> ", 'td' => array('valign' => 'top')),
array('kind' => 'table', 'value' => array(
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hideDescription', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Description')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideStreet', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Street')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hidePostOfficeBox', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Post office box')),
),
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hidePostalCode', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Postal code')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideLocation', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Location')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideState', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('State')),
),
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hidePostalAddress', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Postal address')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideOfficeName', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Office name')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideRoomNumber', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Room number')),
),
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hideTelephoneNumber', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Telephone number')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideHomeTelephoneNumber', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Home telephone number')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideMobileNumber', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Mobile number')),
),
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hideFaxNumber', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Fax number')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideEMailAddress', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('eMail address')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideJobTitle', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Job title')),
),
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hideCarLicense', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Car license')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideEmployeeType', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Employee type')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideBusinessCategory', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Business category')),
),
array(
array('kind' => 'input', 'name' => 'inetOrgPerson_hideDepartments', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Department(s)')),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'name' => 'inetOrgPerson_hideManager', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Manager')),
),
)),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'help', 'value' => 'hiddenOptions'),
)
);
// upload fields // upload fields
$return['upload_columns'] = array( $return['upload_columns'] = array(
array( array(
@ -208,128 +294,168 @@ class inetOrgPerson extends baseModule {
'help' => 'sn', 'help' => 'sn',
'example' => _('Miller'), 'example' => _('Miller'),
'required' => true 'required' => true
), )
array( );
if (!$this->configOptionSet('inetOrgPerson_hideDescription')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_description', 'name' => 'inetOrgPerson_description',
'description' => _('Description'), 'description' => _('Description'),
'help' => 'description', 'help' => 'description',
'example' => _('Temp, contract until december') 'example' => _('Temp, contract until december')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideJobTitle')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_title', 'name' => 'inetOrgPerson_title',
'description' => _('Job title'), 'description' => _('Job title'),
'help' => 'title', 'help' => 'title',
'example' => _('President') 'example' => _('President')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideEmployeeType')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_type', 'name' => 'inetOrgPerson_type',
'description' => _('Employee type'), 'description' => _('Employee type'),
'help' => 'employeeType', 'help' => 'employeeType',
'example' => _('Temp') 'example' => _('Temp')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideManager')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_manager', 'name' => 'inetOrgPerson_manager',
'description' => _('Manager'), 'description' => _('Manager'),
'help' => 'manager', 'help' => 'manager',
'example' => _('uid=smiller,ou=People,dc=company,dc=com') 'example' => _('uid=smiller,ou=People,dc=company,dc=com')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideBusinessCategory')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_businessCategory', 'name' => 'inetOrgPerson_businessCategory',
'description' => _('Business category'), 'description' => _('Business category'),
'help' => 'businessCategory', 'help' => 'businessCategory',
'example' => _('Administration') 'example' => _('Administration')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideStreet')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_street', 'name' => 'inetOrgPerson_street',
'description' => _('Street'), 'description' => _('Street'),
'help' => 'street', 'help' => 'street',
'example' => _('Mystreetname 42') 'example' => _('Mystreetname 42')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hidePostalCode')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_postalCode', 'name' => 'inetOrgPerson_postalCode',
'description' => _('Postal code'), 'description' => _('Postal code'),
'help' => 'postalCode', 'help' => 'postalCode',
'example' => _('GB-12345') 'example' => _('GB-12345')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hidePostalAddress')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_address', 'name' => 'inetOrgPerson_address',
'description' => _('Postal address'), 'description' => _('Postal address'),
'help' => 'postalAddress', 'help' => 'postalAddress',
'example' => _('Mycity') 'example' => _('Mycity')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hidePostOfficeBox')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_postOfficeBox', 'name' => 'inetOrgPerson_postOfficeBox',
'description' => _('Post office box'), 'description' => _('Post office box'),
'help' => 'postOfficeBox', 'help' => 'postOfficeBox',
'example' => _('12345') 'example' => _('12345')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideTelephoneNumber')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_telephone', 'name' => 'inetOrgPerson_telephone',
'description' => _('Telephone number'), 'description' => _('Telephone number'),
'help' => 'telephoneNumber', 'help' => 'telephoneNumber',
'example' => _('123-123-1234') 'example' => _('123-123-1234')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_homePhone', 'name' => 'inetOrgPerson_homePhone',
'description' => _('Home telephone number'), 'description' => _('Home telephone number'),
'help' => 'homePhone', 'help' => 'homePhone',
'example' => _('123-124-1234') 'example' => _('123-124-1234')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideMobileNumber')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_mobile', 'name' => 'inetOrgPerson_mobile',
'description' => _('Mobile number'), 'description' => _('Mobile number'),
'help' => 'mobileTelephoneNumber', 'help' => 'mobileTelephoneNumber',
'example' => _('123-123-1235') 'example' => _('123-123-1235')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideFaxNumber')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_fax', 'name' => 'inetOrgPerson_fax',
'description' => _('Fax number'), 'description' => _('Fax number'),
'help' => 'facsimileTelephoneNumber', 'help' => 'facsimileTelephoneNumber',
'example' => _('123-123-1236') 'example' => _('123-123-1236')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideEMailAddress')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_email', 'name' => 'inetOrgPerson_email',
'description' => _('eMail address'), 'description' => _('eMail address'),
'help' => 'mail', 'help' => 'mail',
'example' => _('user@company.com') 'example' => _('user@company.com')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideRoomNumber')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_roomNumber', 'name' => 'inetOrgPerson_roomNumber',
'description' => _('Room number'), 'description' => _('Room number'),
'help' => 'roomNumber', 'help' => 'roomNumber',
'example' => 'A 2.24' 'example' => 'A 2.24'
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideDepartments')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_departmentNumber', 'name' => 'inetOrgPerson_departmentNumber',
'description' => _('Department(s)'), 'description' => _('Department(s)'),
'help' => 'departmentNumber', 'help' => 'departmentNumber',
'example' => _('Administration') 'example' => _('Administration')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideLocation')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_l', 'name' => 'inetOrgPerson_l',
'description' => _('Location'), 'description' => _('Location'),
'help' => 'l', 'help' => 'l',
'example' => _('MyCity') 'example' => _('MyCity')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideState')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_st', 'name' => 'inetOrgPerson_st',
'description' => _('State'), 'description' => _('State'),
'help' => 'st', 'help' => 'st',
'example' => _('New York') 'example' => _('New York')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideCarLicense')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_carLicense', 'name' => 'inetOrgPerson_carLicense',
'description' => _('Car license'), 'description' => _('Car license'),
'help' => 'carLicense', 'help' => 'carLicense',
'example' => _('yes') 'example' => _('yes')
), );
array( }
if (!$this->configOptionSet('inetOrgPerson_hideOfficeName')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_physicalDeliveryOfficeName', 'name' => 'inetOrgPerson_physicalDeliveryOfficeName',
'description' => _('Office name'), 'description' => _('Office name'),
'help' => 'physicalDeliveryOfficeName', 'help' => 'physicalDeliveryOfficeName',
'example' => _('YourCompany, Human Resources') 'example' => _('YourCompany, Human Resources')
)
); );
}
// cn and uid for upload (only if posixAccount is not loaded) // cn and uid for upload (only if posixAccount is not loaded)
if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) {
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
@ -364,30 +490,71 @@ class inetOrgPerson extends baseModule {
} }
// available PDF fields // available PDF fields
$return['PDF_fields'] = array( $return['PDF_fields'] = array(
'description',
'host', 'host',
'givenName', 'givenName',
'sn', 'sn'
'title',
'employeeType',
'manager',
'street',
'postOfficeBox',
'postalCode',
'postalAddress',
'telephoneNumber',
'mobileTelephoneNumber',
'facimilieTelephoneNumber',
'mail',
'homePhone',
'roomNumber',
'businessCategory',
'location',
'state',
'carLicense',
'officeName',
'departmentNumber'
); );
if (!$this->configOptionSet('inetOrgPerson_hideDescription')) {
$return['PDF_fields'][] = 'description';
}
if (!$this->configOptionSet('inetOrgPerson_hideStreet')) {
$return['PDF_fields'][] = 'street';
}
if (!$this->configOptionSet('inetOrgPerson_hidePostOfficeBox')) {
$return['PDF_fields'][] = 'postOfficeBox';
}
if (!$this->configOptionSet('inetOrgPerson_hidePostalCode')) {
$return['PDF_fields'][] = 'postalCode';
}
if (!$this->configOptionSet('inetOrgPerson_hideLocation')) {
$return['PDF_fields'][] = 'location';
}
if (!$this->configOptionSet('inetOrgPerson_hideState')) {
$return['PDF_fields'][] = 'state';
}
if (!$this->configOptionSet('inetOrgPerson_hidePostalAddress')) {
$return['PDF_fields'][] = 'postalAddress';
}
if (!$this->configOptionSet('inetOrgPerson_hideOfficeName')) {
$return['PDF_fields'][] = 'officeName';
}
if (!$this->configOptionSet('inetOrgPerson_hideRoomNumber')) {
$return['PDF_fields'][] = 'roomNumber';
}
if (!$this->configOptionSet('inetOrgPerson_hideTelephoneNumber')) {
$return['PDF_fields'][] = 'telephoneNumber';
}
if (!$this->configOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
$return['PDF_fields'][] = 'homePhone';
}
if (!$this->configOptionSet('inetOrgPerson_hideMobileNumber')) {
$return['PDF_fields'][] = 'mobileTelephoneNumber';
}
if (!$this->configOptionSet('inetOrgPerson_hideFaxNumber')) {
$return['PDF_fields'][] = 'facimilieTelephoneNumber';
}
if (!$this->configOptionSet('inetOrgPerson_hideEMailAddress')) {
$return['PDF_fields'][] = 'mail';
}
if (!$this->configOptionSet('inetOrgPerson_hideJobTitle')) {
$return['PDF_fields'][] = 'title';
}
if (!$this->configOptionSet('inetOrgPerson_hideCarLicense')) {
$return['PDF_fields'][] = 'carLicense';
}
if (!$this->configOptionSet('inetOrgPerson_hideEmployeeType')) {
$return['PDF_fields'][] = 'employeeType';
}
if (!$this->configOptionSet('inetOrgPerson_hideBusinessCategory')) {
$return['PDF_fields'][] = 'businessCategory';
}
if (!$this->configOptionSet('inetOrgPerson_hideDepartments')) {
$return['PDF_fields'][] = 'departmentNumber';
}
if (!$this->configOptionSet('inetOrgPerson_hideManager')) {
$return['PDF_fields'][] = 'manager';
}
if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) {
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
@ -397,7 +564,6 @@ class inetOrgPerson extends baseModule {
} }
// help Entries // help Entries
$return['help'] = array ( $return['help'] = array (
'user' => array (
'description' => array ( 'description' => array (
"Headline" => _("Description"), "Headline" => _("Description"),
"Text" => _("User description. If left empty sur- and give name will be used.") "Text" => _("User description. If left empty sur- and give name will be used.")
@ -505,7 +671,10 @@ class inetOrgPerson extends baseModule {
'departmentNumber' => array( 'departmentNumber' => array(
"Headline" => _("Department(s)"), "Headline" => _("Department(s)"),
"Text" => _("Here you can enter the user's department(s). Multiple entries are separated by semicolons.") "Text" => _("Here you can enter the user's department(s). Multiple entries are separated by semicolons.")
) ),
'hiddenOptions' => array(
"Headline" => _("Hidden options"),
"Text" => _("The selected options will not be managed inside LAM. You can use this to reduce the number of displayed input fields.")
) )
); );
@ -1794,6 +1963,25 @@ class inetOrgPerson extends baseModule {
return $return; return $return;
} }
/**
* Returns if the given configuration option is set.
* This function returns false if the configuration options cannot be read.
*
* @param String $optionName name of the option
* @return boolean true if option is set
*/
private function configOptionSet($optionName) {
//print_r($this->moduleSettings);die;
// abort if configuration is not available
if (!isset($this->moduleSettings) || !is_array($this->moduleSettings)) {
return false;
}
if (isset($this->moduleSettings[$optionName][0]) && ($this->moduleSettings[$optionName][0] == 'true')) {
return true;
}
return false;
}
} }
?> ?>