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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 14 Oct 2005 16:23:40 -0000


albertel		Fri Oct 14 12:23:40 2005 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - Move Done, Stop buttons and file links to a div at the top of the screen (as per request)
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.69 loncom/homework/bridgetask.pm:1.70
--- loncom/homework/bridgetask.pm:1.69	Wed Oct 12 10:45:44 2005
+++ loncom/homework/bridgetask.pm	Fri Oct 14 12:23:39 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.69 2005/10/12 14:45:44 albertel Exp $
+# $Id: bridgetask.pm,v 1.70 2005/10/14 16:23:39 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -335,11 +335,41 @@
     return $result;
 }
 
+sub webgrade_standard_info {
+    my ($version)=&get_version();
+    my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+    my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
+    my $file_list="<ul>\n";
+    foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
+	my $file=$file_url.$partial_file;
+	$file=~s|/+|/|g;
+	&Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
+	$file_list.='<li><nobr><a href="'.$file.'" target="lonGRDs"><img src="'.
+	    &Apache::loncommon::icon($file).'" border=0"> '.$file.
+	    '</a></nobr></li>'."\n";
+    }
+    $file_list.="</ul>\n";
+
+    my %lt=&Apache::lonlocal::texthash('done' => 'Done',
+				       'stop' => 'Stop',
+				       );
+				       
+    my $result=<<INFO;
+<div class="handininfo">
+  <input type="submit" name="next" value="$lt{'done'}" />
+  <input type="submit" name="stop" value="$lt{'stop'}" />
+  $file_list
+</div>
+INFO
+    return $result;
+}
+
 sub start_Task {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
 
     my ($status,$accessmsg,$slot);
     if ($target ne 'webgrade') {
+	&Apache::structuretags::init_problem_globals('Task');
 	&Apache::structuretags::initialize_storage();
 	&Apache::lonhomework::showhash(%Apache::lonhomework::history);
     } 
@@ -511,6 +541,7 @@
                                value="'.$sec.'" />';
 		}
 	    }
+	    if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
 	}
     } else {
 	# page_start returned a starting result, delete it if we don't need it
@@ -824,9 +855,14 @@
 	#    &mt('Save Partial Grade and Continue Grading').'" /> ';
 	$result.='</form>'.&Apache::loncommon::endbodytag().'</html>';
     } elsif ($target eq 'meta') {
-	$result.='<parameter part="0" package="Task"></parameter>'."\n";
-	#$result.=&Apache::response::meta_part_order();
-	#$result.=&Apache::response::meta_response_order();
+	$result.=&Apache::response::meta_package_write('Task');
+        $result.=&meta_stores_write('solved','string','Problem Status');
+	$result.=&meta_stores_write('tries','int_zeropos',
+				    'Number of Attempts');
+	$result.=&meta_stores_write('awarded','float',
+				    'Partial Credit Factor');
+	$result.=&meta_stores_write('status','string',
+				    'Bridge Task Status');
     }
     undef($Apache::lonhomework::parsing_a_task);
     return $result;
@@ -1485,23 +1521,7 @@
 		    '<td>'.
 		    '<a href="#'.$last_link.'">Prev</a><br />'.
 		    '<a href="#next_'.$link.'">Next</a><br /><br /><br />'.
-		    '<input type="submit" name="next" value="'.
-		    &mt('Done').'" /> '.
-		    '<input type="submit" name="stop" value="'.
-		    &mt('Stop').'" /> '.
 		    '</td></tr>';
-		$result.='<tr><td colspan="4">';
-		my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
-		my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
-		foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
-		    my $file=$file_url.$partial_file;
-		    $file=~s|/+|/|g;
-		    &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
-		    $result.='<nobr><a href="'.$file.'" target="lonGRDs"><img src="'.
-			&Apache::loncommon::icon($file).'" border=0"> '.$file.
-			'</a></nobr> ';
-		}
-		$result.='</td></tr>';
 		$last_link=$link;
 	    }
 	} elsif ($target eq 'grade' && $env{'form.webgrade'}) {