responsive

This commit is contained in:
Roland Gruber 2019-09-01 10:52:03 +02:00
parent b21b3657fb
commit 065232505e
2 changed files with 78 additions and 150 deletions

View File

@ -78,11 +78,11 @@ class inetLocalMailRecipient extends baseModule {
"Headline" => _("Routing address"), 'attr' => 'mailRoutingAddress', "Headline" => _("Routing address"), 'attr' => 'mailRoutingAddress',
"Text" => _("This is the target email address for the user's mails.") "Text" => _("This is the target email address for the user's mails.")
), ),
'localAdr' => array( 'mailLocalAddress' => array(
"Headline" => _("Local address"), 'attr' => 'mailLocalAddress', "Headline" => _("Local address"), 'attr' => 'mailLocalAddress',
"Text" => _("This is one of the users public email addresses.") "Text" => _("This is one of the users public email addresses.")
), ),
'localAdrList' => array( 'mailLocalAddressList' => array(
"Headline" => _("Local address list"), 'attr' => 'mailLocalAddress', "Headline" => _("Local address list"), 'attr' => 'mailLocalAddress',
"Text" => _("This is a comma separated list of the users public email addresses.") "Text" => _("This is a comma separated list of the users public email addresses.")
), ),
@ -94,7 +94,7 @@ class inetLocalMailRecipient extends baseModule {
$profileContainer = new htmlResponsiveRow(); $profileContainer = new htmlResponsiveRow();
$profileContainer->add(new htmlResponsiveInputCheckbox('inetLocalMailRecipient_addExt', false, _('Automatically add this extension'), 'autoAdd'), 12); $profileContainer->add(new htmlResponsiveInputCheckbox('inetLocalMailRecipient_addExt', false, _('Automatically add this extension'), 'autoAdd'), 12);
$profileContainer->add(new htmlResponsiveInputField(_('Routing address'), 'inetLocalMailRecipient_mailRoutingAddress', null, 'mailRoutingAddress'), 12); $profileContainer->add(new htmlResponsiveInputField(_('Routing address'), 'inetLocalMailRecipient_mailRoutingAddress', null, 'mailRoutingAddress'), 12);
$profileContainer->add(new htmlResponsiveInputField(_('Local address'), 'inetLocalMailRecipient_mailLocalAddress', null, 'localAdr'), 12); $profileContainer->add(new htmlResponsiveInputField(_('Local address'), 'inetLocalMailRecipient_mailLocalAddress', null, 'mailLocalAddress'), 12);
$profileContainer->add(new htmlResponsiveInputField(_('Mail server'), 'inetLocalMailRecipient_host', null, 'mailHost'), 12); $profileContainer->add(new htmlResponsiveInputField(_('Mail server'), 'inetLocalMailRecipient_host', null, 'mailHost'), 12);
$return['profile_options'] = $profileContainer; $return['profile_options'] = $profileContainer;
// profile checks // profile checks
@ -117,9 +117,9 @@ class inetLocalMailRecipient extends baseModule {
'example' => _('smiller@otherdomain.org') 'example' => _('smiller@otherdomain.org')
), ),
array( array(
'name' => 'inetLocalMailRecipient_localAdr', 'name' => 'inetLocalMailRecipient_mailLocalAddress',
'description' => _('Local address list'), 'description' => _('Local address list'),
'help' => 'localAdrList', 'help' => 'mailLocalAddressList',
'example' => _('smiller@yourdomain.org') 'example' => _('smiller@yourdomain.org')
), ),
array( array(
@ -132,7 +132,7 @@ class inetLocalMailRecipient extends baseModule {
// available PDF fields // available PDF fields
$return['PDF_fields'] = array( $return['PDF_fields'] = array(
'routingAdr' => _('Routing address'), 'routingAdr' => _('Routing address'),
'localAdr' => _('Local address list'), 'mailLocalAddress' => _('Local address list'),
'host' => _('Mail server') 'host' => _('Mail server')
); );
// self service // self service
@ -149,8 +149,8 @@ class inetLocalMailRecipient extends baseModule {
function load_Messages() { function load_Messages() {
$this->messages['mailRoutingAddress'][0] = array('ERROR', 'Routing address is invalid!'); // third array value is set dynamically $this->messages['mailRoutingAddress'][0] = array('ERROR', 'Routing address is invalid!'); // third array value is set dynamically
$this->messages['mailRoutingAddress'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_routingAdr', 'Routing address is invalid!'); $this->messages['mailRoutingAddress'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_routingAdr', 'Routing address is invalid!');
$this->messages['localAdr'][0] = array('ERROR', 'Local address is invalid!'); // third array value is set dynamically $this->messages['mailLocalAddress'][0] = array('ERROR', 'Local address is invalid!'); // third array value is set dynamically
$this->messages['localAdr'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_localAdr', 'Local address is invalid!'); $this->messages['mailLocalAddress'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_mailLocalAddress', 'Local address is invalid!');
$this->messages['mailHost'][0] = array('ERROR', 'Mail server is invalid!'); // third array value is set dynamically $this->messages['mailHost'][0] = array('ERROR', 'Mail server is invalid!'); // third array value is set dynamically
$this->messages['mailHost'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_server', 'Mail server is invalid!'); $this->messages['mailHost'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_server', 'Mail server is invalid!');
} }
@ -177,43 +177,21 @@ class inetLocalMailRecipient extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
if (in_array('inetLocalMailRecipient', $this->attributes['objectClass'])) { if (in_array('inetLocalMailRecipient', $this->attributes['objectClass'])) {
// mail routing address // mail routing address
$this->addSimpleInputTextField($return, 'mailRoutingAddress', _('Routing address')); $this->addSimpleInputTextField($return, 'mailRoutingAddress', _('Routing address'));
// mail server // mail server
$this->addSimpleInputTextField($return, 'mailHost', _('Mail server')); $this->addSimpleInputTextField($return, 'mailHost', _('Mail server'));
// list current local addresses // list current local addresses
$localAdresses = array(); $this->addMultiValueInputTextField($return, 'mailLocalAddress', _('Local address'));
if (isset($this->attributes['mailLocalAddress'])) $localAdresses = $this->attributes['mailLocalAddress'];
for ($i = 0; $i < sizeof($localAdresses); $i++) {
if ($i == 0) {
$return->addElement(new htmlOutputText(_('Local address')));
}
else {
$return->addElement(new htmlOutputText(''));
}
$return->addElement(new htmlInputField('localAdr' . $i, $localAdresses[$i]));
$return->addElement(new htmlButton('delAdr' . $i, 'del.png', true));
if ($i == 0) {
$return->addElement(new htmlHelpLink('localAdr'));
}
$return->addNewLine();
}
// input box for new local addresses
$return->addElement(new htmlOutputText(_('New local address')));
$return->addElement(new htmlInputField('localAdr', ''));
$return->addElement(new htmlButton('addAdr', 'add.png', true));
$return->addElement(new htmlHelpLink('localAdr'));
$return->addElement(new htmlHiddenInput('adr_number', sizeof($localAdresses)));
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addVerticalSpacer('2rem');
$deleteButton = new htmlButton('remObjectClass', _('Remove mail routing extension')); $deleteButton = new htmlButton('remObjectClass', _('Remove mail routing extension'));
$deleteButton->colspan = 3; $return->add($deleteButton, 12, 12, 12, 'text-center');
$return->addElement($deleteButton);
} }
else { else {
$return->addElement(new htmlButton('addObjectClass', _('Add mail routing extension'))); $return->add(new htmlButton('addObjectClass', _('Add mail routing extension')), 12);
} }
return $return; return $return;
} }
@ -242,7 +220,7 @@ class inetLocalMailRecipient extends baseModule {
return array(); return array();
} }
$errors = array(); $errors = array();
$this->getAccountContainer()->replaceWildcardsInPOST(array('localAdr', 'mailRoutingAddress')); $this->getAccountContainer()->replaceWildcardsInPOST(array('mailLocalAddress', 'mailRoutingAddress'));
$this->attributes['mailRoutingAddress'] = array(); $this->attributes['mailRoutingAddress'] = array();
$this->attributes['mailLocalAddress'] = array(); $this->attributes['mailLocalAddress'] = array();
$this->attributes['mailHost'] = array(); $this->attributes['mailHost'] = array();
@ -270,39 +248,7 @@ class inetLocalMailRecipient extends baseModule {
$errors[] = $message; $errors[] = $message;
} }
} }
// check old local addresses $this->processMultiValueInputTextField('mailLocalAddress', $errors, 'mailLocalAddress');
if (isset($_POST['adr_number'])) {
for ($i = 0; $i < $_POST['adr_number']; $i++) {
if (isset($_POST['delAdr' . $i])) continue;
if (isset($_POST['localAdr' . $i]) && ($_POST['localAdr' . $i] != "")) {
// check if address has correct format
if (!get_preg($_POST['localAdr' . $i], 'mailLocalAddress')) {
$message = $this->messages['localAdr'][0];
$message[] = $_POST['localAdr' . $i];
$errors[] = $message;
}
$this->attributes['mailLocalAddress'][] = $_POST['localAdr' . $i];
}
}
}
// check new local address
if (isset($_POST['localAdr']) && ($_POST['localAdr'] != "")) {
// check if address has correct format
if (get_preg($_POST['localAdr'], 'mailLocalAddress')) {
// check if new address is not already in database
$data = searchLDAPByAttribute('mailLocalAddress', $_POST['localAdr'], 'inetLocalMailRecipient', array('dn'), array($this->get_scope()));
if (sizeof($data) > 0) {
$errors[] = array('WARN', _('This mail address is already in use:') . " " . $_POST['localAdr'], $data[0]['dn']);
}
$this->attributes['mailLocalAddress'][] = $_POST['localAdr'];
}
else {
$message = $this->messages['localAdr'][0];
$message[] = $_POST['localAdr'];
$errors[] = $message;
}
}
$this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']);
return $errors; return $errors;
} }
@ -334,9 +280,11 @@ class inetLocalMailRecipient extends baseModule {
$messages = array(); $messages = array();
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
// add object class // add object class
if (!in_array("inetLocalMailRecipient", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "inetLocalMailRecipient"; if (!in_array("inetLocalMailRecipient", $partialAccounts[$i]['objectClass'])) {
$partialAccounts[$i]['objectClass'][] = "inetLocalMailRecipient";
}
// add local addresses // add local addresses
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_localAdr', 'mailLocalAddress', 'mailLocalAddress', $this->messages['localAdr'][1], $messages, '/,[ ]*/'); $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_mailLocalAddress', 'mailLocalAddress', 'mailLocalAddress', $this->messages['mailLocalAddress'][1], $messages, '/,[ ]*/');
// add routing address // add routing address
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_routingAdr', 'mailRoutingAddress', $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_routingAdr', 'mailRoutingAddress',
'email', $this->messages['mailRoutingAddress'][1], $messages); 'email', $this->messages['mailRoutingAddress'][1], $messages);
@ -354,7 +302,7 @@ class inetLocalMailRecipient extends baseModule {
function get_pdfEntries($pdfKeys, $typeId) { function get_pdfEntries($pdfKeys, $typeId) {
$return = array(); $return = array();
$this->addSimplePDFField($return, 'routingAdr', _('Routing address'), 'mailRoutingAddress'); $this->addSimplePDFField($return, 'routingAdr', _('Routing address'), 'mailRoutingAddress');
$this->addSimplePDFField($return, 'localAdr', _('Local address list'), 'mailLocalAddress'); $this->addSimplePDFField($return, 'mailLocalAddress', _('Local address list'), 'mailLocalAddress');
$this->addSimplePDFField($return, 'host', _('Mail server'), 'mailHost'); $this->addSimplePDFField($return, 'host', _('Mail server'), 'mailHost');
return $return; return $return;
} }

View File

@ -1176,10 +1176,10 @@ class inetOrgPerson extends baseModule implements passwordService {
*/ */
function display_html_attributes() { function display_html_attributes() {
$this->initCache(); $this->initCache();
$equalWidthElements = array(); $container = new htmlResponsiveRow();
$container = new htmlTable();
$fieldContainer = new htmlTable(); $fieldContainer = new htmlTable();
$container->addElement($fieldContainer); $fieldTabletColumns = $this->isBooleanConfigOptionSet('inetOrgPerson_hidejpegPhoto') ? 12 : 6;
$container->add($fieldContainer, 12, $fieldTabletColumns);
// uid // uid
if (!$this->isUnixActive() && !$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) { if (!$this->isUnixActive() && !$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) {
if ($this->isAdminReadOnly('uid')) { if ($this->isAdminReadOnly('uid')) {
@ -1187,7 +1187,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'uid', _('User name')); $this->addSimpleInputTextField($fieldContainer, 'uid', _('User name'));
$equalWidthElements[] = 'uid';
} }
} }
// first name // first name
@ -1196,7 +1195,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'givenName', _('First name')); $this->addSimpleInputTextField($fieldContainer, 'givenName', _('First name'));
$equalWidthElements[] = 'givenName';
} }
// last name // last name
if ($this->isAdminReadOnly('sn')) { if ($this->isAdminReadOnly('sn')) {
@ -1204,7 +1202,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'sn', _('Last name'), true); $this->addSimpleInputTextField($fieldContainer, 'sn', _('Last name'), true);
$equalWidthElements[] = 'sn';
} }
// initials // initials
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) {
@ -1213,7 +1210,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'initials', _('Initials')); $this->addSimpleInputTextField($fieldContainer, 'initials', _('Initials'));
$equalWidthElements[] = 'initials';
} }
} }
// common name // common name
@ -1223,7 +1219,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'cn', _('Common name'), true); $this->addMultiValueInputTextField($fieldContainer, 'cn', _('Common name'), true);
$equalWidthElements[] = 'cn';
} }
} }
// description // description
@ -1232,7 +1227,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'description', _('Description')); $this->addSimpleReadOnlyField($fieldContainer, 'description', _('Description'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'description', _('Description'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'description', _('Description'));
} }
} }
@ -1250,7 +1245,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'street', _('Street')); $this->addSimpleReadOnlyField($fieldContainer, 'street', _('Street'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'street', _('Street'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'street', _('Street'));
} }
} }
// post office box // post office box
@ -1259,7 +1254,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'postOfficeBox', _('Post office box')); $this->addSimpleReadOnlyField($fieldContainer, 'postOfficeBox', _('Post office box'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'postOfficeBox', _('Post office box'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'postOfficeBox', _('Post office box'));
} }
} }
// postal code // postal code
@ -1268,7 +1263,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'postalCode', _('Postal code')); $this->addSimpleReadOnlyField($fieldContainer, 'postalCode', _('Postal code'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'postalCode', _('Postal code'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'postalCode', _('Postal code'));
} }
} }
// location // location
@ -1277,7 +1272,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'l', _('Location')); $this->addSimpleReadOnlyField($fieldContainer, 'l', _('Location'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'l', _('Location'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'l', _('Location'));
} }
} }
// state // state
@ -1286,7 +1281,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'st', _('State')); $this->addSimpleReadOnlyField($fieldContainer, 'st', _('State'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'st', _('State'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'st', _('State'));
} }
} }
// postal address // postal address
@ -1314,7 +1309,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$addressContainer->addElement(new htmlInputTextarea('postalAddress' . $i, $postalAddresses[$i], 30, 3)); $addressContainer->addElement(new htmlInputTextarea('postalAddress' . $i, $postalAddresses[$i], 30, 3));
$equalWidthElements[] = 'postalAddress' . $i;
if ($i < (sizeof($postalAddresses) - 1)) { if ($i < (sizeof($postalAddresses) - 1)) {
$addressContainer->addElement(new htmlOutputText('<br>', false)); $addressContainer->addElement(new htmlOutputText('<br>', false));
} }
@ -1358,7 +1352,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$registeredAddressContainer->addElement(new htmlInputTextarea('registeredAddress' . $i, $registeredAddresses[$i], 30, 3)); $registeredAddressContainer->addElement(new htmlInputTextarea('registeredAddress' . $i, $registeredAddresses[$i], 30, 3));
$equalWidthElements[] = 'registeredAddress' . $i;
if ($i < (sizeof($registeredAddresses) - 1)) { if ($i < (sizeof($registeredAddresses) - 1)) {
$registeredAddressContainer->addElement(new htmlOutputText('<br>', false)); $registeredAddressContainer->addElement(new htmlOutputText('<br>', false));
} }
@ -1383,7 +1376,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name')); $this->addSimpleReadOnlyField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'physicalDeliveryOfficeName', _('Office name'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideRoomNumber')) {
@ -1392,7 +1385,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'roomNumber', _('Room number')); $this->addSimpleInputTextField($fieldContainer, 'roomNumber', _('Room number'));
$equalWidthElements[] = 'roomNumber';
} }
} }
@ -1407,7 +1399,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'telephoneNumber', _('Telephone number')); $this->addSimpleReadOnlyField($fieldContainer, 'telephoneNumber', _('Telephone number'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'telephoneNumber', _('Telephone number'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'telephoneNumber', _('Telephone number'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
@ -1415,7 +1407,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'homePhone', _('Home telephone number')); $this->addSimpleReadOnlyField($fieldContainer, 'homePhone', _('Home telephone number'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'homePhone', _('Home telephone number'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'homePhone', _('Home telephone number'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideMobileNumber')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideMobileNumber')) {
@ -1423,7 +1415,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'mobile', _('Mobile number')); $this->addSimpleReadOnlyField($fieldContainer, 'mobile', _('Mobile number'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'mobile', _('Mobile number'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'mobile', _('Mobile number'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber')) {
@ -1431,7 +1423,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number')); $this->addSimpleReadOnlyField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'facsimileTelephoneNumber', _('Fax number'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePager', true)) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidePager', true)) {
@ -1439,7 +1431,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'pager', _('Pager')); $this->addSimpleReadOnlyField($fieldContainer, 'pager', _('Pager'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'pager', _('Pager'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'pager', _('Pager'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress')) {
@ -1447,7 +1439,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'mail', _('Email address')); $this->addSimpleReadOnlyField($fieldContainer, 'mail', _('Email address'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'mail', _('Email address'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'mail', _('Email address'));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) {
@ -1455,7 +1447,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'labeledURI', _('Web site')); $this->addSimpleReadOnlyField($fieldContainer, 'labeledURI', _('Web site'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'labeledURI', _('Web site'), false, null, false, null, null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'labeledURI', _('Web site'));
} }
} }
@ -1471,7 +1463,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title')); $this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'title', _('Job title'), false, null, false, array_slice($this->titleCache, 0, 300), null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'title', _('Job title'), false, null, false, array_slice($this->titleCache, 0, 300));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) {
@ -1480,7 +1472,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'carLicense', _('Car license')); $this->addSimpleInputTextField($fieldContainer, 'carLicense', _('Car license'));
$equalWidthElements[] = 'carLicense';
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) {
@ -1489,7 +1480,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'employeeNumber', _('Employee number')); $this->addSimpleInputTextField($fieldContainer, 'employeeNumber', _('Employee number'));
$equalWidthElements[] = 'employeeNumber';
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType')) {
@ -1498,7 +1488,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
else { else {
$this->addSimpleInputTextField($fieldContainer, 'employeeType', _('Employee type'), false, null, false, array_slice($this->employeeTypeCache, 0, 300)); $this->addSimpleInputTextField($fieldContainer, 'employeeType', _('Employee type'), false, null, false, array_slice($this->employeeTypeCache, 0, 300));
$equalWidthElements[] = 'employeeType';
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')) {
@ -1506,7 +1495,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'businessCategory', _('Business category')); $this->addSimpleReadOnlyField($fieldContainer, 'businessCategory', _('Business category'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'businessCategory', _('Business category'), false, null, false, array_slice($this->businessCategoryCache, 0, 300), null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'businessCategory', _('Business category'), false, null, false, array_slice($this->businessCategoryCache, 0, 300));
} }
} }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) { if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
@ -1514,7 +1503,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'departmentNumber', _('Department')); $this->addSimpleReadOnlyField($fieldContainer, 'departmentNumber', _('Department'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'departmentNumber', _('Department'), false, null, false, array_slice($this->departmentCache, 0, 300), null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'departmentNumber', _('Department'), false, null, false, array_slice($this->departmentCache, 0, 300));
} }
} }
// organisational unit // organisational unit
@ -1523,7 +1512,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'ou', _('Organisational unit')); $this->addSimpleReadOnlyField($fieldContainer, 'ou', _('Organisational unit'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'ou', _('Organisational unit'), false, null, false, array_slice($this->ouCache, 0, 300), null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'ou', _('Organisational unit'), false, null, false, array_slice($this->ouCache, 0, 300));
} }
} }
// organisation // organisation
@ -1532,7 +1521,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->addSimpleReadOnlyField($fieldContainer, 'o', _('Organisation')); $this->addSimpleReadOnlyField($fieldContainer, 'o', _('Organisation'));
} }
else { else {
$this->addMultiValueInputTextField($fieldContainer, 'o', _('Organisation'), false, null, false, array_slice($this->oCache, 0, 300), null, $equalWidthElements); $this->addMultiValueInputTextField($fieldContainer, 'o', _('Organisation'), false, null, false, array_slice($this->oCache, 0, 300));
} }
} }
// user certificates // user certificates
@ -1624,10 +1613,8 @@ class inetOrgPerson extends baseModule implements passwordService {
$imageContainer->addElement(new htmlButton('delPhoto', _('Delete photo'))); $imageContainer->addElement(new htmlButton('delPhoto', _('Delete photo')));
} }
} }
$container->addElement(new htmlSpacer('50px', null)); $container->add($imageContainer, 12, 6);
$container->addElement($imageContainer, false);
} }
$container->addElement(new htmlEqualWidth($equalWidthElements));
return $container; return $container;
} }
@ -1715,19 +1702,17 @@ class inetOrgPerson extends baseModule implements passwordService {
* @return array meta HTML code * @return array meta HTML code
*/ */
public function display_html_photo() { public function display_html_photo() {
$container = new htmlTable(); $container = new htmlResponsiveRow();
if (empty($this->attributes['jpegPhoto'][0])) { if (empty($this->attributes['jpegPhoto'][0])) {
$container->addElement(new htmlSubTitle(_('Upload image')), true); $container->add(new htmlSubTitle(_('Upload image')), 12);
$label = _('Photo file'); $label = _('Photo file');
$container->addElement(new htmlTableExtendedInputFileUpload('photoFile', $label, 'photoUpload'), true); $container->add(new htmlResponsiveInputFileUpload('photoFile', $label, 'photoUpload'), 12);
$container->addVerticalSpace('1rem'); $container->addVerticalSpacer('1rem');
$buttonContainer = new htmlTable(); $container->addLabel(new htmlAccountPageButton(get_class($this), 'photo', 'upload', _('Upload')));
$buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'photo', 'upload', _('Upload'))); $container->addField(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')));
$buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')));
$container->addElement($buttonContainer);
} }
else { else {
$container->addElement(new htmlSubTitle(_('Crop image')), true); $container->add(new htmlSubTitle(_('Crop image')), 12);
$jpeg_filename = 'jpg' . getRandomNumber() . '.jpg'; $jpeg_filename = 'jpg' . getRandomNumber() . '.jpg';
$outjpeg = @fopen(dirname(__FILE__) . '/../../tmp/' . $jpeg_filename, "wb"); $outjpeg = @fopen(dirname(__FILE__) . '/../../tmp/' . $jpeg_filename, "wb");
fwrite($outjpeg, $this->attributes['jpegPhoto'][0]); fwrite($outjpeg, $this->attributes['jpegPhoto'][0]);
@ -1736,11 +1721,10 @@ class inetOrgPerson extends baseModule implements passwordService {
$img = new htmlImage($photoFile); $img = new htmlImage($photoFile);
$img->setCSSClasses(array('photo')); $img->setCSSClasses(array('photo'));
$img->enableCropping(); $img->enableCropping();
$container->addElement($img, true); $container->add($img, 12);
$container->addVerticalSpace('1rem'); $container->addVerticalSpacer('1rem');
$buttonContainer = new htmlTable(); $doneButton = new htmlAccountPageButton(get_class($this), 'attributes', 'crop', _('Done'));
$buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'crop', _('Done'))); $container->add($doneButton, 12);
$container->addElement($buttonContainer, true);
} }
return $container; return $container;
} }
@ -1751,7 +1735,7 @@ class inetOrgPerson extends baseModule implements passwordService {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_manager() { function display_html_manager() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
if (!isset($this->attributes['manager'])) { if (!isset($this->attributes['manager'])) {
$this->attributes['manager'] = array(); $this->attributes['manager'] = array();
} }
@ -1771,18 +1755,19 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
} }
$size = 20; $size = 20;
if (sizeof($options) < 20) $size = sizeof($options); if (sizeof($options) < 20) {
$size = sizeof($options);
}
$managerSelect = new htmlSelect('manager', $options, array(), $size); $managerSelect = new htmlSelect('manager', $options, array(), $size);
$managerSelect->setHasDescriptiveElements(true); $managerSelect->setHasDescriptiveElements(true);
$managerSelect->setMultiSelect(true); $managerSelect->setMultiSelect(true);
$managerSelect->setRightToLeftTextDirection(true); $managerSelect->setRightToLeftTextDirection(true);
$managerSelect->setSortElements(false); $managerSelect->setSortElements(false);
$managerSelect->setTransformSingleSelect(false); $managerSelect->setTransformSingleSelect(false);
$return->addElement($managerSelect, true); $return->add($managerSelect, 12);
$buttonTable = new htmlTable(); $return->addVerticalSpacer('1rem');
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'manager', 'addManagers', _('Add'))); $return->addLabel(new htmlAccountPageButton(get_class($this), 'manager', 'addManagers', _('Add')));
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'manager', 'cancel', _('Cancel'))); $return->addField(new htmlAccountPageButton(get_class($this), 'manager', 'cancel', _('Cancel')));
$return->addElement($buttonTable);
return $return; return $return;
} }
// show existing managers // show existing managers
@ -1807,17 +1792,16 @@ class inetOrgPerson extends baseModule implements passwordService {
$managerSelect->setRightToLeftTextDirection(true); $managerSelect->setRightToLeftTextDirection(true);
$managerSelect->setSortElements(false); $managerSelect->setSortElements(false);
$managerSelect->setTransformSingleSelect(false); $managerSelect->setTransformSingleSelect(false);
$return->addElement($managerSelect, true); $return->add($managerSelect, 12);
$return->addVerticalSpacer('0.5rem');
$removeButton = new htmlAccountPageButton(get_class($this), 'manager', 'remove', _('Remove selected entries')); $removeButton = new htmlAccountPageButton(get_class($this), 'manager', 'remove', _('Remove selected entries'));
$removeButton->colspan = 3; $return->add($removeButton, 12, 12, 12, 'text-center');
$return->addElement($removeButton, true); $return->addVerticalSpacer('1rem');
$return->addElement(new htmlOutputText('&nbsp;', false), true); $return->add(new htmlHorizontalLine(), 12);
} }
$return->addElement(new htmlOutputText('&nbsp;', false), true); $return->addVerticalSpacer('1rem');
$buttonTable = new htmlTable(); $return->addLabel(new htmlAccountPageButton(get_class($this), 'manager', 'select', _('Add entries')));
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'manager', 'select', _('Add entries'))); $return->addField(new htmlAccountPageButton(get_class($this), 'attributes', 'managerBack', _('Back')));
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'managerBack', _('Back')));
$return->addElement($buttonTable);
return $return; return $return;
} }
@ -1856,7 +1840,7 @@ class inetOrgPerson extends baseModule implements passwordService {
* @return array meta HTML code * @return array meta HTML code
*/ */
function display_html_userCertificate() { function display_html_userCertificate() {
$container = new htmlTable(); $container = new htmlResponsiveRow();
if (isset($this->attributes['userCertificate;binary'])) { if (isset($this->attributes['userCertificate;binary'])) {
$table = new htmlTable(); $table = new htmlTable();
$table->colspan = 10; $table->colspan = 10;
@ -1893,20 +1877,16 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
$table->addNewLine(); $table->addNewLine();
} }
$container->addElement($table, true); $container->add($table, 12);
$container->addElement(new htmlSpacer(null, '20px'), true); $container->addVerticalSpacer('2rem');
} }
$newGroup = new htmlGroup(); $container->add(new htmlResponsiveInputFileUpload('userCertificateUpload', _('New user certificate')), 12, 6);
$newGroup->addElement(new htmlOutputText(_('New user certificate')));
$newGroup->addElement(new htmlSpacer('1px', null));
$newGroup->addElement(new htmlInputFileUpload('userCertificateUpload'));
$newGroup->addElement(new htmlSpacer('1px', null));
$uploadButton = new htmlAccountPageButton(get_class($this), 'userCertificate', 'submit', _('Upload')); $uploadButton = new htmlAccountPageButton(get_class($this), 'userCertificate', 'submit', _('Upload'));
$uploadButton->setIconClass('upButton'); $uploadButton->setIconClass('upButton');
$newGroup->addElement($uploadButton); $container->add($uploadButton, 12, 6);
$container->addElement($newGroup, true); $container->addVerticalSpacer('2rem');
$container->addElement(new htmlSpacer(null, '10px'), true); $container->add(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')), 12);
$container->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')));
return $container; return $container;
} }