better help support

This commit is contained in:
Roland Gruber 2017-11-27 18:11:38 +01:00
parent 150e6158dc
commit ee795fa42e
1 changed files with 38 additions and 12 deletions

View File

@ -3729,6 +3729,8 @@ class htmlResponsiveInputField extends htmlInputField {
private $label;
/** help ID */
private $helpID;
/** help module name */
private $helpModule = null;
/** render HTML of parent class */
private $renderParentHtml = false;
@ -3738,13 +3740,21 @@ class htmlResponsiveInputField extends htmlInputField {
* @param String $label descriptive label
* @param String $fieldName unique field name
* @param String $fieldValue value of input field (optional)
* @param String $helpID help ID (optional)
* @param String|array $helpID help ID or array of help ID + module name (optional)
* @param bool $required field is required
*/
function __construct($label, $fieldName, $fieldValue = null, $helpID = null) {
function __construct($label, $fieldName, $fieldValue = null, $helpID = null, $required = false) {
parent::__construct($fieldName, $fieldValue);
$this->label = $label;
if (is_string($helpID)) {
$this->helpID = $helpID;
}
elseif (is_array($helpID)) {
$this->helpID = $helpID[0];
$this->helpModule = $helpID[1];
}
$this->fieldSize = null;
$this->required = $required;
}
/**
@ -3767,7 +3777,7 @@ class htmlResponsiveInputField extends htmlInputField {
$labelGroup->addElement(new htmlImage($graphicsPath . '/required.png', 16, 16, _('required'), _('required')));
}
if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID);
$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5'));
$labelGroup->addElement($helpLinkLabel);
}
@ -3776,7 +3786,7 @@ class htmlResponsiveInputField extends htmlInputField {
$fieldGroup = new htmlGroup();
$fieldGroup->addElement($this);
if (!empty($this->helpID)) {
$helpLinkField = new htmlHelpLink($this->helpID);
$helpLinkField = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLinkField->setCSSClasses(array('hide-on-mobile'));
$fieldGroup->addElement($helpLinkField);
}
@ -3878,6 +3888,8 @@ class htmlResponsiveSelect extends htmlSelect {
private $label;
/** help ID */
private $helpID;
/** help module name */
private $helpModule = null;
/** render HTML of parent class */
private $renderParentHtml = false;
@ -3888,14 +3900,20 @@ class htmlResponsiveSelect extends htmlSelect {
* @param array $elements list of elememts
* @param array $selectedElements list of selected elements
* @param String $label descriptive label
* @param String $helpID help ID (optional, default none)
* @param String|array $helpID help ID or array of help ID + module name (optional)
* @param int $size size (optional, default = 1)
*/
function __construct($name, $elements, $selectedElements, $label, $helpID = null, $size = 1) {
parent::__construct($name, $elements, $selectedElements, $size);
$this->label = htmlspecialchars($label);
if (is_string($helpID)) {
$this->helpID = $helpID;
}
elseif (is_array($helpID)) {
$this->helpID = $helpID[0];
$this->helpModule = $helpID[1];
}
}
/**
* {@inheritDoc}
@ -3912,7 +3930,7 @@ class htmlResponsiveSelect extends htmlSelect {
$labelGroup = new htmlGroup();
$labelGroup->addElement(new htmlOutputText($this->label));
if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID);
$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5'));
$labelGroup->addElement($helpLinkLabel);
}
@ -3921,7 +3939,7 @@ class htmlResponsiveSelect extends htmlSelect {
$fieldGroup = new htmlGroup();
$fieldGroup->addElement($this);
if (!empty($this->helpID)) {
$helpLink = new htmlHelpLink($this->helpID);
$helpLink = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLink->setCSSClasses(array('hide-on-mobile'));
$fieldGroup->addElement($helpLink);
}
@ -4014,6 +4032,8 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox {
private $label;
/** help ID */
private $helpID;
/** help module name */
private $helpModule = null;
/** render HTML of parent class */
private $renderParentHtml = false;
/** long label */
@ -4025,13 +4045,19 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox {
* @param String $name unique name
* @param boolean $checked checked
* @param String $label descriptive label
* @param String $helpID help ID
* @param String|array $helpID help ID or array of help ID + module name (optional)
* @param bool $longLabel more space for label (default: false)
*/
function __construct($name, $checked, $label, $helpID = null, $longLabel = false) {
parent::__construct($name, $checked);
$this->label = $label;
if (is_string($helpID)) {
$this->helpID = $helpID;
}
elseif (is_array($helpID)) {
$this->helpID = $helpID[0];
$this->helpModule = $helpID[1];
}
$this->longLabel = $longLabel;
}
@ -4060,7 +4086,7 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox {
$fieldGroup = new htmlGroup();
$fieldGroup->addElement($this);
if (!empty($this->helpID)) {
$helpLink = new htmlHelpLink($this->helpID);
$helpLink = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLink->setCSSClasses(array('margin-left5 align-unset-img'));
$fieldGroup->addElement($helpLink);
}