<?php
- /**
- ** options.php
- **
- ** Copyright (c) 1999-2001 The Squirrelmail Development Team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** Functions needed to display the options pages.
- **
- ** $Id$
- **/
+/**
+ * options.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Functions needed to display the options pages.
+ *
+ * $Id$
+ */
/**********************************************/
/* Define constants used in the options code. */
define('SMOPT_SIZE_MEDIUM', 2);
define('SMOPT_SIZE_LARGE', 3);
define('SMOPT_SIZE_HUGE', 4);
+define('SMOPT_SIZE_NORMAL', 5);
define('SMOPT_SAVE_DEFAULT', 'save_option');
define('SMOPT_SAVE_NOOP', 'save_option_noop');
}
/* Set the default save function. */
- if ((type != SMOPT_TYPE_HIDDEN) && ($type != SMOPT_TYPE_COMMENT)) {
+ if (($type != SMOPT_TYPE_HIDDEN) && ($type != SMOPT_TYPE_COMMENT)) {
$this->save_function = SMOPT_SAVE_DEFAULT;
} else {
$this->save_function = SMOPT_SAVE_NOOP;
$result = $this->createWidget_Comment();
break;
default:
- $result = '<FONT COLOR=RED>'
+ $result = '<FONT COLOR="' . $color[2] . '">'
. sprintf(_("Option Type '%s' Not Found"), $this->type)
. '</FONT>';
}
function createWidget_String() {
switch ($this->size) {
- case SMOPT_SIZE_TINY: $width = 5; break;
- case SMOPT_SIZE_SMALL: $width = 12; break;
- case SMOPT_SIZE_LARGE: $width = 38; break;
- case SMOPT_SIZE_HUGE: $width = 50; break;
+ case SMOPT_SIZE_TINY:
+ $width = 5;
+ break;
+ case SMOPT_SIZE_SMALL:
+ $width = 12;
+ break;
+ case SMOPT_SIZE_LARGE:
+ $width = 38;
+ break;
+ case SMOPT_SIZE_HUGE:
+ $width = 50;
+ break;
case SMOPT_SIZE_NORMAL:
- default: $width = 25;
+ default:
+ $width = 25;
}
$result = "<INPUT NAME=\"new_$this->name\" VALUE=\"$this->value\" SIZE=\"$width\">";
setPref($data_dir, $username, $option->name, $option->new_value);
/* I do not know if this next line does any good. */
- $GLOBALS[$name] = $option->new_value;
+ $GLOBALS[$option->name] = $option->new_value;
}
function save_option_noop($option) {
return ($result);
}
-
-function createOptionGroups($optgrps, $optvals) {
- return create_option_groups($optgrps, $optvals);
-}
-
function create_option_groups($optgrps, $optvals) {
/* Build a simple array with which to start. */
$result = array();
return ($result);
}
-function printOptionGroups($option_groups) {
- print_option_groups($option_groups);
-}
-
function print_option_groups($option_groups) {
+ /* Print each option group. */
foreach ($option_groups as $next_optgrp) {
- echo '<TR><TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2" NOWRAP><B>'
- . $next_optgrp['name'] . "</B></TD></TR>\n";
+ /* If it is not blank, print the name for this option group. */
+ if ($next_optgrp['name'] != '') {
+ echo '<TR><TD ALIGN=CENTER VALIGN=MIDDLE COLSPAN=2 NOWRAP><B>'
+ . $next_optgrp['name']
+ . "</B></TD></TR>\n";
+ }
+
+ /* Print each option in this option group. */
foreach ($next_optgrp['options'] as $option) {
if ($option->type != SMOPT_TYPE_HIDDEN) {
echo "<TR>\n";
echo $option->createHTMLWidget();
}
}
+
+ /* Print an empty row after this option group. */
echo "<TR><TD COLSPAN=\"2\"> </TD></TR>\n";
}
}