display selection boxes that contain only one element as text
This commit is contained in:
parent
56ca67879e
commit
df5b63de00
|
@ -740,6 +740,11 @@ class htmlSelect extends htmlElement {
|
|||
if ($this->width != '') {
|
||||
$style = ' style="width: ' . $this->width . '"';
|
||||
}
|
||||
// hide select boxes that contain less than 2 elements
|
||||
if (sizeof($this->elements) < 2) {
|
||||
echo '<div class="hidden">';
|
||||
}
|
||||
// print select box
|
||||
echo '<select' . $class . $style . $name . $size . $multi . $disabled . ' tabindex="' . $tabindex . "\">\n";
|
||||
$tabindex++;
|
||||
if ($this->containsOptgroups) {
|
||||
|
@ -755,6 +760,20 @@ class htmlSelect extends htmlElement {
|
|||
$this->printOptionsHTML($this->elements);
|
||||
}
|
||||
echo "</select>\n";
|
||||
// if select box has only one element then show it as text
|
||||
if (sizeof($this->elements) == 1) {
|
||||
echo '</div>';
|
||||
if ($this->hasDescriptiveElements) {
|
||||
$keys = array_keys($this->elements);
|
||||
echo $keys[0];
|
||||
}
|
||||
else {
|
||||
echo $this->elements[0];
|
||||
}
|
||||
}
|
||||
else if (sizeof($this->elements) == 0) {
|
||||
echo '</div>';
|
||||
}
|
||||
if ($this->multiSelect) {
|
||||
return array($this->name => 'multiselect');
|
||||
}
|
||||
|
|
|
@ -148,6 +148,10 @@ tr.highlight {
|
|||
background-image: url(../graphics/tools.png) !important;
|
||||
}
|
||||
|
||||
.upButton {
|
||||
background-image: url(../graphics/up.gif) !important;
|
||||
}
|
||||
|
||||
.smallPadding span {
|
||||
padding: 0.1em 0.4em !important;
|
||||
}
|
||||
|
@ -172,6 +176,10 @@ tr.highlight {
|
|||
color: black;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* table style for delete.php
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue