Browse Source

Remove embedded HTML for displaying submit buttons on option pages, also display more than one submit button so you need not scroll to the bottom to change options right at the top of a page. Doesn't look so good on the Personal Information page, so if anyone has any bright ideas on how to fine-tune this...

pdontthink 18 years ago
parent
commit
d2af0c9653
3 changed files with 10 additions and 49 deletions
  1. 0 44
      functions/options.php
  2. 5 4
      src/options.php
  3. 5 1
      templates/default/options.tpl

+ 0 - 44
functions/options.php

@@ -689,48 +689,4 @@ function create_option_groups($optgrps, $optvals) {
     return ($result);
 }
 
-/**
- * @param array $option_groups
- */
-function print_option_groups($option_groups) {
-    /* Print each option group. */
-    foreach ($option_groups as $next_optgrp) {
-        /* If it is not blank, print the name for this option group. */
-        if ($next_optgrp['name'] != '') {
-            echo html_tag( 'tr', "\n".
-                        html_tag( 'td',
-                            '<b>' . $next_optgrp['name'] . '</b>' ,
-                        'center' ,'', 'valign="middle" colspan="2" style="white-space: nowrap;"' )
-                    ) ."\n";
-        }
-
-        /* Print each option in this option group. */
-        foreach ($next_optgrp['options'] as $option) {
-            if ($option->type != SMOPT_TYPE_HIDDEN) {
-                echo html_tag( 'tr', "\n".
-                           html_tag( 'td', $option->caption . ':', 'right' ,'', 'valign="middle"' ) .
-                           html_tag( 'td', $option->createHTMLWidget(), 'left' )
-                       ) ."\n";
-            } else {
-                echo $option->createHTMLWidget();
-            }
-        }
-
-        /* Print an empty row after this option group. */
-        echo html_tag( 'tr',
-                   html_tag( 'td', '&nbsp;', 'left', '', 'colspan="2"' )
-                ) . "\n";
-    }
-}
-
-/**
- * Create submit button inside table row.
- * @param string $name
- */
-function OptionSubmit( $name ) {
-        echo html_tag( 'tr',
-                   html_tag( 'td', '<input type="submit" value="' . _("Submit") . '" name="' . $name . '" />&nbsp;&nbsp;&nbsp;&nbsp;', 'right', '', 'colspan="2"' )
-                ) . "\n";
-}
-
 // vim: et ts=4

+ 5 - 4
src/options.php

@@ -406,7 +406,7 @@ if ($optpage == SMOPT_PAGE_MAIN) {
     /**
      * The variables below should not be needed by the template since all plugin
      * hooks are called here, not in the template.  If we find otherwise, these
-     * variables can be passed to the template.  Commenting out for not.
+     * variables can be passed to the template.  Commenting out for now.
      */
 /*
     $oTemplate->assign('max_refresh', isset($max_refresh) ? $max_refresh : NULL);
@@ -420,8 +420,10 @@ if ($optpage == SMOPT_PAGE_MAIN) {
      * END comment block
      */    
      
+    $oTemplate->assign('submit_name', $submit_name);
     $oTemplate->display('options.tpl');
 
+//FIXME: need to remove HTML from here!
     echo "  </td>\n" .
          " </tr>\n";
 
@@ -430,8 +432,7 @@ if ($optpage == SMOPT_PAGE_MAIN) {
         do_hook($inside_hook_name);
     }
 
-    /* Spit out a submit button. */
-    OptionSubmit($submit_name);
+//FIXME: need to remove HTML from here!
     echo "</table>\n" .
          "</form>\n";
 
@@ -443,4 +444,4 @@ if ($optpage == SMOPT_PAGE_MAIN) {
 }
 
 $oTemplate->display('footer.tpl');
-?>
+?>

+ 5 - 1
templates/default/options.tpl

@@ -50,7 +50,11 @@ foreach ($options as $option) {
         }
     }
 
+    echo " <tr>\n  <td colspan=\"2\" align=\"right\">\n"
+       . "   <input type=\"submit\" value=\"" . _("Submit") 
+       . "\" name=\"" . $submit_name . "\" />&nbsp;&nbsp;&nbsp;&nbsp;\n  </td>\n </tr>\n";
+
     echo "</table>\n";
 }
 ?>
-</div>
+</div>