--- loncom/homework/bridgetask.pm 2005/03/31 21:24:29 1.8
+++ loncom/homework/bridgetask.pm 2007/05/03 16:51:47 1.233
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.8 2005/03/31 21:24:29 albertel Exp $
+# $Id: bridgetask.pm,v 1.233 2007/05/03 16:51:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,24 +36,53 @@ use Apache::File();
use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
+use Apache::slotrequest();
use Time::HiRes qw( gettimeofday tv_interval );
+use LONCAPA;
+
+
BEGIN {
- &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Instance','InstanceText','Criteria','ClosingParagraph'));
+ &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','CriteriaText','GraderNote','ClosingParagraph'));
+}
+
+my %dimension;
+my $top = 'top';
+
+sub initialize_bridgetask {
+ # id of current Dimension, 0 means that no dimension is current
+ # (inside '.
+ "\n\t\t".'';
+ $result.= "\n\t\t".'';
+ $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 start_Task {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+sub add_grading_button {
+ my (undef,$cid)=&Apache::lonnet::whichuser();
+ my $cnum=$env{'course.'.$cid.'.num'};
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my %sections = &Apache::loncommon::get_sections($cdom,$cnum);
+
+ my $size=5;
+ if (scalar(keys(%sections)) < 3) {
+ $size=scalar(keys(%sections))+2;
+ }
+ my $sec_select = "\n".'\n";
+
+ my $result="\n\t".'';
+ $result.="\n\t".'';
+ if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
+ $result.="\n\t".''."\n\t\t".'
'."\n";
+ $result.="\n\t".'';
+ $result.="\n\t\t\t".' '."\n";
+
+ ($entries,$ready,$locks)=&get_queue_counts('reviewqueue');
+ $result.="\n\t\t".'Specify a section: '.
+ "\n\t\t\t".''.$sec_select."\n\t\t\t".' ';
+ $result.="\n\t\t\t".''.' ';
+
+ $result.= "\n\t\t\t\t".&mt("[_1] entries, [_2] ready, [_3] being graded",$entries,$ready,$locks).' '."\n\t\t".''.
+ "\n\t\t\t".' '."\n";
+ $result.="\n\t\t".''.
+ "\n\t\t\t\t".' ';
+ $result.=&mt("[_1] entries, [_2] ready, [_3] being graded",
+ $entries,$ready,$locks).' '."\n\t\t".''.
+ "\n\t\t\t".' '
+ ."\n\t".''.
+ "\n\t\t\t\t".' '
+ ."\n\t\t".'
'. + &mt('Student submitted [_1] [_2] the deadline. '. + '(Submission was at [_3], end of period was [_4].)', + $info,$when, + &Apache::lonlocal::locallocaltime($submissiontime), + &Apache::lonlocal::locallocaltime($slot{'endtime'})). + '
'; + } + return $result; +} + +sub file_list { + my ($files,$uname,$udom) = @_; + if (!defined($uname) || !defined($udom)) { + (undef,undef,$udom,$uname) = &Apache::lonnet::whichuser(); + } + my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/'; + + my $file_list="Submitted non-existant file $file
\n"; + } else { + $file = ''.$file.''; + $msg .= "Submitted file $file
\n"; + } + $files .= ''.&mt('Message sent to user: [_1]', + $message_status).'
'; + } + if ($setting eq 'student_and_user_notes_screen') { + $comment_status = + &Apache::lonmsg::store_instructor_comment($subject.''.&mt('Message sent to instructor: [_1]', + $comment_status).'
'; + } + return <Files submitted: $files
+You are now done with this Bridge Task
+'. + &mt('Grading [_1] for [_2] at [_3]', + &Apache::lonnet::gettitle($symb),$uname,$udom).'
'; + $form_tag_start.= + ''; + $Apache::bridgetask::queue_key=$todo; + &Apache::structuretags::initialize_storage(); + &Apache::lonhomework::showhash(%Apache::lonhomework::history); + if ($target eq 'webgrade' && $status_code eq 'selected') { + $form_tag_start.= + ''; + } + } else { + if ($target eq 'webgrade') { + $result.="\n"; + my $back=''. + &mt('Return to resource').'
'; + if ($status_code eq 'stop') { + $result.=''.&mt("Stopped grading.").''.$back; + } elsif ($status_code eq 'cancel') { + $result.=''.&mt("Cancelled grading.").''.$back; + } elsif ($status_code eq 'never_versioned') { + $result.=''. + &mt("Requested user has never accessed the task."). + ''.$back; + } elsif ($status_code =~ /still_open:(.*)/) { + my $date = &Apache::lonlocal::locallocaltime($1); + $result.=''. + &mt("Task is still open, will close at [_1].",$date). + ''.$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'; + } + if (!$todo || $env{'form.cancel'}) { + 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(); } + } elsif ($target eq 'webgrade' + && $env{'request.state'} eq 'construct') { + $result.=$form_tag_start; + $result.=''; + $result.=&webgrade_standard_info(); + } + if ($target eq 'webgrade') { + $result.="\n".'