var $size;
var $comment;
var $script;
+ var $post_script;
/* The name of the Save Function for this option. */
var $save_function;
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;
$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 = '';
$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;
. '</font>';
}
+ /* Add the "post script" for this option. */
+ $result .= $this->post_script;
+
/* Now, return the created widget. */
return ($result);
}
function createWidget_Hidden() {
$result = '<input type="hidden" name="new_' . $this->name
- . '" value="' . $this->value . ' ' . $this->script . '">';
+ . '" value="' . $this->value . '" ' . $this->script . '>';
return ($result);
}
$optset['caption'],
$optset['type'],
$optset['refresh'],
+ (isset($optset['initial_value']) ? $optset['initial_value'] : ''),
$optset['posvals']
);
} else {
$optset['name'],
$optset['caption'],
$optset['type'],
- $optset['refresh']
+ $optset['refresh'],
+ (isset($optset['initial_value']) ? $optset['initial_value'] : '')
);
}
$next_option->setScript($optset['script']);
}
+ /* If provided, set the "post script" for this option. */
+ if (isset($optset['post_script'])) {
+ $next_option->setPostScript($optset['post_script']);
+ }
+
/* Add this option to the option array. */
$result[$grpkey]['options'][] = $next_option;
}