X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Foptions.php;h=bdd5df1303642564a8f75d7909a9ddda7ce6eef0;hp=7617b2bc41adb79c93b891ab9434def182232b8b;hb=6ae9e72937a9ff3e6017c1fedcd37945df12f74a;hpb=76911253eb850bacde3d86c8cb7b4af072e67ebe
diff --git a/functions/options.php b/functions/options.php
index 7617b2bc..bdd5df13 100644
--- a/functions/options.php
+++ b/functions/options.php
@@ -62,6 +62,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 +73,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,18 +83,19 @@ 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 = '';
}
/* Check for a new value. */
- if (isset($_POST["new_$name"])) {
- $this->new_value = $_POST["new_$name"];
- } else {
+ if ( !sqgetGlobalVar("new_$name", $this->new_value, SQ_POST ) ) {
$this->new_value = '';
}
@@ -130,6 +132,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;
@@ -173,9 +180,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);
}
@@ -199,13 +206,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 = "