[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm grades.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sun, 19 Mar 2006 21:38:56 -0000


albertel		Sun Mar 19 16:38:56 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm grades.pm 
  Log:
  - file links were incorrect
  - commiting code to generate file lists
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.118 loncom/homework/bridgetask.pm:1.119
--- loncom/homework/bridgetask.pm:1.118	Mon Mar  6 14:46:59 2006
+++ loncom/homework/bridgetask.pm	Sun Mar 19 16:38:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.118 2006/03/06 19:46:59 albertel Exp $
+# $Id: bridgetask.pm,v 1.119 2006/03/19 21:38:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -371,12 +371,15 @@
     return $result;
 }
 
-sub webgrade_standard_info {
-    my ($version)=&get_version();
-    my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+sub file_list {
+    my ($files,$uname,$udom) = @_;
+    if (!defined($uname) || !defined($udom)) {
+	(undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+    }
     my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
+
     my $file_list="<ul class=\"LC_GRADE_handininfo\">\n";
-    foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
+    foreach my $partial_file (split(',',$files)) {
 	my $file=$file_url.$partial_file;
 	$file=~s|/+|/|g;
 	&Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
@@ -385,6 +388,13 @@
 	    '</a></nobr></li>'."\n";
     }
     $file_list.="</ul>\n";
+    return $file_list;
+}
+
+sub webgrade_standard_info {
+    my ($version)=&get_version();
+
+    my $file_list = &file_list($Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"});
 
     my %lt=&Apache::lonlocal::texthash('done' => 'Next Item',
 				       'stop' => 'Quit Grading',
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.335 loncom/homework/grades.pm:1.336
--- loncom/homework/grades.pm:1.335	Sun Mar 19 16:29:50 2006
+++ loncom/homework/grades.pm	Sun Mar 19 16:38:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.335 2006/03/19 21:29:50 albertel Exp $
+# $Id: grades.pm,v 1.336 2006/03/19 21:38:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -209,7 +209,8 @@
 #--- Currently filters option/rank/radiobutton/match/essay/Task
 #        response types only.
 sub cleanRecord {
-    my ($answer,$response,$symb,$partid,$respid,$record,$order,$version) = @_;
+    my ($answer,$response,$symb,$partid,$respid,$record,$order,$version,
+	$uname,$udom) = @_;
     my $grayFont = '<font color="#999999">';
     if ($response =~ /^(option|rank)$/) {
 	my %answer=&Apache::lonnet::str2hash($answer);
@@ -293,7 +294,7 @@
     } elsif ( $response eq 'Task') {
 	if ( $answer eq 'SUBMITTED') {
 	    my $files = $record->{$version."resource.$respid.$partid.bridgetask.portfiles"};
-	    my $result = &Apache::bridgetask::file_list($files);
+	    my $result = &Apache::bridgetask::file_list($files,$uname,$udom);
 	    return $result;
 	} elsif ( grep(/^\Q$version\E.*?\.instance$/, keys(%{$record})) ) {
 	    my @matches = grep(/^\Q$version\E.*?\.instance$/,
@@ -3938,7 +3939,7 @@
 			    &get_order($partid,$responseId,$symb,$uname,$udom);
 		    }
 		    $displaySub[0].='</b>&nbsp; '.
-			&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:").'<br />';
+			&cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'<br />';
 		}
 	    }
 	    if (exists($$record{"$where.$partid.checkedin"})) {