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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 01 Aug 2002 16:48:21 -0000


bowersj2		Thu Aug  1 12:48:21 2002 EDT

  Modified files:              
    /loncom/interface	loncommon.pm londropadd.pm 
  Log:
  Fixes bug #620, and adds the ability to pass text to help_open_topic to
  also be linked, along with the graphic.
  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.47 loncom/interface/loncommon.pm:1.48
--- loncom/interface/loncommon.pm:1.47	Mon Jul 22 10:25:40 2002
+++ loncom/interface/loncommon.pm	Thu Aug  1 12:48:21 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.47 2002/07/22 14:25:40 bowersj2 Exp $
+# $Id: loncommon.pm,v 1.48 2002/08/01 16:48:21 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -439,10 +439,12 @@
 
 =pod
 
-=item help_open_topic($topic, $stayOnPage, $width, $height)
+=item help_open_topic($topic, $text, $stayOnPage, $width, $height)
 
 Returns a string corresponding to an HTML link to the given help $topic, where $topic corresponds to the name of a .tex file in /home/httpd/html/adm/help/tex, with underscores replaced by spaces.
 
+$text will optionally be linked to the same topic, allowing you to link text in addition to the graphic. If you do not want to link text, but wish to specify one of the later parameters, pass an empty string.
+
 $stayOnPage is a value that will be interpreted as a boolean. If true, the link will not open a new window. If false, the link will open a new window using Javascript. (Default is false.)
 
 $width and $height are optional numerical parameters that will override the width and height of the popped up window, which may be useful for certain help topics with big pictures included.
@@ -450,32 +452,36 @@
 =cut
 
 sub help_open_topic {
-    my ($topic, $stayOnPage, $width, $height) = @_;
+    my ($topic, $text, $stayOnPage, $width, $height) = @_;
+    $text = "" if (not defined $text);
     $stayOnPage = 0 if (not defined $stayOnPage);
     $width = 350 if (not defined $width);
     $height = 400 if (not defined $height);
     my $filename = $topic;
     $filename =~ s/ /_/g;
 
-    my $template;
+    my $template = "";
+    my $link;
 
     if (!$stayOnPage)
     {
-        $template = <<"ENDTEMPLATE";
-<a href="javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,s
-crollbars=1,width=$width,height=$height'))"><image
-  src="/adm/help/gif/smallHelp.gif"
-  border="0" alt="(Help: $topic)"></a>
-ENDTEMPLATE
+	$link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height'))";
     }
     else
     {
-        $template = <<"ENDTEMPLATE";
-<a href="/adm/help/${filename}.hlp"><image
-  src="/adm/help/gif/smallHelp.gif"
-  border="0" alt="(Help: $topic)"></a>
-ENDTEMPLATE
+	$link = "/adm/help/${filename}.hlp";
+    }
+
+    # Add the text
+    if ($text ne "")
+    {
+	$template .= "<a href=\"$link\">$text</a> ";
     }
+
+    # Add the graphic
+    $template .= <<"ENDTEMPLATE";
+<a href="$link"><image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Help: $topic)"></a>
+ENDTEMPLATE
 
     return $template;
 
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.43 loncom/interface/londropadd.pm:1.44
--- loncom/interface/londropadd.pm:1.43	Wed Jul 31 10:56:34 2002
+++ loncom/interface/londropadd.pm	Thu Aug  1 12:48:21 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.43 2002/07/31 14:56:34 bowersj2 Exp $
+# $Id: londropadd.pm,v 1.44 2002/08/01 16:48:21 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -146,9 +146,11 @@
     my $r=shift;
     my $upfile_select=&Apache::loncommon::upfile_select_html();
     my $create_classlist_help = 
-	&Apache::loncommon::help_open_topic("Course_Create_Class_List");
+	&Apache::loncommon::help_open_topic("Course_Create_Class_List",
+           "How do I create a class list from a spreadsheet");
     my $create_csv_help =
-	&Apache::loncommon::help_open_topic("Course_Convert_To_CSV");
+	&Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
+           "How do I create a CSV file from a spreadsheet");
     $r->print(<<ENDUPFORM);
 <input type=hidden name=phase value=two>
 <hr>
@@ -156,9 +158,8 @@
 $upfile_select
 <p><input type=submit name="fileupload" value="Upload Courselist">
 <br />
-How to create a class list from a spreadsheet $create_classlist_help
-<br />
-How to create a CSV file from your spreadsheet $create_csv_help
+$create_classlist_help <br />
+$create_csv_help
 
 <hr />
 <h3>Enroll a single student</h3>