X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Foptions.php;h=c72aea4828cfea8611b022be6363f0cb7bcfa53f;hb=c7df3f1ba789fdd8792d5505d700bfd87416bc63;hp=4d1a89048b303166dbc13b8c0ab04b7f4b9dca1b;hpb=3f4c6c3b884fffd8a0cc64b006e1bdc0d13b06cf;p=squirrelmail.git
diff --git a/functions/options.php b/functions/options.php
index 4d1a8904..c72aea48 100644
--- a/functions/options.php
+++ b/functions/options.php
@@ -3,12 +3,13 @@
/**
* options.php
*
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Functions needed to display the options pages.
*
* $Id$
+ * @package squirrelmail
*/
/**********************************************/
@@ -52,6 +53,7 @@ define('SMOPT_SAVE_NOOP', 'save_option_noop');
* Also, I'd like to ask that people leave this alone (mostly :) until
* I get it a little further along. That should only be a day or two or
* three. I will remove this message when it is ready for primetime usage.
+ * @package squirrelmail
*/
class SquirrelOption {
/* The basic stuff. */
@@ -62,6 +64,7 @@ class SquirrelOption {
var $size;
var $comment;
var $script;
+ var $post_script;
/* The name of the Save Function for this option. */
var $save_function;
@@ -72,7 +75,7 @@ class SquirrelOption {
var $possible_values;
function SquirrelOption
- ($name, $caption, $type, $refresh_level, $possible_values = '') {
+ ($name, $caption, $type, $refresh_level, $initial_value = '', $possible_values = '') {
/* Set the basic stuff. */
$this->name = $name;
$this->caption = $caption;
@@ -82,9 +85,12 @@ class SquirrelOption {
$this->size = SMOPT_SIZE_MEDIUM;
$this->comment = '';
$this->script = '';
+ $this->post_script = '';
/* Check for a current value. */
- if (isset($GLOBALS[$name])) {
+ if (!empty($initial_value)) {
+ $this->value = $initial_value;
+ } else if (isset($GLOBALS[$name])) {
$this->value = $GLOBALS[$name];
} else {
$this->value = '';
@@ -128,6 +134,11 @@ class SquirrelOption {
$this->script = $script;
}
+ /* Set the "post script" for this option. */
+ function setPostScript($post_script) {
+ $this->post_script = $post_script;
+ }
+
/* Set the save function for this option. */
function setSaveFunction($save_function) {
$this->save_function = $save_function;
@@ -171,9 +182,9 @@ class SquirrelOption {
. '';
}
- /* Add the script for this option. */
- $result .= $this->script;
-
+ /* Add the "post script" for this option. */
+ $result .= $this->post_script;
+
/* Now, return the created widget. */
return ($result);
}
@@ -197,13 +208,13 @@ class SquirrelOption {
$width = 25;
}
- $result = "name\" value=\"$this->value\" size=\"$width\">";
+ $result = "name\" value=\"$this->value\" size=\"$width\" $this->script>";
return ($result);
}
function createWidget_StrList() {
/* Begin the select tag. */
- $result = "