X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Foptions.php;h=209afbd3a13e8393548bf39749f0dbf510ff5b10;hb=892b98c9c69f0c026070b0df9b3707e18fdb602f;hp=c018186a1ce162e1496fe58829837749d7506418;hpb=cc61478a38c0d56346511026c34063262eb989c6;p=squirrelmail.git diff --git a/src/options.php b/src/options.php index c018186a..209afbd3 100644 --- a/src/options.php +++ b/src/options.php @@ -1,34 +1,24 @@ name', " . "value = '$option->value', " - . "new_value = '$option->new_value'
\n"; + . "new_value = '$option->new_value'
\n"; */ if ($option->changed()) { $option->save(); @@ -74,6 +64,52 @@ function process_optionmode_link($optpage) { /* There will be something here, later. */ } + +/** + * This function prints out an option page row. + */ +function print_optionpages_row($leftopt, $rightopt = false) { + global $color; + + if ($rightopt) { + $rightopt_name = html_tag( 'td', '' . $rightopt['name'] . '', 'left', $color[9], 'valign="top" width="49%"' ); + $rightopt_desc = html_tag( 'td', $rightopt['desc'], 'left', $color[0], 'valign="top" width="49%"' ); + } else { + $rightopt_name = html_tag( 'td', ' ', 'left', $color[4], 'valign="top" width="49%"' ); + $rightopt_desc = html_tag( 'td', ' ', 'left', $color[4], 'valign="top" width="49%"' ); + } + + echo + html_tag( 'table', "\n" . + html_tag( 'tr', "\n" . + html_tag( 'td', "\n" . + html_tag( 'table', "\n" . + html_tag( 'tr', "\n" . + html_tag( 'td', + '' . $leftopt['name'] . '' , + 'left', $color[9], 'valign="top" width="49%"' ) . + html_tag( 'td', + ' ' , + 'left', $color[4], 'valign="top" width="2%"' ) . "\n" . + $rightopt_name + ) . "\n" . + html_tag( 'tr', "\n" . + html_tag( 'td', + $leftopt['desc'] , + 'left', $color[0], 'valign="top" width="49%"' ) . + html_tag( 'td', + ' ' , + 'left', $color[4], 'valign="top" width="2%"' ) . "\n" . + $rightopt_desc + ) , + '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) , + 'left', '', 'valign="top"' ) + ) , + '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' ); +} + +/* ---------------------------- main ---------------------------- */ + /* Make sure we have an Option Page set. Default to main. */ if (!isset($optpage)) { $optpage = 'main'; @@ -84,9 +120,9 @@ if (!isset($optmode)) { $optmode = SMOPT_MODE_DISPLAY; } -/*************************************************************/ -/*** First, set the load information for each option page. ***/ -/*************************************************************/ +/* + * First, set the load information for each option page. + */ /* Initialize load information variables. */ $optpage_name = ''; @@ -97,31 +133,36 @@ $optpage_loader = ''; switch ($optpage) { case SMOPT_PAGE_MAIN: break; case SMOPT_PAGE_PERSONAL: - $optpage_name = _("Personal Information"); - $optpage_file = 'options_personal.php'; - $optpage_loader = 'load_optpage_data_personal'; + $optpage_name = _("Personal Information"); + $optpage_file = '../src/options_personal.php'; + $optpage_loader = 'load_optpage_data_personal'; + $optpage_loadhook = 'optpage_loadhook_personal'; break; case SMOPT_PAGE_DISPLAY: $optpage_name = _("Display Preferences"); - $optpage_file = 'options_display.php'; + $optpage_file = '../src/options_display.php'; $optpage_loader = 'load_optpage_data_display'; + $optpage_loadhook = 'optpage_loadhook_display'; break; case SMOPT_PAGE_HIGHLIGHT: $optpage_name = _("Message Highlighting"); - $optpage_file = 'options_highlight.php'; + $optpage_file = '../src/options_highlight.php'; $optpage_loader = 'load_optpage_data_highlight'; + $optpage_loadhook = 'optpage_loadhook_highlight'; break; case SMOPT_PAGE_FOLDER: $optpage_name = _("Folder Preferences"); - $optpage_file = 'options_folder.php'; + $optpage_file = '../src/options_folder.php'; $optpage_loader = 'load_optpage_data_folder'; + $optpage_loadhook = 'optpage_loadhook_folder'; break; case SMOPT_PAGE_ORDER: $optpage_name = _("Index Order"); - $optpage_file = 'options_order.php'; + $optpage_file = '../src/options_order.php'; $optpage_loader = 'load_optpage_data_order'; + $optpage_loadhook = 'optpage_loadhook_order'; break; - default: do_hook('set_optpage_loadinfo'); + default: do_hook('optpage_set_loadinfo'); } /**********************************************************/ @@ -135,6 +176,7 @@ if ($optpage != SMOPT_PAGE_MAIN) { /* Assemble the data for this option page. */ $optpage_data = array(); $optpage_data = $optpage_loader(); + do_hook($optpage_loadhook); $optpage_data['options'] = create_option_groups($optpage_data['grps'], $optpage_data['vals']); } @@ -160,23 +202,21 @@ if (isset($optpage_name) && ($optpage_name != '')) { $optpage_title .= " - $optpage_name"; } -?> - -
- -
-
- -
- -' . + html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="2" cellspacing="0" border="0"' ) . "\n" . + html_tag( 'tr' ) . "\n" . + html_tag( 'td', '', 'center' ) . + "$optpage_title
\n". + html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" . + html_tag( 'tr' ) . "\n" . + html_tag( 'td', '', 'center', $color[4] ) . "\n"; /*******************************************************************/ /* DO OLD SAVING OF SUBMITTED OPTIONS. THIS WILL BE REMOVED LATER. */ /*******************************************************************/ /* If in submit mode, select a save hook name and run it. */ -if ($optmode == SMOPT_MODE_SUBMIT) { +if ($optmode == SMOPT_MODE_SUBMIT) { /* Select a save hook name. */ switch ($optpage) { case SMOPT_PAGE_PERSONAL: @@ -221,14 +261,18 @@ if ($optpage == SMOPT_PAGE_MAIN) { /* First, display the results of a submission, if needed. */ /**********************************************************/ if ($optmode == SMOPT_MODE_SUBMIT) { + if (!isset($frame_top)) { + $frame_top = '_top'; + } /* Display a message indicating a successful save. */ - echo '' . _("Successfully Saved Options") . ": $optpage_name
\n"; + echo '' . _("Successfully Saved Options") . ": $optpage_name
\n"; /* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */ - if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) { - echo '' . _("Refresh Folder List") . '
'; + if ( !isset( $max_refresh ) ) { + } else if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) { + echo '' . _("Refresh Folder List") . '
'; } else if ($max_refresh) { - echo '' . _("Refresh Page") . '
'; + echo '' . _("Refresh Page") . '
'; } } /******************************************/ @@ -272,7 +316,7 @@ if ($optpage == SMOPT_PAGE_MAIN) { $optpage_blocks[] = array( 'name' => _("Index Order"), 'url' => 'options_order.php', - 'desc' => _("The order of the message index can be rearanged and changed to contain the headers in any order you want."), + 'desc' => _("The order of the message index can be rearranged and changed to contain the headers in any order you want."), 'js' => false ); @@ -297,9 +341,12 @@ if ($optpage == SMOPT_PAGE_MAIN) { /* Now, print out each option page section. */ /********************************************/ $first_optpage = false; - echo "" . - '
' . - ""; + echo html_tag( 'table', '', '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' ) . "\n" . + html_tag( 'tr' ) . "\n" . + html_tag( 'td', '', 'left', '', 'valign="top"' ) . + html_tag( 'table', '', '', $color[4], 'width="100%" cellpadding="3" cellspacing="0" border="0"' ) . "\n" . + html_tag( 'tr' ) . "\n" . + html_tag( 'td', '', 'left' ); foreach ($optpage_blocks as $next_optpage) { if ($first_optpage == false) { $first_optpage = $next_optpage; @@ -313,7 +360,7 @@ if ($optpage == SMOPT_PAGE_MAIN) { print_optionpages_row($first_optpage); } - echo "
\n"; + echo "
\n"; do_hook('options_link_and_description'); @@ -322,17 +369,16 @@ if ($optpage == SMOPT_PAGE_MAIN) { /* If we are not looking at the main option page, display the page here. */ /*************************************************************************/ } else { - echo '

' . "\n" - . '' . "\n" + echo '
' . "\n" . create_optpage_element($optpage) - . create_optmode_element(SMOPT_MODE_SUBMIT); + . create_optmode_element(SMOPT_MODE_SUBMIT) + . html_tag( 'table', '', '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) . "\n" + . html_tag( 'tr' ) . "\n" + . html_tag( 'td', '', 'left' ) . "\n"; /* Output the option groups for this page. */ print_option_groups($optpage_data['options']); - /*** FIXME: CURRENTLY, THIS NEXT SWITCH STATEMENT DOES NOT TAKE - *** INTO ACCOUNT FOR PLUGINS. NEED TO FIX IT. ***/ - /* Set the inside_hook_name and submit_name. */ switch ($optpage) { case SMOPT_PAGE_PERSONAL: @@ -347,12 +393,12 @@ if ($optpage == SMOPT_PAGE_MAIN) { break; case SMOPT_PAGE_HIGHLIGHT: $inside_hook_name = 'options_highlight_inside'; - $bottom_hook_name = 'options_display_bottom'; + $bottom_hook_name = 'options_highlight_bottom'; $submit_name = 'submit_highlight'; break; case SMOPT_PAGE_FOLDER: $inside_hook_name = 'options_folder_inside'; - $bottom_hook_name = 'options_display_bottom'; + $bottom_hook_name = 'options_folder_bottom'; $submit_name = 'submit_folder'; break; case SMOPT_PAGE_ORDER: @@ -373,7 +419,7 @@ if ($optpage == SMOPT_PAGE_MAIN) { /* Spit out a submit button. */ OptionSubmit($submit_name); - echo '
'; + echo ''; /* If it is not empty, trigger the bottom hook. */ if ($bottom_hook_name != '') { @@ -381,76 +427,10 @@ if ($optpage == SMOPT_PAGE_MAIN) { } } -?> - - - - - - - - -' . + ''. + ''. + '' . + ''; - /*******************************************************************/ - /* Please be warned. The code below this point sucks. This is just */ - /* my first implementation to make the option rows work for both */ - /* Javascript and non-Javascript option chunks. */ - /* */ - /* Please, someone make these better for me. All three functions */ - /* below REALLY do close to the same thing. */ - /* */ - /* This code would be GREATLY improved by a templating system. */ - /* Don't try to implement that now, however. That will come later. */ - /*******************************************************************/ - - /*******************************************************************/ - /* Actually, now that I think about it, don't do anything with */ - /* this code yet. There is ACTUALLY supposed to be a difference */ - /* between the three functions that write the option rows. I just */ - /* have not yet gotten to integrating that yet. */ - /*******************************************************************/ - - /** - * This function prints out an option page row. - */ - function print_optionpages_row($leftopt, $rightopt = false) { - global $color; - - echo "" . - '' . - "
' . - '' . - '' . - "'. - ""; - if ($rightopt) { - echo "'; - } else { - echo ""; - } - - echo '' . - '' . - "' . - ""; - if ($rightopt) { - echo "'; - } else { - echo ""; - } - - echo '' . - '
" . - '' . $leftopt['name'] . ''. - ' " . - '' . $rightopt['name'] . '' . - ' 
" . - $leftopt['desc'] . - ' " . - $rightopt['desc'] . - ' 
' . - '
\n"; - } - -?> \ No newline at end of file +?>