Happy New Year
[squirrelmail.git] / templates / default / edit_list_widget_list_style.tpl
index f81a7785f94b9e9ee3eca69bf4d87461ef54c046..bb24457c63ca89e52635164de697925803d4601e 100644 (file)
   * array    $possible_values   The original list of options in the edit list,
   *                             for use constructing layouts alternative to
   *                             the select widget
+  * mixed    $current_value     The currently selected value(s)
   *
-  * @copyright 1999-2011 The SquirrelMail Project Team
+  * @copyright 1999-2020 The SquirrelMail Project Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
-  * @version $Id: select.tpl 12961 2008-02-24 22:35:08Z pdontthink $
+  * @version $Id$
   * @package squirrelmail
   * @subpackage templates
   */
@@ -39,19 +40,39 @@ echo '<table class="table2" cellspacing="0"><tr><td>';
 
 if ($use_input_widget)
     echo _("Add") . '&nbsp;' . $input_widget . '<br />';
+if (!empty($trailing_text))
+    echo ($trailing_text_small ? '<small>' : '') . ($trailing_text_is_html ? $trailing_text : sm_encode_html_special_chars($trailing_text)) . ($trailing_text_small ? '</small>' : '') . '<br />';
 
 echo '<table class="table_messageList" cellspacing="0">';
 
 $class = 'even';
 $index = 0;
 
+if (is_array($current_value))
+    $selected = $current_value;
+else
+    $selected = array($current_value);
+
 foreach ($possible_values as $key => $value) {
 
     if ($class == 'even') $class = 'odd';
     else $class = 'even';
 
     echo '<tr class="' . $class . '">'
-       . '<td class="col_check" style="width:1%"><input type="checkbox" name="new_' . $name . '[' . ($index++) . ']" id="' . $name . '_list_item_' . $key . '" value="' . $value . '"></td>'
+       . '<td class="col_check" style="width:1%"><input type="checkbox" name="new_' . $name . '[' . ($index++) . ']" id="' . $name . '_list_item_' . $key . '" value="' . $value;
+
+    // having a selected item in the edit list doesn't have
+    // any meaning, but maybe someone will think of a way to
+    // use it, so we might as well put the code in
+    //
+    foreach ($selected as $default) {
+        if ((string)$default == (string)$value) {
+            echo '" checked="checked';
+            break;
+        }
+    }
+
+    echo '"></td>'
        . '<td><label for="' . $name . '_list_item_' . $key . '">' . $value . '</label></td>'
        . "</tr>\n";