Allow text area options to use trailing_text attribute
[squirrelmail.git] / templates / default / options.tpl
index 8f683f04ee5a814fb947319f76f447754286d57c..810513bef5236de0afefcd9d585fa5c334ed7573 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";
 
-/**
- * $Log$
- * Revision 1.2  2006/07/13 18:49:44  tokul
- * reverting some templating changes. They broke plugin blocks.
- * moving display of option blocks to separate template
- *
- * Revision 1.1  2006/07/09 22:22:31  vanmer
- * - initial revision of a template for options output
- *
- *
-**/
-?>
\ No newline at end of file
+    if (!empty($option['name'])) {
+        echo " <tr>\n" .
+             "  <td class=\"header1\" colspan=\"2\">\n" .
+             "   ".$option['name']."\n" .
+             "  </td>\n" .
+             " </tr>\n";
+    }
+
+    $hidden_widgets = '';
+    foreach ($option['options'] as $opt) {
+        if ($opt->type != SMOPT_TYPE_HIDDEN) {
+            echo   "<tr>\n" .
+                   " <td class=\"optionName\"" . ($opt->caption_wrap ? '' : ' style="white-space:nowrap"') . ">\n  ";
+
+            if ($opt->type == SMOPT_TYPE_BOOLEAN_CHECKBOX
+             || $opt->type == SMOPT_TYPE_BOOLEAN) {
+                echo '<label for="new_' . $opt->name . '">'
+                   . $opt->caption . '</label>';
+            } else if ($opt->type == SMOPT_TYPE_TEXTAREA && !empty($opt->trailing_text)) {
+                echo $opt->caption . '<br />' . $opt->trailing_text;
+            } else {
+                echo $opt->caption;
+            }
+
+            echo   "\n </td>\n" .
+                   " <td class=\"optionValue\">\n" .
+                   "  ".$opt->createWidget()."\n" .
+                   " </td>\n" .
+                   "</tr>\n";
+        } else {
+            $hidden_widgets .= $opt->createWidget();
+        }
+    }
+
+    echo " <tr>\n  <td colspan=\"2\" align=\"right\">\n"
+       . $hidden_widgets . "   <input type=\"submit\" value=\"" . _("Submit") 
+       . "\" name=\"" . $submit_name . "\" />&nbsp;&nbsp;&nbsp;&nbsp;\n  </td>\n </tr>\n";
+
+    echo "</table>\n";
+}
+?>
+</div>