Boolean option widgets now default to checkboxes
[squirrelmail.git] / templates / default / options.tpl
index 95b2732e6a23112cb4806a5c8c885b26ac922a48..e9cf2d5a92a9631ceaa5d26cb203c658c63a5dbc 100644 (file)
@@ -3,6 +3,12 @@
  * options.tpl
  *
  * Template for rendering the options page
+ * 
+ * The following variables are available to this template:
+ *      $options - array of options as built by SquirrelMail.  Important fields
+ *                 in this array include (but are not limited to):
+ *          $el['name']     - The name of the option group
+ *          $el['options']  - array of squirrelOption objects
  *
  * @copyright © 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 
 /** add required includes */
 
-
 /** extract variables */
 extract($t);
 
+
+if ( !empty($topmessage) ) {
+       echo "<div id=\"optionMessage\">\n$topmessage\n</div>\n\n";
+}
 ?>
-</td></tr>
-</table>
-</td></tr>
-</table>
 
+<div id="optionDisplay">
+<?php
+foreach ($options as $option) {
+    echo "<table cellspacing=\"0\">\n";
+
+    if (!empty($option['name'])) {
+        echo " <tr>\n" .
+             "  <td class=\"header1\" colspan=\"2\">\n" .
+             "   ".$option['name']."\n" .
+             "  </td>\n" .
+             " </tr>\n";
+    }
+
+    foreach ($option['options'] as $opt) {
+        if ($opt->type != SMOPT_TYPE_HIDDEN) {
+            echo   "<tr>\n" .
+                   " <td class=\"optionName\">\n  ";
+
+            if ($opt->type == SMOPT_TYPE_BOOLEAN_CHECKBOX
+             || $opt->type == SMOPT_TYPE_BOOLEAN) {
+                echo '<label for="new_' . $opt->name . '">'
+                   . $opt->caption . '</label>';
+            } else {
+                echo $opt->caption;
+            }
+
+            echo   "\n </td>\n" .
+                   " <td class=\"optionValue\">\n" .
+                   "  ".$opt->createWidget()."\n" .
+                   " </td>\n" .
+                   "</tr>\n";
+        } else {
+            echo $opt->createWidget();
+        }
+    }
+
+    echo " <tr>\n  <td colspan=\"2\" align=\"right\">\n"
+       . "   <input type=\"submit\" value=\"" . _("Submit") 
+       . "\" name=\"" . $submit_name . "\" />&nbsp;&nbsp;&nbsp;&nbsp;\n  </td>\n </tr>\n";
+
+    echo "</table>\n";
+}
+?>
+</div>