diff --git a/lib/Attribute.php b/lib/Attribute.php index c4e489a..d355aa8 100644 --- a/lib/Attribute.php +++ b/lib/Attribute.php @@ -477,6 +477,10 @@ class Attribute { $this->readonly = true; } + public function isMultiple() { + return false; + } + public function isVisible() { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); diff --git a/lib/AttributeFactory.php b/lib/AttributeFactory.php index 82403db..a928c29 100644 --- a/lib/AttributeFactory.php +++ b/lib/AttributeFactory.php @@ -85,6 +85,7 @@ class AttributeFactory { case 'password': return $this->newPasswordAttribute($name,$values,$server_id,$source); + case 'multiselect': case 'select': return $this->newSelectionAttribute($name,$values,$server_id,$source); diff --git a/lib/PageRender.php b/lib/PageRender.php index 44b6873..eab1fe9 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -1011,6 +1011,9 @@ class PageRender extends Visitor { $vals = $attribute->getValues(); $j = 0; + if (! $vals && ! is_array($vals = $attribute->getDefault())) + $vals = array($attribute->getDefault()); + if (($attribute->getSize() > 0) && ($attribute->getSize() < $attribute->getOptionCount())) { printf(' %s', + printf(' %s', htmlspecialchars($attribute->getName()),$j++, htmlspecialchars($attribute->getName()),$val, $attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '', diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index 18ed07f..7323a1c 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -2042,6 +2042,9 @@ function fillRec(id,value) { protected function drawValueAttribute($attribute,$i) { if (DEBUGTMP) printf('%s
',__METHOD__); + if ($attribute->isMultiple() && $i > 0) + return; + $val = $attribute->getValue($i); if ($attribute->isVisible()) {