responsive update

This commit is contained in:
Roland Gruber 2017-11-01 19:41:29 +01:00
parent 93d26f97cb
commit 45e37db836
4 changed files with 80 additions and 9 deletions

View File

@ -3529,7 +3529,7 @@ class htmlResponsiveRow extends htmlElement {
* @param htmlElement $content label * @param htmlElement $content label
*/ */
public function addLabel($content) { 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; private $label;
/** help ID */ /** help ID */
private $helpID; private $helpID;
/** render HTML of parent class */
private $renderParentHtml = false;
/** /**
* Constructor. * Constructor.
@ -3801,11 +3803,6 @@ class htmlResponsiveSelect extends htmlSelect {
// label text // label text
$labelGroup = new htmlGroup(); $labelGroup = new htmlGroup();
$labelGroup->addElement(new htmlOutputText($this->label)); $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)) { if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID); $helpLinkLabel = new htmlHelpLink($this->helpID);
$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5')); $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);
}
}
?> ?>

View File

@ -143,6 +143,10 @@ input {
margin-left: 5px; margin-left: 5px;
} }
.margin-right5 {
margin-right: 5px;
}
.padding05 { .padding05 {
padding: 0.5em; padding: 0.5em;
} }

View File

@ -25,12 +25,20 @@
margin-top: 5px; margin-top: 5px;
} }
.row textarea {
width: 100%;
}
.row input { .row input {
width: 100%; width: 100%;
} }
.row textarea { .row input[type="submit"] {
width: 100%; width: auto;
}
.row input[type="file"] {
width: auto;
} }
.row input[type="checkbox"] { .row input[type="checkbox"] {

View File

@ -297,7 +297,7 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
</a> </a>
</td> </td>
<td align="right" height=20> <td align="right" height=20>
<a href="./config/index.php"><IMG alt="configuration" src="../graphics/tools.png">&nbsp;<span class="hide-for-small"><?php echo _("LAM configuration") ?></span></a> <a class="margin-right5" href="./config/index.php"><IMG alt="configuration" src="../graphics/tools.png">&nbsp;<span class="hide-for-small"><?php echo _("LAM configuration") ?></span></a>
</td> </td>
</tr> </tr>
</table> </table>