diff --git a/lib/Attribute.php b/lib/Attribute.php
index 92f441c..af134df 100644
--- a/lib/Attribute.php
+++ b/lib/Attribute.php
@@ -778,7 +778,20 @@ class Attribute {
case 'value':
if (is_array($value))
- $this->values = $value;
+ foreach ($value as $y) {
+ if (! $this->haveMoreValues()) {
+ system_message(array(
+ 'title'=>_('Automatically removed attribute values from template'),
+ 'body'=>sprintf('%s [%s]',_('Template defines more values than can be accepted by attribute.'),$this->getName(true)),
+ 'type'=>'warn'));
+
+ $this->clearValue();
+
+ break;
+
+ } else
+ $this->addValue($y);
+ }
else
# Check to see if the value is auto generated.
@@ -791,7 +804,7 @@ class Attribute {
$this->hint = _('Automatically determined');
} else
- $this->values = array($value);
+ $this->addValue($value);
break;
diff --git a/lib/PageRender.php b/lib/PageRender.php
index 0bfb51a..2c08389 100644
--- a/lib/PageRender.php
+++ b/lib/PageRender.php
@@ -1106,10 +1106,7 @@ class PageRender extends Visitor {
foreach ($attribute->getSelection() as $value => $description) {
printf('',$value,
- ($value == $val) ? 'selected="selected"' : '',$description);
-
- if ($value == $val)
- $found = true;
+ ((strcasecmp($value,$val) == 0) && $found = true) ? 'selected="selected"' : '',$description);
if ($value == '')
$empty_value = true;
diff --git a/lib/SelectionAttribute.php b/lib/SelectionAttribute.php
index d0c4331..deb1f11 100644
--- a/lib/SelectionAttribute.php
+++ b/lib/SelectionAttribute.php
@@ -37,6 +37,13 @@ class SelectionAttribute extends Attribute {
$this->selection[$value] = $description;
}
+ public function addValue($new_val,$i=-1) {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ $this->addOption($new_val,$new_val);
+ }
+
public function getOptionCount() {
return count($this->selection);
}