--- loncom/homework/bridgetask.pm 2006/06/23 22:32:39 1.178
+++ loncom/homework/bridgetask.pm 2007/01/24 19:24:33 1.223
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.178 2006/06/23 22:32:39 albertel Exp $
+# $Id: bridgetask.pm,v 1.223 2007/01/24 19:24:33 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,16 +43,16 @@ use LONCAPA;
BEGIN {
- &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','ClosingParagraph'));
+ &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','GraderNote','ClosingParagraph'));
}
my %dimension;
+my $top = 'top';
+
sub initialize_bridgetask {
# id of current Dimension, 0 means that no dimension is current
# (inside only)
@Apache::bridgetask::dimension=();
- # list of all Dimension ids seen
- %Apache::bridgetask::top_dimensionlist=();
# list of all current Instance ids
%Apache::bridgetask::instance=();
# list of all Instance ids seen in this problem
@@ -98,6 +98,7 @@ sub check_in {
&check_in_sequence($user,$domain,$slot_name);
} else {
&create_new_version($type,$user,$domain,$slot_name);
+ &Apache::structuretags::finalize_storage();
}
return 1;
}
@@ -105,7 +106,7 @@ sub check_in {
sub check_in_sequence {
my ($user,$domain,$slot_name) = @_;
my $navmap = Apache::lonnavmaps::navmap->new();
- my ($symb) = &Apache::lonxml::whichuser();
+ my ($symb) = &Apache::lonnet::whichuser();
my ($map) = &Apache::lonnet::decode_symb($symb);
my @resources =
$navmap->retrieveResources($map, sub { $_[0]->is_problem() },0,0);
@@ -152,11 +153,14 @@ sub create_new_version {
} elsif ($type eq 'problem') {
&Apache::lonxml::debug("authed $slot_name");
}
-
- if (defined($user) && defined($domain)) {
- $Apache::lonhomework::results{"resource.$id.checkedin"}=
- $user.':'.$domain;
+ if (!defined($user) || !defined($domain)) {
+ $user = $env{'user.name'};
+ $domain = $env{'user.domain'};
}
+
+ $Apache::lonhomework::results{"resource.$id.checkedin"}=
+ $user.':'.$domain;
+
if (defined($slot_name)) {
$Apache::lonhomework::results{"resource.$id.checkedin.slot"}=
$slot_name;
@@ -222,7 +226,7 @@ sub add_previous_version_button {
}
sub add_grading_button {
- my (undef,$cid)=&Apache::lonxml::whichuser();
+ 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);
@@ -231,36 +235,43 @@ sub add_grading_button {
if (scalar(keys(%sections)) < 3) {
$size=scalar(keys(%sections))+2;
}
- my $sec_select = '\n";
- my $result=' ';
- $result.='';
+ $result.="\n\t".'';
if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
- $result.='
'."\n";
}
return $result;
}
@@ -292,18 +303,19 @@ sub add_request_another_attempt_button {
my $description=&Apache::slotrequest::get_description($slot_name,
$slot);
$result.=(< Will be next available: $description
+
Will be next available: $description
STUFF
}
if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); }
$symb=&escape($symb);
- $result.='';
+ &mt($text).'" />'."\n\t".
+ ''."\n";
return $result;
}
@@ -323,9 +335,22 @@ sub style {
my ($target) = @_;
if ($target eq 'web'
|| $target eq 'webgrade') {
- return (<
STYLE
+ if ($env{'browser.type'} eq 'explorer'
+ && $env{'browser.os'} eq 'win' ) {
+ if ($env{'browser.version'} < 7) {
+ $style .= (<
+STYLE
+ } else {
+ $style .= (<
+STYLE
+ }
+ }
+ return $style;
}
return;
}
@@ -356,6 +381,13 @@ sub nest {
}
}
+sub start_delay {
+ push(@delay,1);
+}
+sub end_delay {
+ pop(@delay);
+}
+
sub nested_parse {
my ($str,$env,$args) = @_;
my @old_env = @Apache::scripttag::parser_env;
@@ -372,6 +404,8 @@ sub nested_parse {
@Apache::scripttag::parser_env = @old_env;
if ($args->{'delayed_dim_results'}) {
my $dim = &get_dim_id();
+ &Apache::lonxml::debug(" tossing out $result ");
+ &Apache::lonxml::debug(" usining out $dim 's ". $dimension{$dim}{'result'});
return $dimension{$dim}{'result'};
}
return $result;
@@ -383,12 +417,14 @@ sub internal_location {
}
sub submission_time_stamp {
- my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
+ my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser();
my $submissiontime;
my $version=$Apache::lonhomework::history{'resource.0.version'};
for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) {
- if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})) {
+ if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})
+ && defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.tries'})) {
$submissiontime=$Apache::lonhomework::history{$v.':timestamp'};
+ last;
}
}
my $result;
@@ -399,16 +435,18 @@ sub submission_time_stamp {
my ($color,$when)=('#FF6666','after');
if ($diff > 0) { ($color,$when)=('#336600','before'); }
my $info;
+ $diff = abs($diff);
if ($diff%60) { $info=($diff%60).' seconds'; }
$diff=int($diff/60);
if ($diff%60) { $info=($diff%60).' minutes '.$info; }
$diff=int($diff/60);
if ($diff) { $info=$diff.' hours '.$info; }
$result='
'.
- &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'}))).
+ &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;
@@ -417,7 +455,7 @@ sub submission_time_stamp {
sub file_list {
my ($files,$uname,$udom) = @_;
if (!defined($uname) || !defined($udom)) {
- (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+ (undef,undef,$udom,$uname) = &Apache::lonnet::whichuser();
}
my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
@@ -478,7 +516,7 @@ sub done_screen {
my ($version) = @_;
my $title=&Apache::lonnet::gettitle();
my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
- my (undef,undef,$domain,$user)= &Apache::lonxml::whichuser();
+ my (undef,undef,$domain,$user)= &Apache::lonnet::whichuser();
my $files = '
';
my $msg;
foreach my $file (@files) {
@@ -530,8 +568,8 @@ sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my ($status,$accessmsg,$slot);
+ &Apache::structuretags::init_problem_globals('Task');
if ($target ne 'webgrade') {
- &Apache::structuretags::init_problem_globals('Task');
&Apache::structuretags::initialize_storage();
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
if ($env{'request.state'} eq 'construct') {
@@ -553,7 +591,6 @@ sub start_Task {
&Apache::structuretags::page_start($target,$token,$tagstack,
$parstack,$parser,$safeeval,
$name,&style($target));
- $result .= '
'."\n";
}
if ($target eq 'web' && $env{'request.state'} ne 'construct') {
@@ -562,7 +599,7 @@ sub start_Task {
$result.='";
+ $result.=$uri.'">'.&add_grading_button()."\n";
my $symb=&Apache::lonnet::symbread();
if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
$result.='