From 45e37db8361a3416bc0a549633a4132928986f91 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 1 Nov 2017 19:41:29 +0100 Subject: [PATCH] responsive update --- lam/lib/html.inc | 71 +++++++++++++++++++++++++++++--- lam/style/500_layout.css | 4 ++ lam/style/responsive/120_lam.css | 12 +++++- lam/templates/login.php | 2 +- 4 files changed, 80 insertions(+), 9 deletions(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 724adbd7..e14e1a9f 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -3529,7 +3529,7 @@ class htmlResponsiveRow extends htmlElement { * @param htmlElement $content label */ public function addLabel($content) { - $this->add($content, 12, 6, 6, 'responsiveLabel'); + $this->add($content, 12, 6, 6, 'responsiveLabel nowrap'); } /** @@ -3770,6 +3770,8 @@ class htmlResponsiveSelect extends htmlSelect { private $label; /** help ID */ private $helpID; + /** render HTML of parent class */ + private $renderParentHtml = false; /** * Constructor. @@ -3801,11 +3803,6 @@ class htmlResponsiveSelect extends htmlSelect { // label text $labelGroup = new htmlGroup(); $labelGroup->addElement(new htmlOutputText($this->label)); - if ($this->required) { - $graphicsPath = "../../graphics"; - if (is_dir("../graphics")) $graphicsPath = "../graphics"; - $labelGroup->addElement(new htmlImage($graphicsPath . '/required.png', 16, 16, _('required'), _('required'))); - } if (!empty($this->helpID)) { $helpLinkLabel = new htmlHelpLink($this->helpID); $helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5')); @@ -3826,5 +3823,67 @@ class htmlResponsiveSelect extends htmlSelect { } +/** + * Responsive checkbox with descriptive label and help link. + * + * @package metaHTML + */ +class htmlResponsiveInputCheckbox extends htmlInputCheckbox { + + /** descriptive label */ + private $label; + /** help ID */ + private $helpID; + /** render HTML of parent class */ + private $renderParentHtml = false; + + /** + * Constructor. + * + * @param String $name unique name + * @param boolean $checked checked + * @param String $label descriptive label + * @param String $helpID help ID + */ + function __construct($name, $checked, $label, $helpID = null) { + parent::__construct($name, $checked); + $this->label = htmlspecialchars($label); + $this->helpID = $helpID; + } + + /** + * {@inheritDoc} + * @see htmlInputField::generateHTML() + */ + function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { + if ($this->renderParentHtml) { + return parent::generateHTML($module, $input, $values, $restricted, $tabindex, $scope); + } + // HTML of parent class is rendered on second call (done by htmlResponsiveRow) + $this->renderParentHtml = true; + $row = new htmlResponsiveRow(); + // label text + $labelGroup = new htmlGroup(); + $labelGroup->addElement(new htmlOutputText($this->label)); + if (!empty($this->helpID)) { + $helpLinkLabel = new htmlHelpLink($this->helpID); + $helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5')); + $labelGroup->addElement($helpLinkLabel); + } + $row->add($labelGroup, 12, 6, 6, 'responsiveLabel'); + // input field + $fieldGroup = new htmlGroup(); + $fieldGroup->addElement($this); + if (!empty($this->helpID)) { + $helpLink = new htmlHelpLink($this->helpID); + $helpLink->setCSSClasses(array('hide-on-mobile', 'margin-left5')); + $fieldGroup->addElement($helpLink); + } + $row->add($fieldGroup, 12, 6, 6, 'responsiveField nowrap'); + return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope); + } + +} + ?> diff --git a/lam/style/500_layout.css b/lam/style/500_layout.css index 7d184735..3b9ebb6a 100644 --- a/lam/style/500_layout.css +++ b/lam/style/500_layout.css @@ -143,6 +143,10 @@ input { margin-left: 5px; } +.margin-right5 { + margin-right: 5px; +} + .padding05 { padding: 0.5em; } diff --git a/lam/style/responsive/120_lam.css b/lam/style/responsive/120_lam.css index c2fd944c..817cd76e 100644 --- a/lam/style/responsive/120_lam.css +++ b/lam/style/responsive/120_lam.css @@ -25,12 +25,20 @@ margin-top: 5px; } +.row textarea { + width: 100%; +} + .row input { width: 100%; } -.row textarea { - width: 100%; +.row input[type="submit"] { + width: auto; +} + +.row input[type="file"] { + width: auto; } .row input[type="checkbox"] { diff --git a/lam/templates/login.php b/lam/templates/login.php index 0d10b636..5a82f6cd 100644 --- a/lam/templates/login.php +++ b/lam/templates/login.php @@ -297,7 +297,7 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen - configuration  + configuration