version 1.176, 2004/05/26 22:45:57
|
version 1.181, 2004/09/29 06:51:25
|
Line 52 use Apache::Constants qw(:common);
|
Line 52 use Apache::Constants qw(:common);
|
use HTML::Entities(); |
use HTML::Entities(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
#use Time::HiRes qw( gettimeofday tv_interval ); |
use Time::HiRes qw( gettimeofday tv_interval ); |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register_insert(); |
&Apache::lonxml::register_insert(); |
Line 292 sub check_access {
|
Line 292 sub check_access {
|
$status = 'CANNOT_ANSWER'; |
$status = 'CANNOT_ANSWER'; |
} |
} |
} |
} |
|
if ($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER') { |
|
my $interval=&Apache::lonnet::EXT("resource.$id.interval"); |
|
&Apache::lonxml::debug("looking for interval $interval"); |
|
if ($interval) { |
|
my $first_access=&Apache::lonnet::get_first_access('map'); |
|
&Apache::lonxml::debug("looking for accesstime $first_access"); |
|
if (!$first_access) { |
|
$status='NOT_YET_VIEWED'; |
|
$datemsg=' '.$interval.' seconds'; |
|
} else { |
|
my $newdate=localtime($first_access+$interval); |
|
if (time > ($first_access+$interval)) { |
|
$status='CLOSED'; |
|
$datemsg = &mt("was due on")." $newdate".&mt(", and answers will be available on")." $date"; |
|
} else { |
|
$datemsg = &mt("is due at")." $newdate"; |
|
} |
|
} |
|
} |
|
} |
#if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && |
#if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && |
# (!$Apache::lonhomework::history{"resource.0.outtoken"})) { |
# (!$Apache::lonhomework::history{"resource.0.outtoken"})) { |
# return ('UNCHECKEDOUT','needs to be checked out'); |
# return ('UNCHECKEDOUT','needs to be checked out'); |
Line 434 sub analyze_header {
|
Line 453 sub analyze_header {
|
<head><title>'.&mt("Analyzing a problem").'</title></head> |
<head><title>'.&mt("Analyzing a problem").'</title></head> |
<body bgcolor="#FFFFFF">'.&Apache::lonxml::message_location().' |
<body bgcolor="#FFFFFF">'.&Apache::lonxml::message_location().' |
<form name="lonhomework" method="POST" action="'. |
<form name="lonhomework" method="POST" action="'. |
&HTML::Entities::encode($ENV{'request.uri'},'<>&"').'"> |
&HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'. |
|
&Apache::structuretags::remember_problem_state().' |
<input type="submit" name="problemmode" value="'.&mt("EditXML").'" /> |
<input type="submit" name="problemmode" value="'.&mt("EditXML").'" /> |
<input type="submit" name="problemmode" value="'.&mt('Edit').'" /> |
<input type="submit" name="problemmode" value="'.&mt('Edit').'" /> |
<hr /> |
<hr /> |
Line 546 sub editxmlmode {
|
Line 566 sub editxmlmode {
|
&Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index", |
&Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index", |
"Problem Editing Help"). |
"Problem Editing Help"). |
'</td><td>'. |
'</td><td>'. |
&Apache::loncommon::help_open_faq(5). |
&Apache::loncommon::help_open_menu('',undef,undef,undef,5,'Authoring'). |
&Apache::loncommon::help_open_bug('Authoring').'</td></tr></table>'; |
'</td></tr></table>'; |
if ($cols > 80) { $cols = 80; } |
if ($cols > 80) { $cols = 80; } |
if ($cols < 70) { $cols = 70; } |
if ($cols < 70) { $cols = 70; } |
if ($rows < 20) { $rows = 20; } |
if ($rows < 20) { $rows = 20; } |
$result.='<html><body bgcolor="#FFFFFF">'. |
$result.='<html><body bgcolor="#FFFFFF">'. |
&Apache::lonxml::message_location().' |
&Apache::lonxml::message_location().' |
<form name="lonhomework" method="POST" action="'. |
<form name="lonhomework" method="POST" action="'. |
&HTML::Entities::encode($ENV{'request.uri'},'<>&"').'"> |
&HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'. |
|
&Apache::structuretags::remember_problem_state().' |
<input type="hidden" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="hidden" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" /> |
<input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" /> |
<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" /> |
<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" /> |
Line 734 sub handler {
|
Line 755 sub handler {
|
if (&setupheader($request)) { return OK; } |
if (&setupheader($request)) { return OK; } |
$ENV{'request.uri'}=$request->uri; |
$ENV{'request.uri'}=$request->uri; |
|
|
#setup permissions |
&setuppermissions(); |
$Apache::lonhomework::browse= &Apache::lonnet::allowed('bre',$ENV{'request.filename'}); |
|
$Apache::lonhomework::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); |
|
&Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:"); |
&Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:"); |
# some times multiple problemmodes are submitted, need to select |
# some times multiple problemmodes are submitted, need to select |
# the last one |
# the last one |