[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncommon.pm lonpickcourse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 19 Mar 2004 03:47:09 -0000


albertel		Thu Mar 18 22:47:09 2004 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm loncommon.pm 
    /loncom/homework	grades.pm 
  Log:
  - BUG# 2716, show course title when picking a course
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.12 loncom/interface/lonpickcourse.pm:1.13
--- loncom/interface/lonpickcourse.pm:1.12	Tue Nov  4 11:33:10 2003
+++ loncom/interface/lonpickcourse.pm	Thu Mar 18 22:47:09 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.12 2003/11/04 16:33:10 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.13 2004/03/19 03:47:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -51,7 +51,8 @@
 # Get parameters from query string
     &Apache::loncommon::get_unprocessed_cgi
         ($ENV{'QUERY_STRING'},['domainfilter','descriptfilter',
-                 'sincefilter','form','cnumelement','cdomelement']);
+			       'sincefilter','form','cnumelement',
+			       'cdomelement','cnameelement']);
 # domain filter and selection
     my $domainfilter=$ENV{'form.domainfilter'};
     $domainfilter=~s/\W//g;
@@ -84,10 +85,17 @@
 				       'cac' => 'Course Activity',
 				       'cde' => 'Course Description',
 				       'cdo' => 'Course Domain');
+    my ($name_code,$name_input);
+    if (defined($ENV{'form.cnameelement'}) && $ENV{'form.cnameelement'} ne '') {
+	$name_code = "opener.document.$ENV{'form.form'}.$ENV{'form.cnameelement'}.value=cdesc;";
+	$name_input ='<input type="hidden" name="cnameelement" value="'.
+	    $ENV{'form.cnameelement'}.'" />';
+    }
     $r->print(<<ENDSCRIPT);
 <script>
-function gochoose(cname,cdom) {
-    opener.document.$ENV{'form.form'}.$ENV{'form.cnumelement'}.value=cname;
+function gochoose(cname,cdom,cdesc) {
+    $name_code
+    opener.document.$ENV{"form.form"}.$ENV{'form.cnumelement'}.value=cname;
     var slct=opener.document.$ENV{'form.form'}.$ENV{'form.cdomelement'};
     var i;
     for (i=0;i<slct.length;i++) {
@@ -99,6 +107,7 @@
 <form method="post">
 <input type="hidden" name="cnumelement" value="$ENV{'form.cnumelement'}" />
 <input type="hidden" name="cdomelement" value="$ENV{'form.cdomelement'}" />
+$name_input
 <input type="hidden" name="form" value="$ENV{'form.form'}" />
 
 $lt{'cac'}: $sincefilterform
@@ -127,9 +136,11 @@
 	}
 	foreach my $description (sort(keys(%by_descrip))) {
 	    my $course=$by_descrip{$description};
+	    my $cleandesc=&HTML::Entities::encode($courses{$course});
+	    $cleandesc=~s/'/\\'/g;
 	    my ($cdom,$cnum)=split(/\_/,$course);
 	    $r->print('<input type="button" value="Select" onClick="gochoose('.
-		  "'".$cnum."','".$cdom."')".'" /> '.$courses{$course}.' ('.
+		  "'".$cnum."','".$cdom."','".$cleandesc."')".'" /> '.$courses{$course}.' ('.
 		  ($Apache::lonnet::domaindescription{$cdom}?
                    $Apache::lonnet::domaindescription{$cdom}:$cdom).
                  ")<br />\n");
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.186 loncom/interface/loncommon.pm:1.187
--- loncom/interface/loncommon.pm:1.186	Mon Mar 15 17:32:37 2004
+++ loncom/interface/loncommon.pm	Thu Mar 18 22:47:09 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.186 2004/03/15 22:32:37 albertel Exp $
+# $Id: loncommon.pm,v 1.187 2004/03/19 03:47:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -353,7 +353,7 @@
    return (<<ENDSTDBRW);
 <script type="text/javascript" language="Javascript" >
     var stdeditbrowser;
-    function opencrsbrowser(formname,uname,udom) {
+    function opencrsbrowser(formname,uname,udom,desc) {
         var url = '/adm/pickcourse?';
         var filter;
         if (filter != null) {
@@ -368,7 +368,8 @@
 	   }
         }
         url += 'form=' + formname + '&cnumelement='+uname+
-                                    '&cdomelement='+udom;
+	                            '&cdomelement='+udom+
+                                    '&cnameelement='+desc;
         var title = 'Course_Browser';
         var options = 'scrollbars=1,resizable=1,menubar=0';
         options += ',width=700,height=600';
@@ -380,9 +381,9 @@
 }
 
 sub selectcourse_link {
-   my ($form,$unameele,$udomele)=@_;
+   my ($form,$unameele,$udomele,$desc)=@_;
     return "<a href='".'javascript:opencrsbrowser("'.$form.'","'.$unameele.
-        '","'.$udomele.'");'."'>".&mt('Select Course')."</a>";
+        '","'.$udomele.'","'.$desc.'");'."'>".&mt('Select Course')."</a>";
 }
 
 =pod
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.180 loncom/homework/grades.pm:1.181
--- loncom/homework/grades.pm:1.180	Fri Mar 12 13:03:38 2004
+++ loncom/homework/grades.pm	Thu Mar 18 22:47:09 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.180 2004/03/12 18:03:38 albertel Exp $
+# $Id: grades.pm,v 1.181 2004/03/19 03:47:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4204,7 +4204,8 @@
     my ($r)=@_;
     $r->print(&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'}));
     my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid',
-							  'domainid');
+							  'domainid',
+							  'coursename');
     my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'},
 						   'domainid');
     my $default_form_data=&defaultFormData(&get_symb_and_url($r,1));
@@ -4221,12 +4222,14 @@
 
 <form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'>
 $default_form_data
-Course: <input name='courseid' type='text' />
-Domain: $domsel $select_link
-<br />
+<table>
+<tr><td>$select_link </td></tr>
+<tr><td>Course ID:   </td><td><input name='courseid' type='text' />  </td></tr>
+<tr><td>Course Name: </td><td><input name='coursename' type='text' /></td></tr>
+<tr><td>Domain:      </td><td>$domsel                                </td></tr>
+<tr><td>File to upload:</td><td><input type="file" name="upfile" size="50" /></td></tr>
+</table>
 <input name='command' value='scantronupload_save' type='hidden' />
-File to upload:<input type="file" name="upfile" size="50" />
-<br />
 <input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Scantron Data" />
 </form>
 UPLOAD