version 1.14, 2017/12/30 14:03:53
|
version 1.15, 2017/12/30 19:51:30
|
Line 127 sub handler {
|
Line 127 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
my ($status,$open,$close,$msg,$donebuttonresult,$donemsg); |
my ($symb,$status,$open,$close,$msg,$donebuttonresult,$donemsg); |
|
if (($target eq 'tex') || ($toolhash{'gradable'})) { |
|
($symb) = &Apache::lonnet::whichuser(); |
|
} |
|
if ($target eq 'tex') { |
|
my $title = &Apache::lonnet::gettitle($symb); |
|
$r->print(&mt('External Tool: [_1]','\textit{'.$title.'}').'\\\\'); |
|
} |
if ($toolhash{'gradable'}) { |
if ($toolhash{'gradable'}) { |
$Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$r->uri); |
$Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$r->uri); |
my ($symb) = &Apache::lonnet::whichuser(); |
|
if ($env{'form.markaccess'}) { |
if ($env{'form.markaccess'}) { |
my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb); |
my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb); |
my ($timelimit) = split(/_/,$interval[0]); |
my ($timelimit) = split(/_/,$interval[0]); |
Line 142 sub handler {
|
Line 148 sub handler {
|
undef($env{'form.LC_interval_done'}); |
undef($env{'form.LC_interval_done'}); |
undef($env{'form.LC_interval_done_proctorpass'}); |
undef($env{'form.LC_interval_done_proctorpass'}); |
} |
} |
($status,$msg) = &gradabletool_access_check(); |
($status,$msg) = &gradabletool_access_check($target); |
undef($Apache::lonhomework::browse); |
undef($Apache::lonhomework::browse); |
if ($status eq 'SHOW_ANSWER') { |
if ($status eq 'SHOW_ANSWER') { |
$r->print(&display_score()); |
$r->print(&display_score($target)); |
|
if ($target eq 'tex') { |
|
$r->print('\end{document}'); |
|
} |
return OK; |
return OK; |
} elsif ($status ne 'CAN_ANSWER') { |
} elsif ($status ne 'CAN_ANSWER') { |
$r->print($msg); |
if ($target eq 'tex') { |
|
$r->print('\end{document}'); |
|
} else { |
|
$r->print($msg); |
|
} |
return OK; |
return OK; |
} |
} |
} else { |
} else { |
my ($status,$open,$close,$msg)=&Apache::londatecheck::content_date_check(); |
my ($status,$open,$close,$msg)=&Apache::londatecheck::content_date_check(); |
if ($status ne 'OPEN') { |
if ($status ne 'OPEN') { |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$r->print(&mt('Not open to be viewed')); |
$r->print(&mt('Not open to be viewed').'\end{document}'); |
} else { |
} else { |
$r->print($msg); |
$r->print($msg); |
} |
} |
Line 164 sub handler {
|
Line 177 sub handler {
|
($status,$msg)=&Apache::lonipcheck::ip_access_check(); |
($status,$msg)=&Apache::lonipcheck::ip_access_check(); |
if ($status ne 'OPEN') { |
if ($status ne 'OPEN') { |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$r->print(&mt('Not open to be viewed')); |
$r->print(&mt('Not open to be viewed').'\end{document}'); |
} else { |
} else { |
$r->print($msg); |
$r->print($msg); |
} |
} |
Line 174 sub handler {
|
Line 187 sub handler {
|
} |
} |
my $launchok = 1; |
my $launchok = 1; |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$r->print(&mt('External Tool')); |
$r->print('\end{document}'); |
} else { |
} else { |
my $now = time; |
my $now = time; |
if ($toolhash{'passback'}) { |
if ($toolhash{'passback'}) { |
Line 448 ENDJS
|
Line 461 ENDJS
|
} |
} |
|
|
sub gradabletool_access_check { |
sub gradabletool_access_check { |
|
my ($target) = @_; |
my ($result,$resource_due); |
my ($result,$resource_due); |
my $status; |
my $status; |
my ($symb,$courseid,$udom,$uname) = &Apache::lonnet::whichuser(); |
my ($symb,$courseid,$udom,$uname) = &Apache::lonnet::whichuser(); |
my @targets; |
my @targets; |
if (defined($env{'form.submitted'}) && defined($env{'form.validate'})) { |
if ($target) { |
|
@targets = ($target); |
|
} elsif (defined($env{'form.submitted'}) && defined($env{'form.validate'})) { |
@targets = ('grade','web'); |
@targets = ('grade','web'); |
} else { |
} else { |
@targets = ('web'); |
@targets = ('web'); |
Line 497 sub gradabletool_access_check {
|
Line 513 sub gradabletool_access_check {
|
} |
} |
|
|
sub display_score { |
sub display_score { |
|
my ($target) = @_; |
my $weight = &Apache::lonnet::EXT('resource.0.weight'); |
my $weight = &Apache::lonnet::EXT('resource.0.weight'); |
if ((!defined($weight)) || ($weight eq '')) { $weight=1; } |
if ((!defined($weight)) || ($weight eq '')) { $weight=1; } |
my $awarded = $Apache::lonhomework::history{'resource.0.awarded'}; |
my $awarded = $Apache::lonhomework::history{'resource.0.awarded'}; |
if (!defined($awarded)) { $awarded=0; } |
if (!defined($awarded)) { $awarded=0; } |
my $display=''; |
my $display=''; |
|
if ($target eq 'tex') { |
|
$display = '\\\\'; |
|
} |
if (!defined($awarded)) { |
if (!defined($awarded)) { |
$display = &mt('[_1] possible points.',$weight); |
$display .= &mt('[_1] possible points.',$weight); |
} else { |
} else { |
my $points = $awarded*$weight; |
my $points = $awarded*$weight; |
my $result = sprintf('%.2f',$points); |
my $result = sprintf('%.2f',$points); |
$display = &mt('You have [_1] out of [quant,_2,possible point]', |
$display .= &mt('You have [_1] out of [quant,_2,possible point]', |
$result,$weight); |
$result,$weight); |
} |
} |
my $comment = $Apache::lonhomework::history{'resource.0.comment'}; |
my $comment = $Apache::lonhomework::history{'resource.0.comment'}; |
if (!defined($comment) || $comment!~/\w/) { |
if (!defined($comment) || $comment!~/\w/) { |
$comment=''; |
$comment=''; |
} else { |
} else { |
$comment='<br /><table><tr><td bgcolor="#FFFFDD">'.$comment.'</td></tr></table>'; |
if ($target eq 'tex') { |
|
$comment = '\\\\'.$comment; |
|
} else { |
|
$comment='<br /><table><tr><td bgcolor="#FFFFDD">'.$comment.'</td></tr></table>'; |
|
} |
} |
} |
my $gradeinfo = $Apache::lonhomework::history{'resource.0.gradeinfo'}; |
my $gradeinfo = $Apache::lonhomework::history{'resource.0.gradeinfo'}; |
if (!defined($gradeinfo) || $gradeinfo!~/\w/) { |
if (!defined($gradeinfo) || $gradeinfo!~/\w/) { |
$gradeinfo=''; |
$gradeinfo=''; |
} else { |
} else { |
$gradeinfo='<br /><table><tr><td bgcolor="#DDDDFF"><font size="+2">'.$gradeinfo.'</font></td></tr></table>'; |
if ($target eq 'tex') { |
|
$gradeinfo = '\\\\'.$gradeinfo; |
|
} else { |
|
$gradeinfo='<br /><table><tr><td bgcolor="#DDDDFF"><font size="+2">'.$gradeinfo.'</font></td></tr></table>'; |
|
} |
} |
} |
return $display.$comment.$gradeinfo; |
return $display.$comment.$gradeinfo; |
} |
} |