responsive self service

This commit is contained in:
Roland Gruber 2015-08-06 19:20:54 +00:00
parent 5342ee41ad
commit a74e645ea3
4 changed files with 119 additions and 122 deletions

View File

@ -936,7 +936,7 @@ class pykotaUser extends baseModule {
* @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) {
if ($passwordChangeOnly) { if ($passwordChangeOnly) {
@ -949,86 +949,70 @@ class pykotaUser extends baseModule {
if (in_array('pykotaBalance', $fields)) { if (in_array('pykotaBalance', $fields)) {
$pykotaBalance = ''; $pykotaBalance = '';
if (isset($attributes['pykotaBalance'][0])) $pykotaBalance = $attributes['pykotaBalance'][0]; if (isset($attributes['pykotaBalance'][0])) $pykotaBalance = $attributes['pykotaBalance'][0];
$return['pykotaBalance'] = new htmlTableRow(array( $row = new htmlResponsiveRow();
new htmlOutputText($this->getSelfServiceLabel('pykotaBalance', _('Balance'))), new htmlOutputText($pykotaBalance) $row->add(new htmlOutputText($this->getSelfServiceLabel('pykotaBalance', _('Balance'))), 12, 6, 6, 'responsiveLabel');
)); $row->add(new htmlOutputText($pykotaBalance), 12, 6, 6, 'responsiveField');
$return['pykotaBalance'] = $row;
} }
if (in_array('pykotaLifeTimePaid', $fields)) { if (in_array('pykotaLifeTimePaid', $fields)) {
$pykotaLifeTimePaid = ''; $pykotaLifeTimePaid = '';
if (isset($attributes['pykotaLifeTimePaid'][0])) $pykotaLifeTimePaid = $attributes['pykotaLifeTimePaid'][0]; if (isset($attributes['pykotaLifeTimePaid'][0])) $pykotaLifeTimePaid = $attributes['pykotaLifeTimePaid'][0];
$return['pykotaLifeTimePaid'] = new htmlTableRow(array( $row = new htmlResponsiveRow();
new htmlOutputText($this->getSelfServiceLabel('pykotaLifeTimePaid', _('Total paid'))), new htmlOutputText($pykotaLifeTimePaid) $row->add(new htmlOutputText($this->getSelfServiceLabel('pykotaLifeTimePaid', _('Total paid'))), 12, 6, 6, 'responsiveLabel');
)); $row->add(new htmlOutputText($pykotaLifeTimePaid), 12, 6, 6, 'responsiveField');
$return['pykotaLifeTimePaid'] = $row;
} }
// payment history // payment history
if (in_array('pykotaPayments', $fields)) { if (in_array('pykotaPayments', $fields)) {
$pykotaPayments = new htmlTable(); $pykotaPayments = new htmlResponsiveRow();
$pykotaPayments->colspan = 5;
if (!empty($attributes['pykotaPayments'][0])) { if (!empty($attributes['pykotaPayments'][0])) {
$spacer = new htmlSpacer('10px', null); $pykotaPayments->add(new htmlOutputText(_('Date')), 3, 3, 3, 'bold');
$pykotaPayments->addElement(new htmlOutputText(_('Date')), false, true); $pykotaPayments->add(new htmlOutputText(_('Amount')), 3, 3, 3, 'bold');
$pykotaPayments->addElement($spacer); $pykotaPayments->add(new htmlOutputText(_('Comment')), 6, 6, 6, 'bold');
$pykotaPayments->addElement(new htmlOutputText(_('Amount')), false, true);
$pykotaPayments->addElement($spacer);
$pykotaPayments->addElement(new htmlOutputText(_('Comment')), true, true);
rsort($attributes['pykotaPayments']); rsort($attributes['pykotaPayments']);
foreach ($attributes['pykotaPayments'] as $payment) { foreach ($attributes['pykotaPayments'] as $payment) {
$parts = explode(' # ', $payment); $parts = explode(' # ', $payment);
$pykotaPayments->addElement(new htmlOutputText($parts[0])); $pykotaPayments->add(new htmlOutputText($parts[0]), 3);
$pykotaPayments->addElement($spacer);
$amount = new htmlOutputText($parts[1]); $amount = new htmlOutputText($parts[1]);
$amount->alignment = htmlElement::ALIGN_RIGHT; $amount->alignment = htmlElement::ALIGN_RIGHT;
$pykotaPayments->addElement($amount); $pykotaPayments->add($amount, 3);
$pykotaPayments->addElement($spacer); $comment = empty($parts[2]) ? '' : $parts[2];
if (!empty($parts[2])) { $pykotaPayments->add(new htmlOutputText(base64_decode($parts[2])), 6);
$pykotaPayments->addElement(new htmlOutputText(base64_decode($parts[2])));
}
$pykotaPayments->addNewLine();
} }
} }
$pykotaPaymentsLabel = new htmlOutputText($this->getSelfServiceLabel('pykotaPayments', _('Payment history'))); $row->add(new htmlSpacer(null, '10px'), 12);
$pykotaPaymentsLabel->alignment = htmlElement::ALIGN_TOP; $row = new htmlResponsiveRow();
$return['pykotaPayments'] = new htmlTableRow(array( $row->add(new htmlOutputText($this->getSelfServiceLabel('pykotaPayments', _('Payment history'))), 12, 12, 12, 'bold text-left');
$pykotaPaymentsLabel, $pykotaPayments $row->add($pykotaPayments, 12);
)); $return['pykotaPayments'] = $row;
} }
// job history // job history
if (in_array('pykotaJobHistory', $fields) && !empty($this->selfServiceSettings->moduleSettings['pykotaUser_jobSuffix'][0]) && !empty($attributes['pykotaUserName'][0])) { if (in_array('pykotaJobHistory', $fields) && !empty($this->selfServiceSettings->moduleSettings['pykotaUser_jobSuffix'][0]) && !empty($attributes['pykotaUserName'][0])) {
$jobs = $this->getJobs($attributes['pykotaUserName'][0], $this->selfServiceSettings->moduleSettings['pykotaUser_jobSuffix'][0]); $jobs = $this->getJobs($attributes['pykotaUserName'][0], $this->selfServiceSettings->moduleSettings['pykotaUser_jobSuffix'][0]);
$pykotaJobs = new htmlTable(); $pykotaJobs = new htmlResponsiveRow();
$pykotaJobs->colspan = 5; $pykotaJobs->add(new htmlOutputText(_('Date')), 3, 3, 3, 'bold');
$spacer = new htmlSpacer('10px', null); $pykotaJobs->add(new htmlOutputText(_('Printer')), 3, 3, 3, 'bold');
$pykotaJobs->addElement(new htmlOutputText(_('Date')), false, true); $pykotaJobs->add(new htmlOutputText(_('Price')), 2, 2, 2, 'bold');
$pykotaJobs->addElement($spacer); $pykotaJobs->add(new htmlOutputText(_('Size')), 1, 1, 1, 'bold');
$pykotaJobs->addElement(new htmlOutputText(_('Printer')), false, true);
$pykotaJobs->addElement($spacer);
$pykotaJobs->addElement(new htmlOutputText(_('Price')), false, true);
$pykotaJobs->addElement($spacer);
$pykotaJobs->addElement(new htmlOutputText(_('Size')), false, true);
$pykotaJobs->addElement($spacer);
$title = new htmlOutputText(_('Title')); $title = new htmlOutputText(_('Title'));
$title->alignment = htmlElement::ALIGN_LEFT; $title->alignment = htmlElement::ALIGN_LEFT;
$pykotaJobs->addElement($title, true, true); $pykotaJobs->add($title, 3, 3, 3, 'bold');
foreach ($jobs as $job) { foreach ($jobs as $job) {
$pykotaJobs->addElement(new htmlOutputText(formatLDAPTimestamp($job['createtimestamp'][0]))); $pykotaJobs->add(new htmlOutputText(formatLDAPTimestamp($job['createtimestamp'][0])), 3);
$pykotaJobs->addElement($spacer); $pykotaJobs->add(new htmlOutputText($job['pykotaprintername'][0]), 3);
$pykotaJobs->addElement(new htmlOutputText($job['pykotaprintername'][0]));
$pykotaJobs->addElement($spacer);
$price = new htmlOutputText($job['pykotajobprice'][0]); $price = new htmlOutputText($job['pykotajobprice'][0]);
$price->alignment = htmlElement::ALIGN_RIGHT; $price->alignment = htmlElement::ALIGN_RIGHT;
$pykotaJobs->addElement($price); $pykotaJobs->add($price, 2);
$pykotaJobs->addElement($spacer);
$size = new htmlOutputText($job['pykotajobsize'][0]); $size = new htmlOutputText($job['pykotajobsize'][0]);
$size->alignment = htmlElement::ALIGN_RIGHT; $size->alignment = htmlElement::ALIGN_RIGHT;
$pykotaJobs->addElement($size); $pykotaJobs->add($size, 1);
$pykotaJobs->addElement($spacer); $pykotaJobs->add(new htmlOutputText($job['pykotatitle'][0]), 3);
$pykotaJobs->addElement(new htmlOutputText($job['pykotatitle'][0]), true);
} }
$pykotaJobsLabel = new htmlOutputText($this->getSelfServiceLabel('pykotaJobHistory', _('Job history'))); $row = new htmlResponsiveRow();
$pykotaJobsLabel->alignment = htmlElement::ALIGN_TOP; $row->add(new htmlSpacer(null, '10px'), 12);
$return['pykotaJobHistory'] = new htmlTableRow(array( $row->add(new htmlOutputText($this->getSelfServiceLabel('pykotaJobHistory', _('Job history'))), 12, 12, 12, 'bold text-left');
$pykotaJobsLabel, $pykotaJobs $row->add($pykotaJobs, 12);
)); $return['pykotaJobHistory'] = $row;
} }
return $return; return $return;
} }

View File

@ -2225,7 +2225,7 @@ class sambaSamAccount 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();
@ -2236,27 +2236,27 @@ class sambaSamAccount extends baseModule implements passwordService {
return $return; return $return;
} }
if (in_array('password', $fields)) { if (in_array('password', $fields)) {
$pwdTable = new htmlTable(); $group = new htmlGroup();
$pwdTable->colspan = 3; $pwd1 = new htmlResponsiveInputField($this->getSelfServiceLabel('password', _('New password')), 'sambaSamAccount_password');
$pwd1 = new htmlTableExtendedInputField($this->getSelfServiceLabel('password', _('New password')), 'sambaSamAccount_password');
$pwd1->setIsPassword(true, true); $pwd1->setIsPassword(true, true);
$pwdTable->addElement($pwd1, true); $group->addElement($pwd1);
$pwd2 = new htmlTableExtendedInputField(_('Reenter password'), 'sambaSamAccount_password2'); $pwd2 = new htmlResponsiveInputField(_('Reenter password'), 'sambaSamAccount_password2');
$pwd2->setIsPassword(true); $pwd2->setIsPassword(true);
$pwd2->setSameValueFieldID('sambaSamAccount_password'); $pwd2->setSameValueFieldID('sambaSamAccount_password');
$pwdTable->addElement($pwd2); $group->addElement($pwd2);
$return['password'] = new htmlTableRow(array( $row = new htmlResponsiveRow();
$pwdTable $row->add($group, 12);
)); $return['password'] = $row;
} }
if (in_array('sambaPwdLastSet', $fields)) { if (in_array('sambaPwdLastSet', $fields)) {
$sambaPwdLastSet = ''; $sambaPwdLastSet = '';
if (isset($attributes['sambaPwdLastSet'][0])) { if (isset($attributes['sambaPwdLastSet'][0])) {
$sambaPwdLastSet = date('d.m.Y H:i', $attributes['sambaPwdLastSet'][0]); $sambaPwdLastSet = date('d.m.Y H:i', $attributes['sambaPwdLastSet'][0]);
} }
$return['sambaPwdLastSet'] = new htmlTableRow(array( $row = new htmlResponsiveRow();
new htmlOutputText($this->getSelfServiceLabel('sambaPwdLastSet', _('Last password change'))), new htmlOutputText($sambaPwdLastSet) $row->add(new htmlOutputText($this->getSelfServiceLabel('sambaPwdLastSet', _('Last password change'))), 12, 6, 6, 'responsiveLabel');
)); $row->add(new htmlOutputText($sambaPwdLastSet), 12, 6, 6, 'responsiveField');
$return['sambaPwdLastSet'] = $row;
} }
return $return; return $return;
} }

