responsive self service

This commit is contained in:
Roland Gruber 2015-08-09 09:00:38 +00:00
parent a53a432c2b
commit 81946a0d38
3 changed files with 91 additions and 81 deletions

View File

@ -3255,6 +3255,22 @@ class htmlResponsiveRow extends htmlElement {
private $cells = array(); private $cells = array();
/**
* Creates a new responsive row.
*
* @param htmlElement $label label element if this is a simple label+field row
* @param htmlElement $field field element if this is a simple label+field row
*/
public function __construct($label = null, $field = null) {
$this->cells = array();
if ($label != null) {
$this->addLabel($label);
}
if ($field != null) {
$this->addField($field);
}
}
/** /**
* Adds a responsive cell to the row. * Adds a responsive cell to the row.
* *

View File

@ -2476,7 +2476,7 @@ class inetOrgPerson extends baseModule implements passwordService {
* @param array $attributes attributes of LDAP account * @param array $attributes attributes of LDAP account
* @param boolean $passwordChangeOnly indicates that the user is only allowed to change his password and no LDAP content is readable * @param boolean $passwordChangeOnly indicates that the user is only allowed to change his password and no LDAP content is readable
* @param array $readOnlyFields list of read-only fields * @param array $readOnlyFields list of read-only fields
* @return array list of meta HTML elements (field name => htmlTableRow) * @return array list of meta HTML elements (field name => htmlResponsiveRow)
*/ */
function getSelfServiceOptions($fields, $attributes, $passwordChangeOnly, $readOnlyFields) { function getSelfServiceOptions($fields, $attributes, $passwordChangeOnly, $readOnlyFields) {
$return = array(); $return = array();
@ -2490,9 +2490,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('firstName', $readOnlyFields)) { if (in_array('firstName', $readOnlyFields)) {
$firstNameField = new htmlOutputText($firstName); $firstNameField = new htmlOutputText($firstName);
} }
$return['firstName'] = new htmlTableRow(array( $return['firstName'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('firstName', _('First name'))), $firstNameField new htmlOutputText($this->getSelfServiceLabel('firstName', _('First name'))), $firstNameField
)); );
} }
if (in_array('lastName', $fields)) { if (in_array('lastName', $fields)) {
$lastName = ''; $lastName = '';
@ -2501,9 +2501,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('lastName', $readOnlyFields)) { if (in_array('lastName', $readOnlyFields)) {
$lastNameField = new htmlOutputText($lastName); $lastNameField = new htmlOutputText($lastName);
} }
$return['lastName'] = new htmlTableRow(array( $return['lastName'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('lastName', _('Last name'))), $lastNameField new htmlOutputText($this->getSelfServiceLabel('lastName', _('Last name'))), $lastNameField
)); );
} }
if (in_array('mail', $fields)) { if (in_array('mail', $fields)) {
$mail = ''; $mail = '';
@ -2512,9 +2512,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('mail', $readOnlyFields)) { if (in_array('mail', $readOnlyFields)) {
$mailField = new htmlOutputText($mail); $mailField = new htmlOutputText($mail);
} }
$return['mail'] = new htmlTableRow(array( $return['mail'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('mail', _('Email address'))), $mailField new htmlOutputText($this->getSelfServiceLabel('mail', _('Email address'))), $mailField
)); );
} }
if (in_array('labeledURI', $fields)) { if (in_array('labeledURI', $fields)) {
$labeledURI = ''; $labeledURI = '';
@ -2523,9 +2523,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('labeledURI', $readOnlyFields)) { if (in_array('labeledURI', $readOnlyFields)) {
$labeledURIField = new htmlOutputText($labeledURI); $labeledURIField = new htmlOutputText($labeledURI);
} }
$return['labeledURI'] = new htmlTableRow(array( $return['labeledURI'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('labeledURI', _('Web site'))), $labeledURIField new htmlOutputText($this->getSelfServiceLabel('labeledURI', _('Web site'))), $labeledURIField
)); );
} }
if (in_array('telephoneNumber', $fields)) { if (in_array('telephoneNumber', $fields)) {
$telephoneNumber = ''; $telephoneNumber = '';
@ -2534,9 +2534,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('telephoneNumber', $readOnlyFields)) { if (in_array('telephoneNumber', $readOnlyFields)) {
$telephoneNumberField = new htmlOutputText($telephoneNumber); $telephoneNumberField = new htmlOutputText($telephoneNumber);
} }
$return['telephoneNumber'] = new htmlTableRow(array( $return['telephoneNumber'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('telephoneNumber', _('Telephone number'))), $telephoneNumberField new htmlOutputText($this->getSelfServiceLabel('telephoneNumber', _('Telephone number'))), $telephoneNumberField
)); );
} }
if (in_array('homePhone', $fields)) { if (in_array('homePhone', $fields)) {
$homePhone = ''; $homePhone = '';
@ -2545,9 +2545,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('homePhone', $readOnlyFields)) { if (in_array('homePhone', $readOnlyFields)) {
$homePhoneField = new htmlOutputText($homePhone); $homePhoneField = new htmlOutputText($homePhone);
} }
$return['homePhone'] = new htmlTableRow(array( $return['homePhone'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('homePhone', _('Home telephone number'))), $homePhoneField new htmlOutputText($this->getSelfServiceLabel('homePhone', _('Home telephone number'))), $homePhoneField
)); );
} }
if (in_array('mobile', $fields)) { if (in_array('mobile', $fields)) {
$mobile = ''; $mobile = '';
@ -2556,9 +2556,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('mobile', $readOnlyFields)) { if (in_array('mobile', $readOnlyFields)) {
$mobileField = new htmlOutputText($mobile); $mobileField = new htmlOutputText($mobile);
} }
$return['mobile'] = new htmlTableRow(array( $return['mobile'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('mobile', _('Mobile telephone number'))), $mobileField new htmlOutputText($this->getSelfServiceLabel('mobile', _('Mobile telephone number'))), $mobileField
)); );
} }
if (in_array('faxNumber', $fields)) { if (in_array('faxNumber', $fields)) {
$faxNumber = ''; $faxNumber = '';
@ -2567,9 +2567,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('faxNumber', $readOnlyFields)) { if (in_array('faxNumber', $readOnlyFields)) {
$faxNumberField = new htmlOutputText($faxNumber); $faxNumberField = new htmlOutputText($faxNumber);
} }
$return['faxNumber'] = new htmlTableRow(array( $return['faxNumber'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('faxNumber', _('Fax number'))), $faxNumberField new htmlOutputText($this->getSelfServiceLabel('faxNumber', _('Fax number'))), $faxNumberField
)); );
} }
if (in_array('pager', $fields)) { if (in_array('pager', $fields)) {
$pager = ''; $pager = '';
@ -2578,9 +2578,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('pager', $readOnlyFields)) { if (in_array('pager', $readOnlyFields)) {
$pagerField = new htmlOutputText($pager); $pagerField = new htmlOutputText($pager);
} }
$return['pager'] = new htmlTableRow(array( $return['pager'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('pager', _('Pager'))), $pagerField new htmlOutputText($this->getSelfServiceLabel('pager', _('Pager'))), $pagerField
)); );
} }
if (in_array('street', $fields)) { if (in_array('street', $fields)) {
$street = ''; $street = '';
@ -2589,9 +2589,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('street', $readOnlyFields)) { if (in_array('street', $readOnlyFields)) {
$streetField = new htmlOutputText($street); $streetField = new htmlOutputText($street);
} }
$return['street'] = new htmlTableRow(array( $return['street'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('street', _('Street'))), $streetField new htmlOutputText($this->getSelfServiceLabel('street', _('Street'))), $streetField
)); );
} }
if (in_array('postalAddress', $fields)) { if (in_array('postalAddress', $fields)) {
$postalAddress = ''; $postalAddress = '';
@ -2600,9 +2600,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('postalAddress', $readOnlyFields)) { if (in_array('postalAddress', $readOnlyFields)) {
$postalAddressField = new htmlOutputText($postalAddress); $postalAddressField = new htmlOutputText($postalAddress);
} }
$return['postalAddress'] = new htmlTableRow(array( $return['postalAddress'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('postalAddress', _('Postal address'))), $postalAddressField new htmlOutputText($this->getSelfServiceLabel('postalAddress', _('Postal address'))), $postalAddressField
)); );
} }
if (in_array('registeredAddress', $fields)) { if (in_array('registeredAddress', $fields)) {
$registeredAddress = ''; $registeredAddress = '';
@ -2611,9 +2611,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('registeredAddress', $readOnlyFields)) { if (in_array('registeredAddress', $readOnlyFields)) {
$registeredAddressField = new htmlOutputText($registeredAddress); $registeredAddressField = new htmlOutputText($registeredAddress);
} }
$return['registeredAddress'] = new htmlTableRow(array( $return['registeredAddress'] = new htmlResponsiveRow(
new htmlOutputText(_('Registered address')), $registeredAddressField new htmlOutputText(_('Registered address')), $registeredAddressField
)); );
} }
if (in_array('postalCode', $fields)) { if (in_array('postalCode', $fields)) {
$postalCode = ''; $postalCode = '';
@ -2622,9 +2622,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('postalCode', $readOnlyFields)) { if (in_array('postalCode', $readOnlyFields)) {
$postalCodeField = new htmlOutputText($postalCode); $postalCodeField = new htmlOutputText($postalCode);
} }
$return['postalCode'] = new htmlTableRow(array( $return['postalCode'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('postalCode', _('Postal code'))), $postalCodeField new htmlOutputText($this->getSelfServiceLabel('postalCode', _('Postal code'))), $postalCodeField
)); );
} }
if (in_array('postOfficeBox', $fields)) { if (in_array('postOfficeBox', $fields)) {
$postOfficeBox = ''; $postOfficeBox = '';
@ -2633,9 +2633,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('postOfficeBox', $readOnlyFields)) { if (in_array('postOfficeBox', $readOnlyFields)) {
$postOfficeBoxField = new htmlOutputText($postOfficeBox); $postOfficeBoxField = new htmlOutputText($postOfficeBox);
} }
$return['postOfficeBox'] = new htmlTableRow(array( $return['postOfficeBox'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('postOfficeBox', _('Post office box'))), $postOfficeBoxField new htmlOutputText($this->getSelfServiceLabel('postOfficeBox', _('Post office box'))), $postOfficeBoxField
)); );
} }
if (in_array('roomNumber', $fields)) { if (in_array('roomNumber', $fields)) {
$roomNumber = ''; $roomNumber = '';
@ -2644,9 +2644,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('roomNumber', $readOnlyFields)) { if (in_array('roomNumber', $readOnlyFields)) {
$roomNumberField = new htmlOutputText($roomNumber); $roomNumberField = new htmlOutputText($roomNumber);
} }
$return['roomNumber'] = new htmlTableRow(array( $return['roomNumber'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('roomNumber', _('Room number'))), $roomNumberField new htmlOutputText($this->getSelfServiceLabel('roomNumber', _('Room number'))), $roomNumberField
)); );
} }
if (in_array('location', $fields)) { if (in_array('location', $fields)) {
$l = ''; $l = '';
@ -2655,9 +2655,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('location', $readOnlyFields)) { if (in_array('location', $readOnlyFields)) {
$lField = new htmlOutputText($l); $lField = new htmlOutputText($l);
} }
$return['location'] = new htmlTableRow(array( $return['location'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('location', _('Location'))), $lField new htmlOutputText($this->getSelfServiceLabel('location', _('Location'))), $lField
)); );
} }
if (in_array('state', $fields)) { if (in_array('state', $fields)) {
$st = ''; $st = '';
@ -2666,9 +2666,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('state', $readOnlyFields)) { if (in_array('state', $readOnlyFields)) {
$stField = new htmlOutputText($st); $stField = new htmlOutputText($st);
} }
$return['state'] = new htmlTableRow(array( $return['state'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('state', _('State'))), $stField new htmlOutputText($this->getSelfServiceLabel('state', _('State'))), $stField
)); );
} }
if (in_array('carLicense', $fields)) { if (in_array('carLicense', $fields)) {
$carLicense = ''; $carLicense = '';
@ -2677,9 +2677,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('carLicense', $readOnlyFields)) { if (in_array('carLicense', $readOnlyFields)) {
$carLicenseField = new htmlOutputText($carLicense); $carLicenseField = new htmlOutputText($carLicense);
} }
$return['carLicense'] = new htmlTableRow(array( $return['carLicense'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('carLicense', _('Car license'))), $carLicenseField new htmlOutputText($this->getSelfServiceLabel('carLicense', _('Car license'))), $carLicenseField
)); );
} }
if (in_array('officeName', $fields)) { if (in_array('officeName', $fields)) {
$physicalDeliveryOfficeName = ''; $physicalDeliveryOfficeName = '';
@ -2688,9 +2688,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('officeName', $readOnlyFields)) { if (in_array('officeName', $readOnlyFields)) {
$physicalDeliveryOfficeNameField = new htmlOutputText($physicalDeliveryOfficeName); $physicalDeliveryOfficeNameField = new htmlOutputText($physicalDeliveryOfficeName);
} }
$return['officeName'] = new htmlTableRow(array( $return['officeName'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('officeName', _('Office name'))), $physicalDeliveryOfficeNameField new htmlOutputText($this->getSelfServiceLabel('officeName', _('Office name'))), $physicalDeliveryOfficeNameField
)); );
} }
if (in_array('businessCategory', $fields)) { if (in_array('businessCategory', $fields)) {
$businessCategory = ''; $businessCategory = '';
@ -2699,9 +2699,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('businessCategory', $readOnlyFields)) { if (in_array('businessCategory', $readOnlyFields)) {
$businessCategoryField = new htmlOutputText($businessCategory); $businessCategoryField = new htmlOutputText($businessCategory);
} }
$return['businessCategory'] = new htmlTableRow(array( $return['businessCategory'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('businessCategory', _('Business category'))), $businessCategoryField new htmlOutputText($this->getSelfServiceLabel('businessCategory', _('Business category'))), $businessCategoryField
)); );
} }
if (in_array('jpegPhoto', $fields)) { if (in_array('jpegPhoto', $fields)) {
if (isset($attributes['jpegPhoto'][0])) { if (isset($attributes['jpegPhoto'][0])) {
@ -2716,21 +2716,19 @@ class inetOrgPerson extends baseModule implements passwordService {
$photoSub->addElement($img, true); $photoSub->addElement($img, true);
if (!in_array('jpegPhoto', $readOnlyFields)) { if (!in_array('jpegPhoto', $readOnlyFields)) {
$photoSubSub = new htmlTable(); $photoSubSub = new htmlTable();
$upload = new htmlInputFileUpload('photoFile');
$upload->colspan = 2;
$photoSubSub->addElement($upload, true);
$photoSubSub->addElement(new htmlTableExtendedInputCheckbox('removeReplacePhoto', false, _('Remove/replace photo'), null, false)); $photoSubSub->addElement(new htmlTableExtendedInputCheckbox('removeReplacePhoto', false, _('Remove/replace photo'), null, false));
$photoSubSub->addElement(new htmlInputFileUpload('photoFile'));
$photoSub->addElement($photoSubSub); $photoSub->addElement($photoSubSub);
} }
$photoRowCells = array(new htmlOutputText($this->getSelfServiceLabel('jpegPhoto', _('Photo'))), $photoSub); $return['jpegPhoto'] = new htmlResponsiveRow(new htmlOutputText($this->getSelfServiceLabel('jpegPhoto', _('Photo'))), $photoSub);
$photoRow = new htmlTableRow($photoRowCells);
$return['jpegPhoto'] = $photoRow;
} }
elseif (!in_array('jpegPhoto', $readOnlyFields)) { elseif (!in_array('jpegPhoto', $readOnlyFields)) {
$photoSub = new htmlTable(); $photoSub = new htmlTable();
$photoSub->addElement(new htmlTableExtendedInputFileUpload('photoFile', _('Add photo'))); $photoSub->addElement(new htmlTableExtendedInputFileUpload('photoFile', _('Add photo')));
$photoSub->addElement(new htmlHiddenInput('addPhoto', 'true')); $photoSub->addElement(new htmlHiddenInput('addPhoto', 'true'));
$photoRowCells = array(new htmlOutputText($this->getSelfServiceLabel('jpegPhoto', _('Photo'))), $photoSub); $return['jpegPhoto'] = new htmlResponsiveRow(new htmlOutputText($this->getSelfServiceLabel('jpegPhoto', _('Photo'))), $photoSub);
$photoRow = new htmlTableRow($photoRowCells);
$return['jpegPhoto'] = $photoRow;
} }
} }
if (in_array('departmentNumber', $fields)) { if (in_array('departmentNumber', $fields)) {
@ -2740,9 +2738,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('departmentNumber', $readOnlyFields)) { if (in_array('departmentNumber', $readOnlyFields)) {
$departmentNumberField = new htmlOutputText($departmentNumber); $departmentNumberField = new htmlOutputText($departmentNumber);
} }
$return['departmentNumber'] = new htmlTableRow(array( $return['departmentNumber'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('departmentNumber', _('Department'))), $departmentNumberField new htmlOutputText($this->getSelfServiceLabel('departmentNumber', _('Department'))), $departmentNumberField
)); );
} }
if (in_array('initials', $fields)) { if (in_array('initials', $fields)) {
$initials = ''; $initials = '';
@ -2751,9 +2749,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('initials', $readOnlyFields)) { if (in_array('initials', $readOnlyFields)) {
$initialsField = new htmlOutputText($initials); $initialsField = new htmlOutputText($initials);
} }
$return['initials'] = new htmlTableRow(array( $return['initials'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('initials', _('Initials'))), $initialsField new htmlOutputText($this->getSelfServiceLabel('initials', _('Initials'))), $initialsField
)); );
} }
if (in_array('title', $fields)) { if (in_array('title', $fields)) {
$title = ''; $title = '';
@ -2762,9 +2760,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('title', $readOnlyFields)) { if (in_array('title', $readOnlyFields)) {
$titleField = new htmlOutputText($title); $titleField = new htmlOutputText($title);
} }
$return['title'] = new htmlTableRow(array( $return['title'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('title', _('Job title'))), $titleField new htmlOutputText($this->getSelfServiceLabel('title', _('Job title'))), $titleField
)); );
} }
if (in_array('userCertificate', $fields)) { if (in_array('userCertificate', $fields)) {
$userCertificates = array(); $userCertificates = array();
@ -2792,9 +2790,7 @@ class inetOrgPerson extends baseModule implements passwordService {
$certTable->addElement($uploadStatus, true); $certTable->addElement($uploadStatus, true);
$certLabel = new htmlOutputText($this->getSelfServiceLabel('userCertificate', _('User certificates'))); $certLabel = new htmlOutputText($this->getSelfServiceLabel('userCertificate', _('User certificates')));
$certLabel->alignment = htmlElement::ALIGN_TOP; $certLabel->alignment = htmlElement::ALIGN_TOP;
$userCertificatesCells = array($certLabel, $certTable); $return['userCertificate'] = new htmlResponsiveRow($certLabel, $certTable);
$userCertificatesRow = new htmlTableRow($userCertificatesCells);
$return['userCertificate'] = $userCertificatesRow;
} }
// ou // ou
if (in_array('ou', $fields)) { if (in_array('ou', $fields)) {
@ -2823,9 +2819,9 @@ class inetOrgPerson extends baseModule implements passwordService {
$ouField->setRightToLeftTextDirection(true); $ouField->setRightToLeftTextDirection(true);
$ouField->setSortElements(false); $ouField->setSortElements(false);
} }
$return['ou'] = new htmlTableRow(array( $return['ou'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('ou', _('Organisational unit'))), $ouField new htmlOutputText($this->getSelfServiceLabel('ou', _('Organisational unit'))), $ouField
)); );
} }
// description // description
if (in_array('description', $fields)) { if (in_array('description', $fields)) {
@ -2835,9 +2831,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('description', $readOnlyFields)) { if (in_array('description', $readOnlyFields)) {
$descriptionField = new htmlOutputText($description); $descriptionField = new htmlOutputText($description);
} }
$return['description'] = new htmlTableRow(array( $return['description'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('description', _('Description'))), $descriptionField new htmlOutputText($this->getSelfServiceLabel('description', _('Description'))), $descriptionField
)); );
} }
// uid // uid
if (in_array('uid', $fields)) { if (in_array('uid', $fields)) {
@ -2847,9 +2843,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (in_array('uid', $readOnlyFields)) { if (in_array('uid', $readOnlyFields)) {
$uidField = new htmlOutputText($uid); $uidField = new htmlOutputText($uid);
} }
$return['uid'] = new htmlTableRow(array( $return['uid'] = new htmlResponsiveRow(
new htmlOutputText($this->getSelfServiceLabel('uid', _('User name'))), $uidField new htmlOutputText($this->getSelfServiceLabel('uid', _('User name'))), $uidField
)); );
} }
return $return; return $return;
} }
@ -2871,14 +2867,6 @@ class inetOrgPerson extends baseModule implements passwordService {
fwrite($out, $userCertificates[$i]); fwrite($out, $userCertificates[$i]);
fclose ($out); fclose ($out);
$path = '../../tmp/' . $filename; $path = '../../tmp/' . $filename;
$saveLink = new htmlLink('', $path, '../../graphics/save.png');
$saveLink->setTitle(_('Save'));
$saveLink->setTargetWindow('_blank');
$certTable->addElement($saveLink);
$delLink = new htmlLink('', '#', '../../graphics/del.png');
$delLink->setTitle(_('Delete'));
$delLink->setOnClick('inetOrgPersonDeleteCertificate(' . $i . '); return false;');
$certTable->addElement($delLink);
if (function_exists('openssl_x509_parse')) { if (function_exists('openssl_x509_parse')) {
$pem = @chunk_split(@base64_encode($userCertificates[$i]), 64, "\n"); $pem = @chunk_split(@base64_encode($userCertificates[$i]), 64, "\n");
if (!empty($pem)) { if (!empty($pem)) {
@ -2896,6 +2884,14 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
} }
} }
$saveLink = new htmlLink('', $path, '../../graphics/save.png');
$saveLink->setTitle(_('Save'));
$saveLink->setTargetWindow('_blank');
$certTable->addElement($saveLink);
$delLink = new htmlLink('', '#', '../../graphics/del.png');
$delLink->setTitle(_('Delete'));
$delLink->setOnClick('inetOrgPersonDeleteCertificate(' . $i . '); return false;');
$certTable->addElement($delLink);
$certTable->addNewLine(); $certTable->addNewLine();
} }
$content->addElement($certTable, true); $content->addElement($certTable, true);

