From 9184e06da12d8aac5f07f79627b05d6d075ca335 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.bernigaud@opensides.be>
Date: Mon, 25 Apr 2016 10:15:53 +0200
Subject: [PATCH] Growing SetAttribute line number until number of values or 15
 is reached

---
 include/simpleplugin/class_attribute.inc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/simpleplugin/class_attribute.inc b/include/simpleplugin/class_attribute.inc
index ca1e478b1..70d3df5b0 100644
--- a/include/simpleplugin/class_attribute.inc
+++ b/include/simpleplugin/class_attribute.inc
@@ -1976,6 +1976,7 @@ class SetAttribute extends Attribute
   protected $valueUnicity     = TRUE;
   protected $editingValue     = FALSE;
   protected $linearRendering  = TRUE;
+  protected $size = 4;
 
   /*! \brief The constructor of SetAttribute
    *
@@ -2108,10 +2109,13 @@ class SetAttribute extends Attribute
 
   function renderOnlyFormInput()
   {
+    if (($this->size < 15) && ($this->size < count($this->value))) {
+      $this->size = min(15, count($this->value));
+    }
     $id = $this->getHtmlId();
     $smarty = get_smarty();
     $smarty->assign($id.'_values', $this->getDisplayValues());
-    $display = '<select multiple="multiple"  name="row'.$id.'[]" id="row'.$id.'"'.
+    $display = '<select multiple="multiple"  name="row'.$id.'[]" id="row'.$id.'" size="'.$this->size.'"'.
                 ($this->disabled? ' disabled="disabled"':'').
                 ' >'."\n";
     $display .= '{html_options options=$'.$id.'_values}';
@@ -2259,6 +2263,11 @@ class SetAttribute extends Attribute
   {
     return in_array($value, $this->value);
   }
+
+  function setSize($size)
+  {
+    $this->size = $size;
+  }
 }
 
 /*! \brief This class allow to handle easily a composite attribute
-- 
GitLab