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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Sat, 07 Apr 2007 00:12:45 -0000


albertel		Fri Apr  6 20:12:45 2007 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm bridgetask.pm structuretags.pm 
  Log:
  - enable task grading in CSTR
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.266 loncom/homework/lonhomework.pm:1.267
--- loncom/homework/lonhomework.pm:1.266	Fri Apr  6 17:21:34 2007
+++ loncom/homework/lonhomework.pm	Fri Apr  6 20:12:42 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.266 2007/04/06 21:21:34 albertel Exp $
+# $Id: lonhomework.pm,v 1.267 2007/04/07 00:12:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,7 +112,10 @@
 		return ('web');
 	    }
 	} else {
-	    if ( $env{'form.problemmode'} eq &mt('View') ||
+	    if ($env{'form.problemstate'} eq 'WEB_GRADE') {
+		#$env{'form.webgrade'} = 'yes';
+		return ('grade','webgrade','answer');
+	    } elsif ( $env{'form.problemmode'} eq &mt('View') ||
 		 $env{'form.problemmode'} eq &mt('Discard Edits and View')) {
 		if ( defined($env{'form.submitted'}) &&
 		     (!defined($env{'form.resetdata'})) &&
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.230 loncom/homework/bridgetask.pm:1.231
--- loncom/homework/bridgetask.pm:1.230	Fri Apr  6 17:22:24 2007
+++ loncom/homework/bridgetask.pm	Fri Apr  6 20:12:43 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.230 2007/04/06 21:22:24 albertel Exp $
+# $Id: bridgetask.pm,v 1.231 2007/04/07 00:12:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -487,6 +487,7 @@
 	    'stop'   => 'Quit Grading',
 	    'fail'   => 'Fail Rest',
 	    'cancel' => 'Cancel',
+	    'submit' => 'Submit Grades',
 	    );
     %lt=&Apache::lonlocal::texthash(%lt);
 
@@ -494,26 +495,35 @@
   <div class="LC_GRADING_maincontrols">
 INFO
 
-    if (&grade_mode() eq 'regrade') {
+    if ($env{'request.state'} eq 'construct') {
 	$result.=<<INFO;
+    <input type="submit" name="next" value="$lt{'submit'}" />
+INFO
+    } else {
+	if (&grade_mode() eq 'regrade' && $env{'request.state'} ne 'construct') {
+	    $result.=<<INFO;
     <input type="submit" name="cancel" value="$lt{'cancel'}" />
 INFO
-    }
+        }
 
-    $result.=<<INFO;
+	$result.=<<INFO;
     <input type="submit" name="next" value="$lt{'done'}" />
     <input type="submit" name="stop" value="$lt{'stop'}" />
+INFO
+    }
+    $result.=<<INFO;
     <input type="button" name="fail" value="$lt{'fail'}" 
            onclick="javascript:onFailRest()" />
   </div>
   $file_list
 INFO
     return $result;
+
 }
 
 sub done_screen {
     my ($version) = @_;
-    my $title=&Apache::lonnet::gettitle();
+    my $title=&Apache::lonnet::gettitle($env{'request.uri'});
     my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
     my (undef,undef,$domain,$user)= &Apache::lonnet::whichuser();
     my $files = '<ul>';
@@ -619,7 +629,7 @@
 	    }
 	}
     }
-    if ($target eq 'web' && $env{'request.state'} eq 'construct') {
+    if ($target =~/(web|webgrade)/ && $env{'request.state'} eq 'construct') {
 	$form_tag_start.=&Apache::structuretags::problem_web_to_edit_header($env{'form.rndseed'});
     }
     if ($target eq 'web' 
@@ -723,8 +733,12 @@
 	if ($todo) {
 	    &setup_env_for_other_user($todo,$safeeval);
 	    my ($symb,$uname,$udom)=&decode_queue_key($todo);
-	    $result.="\n".'<table><tr><td>Found '.
-		&Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.'</td></tr></table>';
+	    if ($env{'request.state'} eq 'construct') {
+		$symb = $env{'request.uri'};
+	    }
+	    $result.="\n".'<p>'.
+		&mt('Grading [_1] for [_2] at [_3]',
+		    &Apache::lonnet::gettitle($symb),$uname,$udom).'</p>';
 	    $form_tag_start.=
 		'<input type="hidden" name="gradingkey" value="'.
 		&escape($todo).'" />';
@@ -799,6 +813,12 @@
 		}
 	    }
 	    if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
+	} elsif ($target eq 'webgrade' 
+		 && $env{'request.state'} eq 'construct') {
+	    $result.=$form_tag_start;
+	    $result.='<input type="hidden" name="webgrade" value="'.
+		$webgrade.'" />';
+	    $result.=&webgrade_standard_info();
 	}
 	if ($target eq 'webgrade') {
 	    $result.="\n".'<div id="LC_GRADING_criterialist">';
@@ -846,6 +866,12 @@
     my ($target)=@_;
     my $todo;
 
+    if ($env{'request.state'} eq 'construct') {
+	my ($symb,$cid,$udom,$uname) = &Apache::lonnet::whichuser();
+	my $gradingkey=&encode_queue_key($symb,$udom,$uname);
+	return ($gradingkey);
+    }
+
     if (defined($env{'form.reviewasubmission'})) {
 	&Apache::lonxml::debug("review a submission....");
 	$env{'form.queue'}='reviewqueue';
@@ -1056,8 +1082,7 @@
 		if (&show_task($status,$previous) &&
 		    $Apache::lonhomework::history{"resource.$version.0.status"} =~ /^(pass|fail)$/) {
 		    my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"};
-		    my $title=&Apache::lonnet::gettitle();
-
+		    my $title=&Apache::lonnet::gettitle($env{'request.uri'});
 		    my $start_time;
 
 		    my $slot_name=
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.375 loncom/homework/structuretags.pm:1.376
--- loncom/homework/structuretags.pm:1.375	Fri Apr  6 17:22:24 2007
+++ loncom/homework/structuretags.pm	Fri Apr  6 20:12:43 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.375 2007/04/06 21:22:24 albertel Exp $
+# $Id: structuretags.pm,v 1.376 2007/04/07 00:12:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -344,6 +344,20 @@
 	     '.'.&Apache::loncommon::help_open_topic("Analyze_Problem",
 						     '',undef,undef,300).
 						     '<hr />';
+    } elsif ($Apache::lonhomework::parsing_a_task) {
+	$result.="
+<nobr>
+Problem Status:
+<select name='problemstate'>
+  <option value=''></option>
+  ".&option('CLOSED'               ,'problemstate').&mt("Closed")."</option>
+  ".&option('CAN_ANSWER'           ,'problemstate').&mt("Answerable")."</option>
+  ".&option('WEB_GRADE'            ,'problemstate').&mt("Criteria Grading")."</option>
+  ".&option('SHOW_ANSWER'          ,'problemstate').&mt("Show Feedback")."</option>
+</select>
+</nobr>
+<input type='submit' name='changeproblemmode' value='".&mt("Change")."' />
+<hr />";
     }
     return $result;
 }