Added multiply selection support in array_selector.
[fa-stable.git] / includes / ui / ui_lists.inc
index 9563cf08d5a49334868004e69d674b51226f1a2f..7835f33905bbef4d64bd11b4bb774cae71af5e1f 100644 (file)
@@ -52,6 +52,7 @@ $opts = array(                // default options
        'search_submit' => true, //search submit button: true/false
        'size' => 8,    // size and max of box tag
        'max' => 50,
+       'height' => false,      // number of lines in select box
        'cells' => false,       // combo displayed as 2 <td></td> cells
        'search' => array(), // sql field names to search
        'format' => null,        // format functions for regular options
@@ -207,7 +208,9 @@ $opts = array(              // default options
                $txt = $found;
                $Ajax->addUpdate($name, $search_box, $txt ? $txt : '');
        }
-       $selector = "<select $disabled name='$name' class='$class' title='"
+       $selector = "<select ".(strpos($name,'[]')!==false ? "multiple" : '')
+               . ($opts['height']!==false ? ' size="'.$opts['height'].'"' : '')
+               . "$disabled name='$name' class='$class' title='"
                . $opts['sel_hint']."' $rel>".$selector."</select>\n";
 
        $Ajax->addUpdate($name, "_{$name}_sel", $selector);
@@ -274,6 +277,7 @@ $opts = array(              // default options
        'async' => true,        // select update via ajax (true) vs _page_body reload
        'default' => '', // default value when $_POST is not set
                // search box parameters
+       'height' => false,      // number of lines in select box
        'sel_hint' => null,
        'disabled' => false
 );
@@ -328,7 +332,9 @@ $opts = array(              // default options
        }
        $_POST[$name] = $selected_id;
 
-       $selector = "<select $disabled name='$name' class='combo' title='"
+       $selector = "<select ".(strpos($name,'[]')!==false ? "multiple" : '')
+               . ($opts['height']!==false ? ' size="'.$opts['height'].'"' : '')
+               . "$disabled name='$name' class='combo' title='"
                . $opts['sel_hint']."'>".$selector."</select>\n";
 
        $Ajax->addUpdate($name, "_{$name}_sel", $selector);
@@ -2126,5 +2132,23 @@ function tab_list_row($label, $name, $selected_id=null)
        echo "</td></tr>\n";
 }
 
+//---------------------------------------------------------------------------------------------
+//     List of sets of active extensions 
+//
+function extset_list($name, $value=null, $submit_on_change=false)
+{
+       global $db_connections;
+
+       $items = array();
+       foreach ($db_connections as $comp)
+               $items[] = sprintf(_("Activated for '%s'"), $comp['name']);
+       array_selector( $name, $value, $items,
+               array(
+                       'spec_option'=> _("Installed on system"),
+                       'spec_id' => -1,
+                       'select_submit'=> $submit_on_change,
+                       'async' => true
+               ));
+}
 
 ?>
\ No newline at end of file