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

View File

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

View File

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

View File

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