X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Foptions.php;h=d2caed53031f4f136d65d1d25061d4942cfd1ffe;hb=fbecf05fbb1c46ab5e60d5156c179502571b5dbf;hp=a205bbf62687537969b0c09e9561c87834f3dbbe;hpb=cbe5423b30fd1c50b7dd9546778cbebf48804953;p=squirrelmail.git diff --git a/functions/options.php b/functions/options.php index a205bbf6..d2caed53 100644 --- a/functions/options.php +++ b/functions/options.php @@ -1,14 +1,15 @@ save_function = SMOPT_SAVE_DEFAULT; } else { $this->save_function = SMOPT_SAVE_NOOP; @@ -143,7 +145,7 @@ class SquirrelOption { case SMOPT_TYPE_STRLIST: $result = $this->createWidget_StrList(); break; - case SMOPT_TYPE_TEXTAREA: + case SMOPT_TYPE_textarea: $result = $this->createWidget_TextArea(); break; case SMOPT_TYPE_INTEGER: @@ -162,9 +164,9 @@ class SquirrelOption { $result = $this->createWidget_Comment(); break; default: - $result = '' + $result = '' . sprintf(_("Option Type '%s' Not Found"), $this->type) - . ''; + . ''; } /* Add the script for this option. */ @@ -176,41 +178,50 @@ class SquirrelOption { 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 = "name\" VALUE=\"$this->value\" SIZE=\"$width\">"; + $result = "name\" value=\"$this->value\" size=\"$width\">"; return ($result); } function createWidget_StrList() { /* Begin the select tag. */ - $result = "name\">"; /* Add each possible value to the select list. */ foreach ($this->possible_values as $real_value => $disp_value) { /* Start the next new option string. */ - $new_option = ""; + $new_option .= ">$disp_value"; /* And add the new option string to our select tag. */ $result .= $new_option; } /* Close the select tag and return our happy result. */ - $result .= ''; + $result .= ''; return ($result); } @@ -223,8 +234,8 @@ class SquirrelOption { case SMOPT_SIZE_NORMAL: default: $rows = 5; $cols = 50; } - $result = ""; + $result = ""; return ($result); } @@ -239,21 +250,21 @@ class SquirrelOption { function createWidget_Boolean() { /* Do the whole current value thing. */ if ($this->value != SMPREF_NO) { - $yes_chk = ' CHECKED'; + $yes_chk = ' checked'; $no_chk = ''; } else { $yes_chk = ''; - $no_chk = ' CHECKED'; + $no_chk = ' checked'; } /* Build the yes choice. */ - $yes_option = ' " + $yes_option = ' " . _("Yes"); /* Build the no choice. */ - $no_option = ' " + $no_option = ' " . _("No"); /* Build and return the combined "boolean widget". */ @@ -262,8 +273,8 @@ class SquirrelOption { } function createWidget_Hidden() { - $result = ''; + $result = ''; return ($result); } @@ -287,7 +298,7 @@ function save_option($option) { 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) { @@ -303,17 +314,12 @@ function create_optmode_element($optmode) { } function create_hidden_element($name, $value) { - $result = ''; + $result = ''; 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(); @@ -376,32 +382,42 @@ function create_option_groups($optgrps, $optvals) { 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 '' - . $next_optgrp['name'] . "\n"; + /* If it is not blank, print the name for this option group. */ + if ($next_optgrp['name'] != '') { + echo html_tag( 'tr', "\n". + html_tag( 'td', + '' . $next_optgrp['name'] . '' , + 'center' ,'', 'valign="middle" colspan="2" nowrap' ) + ) ."\n"; + } + + /* Print each option in this option group. */ foreach ($next_optgrp['options'] as $option) { if ($option->type != SMOPT_TYPE_HIDDEN) { - echo "\n"; - echo ' ' - . $option->caption . ":\n"; - echo ' ' . $option->createHTMLWidget() . "\n"; - echo "\n"; + echo html_tag( 'tr', "\n". + html_tag( 'td', $option->caption . ':', 'right' ,'', 'valign="middle"' ) . + html_tag( 'td', $option->createHTMLWidget(), 'left' ) + ) ."\n"; } else { echo $option->createHTMLWidget(); } } - echo " \n"; + + /* Print an empty row after this option group. */ + echo html_tag( 'tr', + html_tag( 'td', ' ', 'left', '', 'colspan="2"' ) + ) . "\n"; } } function OptionSubmit( $name ) { - echo ' ' . - ''; + echo html_tag( 'tr', + html_tag( 'td', ' ', 'left', '', 'colspan="2"' ) . + html_tag( 'td', '', 'left', '', 'colspan="2"' ) + ) . "\n"; } ?>