--- loncom/homework/bridgetask.pm 2005/03/17 21:21:11 1.2
+++ loncom/homework/bridgetask.pm 2006/03/31 20:29:56 1.135
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.2 2005/03/17 21:21:11 albertel Exp $
+# $Id: bridgetask.pm,v 1.135 2006/03/31 20:29:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,41 +36,442 @@ use Apache::File();
use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
+use Apache::slotrequest();
use Time::HiRes qw( gettimeofday tv_interval );
+
BEGIN {
&Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Instance','InstanceText','Criteria','ClosingParagraph'));
}
-sub start_Task {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+sub initialize_bridgetask {
+ # id of current Dimension, 0 means that no dimension is current
+ # (inside '."\n";
+ $result.='';
+ $result.=&Apache::loncommon::select_dom_form($env{'user.domain'},
+ 'gradingdomain');
+ $result.=' '.
+ &Apache::loncommon::selectstudent_link('gradesubmission',
+ 'gradinguser',
+ 'gradingdomain');
+ $result.=&Apache::loncommon::studentbrowser_javascript();
+ $result.= '".&mt("Showing previous version [_1]",$version).
+ "
\n";
+ }
+ my @to_show;
+ foreach my $test_version (1..$Apache::lonhomework::history{'resource.0.version'}) {
+ if (defined($Apache::lonhomework::history{'resource.'.$test_version.'.0.status'})) {
+ push(@to_show,$test_version);
+ }
+ }
+ my $list='\n\n";
+ $list.='';
+ $result.='";
+ return $result;
+}
+
+sub add_grading_button {
+ my (undef,$cid)=&Apache::lonxml::whichuser();
+ my $cnum=$env{'course.'.$cid.'.num'};
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my %sections;
+ my $numsections=&Apache::loncommon::get_sections($cdom,$cnum,\%sections);
+ my $size=5;
+ if (scalar(keys(%sections)) < 3) {
+ $size=scalar(keys(%sections))+2;
+ }
+ my $sec_select = '\n";
+
+ my $result=' ';
+ $result.='';
+ if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
+ $result.='
'."\n";
+ $result.='';
+ $result.=' '."\n";
+
+ ($entries,$ready,$locks)=&get_queue_counts('reviewqueue');
+ $result.='Specify a section: '.$sec_select.' ';
+ $result.=''.' ';
+
+ $result.= &mt("[_1] entries, [_2] ready, [_3] being graded",$entries,$ready,$locks).' '."\n";
+ $result.=''.
+ ' ';
+ $result.=&mt("[_1] entries, [_2] ready, [_3] being graded",
+ $entries,$ready,$locks).'
'. + &mt('Student submitted [_1] [_2] the deadline. + (Submission was at [_3], end of period was [_4].)', + $info,$when,scalar(localtime($submissiontime)), + scalar(localtime($slot{'endtime'}))). + '
'; + } + return $result; +} + +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="Files submitted: $files
+You are now done with this Bridge Task
+Found '. + &Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.' |
'. + &mt('Return to resource').'
'; + if ($status_code eq 'stop') { + $result.=''.&mt("Stopped grading.").''.$back; + } elsif ($status_code eq 'lock_failed') { + $result.=''.&mt("Failed to lock the requested record.") + .''.$back; + } elsif ($status_code eq 'unlock') { + $result.=''.&mt("Unlocked the requested record.") + .''.$back; + $result.=&show_queue($env{'form.queue'},1); + } elsif ($status_code eq 'show_list') { + $result.=&show_queue($env{'form.queue'},1); + } elsif ($status_code eq 'select_user') { + $result.=&select_user(); + } elsif ($status_code eq 'unable') { + $result.=''.&mt("Unable to aqcuire a user to grade.").''.$back; + } elsif ($status_code eq 'not_allowed') { + $result.=''.&mt('Not allowed to grade the requested user.').' '.$msg.''.$back; + } else { + $result.=''.&mt("No user to be graded.").''.$back; + } + } + $webgrade='no'; + my $bodytext=&Apache::lonxml::get_all_text("/task",$parser,$style); + } + if ($target eq 'webgrade' && defined($env{'form.queue'})) { + if ($webgrade eq 'yes') { + $result.=&submission_time_stamp(); + } + $result.=$form_tag_start; + $result.=''; + $result.=''; + if ($env{'form.regrade'}) { + $result.=''; + } + if ($env{'form.chosensections'}) { + my @chosen_sections= + &Apache::loncommon::get_env_multiple('form.chosensections'); + foreach my $sec (@chosen_sections) { + $result.=''; } } + if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); } + } + if ($target eq 'webgrade') { + $result.="\n".'