Put names to checkboxes that can be used by others
[squirrelmail.git] / templates / default / select.tpl
index e47349c589f8b9a9649b89228bf6411a278cf9d6..9f112eff8e49e2653876243490b961b5e6341e07 100644 (file)
@@ -25,6 +25,8 @@
   *                   optional and might be null) should be placed
   *                   in double quotes as attribute values (optional;
   *                   may not be present)
+  * int     $size     The desired height of multiple select boxes (not
+  *                   applicable when $multiple is FALSE)
   *
   * @copyright © 1999-2008 The SquirrelMail Project Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
@@ -48,7 +50,7 @@ if (isset($aAttribs['id'])) {
 }
 
 
-echo '<select name="' . $name . ($multiple ? '[]" multiple="multiple" size="3"' : '"');
+echo '<select name="' . $name . ($multiple ? '[]" multiple="multiple" size="' . $size . '"' : '"');
 foreach ($aAttribs as $key => $value) {
     echo ' ' . $key . (is_null($value) ? '' : '="' . $value . '"');
 }
@@ -63,7 +65,7 @@ foreach ($aValues as $key => $value) {
     //
     if ($multiple) {
         foreach ($default as $def) {
-            if ($def === $key) {
+            if ((string)$def == (string)$key) {
                 echo ' selected="selected"';
                 break;
             }
@@ -74,7 +76,7 @@ foreach ($aValues as $key => $value) {
     // (we could use the same code above, but we do this here to increase
     // efficency and performance)
     //
-    else if ($default[0] === $key)
+    else if ((string)$default[0] == (string)$key)
         echo ' selected="selected"';
 
     echo '>' . $label_open . $value . $label_close  . "</option>\n";