From a53a432c2baa1033df7e1c19a9dc4d48e6a84fb1 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 9 Aug 2015 07:57:56 +0000 Subject: [PATCH] responsive self service --- lam/lib/baseModule.inc | 4 ++-- lam/lib/html.inc | 18 ++++++++++++++++++ lam/lib/modules/kolabUser.inc | 18 +++++++++--------- lam/lib/modules/ldapPublicKey.inc | 10 +++++----- lam/lib/modules/posixAccount.inc | 8 ++++---- lam/lib/modules/pykotaUser.inc | 8 ++++---- lam/lib/modules/sambaSamAccount.inc | 4 ++-- lam/lib/modules/shadowAccount.inc | 4 ++-- 8 files changed, 46 insertions(+), 28 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index e6f7e83d..1b4b6a9a 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -1428,8 +1428,8 @@ abstract class baseModule { } } $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel($name, $label)), 12, 6, 6, 'responsiveLabel'); - $row->add($field, 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel($name, $label))); + $row->addField($field); $container[$name] = $row; } diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 96c6ebcc..333a1061 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -3279,6 +3279,24 @@ class htmlResponsiveRow extends htmlElement { $this->addCell(new htmlResponsiveCell($content, $numMobile, $tabletCols, $tabletCols, $classes)); } + /** + * Adds the content as a typical label with 12/6/6 columns and CSS class "responsiveLabel". + * + * @param htmlElement $content label + */ + public function addLabel($content) { + $this->add($content, 12, 6, 6, 'responsiveLabel'); + } + + /** + * Adds the content as a typical field with 12/6/6 columns and CSS class "responsiveField". + * + * @param htmlElement $content field + */ + public function addField($content) { + $this->add($content, 12, 6, 6, 'responsiveField'); + } + /** * Prints the HTML code for this element. * diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index 965921db..9e5c4ec0 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -789,7 +789,7 @@ class kolabUser extends baseModule { * @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 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) { if ($passwordChangeOnly) { @@ -842,10 +842,10 @@ class kolabUser extends baseModule { $delegateContainer->addElement(new htmlTableExtendedInputCheckbox('new_delegate', false, _("Add"), null, false), true); } $delegateLabel = new htmlOutputText($this->getSelfServiceLabel('kolabDelegate', _('Delegates'))); - $delegateLabel->alignment = htmlElement::ALIGN_TOP; - $return['kolabDelegate'] = new htmlTableRow(array( - $delegateLabel, $delegateContainer - )); + $row = new htmlResponsiveRow(); + $row->addLabel($delegateLabel); + $row->addField($delegateContainer); + $return['kolabDelegate'] = $row; } // invitation policies if (in_array('kolabInvitationPolicy', $fields)) { @@ -890,10 +890,10 @@ class kolabUser extends baseModule { $invitationContainer->addElement(new htmlTableExtendedInputCheckbox('addInvPol', false, _("Add"), null, false), true); } $invitationLabel = new htmlOutputText($this->getSelfServiceLabel('kolabInvitationPolicy', _('Invitation policy'))); - $invitationLabel->alignment = htmlElement::ALIGN_TOP; - $return['kolabInvitationPolicy'] = new htmlTableRow(array( - $invitationLabel, $invitationContainer - )); + $row = new htmlResponsiveRow(); + $row->addLabel($invitationLabel); + $row->addField($invitationContainer); + $return['kolabInvitationPolicy'] = $row; } return $return; } diff --git a/lam/lib/modules/ldapPublicKey.inc b/lam/lib/modules/ldapPublicKey.inc index 4f365cf0..407b9cd8 100644 --- a/lam/lib/modules/ldapPublicKey.inc +++ b/lam/lib/modules/ldapPublicKey.inc @@ -230,7 +230,7 @@ class ldapPublicKey extends baseModule { * @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 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) { $return = array(); @@ -254,10 +254,10 @@ class ldapPublicKey extends baseModule { $uploadStatus->colspan = 7; $keyTable->addElement($uploadStatus, true); $keyLabel = new htmlOutputText($this->getSelfServiceLabel('sshPublicKey', _('SSH public keys'))); - $keyLabel->alignment = htmlElement::ALIGN_TOP; - $keyCells = array($keyLabel, $keyTable); - $keyRow = new htmlTableRow($keyCells); - $return['sshPublicKey'] = $keyRow; + $row = new htmlResponsiveRow(); + $row->addLabel($keyLabel); + $row->addField($keyTable); + $return['sshPublicKey'] = $row; } return $return; } diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index f0e1ea9f..c55ff2e0 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -2681,8 +2681,8 @@ class posixAccount extends baseModule implements passwordService { $cnField = new htmlOutputText($cn); } $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel('cn', _('Common name'))), 12, 6, 6, 'responsiveLabel'); - $row->add($cnField, 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('cn', _('Common name')))); + $row->addField($cnField); $return['cn'] = $row; } if (in_array('loginShell', $fields)) { @@ -2694,8 +2694,8 @@ class posixAccount extends baseModule implements passwordService { $loginShellField = new htmlOutputText($loginShell); } $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel('loginShell', _('Login shell'))), 12, 6, 6, 'responsiveLabel'); - $row->add($loginShellField, 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('loginShell', _('Login shell')))); + $row->addField($loginShellField); $return['loginShell'] = $row; } return $return; diff --git a/lam/lib/modules/pykotaUser.inc b/lam/lib/modules/pykotaUser.inc index 9838abc5..14823388 100644 --- a/lam/lib/modules/pykotaUser.inc +++ b/lam/lib/modules/pykotaUser.inc @@ -950,16 +950,16 @@ class pykotaUser extends baseModule { $pykotaBalance = ''; if (isset($attributes['pykotaBalance'][0])) $pykotaBalance = $attributes['pykotaBalance'][0]; $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel('pykotaBalance', _('Balance'))), 12, 6, 6, 'responsiveLabel'); - $row->add(new htmlOutputText($pykotaBalance), 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('pykotaBalance', _('Balance')))); + $row->addField(new htmlOutputText($pykotaBalance)); $return['pykotaBalance'] = $row; } if (in_array('pykotaLifeTimePaid', $fields)) { $pykotaLifeTimePaid = ''; if (isset($attributes['pykotaLifeTimePaid'][0])) $pykotaLifeTimePaid = $attributes['pykotaLifeTimePaid'][0]; $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel('pykotaLifeTimePaid', _('Total paid'))), 12, 6, 6, 'responsiveLabel'); - $row->add(new htmlOutputText($pykotaLifeTimePaid), 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('pykotaLifeTimePaid', _('Total paid')))); + $row->addField(new htmlOutputText($pykotaLifeTimePaid)); $return['pykotaLifeTimePaid'] = $row; } // payment history diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 46f4f2a3..cef3fe42 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -2254,8 +2254,8 @@ class sambaSamAccount extends baseModule implements passwordService { $sambaPwdLastSet = date('d.m.Y H:i', $attributes['sambaPwdLastSet'][0]); } $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel('sambaPwdLastSet', _('Last password change'))), 12, 6, 6, 'responsiveLabel'); - $row->add(new htmlOutputText($sambaPwdLastSet), 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('sambaPwdLastSet', _('Last password change')))); + $row->addField(new htmlOutputText($sambaPwdLastSet)); $return['sambaPwdLastSet'] = $row; } return $return; diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 84825fe3..4c6f242d 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -743,8 +743,8 @@ class shadowAccount extends baseModule implements passwordService { $shadowLastChange = $date['mday'] . "." . $date['mon'] . "." . $date['year']; } $row = new htmlResponsiveRow(); - $row->add(new htmlOutputText($this->getSelfServiceLabel('shadowLastChange', _('Last password change'))), 12, 6, 6, 'responsiveLabel'); - $row->add(new htmlOutputText($shadowLastChange), 12, 6, 6, 'responsiveField'); + $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('shadowLastChange', _('Last password change')))); + $row->addField(new htmlOutputText($shadowLastChange)); $return['shadowLastChange'] = $row; } return $return;