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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 31 May 2005 21:11:58 -0000


albertel		Tue May 31 17:11:58 2005 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - can now explictly go back the tohe current version of a task
  - starting to wire up the 'schedule a new slot'
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.35 loncom/homework/bridgetask.pm:1.36
--- loncom/homework/bridgetask.pm:1.35	Tue May 31 12:31:01 2005
+++ loncom/homework/bridgetask.pm	Tue May 31 17:11:56 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.35 2005/05/31 16:31:01 albertel Exp $
+# $Id: bridgetask.pm,v 1.36 2005/05/31 21:11:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -91,6 +91,7 @@
 sub get_version {
     my ($version,$previous);
     if ($env{'form.previousversion'} && 
+	$env{'form.previousversion'} ne 'current' &&
 	defined($Apache::lonhomework::history{'resource.'.$env{'form.previousversion'}.'.status'})) {
 	$version=$env{'form.previousversion'};
 	$previous=1;
@@ -129,6 +130,7 @@
     my $list='<option>'.
 	join("</option>\n<option>",@to_show).
 	     "</option>\n";
+    $list.='<option value="current">'.&mt('Current').'</option>';
     $result.='<form name="getprevious" method="POST" action="';
     my $uri=$env{'request.uri'};
     if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
@@ -163,8 +165,14 @@
 
 sub add_request_another_attempt_button {
     my $result;
-    $result.=' <input type="submit" name="requestattempt" value="'.
-	&mt("Request another attempt").'" />';
+    my $symb=&Apache::lonnet::symbread();
+    if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); }
+    $symb=&Apache::lonnet::escape($symb);
+    $result.='<form method="POST" action="/adm/slotrequest">'.
+	'<input type="hidden" name="symb" value="'.$symb.'" />'.
+	'<input type="submit" name="requestattempt" value="'.
+	        &mt("Request another attempt").'" />'.
+	'</form>';
     return $result;
 }
 
@@ -264,9 +272,8 @@
 	} elsif ($target eq 'web') {
 	    my $name= &Apache::structuretags::get_resource_name($parstack,$safeeval);
 	    $result.="$head_tag_start<title>$name</title></head>
-              $body_tag_start \n $form_tag_start".	
-	      '<input type="hidden" name="submitted" value="yes" />';
-	    $result.=&preserve_grade_info();
+              $body_tag_start \n";
+	    
 	    my ($version,$previous)=&get_version();
 	    if ($Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
 		$result.='<h1><font color="red">'.&mt('Did not pass').'</font></h1>';
@@ -277,6 +284,10 @@
 	    if ($Apache::lonhomework::history{"resource.$version.status"} eq 'pass') {
 		$result.='<h1><font color="green">'.&mt('Passed').'</font></h1>';
 	    }
+	    $result.=$form_tag_start.
+		'<input type="hidden" name="submitted" value="yes" />';
+	    $result.=&preserve_grade_info();
+
 	}
     } elsif ( ($target eq 'grade' && $env{'form.webgrade'}) ||
 	      $target eq 'webgrade') {