diff --git a/lam/graphics/required.png b/lam/graphics/required.png
deleted file mode 100644
index 2718ce4c3..000000000
Binary files a/lam/graphics/required.png and /dev/null differ
diff --git a/lam/lib/html.inc b/lam/lib/html.inc
index cc0d6d21e..a31b546c7 100644
--- a/lam/lib/html.inc
+++ b/lam/lib/html.inc
@@ -27,6 +27,26 @@
* @author Roland Gruber
*/
+/**
+ * Returns the marker for required values.
+ *
+ * @return string HTML code for required marker
+ */
+function htmlGetRequiredMarker(): string {
+ return '*';
+}
+
+/**
+ * Returns the marker for required values.
+ *
+ * @return htmlSpan HTML code for required marker
+ */
+function htmlGetRequiredMarkerElement(): htmlSpan {
+ $span = new htmlSpan(new htmlOutputText('*'), array('lam-required'));
+ $span->setTitle(_('required'));
+ return $span;
+}
+
/**
* Represents a HTML element.
* This is used to build HTML code by using objects.
@@ -948,9 +968,7 @@ class htmlTableExtendedInputField extends htmlInputField {
echo '
';
echo $this->label;
if ($this->required) {
- $graphicsPath = "../../graphics";
- if (is_dir("../graphics")) $graphicsPath = "../graphics";
- echo '

';
+ echo htmlGetRequiredMarker();
}
echo '
';
echo "\n\n\n";
@@ -2045,9 +2063,7 @@ class htmlOutputText extends htmlElement {
echo $this->string;
}
if ($this->markAsRequired) {
- $graphicsPath = "../../graphics";
- if (is_dir("../graphics")) $graphicsPath = "../graphics";
- echo ' ';
+ echo htmlGetRequiredMarker();
}
if ($this->isPreformatted) {
echo "";
@@ -2763,9 +2779,7 @@ class htmlTableExtendedInputTextarea extends htmlInputTextarea {
echo '';
echo $this->label;
if ($this->required) {
- $graphicsPath = "../../graphics";
- if (is_dir("../graphics")) $graphicsPath = "../graphics";
- echo '  ';
+ echo htmlGetRequiredMarker();
}
echo ' ';
echo "\n | \n\n";
@@ -3705,6 +3719,8 @@ class htmlSpan extends htmlElement {
private $content = null;
/** onclick handler */
private $onclick = null;
+ /** title */
+ private $title = null;
/**
* Constructor.
@@ -3739,7 +3755,11 @@ class htmlSpan extends htmlElement {
if (!empty($this->onclick)) {
$onclickHandler = ' onclick="' . $this->onclick . '"';
}
- echo '';
+ $titleCode = '';
+ if ($this->title !== null) {
+ $titleCode = ' title="' . $this->title . '"';
+ }
+ echo '';
if ($this->content != null) {
$return = $this->content->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
}
@@ -3756,6 +3776,15 @@ class htmlSpan extends htmlElement {
$this->onclick = $event;
}
+ /**
+ * Sets the title.
+ *
+ * @param string|null $title title
+ */
+ public function setTitle(?string $title): void {
+ $this->title = htmlspecialchars($title);
+ }
+
}
/**
@@ -4465,11 +4494,7 @@ class htmlResponsiveInputField extends htmlInputField {
$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')));
+ $labelGroup->addElement(htmlGetRequiredMarkerElement());
}
if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
@@ -4561,9 +4586,7 @@ class htmlResponsiveInputFileUpload extends htmlInputFileUpload {
$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')));
+ $labelGroup->addElement(htmlGetRequiredMarkerElement());
}
if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
@@ -4648,9 +4671,7 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea {
$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')));
+ $labelGroup->addElement(htmlGetRequiredMarkerElement());
}
if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
diff --git a/lam/style/500_layout.css b/lam/style/500_layout.css
index dff971c80..269a62817 100644
--- a/lam/style/500_layout.css
+++ b/lam/style/500_layout.css
@@ -341,6 +341,12 @@ table.accountlist > tbody > tr:hover {
vertical-align: unset;
}
+span.lam-required {
+ font-weight: bold;
+ color: #ff9933;
+ margin-left: 0.2rem;
+}
+
/* table preferences */
table.accountlist thead {
|