[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm

bisitz bisitz@source.lon-capa.org
Fri, 12 Jun 2009 17:58:22 -0000


bisitz		Fri Jun 12 17:58:22 2009 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm 
  Log:
  Helper screen optimizations:
  - Removed unnecessary und inflexible table structure
    (also accessibility enhancement)
  - Moved "Previous" and "Next" buttons to left top / left bottom of the page
    (Ergonmical enhancement: No massive horizontal eye and mouse movement needed anymore on big screens to access buttons; less confusion for screens with only little content)
  - Simplified code for "Previous" and "Next" buttons
  - Don't display headline in italics anymore
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.174 loncom/interface/lonhelper.pm:1.175
--- loncom/interface/lonhelper.pm:1.174	Fri Jun 12 15:31:30 2009
+++ loncom/interface/lonhelper.pm	Fri Jun 12 17:58:22 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.174 2009/06/12 15:31:30 bisitz Exp $
+# $Id: lonhelper.pm,v 1.175 2009/06/12 17:58:22 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -608,68 +608,56 @@
 
     if (!$state->overrideForm()) { $result.='<form name="helpform" method="post">'; }
     if ($stateHelp) {
-	$stateHelp = &Apache::loncommon::help_open_topic($stateHelp);
+        $stateHelp = &Apache::loncommon::help_open_topic($stateHelp);
     }
-    $result .= <<HEADER;
-        <table border="0" width='100%'><tr><td>
-        <h2><i>$stateTitle</i>$stateHelp</h2>
-HEADER
 
-    $result .= "<table cellpadding='10' width='100%'><tr><td rowspan='2' valign='top'>";
-
-    if (!$state->overrideForm()) {
-        $result .= $self->_saveVars();
-    }
-    $result .= $state->render();
-
-    $result .= "</td><td valign='top' align='right'>";
-
-    # Warning: Copy and pasted from below, because it's too much trouble to 
-    # turn this into a subroutine
+    # Prepare buttons
+    my $buttons;
     if (!$state->overrideForm()) {
         if ($self->{STATE} ne $self->{START_STATE}) {
             #$result .= '<input name="SUBMIT" type="submit" value="&lt;- Previous" />&nbsp;&nbsp;';
         }
+        $buttons = '<p>'; # '<fieldset>';
         if ($self->{DONE}) {
             my $returnPage = $self->{RETURN_PAGE};
-            $result .= "<a href=\"$returnPage\">" . &mt("End Helper") . "</a>";
+            $buttons .= '<a href="'.$returnPage.'">'.&mt('End Helper').'</a>';
         }
         else {
-            $result .= '<span class="LC_nobreak"><input name="back" type="button" ';
-            $result .= 'value="' . $previous . '" onclick="history.go(-1)" /> ';
-            $result .= '<input name="SUBMIT" type="submit" value="' . $next . '" /></span>';
+            $buttons .= '<span class="LC_nobreak">'
+                       .'<input name="back" type="button" '
+                       .'value="'.$previous.'" onclick="history.go(-1)" /> '
+                       .'<input name="SUBMIT" type="submit" value="'.$next.'" />'
+                       .'</span>';
         }
+    $buttons .= '</p>'; # '</fieldset>';
     }
 
-    $result .= "</td></tr><tr><td valign='bottom' align='right'>";
 
-    # Warning: Copy and pasted from above, because it's too much trouble to 
-    # turn this into a subroutine
+
+    $result .= '<h2>'.$stateTitle.$stateHelp.'</h2>';
+
+#   $result .= '<div>';
+
+    # Top buttons
+    $result .= $buttons;
+
+    # Main content of current helper screen
     if (!$state->overrideForm()) {
-        if ($self->{STATE} ne $self->{START_STATE}) {
-            #$result .= '<input name="SUBMIT" type="submit" value="&lt;- Previous" />&nbsp;&nbsp;';
-        }
-        if ($self->{DONE}) {
-            my $returnPage = $self->{RETURN_PAGE};
-            $result .= "<a href=\"$returnPage\">" . &mt('End Helper') . "</a>";
-        }
-        else {
-            $result .= '<span class="LC_nobreak"><input name="back" type="button" ';
-            $result .= 'value="' . $previous . '" onclick="history.go(-1)" /> ';
-            $result .= '<input name="SUBMIT" type="submit" value="' . $next . '" /></span>';
-        }
+        $result .= $self->_saveVars();
     }
+    $result .= $state->render();
+
+    # Bottom buttons
+    $result .= $buttons;
+
 
     #foreach my $key (keys %{$self->{VARS}}) {
     #    $result .= "|$key| -> " . $self->{VARS}->{$key} . "<br />";
     #}
 
-    $result .= "</td></tr></table>";
+#   $result .= '</div>';
 
     $result .= <<FOOTER;
-              </td>
-            </tr>
-          </table>
         </form>
 FOOTER