From 62985466204fd9f7e92e90053ee8a1672be4f29a Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 17 Sep 2019 12:02:21 +0200 Subject: [PATCH] responsive --- lam/lib/baseModule.inc | 11 ++++----- lam/lib/modules.inc | 4 ++++ lam/lib/modules/puppetClient.inc | 22 ++++++++---------- lam/lib/modules/pykotaBillingCode.inc | 32 ++++++++++++++------------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index 26af355e..21d67bce 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -1504,7 +1504,7 @@ abstract class baseModule { * There must be a help entry with the attribute name as ID. * A new line will also be added after this entry so multiple calls will show the fields one below the other. * - * @param htmlTable $container parent container + * @param htmlResponsiveRow $container parent container * @param String $attrName attribute name * @param String $label label name * @param array $options options for the selects @@ -1526,9 +1526,8 @@ abstract class baseModule { $values = array_values($values); if ($label !== null) { $labelTextOut = new htmlOutputText($label); - $labelTextOut->alignment = htmlElement::ALIGN_TOP; $labelTextOut->setMarkAsRequired($required); - $container->addElement($labelTextOut); + $container->addLabel($labelTextOut); } $subContainer = new htmlTable(); $subContainer->alignment = htmlElement::ALIGN_TOP; @@ -1544,13 +1543,11 @@ abstract class baseModule { } if ($i == 0) { $subContainer->addElement(new htmlButton('add_' . $attrName, 'add.png', true)); + $subContainer->addElement(new htmlHelpLink($attrName)); } $subContainer->addNewLine(); } - $container->addElement($subContainer); - $help = new htmlHelpLink($attrName); - $help->alignment = htmlElement::ALIGN_TOP; - $container->addElement($help, true); + $container->addField($subContainer); } /** diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 071b5790..12af4986 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -1291,12 +1291,14 @@ class accountContainer { // save button $saveButton = new htmlButton('accountContainerSaveAccount', _('Save')); $saveButton->setIconClass('saveButton'); + $saveButton->setCSSClasses(array('fullwidth-mobile-only')); $leftButtonGroup->addElement($saveButton); $leftButtonGroup->addElement(new htmlSpacer('1px', null)); // reset button if (!$this->isNewAccount) { $resetButton = new htmlButton('accountContainerReset', _('Reset changes')); $resetButton->setIconClass('undoButton'); + $resetButton->setCSSClasses(array('fullwidth-mobile-only')); $leftButtonGroup->addElement($resetButton); } // set password button @@ -1304,6 +1306,7 @@ class accountContainer { $leftButtonGroup->addElement(new htmlSpacer('15px', null)); $passwordButton = new htmlButton('accountContainerPassword', _('Set password')); $passwordButton->setIconClass('passwordButton'); + $passwordButton->setCSSClasses(array('fullwidth-mobile-only')); $passwordButton->setOnClick('passwordShowChangeDialog(\'' . _('Set password') . '\', \'' . _('Ok') . '\', \'' . _('Cancel') . '\', \'' . _('Set random password') . '\', \'../misc/ajax.php?function=passwordChange&editKey=' . htmlspecialchars($this->base) . '\',\'' . getSecurityTokenName() . '\',\'' . getSecurityTokenValue() . '\');'); @@ -1313,6 +1316,7 @@ class accountContainer { $leftButtonGroup->addElement(new htmlSpacer('15px', null)); $deleteButton = new htmlButton('accountContainerDelete', _('Delete')); $deleteButton->setIconClass('deleteButton'); + $deleteButton->setCSSClasses(array('fullwidth-mobile-only')); $leftButtonGroup->addElement($deleteButton); } $row->add($leftButtonGroup, 12, 7); diff --git a/lam/lib/modules/puppetClient.inc b/lam/lib/modules/puppetClient.inc index 3ea7700f..413d75da 100644 --- a/lam/lib/modules/puppetClient.inc +++ b/lam/lib/modules/puppetClient.inc @@ -5,7 +5,7 @@ use \LAM\PDF\PDFTableRow; /* This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2012 - 2018 Roland Gruber + Copyright (C) 2012 - 2019 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -232,9 +232,9 @@ class puppetClient extends baseModule { if (isset($_POST['form_subpage_puppetClient_attributes_addObjectClass'])) { $this->attributes['objectClass'][] = 'puppetClient'; } - $return = new htmlTable(); + $return = new htmlResponsiveRow(); if (!in_array('puppetClient', $this->attributes['objectClass'])) { - $return->addElement(new htmlAccountPageButton('puppetClient', 'attributes', 'addObjectClass', _('Add Puppet extension'))); + $return->add(new htmlAccountPageButton('puppetClient', 'attributes', 'addObjectClass', _('Add Puppet extension')), 12); return $return; } $this->initCache(); @@ -251,8 +251,7 @@ class puppetClient extends baseModule { $environments[] = ''; } $environmentLabel = new htmlOutputText(_('Environment')); - $environmentLabel->alignment = htmlElement::ALIGN_TOP; - $return->addElement($environmentLabel); + $return->addLabel($environmentLabel); $environmentContainer = new htmlGroup(); for ($i = 0; $i < sizeof($environments); $i++) { $environmentField = new htmlInputField('environment' . $i, $environments[$i]); @@ -263,12 +262,10 @@ class puppetClient extends baseModule { } else { $environmentContainer->addElement(new htmlButton('addEnvironment', 'add.png', true)); + $environmentContainer->addElement(new htmlHelpLink('environment')); } } - $return->addElement($environmentContainer); - $environmentHelp = new htmlHelpLink('environment'); - $environmentHelp->alignment = htmlElement::ALIGN_TOP; - $return->addElement($environmentHelp, true); + $return->addField($environmentContainer); // parent node $possibleParentNodes = $this->getPossibleParentNodes(); array_unshift($possibleParentNodes, '-'); @@ -276,7 +273,7 @@ class puppetClient extends baseModule { if (isset($this->attributes['parentnode'][0])) { $parentnode = $this->attributes['parentnode'][0]; } - $return->addElement(new htmlTableExtendedSelect('parentnode', $possibleParentNodes, array($parentnode), _('Parent node'), 'parentnode'), true); + $return->add(new htmlResponsiveSelect('parentnode', $possibleParentNodes, array($parentnode), _('Parent node'), 'parentnode'), 12); // classes if (empty($this->moduleSettings['puppetClient_enforceClasses'][0])) { $this->addMultiValueInputTextField($return, 'puppetclass', _('Classes'), false, null, false, $this->classCache); @@ -287,10 +284,9 @@ class puppetClient extends baseModule { // variables $this->addMultiValueInputTextField($return, 'puppetvar', _('Variables'), false, null, false, $this->variablesCache); - $return->addElement(new htmlSpacer(null, '10px'),true); + $return->addVerticalSpacer('2rem'); $remButton = new htmlAccountPageButton('puppetClient', 'attributes', 'remObjectClass', _('Remove Puppet extension')); - $remButton->colspan = 4; - $return->addElement($remButton); + $return->add($remButton, 12, 12, 12, 'text-center'); return $return; } diff --git a/lam/lib/modules/pykotaBillingCode.inc b/lam/lib/modules/pykotaBillingCode.inc index d37e0cdf..16d6d1c7 100644 --- a/lam/lib/modules/pykotaBillingCode.inc +++ b/lam/lib/modules/pykotaBillingCode.inc @@ -1,9 +1,8 @@ addSimpleInputTextField($container, 'pykotaBillingCode', _('Billing code'), true); // balance - $container->addElement(new htmlOutputText(_('Balance'))); + $container->addLabel(new htmlOutputText(_('Balance'))); $pykotaBalance = ''; if (isset($this->attributes['pykotaBalance'][0])) { $pykotaBalance = $this->attributes['pykotaBalance'][0]; } - $container->addElement(new htmlOutputText($pykotaBalance)); - $container->addElement(new htmlHelpLink('pykotaBalance'), true); + $balanceGroup = new htmlGroup(); + $balanceGroup->addElement(new htmlOutputText($pykotaBalance)); + $balanceGroup->addElement(new htmlHelpLink('pykotaBalance')); + $container->addField($balanceGroup); // page count - $container->addElement(new htmlOutputText(_('Page count'))); + $container->addLabel(new htmlOutputText(_('Page count'))); $pykotaPageCounter = ''; if (isset($this->attributes['pykotaPageCounter'][0])) { $pykotaPageCounter = $this->attributes['pykotaPageCounter'][0]; } - $container->addElement(new htmlOutputText($pykotaPageCounter)); - $container->addElement(new htmlHelpLink('pykotaPageCounter'), true); + $pageCounterGroup = new htmlGroup(); + $pageCounterGroup->addElement(new htmlOutputText($pykotaPageCounter)); + $pageCounterGroup->addElement(new htmlHelpLink('pykotaPageCounter')); + $container->addField($pageCounterGroup); // description $this->addSimpleInputTextField($container, 'description', _('Description'), false, null, true); // reset - $container->addElement(new htmlSpacer(null, '20px'), true); - $container->addElement(new htmlOutputText('')); - $container->addElement(new htmlButton('resetCounters', _('Reset'))); - $container->addElement(new htmlHelpLink('reset'), true); - // same width - $container->addElement(new htmlEqualWidth(array('pykotaBillingCode', 'description'))); + $container->addVerticalSpacer('2rem'); + $resetGroup = new htmlGroup(); + $resetGroup->addElement(new htmlButton('resetCounters', _('Reset'))); + $resetGroup->addElement(new htmlHelpLink('reset')); + $container->add($resetGroup, 12, 12, 12, 'text-center'); return $container; }