5 * Copyright (c) 1999-2001 The Squirrelmail Development Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * Functions needed to display the options pages.
13 * SquirrelOption: An option for Squirrelmail.
15 * This class is a work in progress. When complete, it will handle
16 * presentation and saving of Squirrelmail user options in a simple,
17 * streamline manner. Stay tuned for more stuff.
19 * Also, I'd like to ask that people leave this alone (mostly :) until
20 * I get it a little further along. That should only be a day or two or
21 * three. I will remove this message when it is ready for primetime usage.
23 class SquirrelOption
{
24 /* The basic stuff. */
30 /* The various 'values' for this options. */
35 /* This variable needs to be made private so it can not be messed with. */
36 /* I just don't remember how to do it right now and think it would be */
37 /* better to keep coding. Someone can fix it, if they want. Or I will. */
40 function SquirrelOption
41 ($name, $caption, $value, $refresh_level = SMOPT_REFRESH_NONE
,
42 $type = SMOPT_TYPE_STRING
, $possible_values = '') {
43 /* Set the basic stuff. */
45 $this->caption
= $caption;
46 $this->value
= $value;
48 /* Set the optional parameters. */
49 $this->refresh_level
= $refresh_level;
51 $this->value
= $value;
52 $this->possible_values
= $possible_value;
54 /* Lastly, check for a new value. */
55 if (isset($GLOBALS["new_$name"])) {
56 $this->new_value
= $GLOBALS["new_$name"];
57 $this->changed
= ($this->value
!== $this->new_value
);
61 function hasChanged() {
62 return ($this->changed
);
66 function OptionSelect( $title, $name, $data, $default, $show = '', $store = '' ) {
68 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
69 "<select name=\"$name\">";
70 foreach( $data as $key => $opt ) {
82 echo "<option value=\"$vl\"";
83 if( $vl == $default ) {
86 echo ">$nm</option>\n";
89 echo "</select></td></tr>\n";
92 function OptionRadio( $title, $name, $data, $default, $show = '', $store = '', $sep = ' ' ) {
93 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>";
94 foreach( $data as $key => $opt ) {
106 echo "<input type=\"radio\" name=\"$name\" value=\"$vl\"";
107 if( $vl == $default ) {
116 function OptionText( $title, $name, $value, $size ) {
117 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
118 "<input name=\"$name\" value=\"$value\" size=\"$size\">" .
122 function OptionHidden( $name, $value ) {
123 echo "<INPUT TYPE=HIDDEN NAME=\"$name\" VALUE=\"$value\">\n";
126 function OptionCheck( $title, $name, $value, $comment ) {
129 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
130 "<input type=\"checkbox\" name=\"$name\" $chk> $comment" .
134 function OptionTitle( $title ) {
135 echo "<tr><td colspan=2 align=left valign=middle nowrap><b>$title</b></td></tr>\n";
138 function OptionSubmit( $name ) {
139 echo '<tr><td> </td><td><input type="submit" value="' . _("Submit") . '" name="' . $name . '">' .