View File

@ -729,7 +729,7 @@ class shadowAccount 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();
@ -742,9 +742,10 @@ class shadowAccount extends baseModule implements passwordService {
$date = getdate($attributes['shadowLastChange'][0] * 3600 * 24); $date = getdate($attributes['shadowLastChange'][0] * 3600 * 24);
$shadowLastChange = $date['mday'] . "." . $date['mon'] . "." . $date['year']; $shadowLastChange = $date['mday'] . "." . $date['mon'] . "." . $date['year'];
} }
$return['shadowLastChange'] = new htmlTableRow(array( $row = new htmlResponsiveRow();
new htmlOutputText($this->getSelfServiceLabel('shadowLastChange', _('Last password change'))), new htmlOutputText($shadowLastChange) $row->add(new htmlOutputText($this->getSelfServiceLabel('shadowLastChange', _('Last password change'))), 12, 6, 6, 'responsiveLabel');
)); $row->add(new htmlOutputText($shadowLastChange), 12, 6, 6, 'responsiveField');
$return['shadowLastChange'] = $row;
} }
return $return; return $return;
} }

View File

@ -149,6 +149,18 @@ table.collapse {
text-align: right; text-align: right;
} }
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.bold {
font-weight: bold;
}
/** buttons */ /** buttons */
.saveButton { .saveButton {
background-image: url(../graphics/save.png) !important; background-image: url(../graphics/save.png) !important;
@ -661,7 +673,7 @@ h4.schema_oclass_sub {
/** responsive styles */ /** responsive styles */
div.dialog-page { div.dialog-page {
max-width: 45em; float: left;
} }
/* mobile */ /* mobile */