[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonhelp.pm lonhelpmenu.pm lonhtmlcommon.pm lonmenu.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 18 Jul 2006 21:55:26 -0000


This is a MIME encoded message

--albertel1153259726
Content-Type: text/plain

albertel		Tue Jul 18 17:55:26 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonhelp.pm lonhelpmenu.pm 
                     	lonhtmlcommon.pm lonmenu.pm 
  Log:
  - attempting to rework the top help link and the breadcrumb help links
    as per usability report and extensive arguing
  
  
  
--albertel1153259726
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060718175526.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.429 loncom/interface/loncommon.pm:1.430
--- loncom/interface/loncommon.pm:1.429	Mon Jul 17 15:47:20 2006
+++ loncom/interface/loncommon.pm	Tue Jul 18 17:55:24 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.429 2006/07/17 19:47:20 www Exp $
+# $Id: loncommon.pm,v 1.430 2006/07/18 21:55:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -706,8 +706,68 @@
 	.'</td></tr></table>';
 }
 
+sub general_help {
+    my $helptopic='Student_Intro';
+    if ($env{'request.role'}=~/^(ca|au)/) {
+	$helptopic='Authoring_Intro';
+    } elsif ($env{'request.role'}=~/^cc/) {
+	$helptopic='Course_Coordination_Intro';
+    }
+    return $helptopic;
+}
+
+sub update_help_link {
+    my ($topic,$component_help,$faq,$bug,$stayOnPage) = @_;
+    my $origurl = $ENV{'REQUEST_URI'};
+    $origurl=~s|^/~|/priv/|;
+    my $timestamp = time;
+    foreach my $datum (\$topic,\$component_help,\$faq,\$bug,\$origurl) {
+        $$datum = &escape($$datum);
+    }
+
+    my $banner_link = "/adm/helpmenu?page=banner&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp&amp;stayonpage=$stayOnPage";
+    my $output .= <<"ENDOUTPUT";
+<script type="text/javascript">
+// <!-- BEGIN LON-CAPA Internal
+banner_link = '$banner_link';
+// END LON-CAPA Internal -->
+</script>
+ENDOUTPUT
+    return $output;
+}
+
+# now just updates the help link and generates a blue icon
 sub help_open_menu {
-    my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) = @_;
+    my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) 
+	= @_;
+    
+    $stayOnPage = 0 if (not defined $stayOnPage);
+    if ($env{'browser.interface'} eq 'textual' ||
+	$env{'environment.remote'} eq 'off' ) {
+	$stayOnPage=1;
+    }
+    my $output;
+    if ($component_help) {
+	if (!$text) {
+	    $output=&help_open_topic($component_help,undef,$stayOnPage,
+				       $width,$height);
+	} else {
+	    my $help_text;
+	    $help_text=&unescape($topic);
+	    $output='<table><tr><td>'.
+		&help_open_topic($component_help,$help_text,$stayOnPage,
+				 $width,$height).'</td></tr></table>';
+	}
+    }
+    my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage);
+    return $output.$banner_link;
+}
+
+sub top_nav_help {
+    my ($text) = @_;
+
+    my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height);
+   
     $text = "" if (not defined $text);
     $stayOnPage = 0 if (not defined $stayOnPage);
     if ($env{'browser.interface'} eq 'textual' ||
@@ -718,25 +778,15 @@
     $height = 600 if (not defined $height);
     my $link='';
     my $title = &mt('Get help');
-    my $origurl = $ENV{'REQUEST_URI'};
-    $origurl=~s|^/~|/priv/|;
-    my $timestamp = time;
-    foreach my $datum (\$topic,\$component_help,\$faq,\$bug,\$origurl) {
-        $$datum = &escape($$datum);
-    }
-    if (!$stayOnPage) {
-         $link = "javascript:helpMenu('open')";
+    if ($stayOnPage) {
+	$link = "javascript:helpMenu('display')";
     } else {
-        $link = "javascript:helpMenu('display')";
+        $link = "javascript:helpMenu('open')";
     }
-    my $banner_link = "/adm/helpmenu?page=banner&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp&amp;stayonpage=$stayOnPage";
-    my $details_link = "/adm/helpmenu?page=body&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp";
+    my $helptopic=&general_help();
+    my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage);
+    my $details_link = '/adm/help/'.$helptopic.'.hlp';
     my $template;
-    if ($text ne "") {
-	$template .= 
-  "<table bgcolor='#CC3300' cellspacing='1' cellpadding='1' border='0'><tr>".
-  "<td bgcolor='#CC6600'><a href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";
-    }
     my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
     my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");
     my $start_page =
@@ -754,6 +804,7 @@
  <script type="text/javascript">
 // <!-- BEGIN LON-CAPA Internal
 // <![CDATA[
+var banner_link = '';
 function helpMenu(target) {
     var caller = this;
     if (target == 'open') {
@@ -773,29 +824,16 @@
     return;
 }
 function writeHelp(caller) {
-    caller.document.writeln('$start_page<frame name="bannerframe"  src="$banner_link" /><frame name="bodyframe" src="$details_link" /> $end_page')
+    caller.document.writeln('$start_page<frame name="bannerframe"  src="'+banner_link+'" /><frame name="bodyframe" src="$details_link" /> $end_page')
     caller.document.close()
     caller.focus()
 }
 // ]]>
 // END LON-CAPA Internal -->
  </script>
- <a href="$link" title="$title"><img src="$helpicon" border="0" alt="(Help Menu)" /></a>
+$banner_link
+ <a href="$link" title="$title">$text<img src="$helpicon" border="0" alt="(Help Menu)" /></a>
 ENDTEMPLATE
-    if ($component_help) {
-	if (!$text) {
-	    $template=&help_open_topic($component_help,undef,$stayOnPage,
-				       $width,$height).' '.$template;
-	} else {
-	    my $help_text;
-	    $help_text=&unescape($topic);
-	    $template='<table><tr><td>'.
-		&help_open_topic($component_help,$help_text,$stayOnPage,
-				 $width,$height).'</td><td>'.$template.
-				 '</td></tr></table>';
-	}
-    }
-    if ($text ne '') { $template.='</td></tr></table>' };
     return $template;
 }
 
Index: loncom/interface/lonhelp.pm
diff -u loncom/interface/lonhelp.pm:1.31 loncom/interface/lonhelp.pm:1.32
--- loncom/interface/lonhelp.pm:1.31	Fri Jul 14 13:05:21 2006
+++ loncom/interface/lonhelp.pm	Tue Jul 18 17:55:24 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonhelp.pm,v 1.31 2006/07/14 17:05:21 www Exp $
+# $Id: lonhelp.pm,v 1.32 2006/07/18 21:55:24 albertel Exp $
 #
 # .tex help system web server handler
 #
@@ -59,7 +59,7 @@
 sub servetext {
     my ($r,$text) = @_;
     my $bugs=&Apache::loncommon::help_open_bug('Documentation','Report a documentation bug');
-    my $morehelp=Apache::loncommon::help_open_menu(undef,undef,1,undef,undef,undef,undef,'Help and Assistance Menu');
+    my $morehelp;#=&Apache::loncommon::help_open_menu(undef,undef,1,undef,undef,undef,undef,'Help and Assistance Menu');
     my $start_page=
 	&Apache::loncommon::start_page('LON-CAPA Help',undef,
 				       {'only_body' => 1,});
@@ -213,8 +213,8 @@
              $text=&listmatches($docroot,$env{'form.searchterm'}); 
          }
      } else {
-	 my $filenames = &unescape(substr ($ENV{'REQUEST_URI'} , 
-							   rindex($ENV{'REQUEST_URI'}, '/') + 1, -4));
+	 my $filenames = &unescape(substr($ENV{'REQUEST_URI'} , 
+					  rindex($ENV{'REQUEST_URI'}, '/') + 1, -4));
 	 
 	 # Security check on the file; the whole filename must consist
 	 # of nothing but alphanums, ' ,, or ., or the file
Index: loncom/interface/lonhelpmenu.pm
diff -u loncom/interface/lonhelpmenu.pm:1.30 loncom/interface/lonhelpmenu.pm:1.31
--- loncom/interface/lonhelpmenu.pm:1.30	Fri Jul 14 13:44:11 2006
+++ loncom/interface/lonhelpmenu.pm	Tue Jul 18 17:55:24 2006
@@ -145,6 +145,7 @@
 
     $r->print('<table id="LC_helpmenu" width="'.$width.'">');
 
+    my $general_help = &Apache::loncommon::general_help();
     $r->print(<<END);
   <tr height="50">
    <td width='5'>&nbsp;</td>
@@ -152,10 +153,12 @@
     <fieldset><legend><img src="$location/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' />&nbsp;&nbsp;LON-CAPA help/support</legend>
  <table id="LC_helpmenu_links">
    <tr>
+	<td><a href="/adm/help/$general_help.hlp" target="bodyframe">
+		  <img src="$location/help/gif/smallHelp.gif" border="0" alt="(General help)" valign="middle" />&nbsp;General Help</a>&nbsp;</td>
 END
     if ($component_url) {
 	$r->print("<td><a href=\"$component_url\" target=\"bodyframe\">".
-		  '<img src="'.$location.'/help/gif/smallHelp.gif" border="0" alt="(Topic help)" valign="middle" />&nbsp;Topic help</a>&nbsp;</td>');
+		  '<img src="'.$location.'/help/gif/smallHelp.gif" border="0" alt="(Topic help)" valign="middle" />&nbsp;'.$topic.'</a>&nbsp;</td>');
     }
     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
         $r->print('
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.143 loncom/interface/lonhtmlcommon.pm:1.144
--- loncom/interface/lonhtmlcommon.pm:1.143	Fri Jul  7 15:17:19 2006
+++ loncom/interface/lonhtmlcommon.pm	Tue Jul 18 17:55:24 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.143 2006/07/07 19:17:19 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.144 2006/07/18 21:55:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1264,26 +1264,27 @@
         $bug = $last->{'bug'} if (exists($last->{'bug'}));
         $help = $last->{'help'} if (exists($last->{'help'}));
         $component_help=($component_help?$component_help:$help);
-#        if ($faq ne '') {
-#            $icons .= &Apache::loncommon::help_open_faq($faq);
-#        }
+        if ($faq ne '') {
+            $icons .= &Apache::loncommon::help_open_faq($faq);
+        }
 #        if ($bug ne '') {
 #            $icons .= &Apache::loncommon::help_open_bug($bug);
 #        }
-	if ($helplink ne 'nohelp') {
+	if ($faq ne '' || $component_help ne '' || $bug ne '') {
 	    $icons .= &Apache::loncommon::help_open_menu($component,
 							 $component_help,
 							 $faq,$bug);
 	}
-        if ($icons ne '') {
-            $Str .= $icons.'&nbsp;';
-        }
         #
         $Str .= $links.'</td>';
         #
         if (defined($component)) {
             $Str .= '<td class="'.$css_class.'_component">'.
-                &mt($component).'</td>';
+                &mt($component);
+	    if ($icons ne '') {
+		$Str .= '&nbsp;'.$icons;
+	    }
+	    $Str .= '</td>';
         }
         $Str .= '</tr></table>'."\n";
         #
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.197 loncom/interface/lonmenu.pm:1.198
--- loncom/interface/lonmenu.pm:1.197	Tue Jul 18 15:45:15 2006
+++ loncom/interface/lonmenu.pm	Tue Jul 18 17:55:24 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.197 2006/07/18 19:45:15 raeburn Exp $
+# $Id: lonmenu.pm,v 1.198 2006/07/18 21:55:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -235,13 +235,8 @@
 	if ($env{'user.adv'}) {
 	    $remote = '<td><a href="/adm/remote?action=launch&amp;url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'
 	}
-        my $helptopic='Student_Intro';
-        if ($env{'request.role'}=~/^(ca|au)/) {
-	    $helptopic='Authoring_Intro';
-	} elsif ($env{'request.role'}=~/^cc/) {
-	    $helptopic='Course_Coordination_Intro';
-	}
-        my $helplink=&Apache::loncommon::help_open_topic($helptopic,'Help');
+
+        my $helplink=&Apache::loncommon::top_nav_help('Help');
 	return (<<ENDINLINEMENU);
 <script type="text/javascript">
 // BEGIN LON-CAPA Internal

--albertel1153259726--