View File

@ -251,7 +251,6 @@ class ldapPublicKey extends baseModule {
// upload status // upload status
$uploadStatus = new htmlDiv('ldapPublicKey_upload_status_key', new htmlOutputText('')); $uploadStatus = new htmlDiv('ldapPublicKey_upload_status_key', new htmlOutputText(''));
$uploadStatus->setCSSClasses(array('qq-upload-list')); $uploadStatus->setCSSClasses(array('qq-upload-list'));
$uploadStatus->colspan = 7;
$keyTable->addElement($uploadStatus, true); $keyTable->addElement($uploadStatus, true);
$keyLabel = new htmlOutputText($this->getSelfServiceLabel('sshPublicKey', _('SSH public keys'))); $keyLabel = new htmlOutputText($this->getSelfServiceLabel('sshPublicKey', _('SSH public keys')));
$row = new htmlResponsiveRow(); $row = new htmlResponsiveRow();
@ -270,39 +269,38 @@ class ldapPublicKey extends baseModule {
*/ */
private function getSelfServiceKeys() { private function getSelfServiceKeys() {
$keys = $_SESSION[self::SESS_KEY_LIST]; $keys = $_SESSION[self::SESS_KEY_LIST];
$content = new htmlTable(); $content = new htmlResponsiveRow();
if (sizeof($keys) > 0) { if (sizeof($keys) > 0) {
$keyTable = new htmlTable();
for ($i = 0; $i < sizeof($keys); $i++) { for ($i = 0; $i < sizeof($keys); $i++) {
$group = new htmlGroup();
$keyInput = new htmlInputField('sshPublicKey_' . $i, $keys[$i]); $keyInput = new htmlInputField('sshPublicKey_' . $i, $keys[$i]);
$keyInput->setFieldMaxLength(16384); $keyInput->setFieldMaxLength(16384);
$keyTable->addElement($keyInput); $group->addElement($keyInput);
$delLink = new htmlLink('', '#', '../../graphics/del.png'); $delLink = new htmlLink('', '#', '../../graphics/del.png');
$delLink->setTitle(_('Delete')); $delLink->setTitle(_('Delete'));
$delLink->setOnClick('ldapPublicKeyDeleteKey(' . $i . ', ' . sizeof($keys) . ');return false;'); $delLink->setOnClick('ldapPublicKeyDeleteKey(' . $i . ', ' . sizeof($keys) . ');return false;');
$keyTable->addElement($delLink); $group->addElement($delLink);
if ($i == (sizeof($keys) - 1)) { if ($i == (sizeof($keys) - 1)) {
$addLink = new htmlLink('', '#', '../../graphics/add.png'); $addLink = new htmlLink('', '#', '../../graphics/add.png');
$addLink->setTitle(_('Add')); $addLink->setTitle(_('Add'));
$addLink->setOnClick('ldapPublicKeyAddKey(' . sizeof($keys) . ');return false;'); $addLink->setOnClick('ldapPublicKeyAddKey(' . sizeof($keys) . ');return false;');
$keyTable->addElement($addLink); $group->addElement($addLink);
} }
$keyTable->addNewLine(); $content->add($group, 12, 12, 12, 'nowrap');
} }
$content->addElement($keyTable, true);
} }
else { else {
$addLink = new htmlLink('', '#', '../../graphics/add.png'); $addLink = new htmlLink('', '#', '../../graphics/add.png');
$addLink->setTitle(_('Add')); $addLink->setTitle(_('Add'));
$addLink->setOnClick('ldapPublicKeyAddKey(' . sizeof($keys) . ');return false;'); $addLink->setOnClick('ldapPublicKeyAddKey(' . sizeof($keys) . ');return false;');
$content->addElement($addLink, true); $content->add($addLink, 12);
} }
// upload button // upload button
$uploadButtons = new htmlGroup(); $uploadButtons = new htmlGroup();
$uploadButtons->addElement(new htmlDiv('ldapPublicKeyKeyUploadId', new htmlOutputText('')), true); $uploadButtons->addElement(new htmlDiv('ldapPublicKeyKeyUploadId', new htmlOutputText('')), true);
$keyUpload = new htmlJavaScript('ldapPublicKeyUploadKey(\'ldapPublicKeyKeyUploadId\', ' . sizeof($keys) . ');'); $keyUpload = new htmlJavaScript('ldapPublicKeyUploadKey(\'ldapPublicKeyKeyUploadId\', ' . sizeof($keys) . ');');
$uploadButtons->addElement($keyUpload); $uploadButtons->addElement($keyUpload);
$content->addElement($uploadButtons, true); $content->add($uploadButtons, 12);
return $content; return $content;
} }