version 1.233, 2006/02/10 18:36:37
|
version 1.239, 2006/04/11 21:08:29
|
Line 143 sub setup_vars {
|
Line 143 sub setup_vars {
|
# return ';$external::target='.$target.';'; |
# return ';$external::target='.$target.';'; |
} |
} |
|
|
sub send_header { |
|
my ($request)= @_; |
|
$request->print(&Apache::lontexconvert::header()); |
|
# $request->print('<form name='.$env{'form.request.prefix'}.'lonhomework method="POST" action="'.$request->uri.'">'); |
|
} |
|
|
|
sub createmenu { |
sub createmenu { |
my ($which,$request)=@_; |
my ($which,$request)=@_; |
if ($which eq 'grade') { |
if ($which eq 'grade') { |
Line 159 sub createmenu {
|
Line 153 sub createmenu {
|
} |
} |
} |
} |
|
|
sub send_footer { |
|
my ($request)= @_; |
|
# $request->print('</form>'); |
|
$request->print(&Apache::lontexconvert::footer()); |
|
} |
|
|
|
sub proctor_checked_in { |
sub proctor_checked_in { |
my ($slot_name,$slot,$type)=@_; |
my ($slot_name,$slot,$type)=@_; |
my @possible_proctors=split(",",$slot->{'proctor'}); |
my @possible_proctors=split(",",$slot->{'proctor'}); |
Line 297 sub check_slot_access {
|
Line 285 sub check_slot_access {
|
$slotstatus='CAN_ANSWER'; |
$slotstatus='CAN_ANSWER'; |
} |
} |
|
|
my ($got_grade,$checkedin); |
my ($is_correct,$got_grade,$checkedin); |
if ($type eq 'Task') { |
if ($type eq 'Task') { |
my $version=$Apache::lonhomework::history{'resource.0.version'}; |
my $version=$Apache::lonhomework::history{'resource.0.version'}; |
$got_grade = |
$got_grade = |
($Apache::lonhomework::history{"resource.$version.0.status"} |
($Apache::lonhomework::history{"resource.$version.0.status"} |
=~ /^(?:pass|fail)$/); |
=~ /^(?:pass|fail)$/); |
|
$is_correct = |
|
($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass' |
|
|| $Apache::lonhomework::history{"resource.0.solved"} =~ /^correct_/ ); |
$checkedin = |
$checkedin = |
$Apache::lonhomework::history{"resource.$version.0.checkedin"}; |
$Apache::lonhomework::history{"resource.$version.0.checkedin"}; |
} elsif ($type eq 'problem') { |
} elsif ($type eq 'problem') { |
Line 310 sub check_slot_access {
|
Line 301 sub check_slot_access {
|
$checkedin = $Apache::lonhomework::history{"resource.0.checkedin"}; |
$checkedin = $Apache::lonhomework::history{"resource.0.checkedin"}; |
} |
} |
|
|
|
&Apache::lonxml::debug(" slot is $slotstatus checkedin ($checkedin) got_grade ($got_grade) is_correct ($is_correct)"); |
|
|
|
# has a current checked in recrd, but hasn't got a grade, must be awaiting |
|
# a grade |
|
if ($checkedin |
|
&& !$got_grade) { |
|
return ('WAITING_FOR_GRADE'); |
|
} |
|
|
if ($slotstatus eq 'NOT_IN_A_SLOT' |
if ($slotstatus eq 'NOT_IN_A_SLOT' |
&& $checkedin ) { |
&& $checkedin ) { |
|
|
Line 320 sub check_slot_access {
|
Line 320 sub check_slot_access {
|
} |
} |
|
|
} |
} |
|
if ( $is_correct) { |
|
return ('SHOW_ANSWER'); |
|
} |
if ( $status eq 'CANNOT_ANSWER' && |
if ( $status eq 'CANNOT_ANSWER' && |
($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) { |
($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) { |
return ($status,$datemsg); |
return ($status,$datemsg); |
Line 619 sub handle_save_or_undo {
|
Line 622 sub handle_save_or_undo {
|
|
|
sub analyze_header { |
sub analyze_header { |
my ($request) = @_; |
my ($request) = @_; |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef, |
my $result = |
($env{'environment.remote'} ne 'off')); |
&Apache::loncommon::start_page('Analyzing a problem',undef, |
my $html=&Apache::lonxml::xmlbegin(); |
{'only_body' => ($env{'environment.remote'} ne 'off'),}); |
my $result.=$html.' |
$result .= |
<head><title>'.&mt("Analyzing a problem").'</title></head> |
&Apache::lonxml::message_location().' |
'.$bodytag.&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().' |
&Apache::structuretags::remember_problem_state().' |
Line 641 sub analyze_header {
|
Line 643 sub analyze_header {
|
|
|
sub analyze_footer { |
sub analyze_footer { |
my ($request) = @_; |
my ($request) = @_; |
my $result='</body></html>'; |
$request->print(&Apache::loncommon::end_page()); |
$request->print($result); |
|
$request->rflush(); |
$request->rflush(); |
} |
} |
|
|
Line 753 sub editxmlmode {
|
Line 754 sub editxmlmode {
|
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; } |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef, |
my $start_page = |
($env{'environment.remote'} ne 'off')); |
&Apache::loncommon::start_page("EditXML $file", |
my $html=&Apache::lonxml::xmlbegin(); |
&Apache::edit::js_change_detection(), |
my $head="<head><title>EditXML $file</title>". |
{'only_body' => |
&Apache::edit::js_change_detection()."</head>"; |
($env{'environment.remote'} ne 'off')}); |
|
|
$result.=$html.$head.$bodytag. |
$result.=$start_page. |
&renderpage($request,$file,['no_output_web'],1). |
&renderpage($request,$file,['no_output_web'],1). |
&Apache::lonxml::message_location().' |
&Apache::lonxml::message_location().' |
<form '.&Apache::edit::form_change_detection().' name="lonhomework" method="POST" action="'. |
<form '.&Apache::edit::form_change_detection().' name="lonhomework" method="POST" action="'. |
Line 778 sub editxmlmode {
|
Line 779 sub editxmlmode {
|
&HTML::Entities::encode($problem,'<>&"').'</textarea><br /> |
&HTML::Entities::encode($problem,'<>&"').'</textarea><br /> |
<input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes').'" /> |
<input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes').'" /> |
<input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /> |
<input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /> |
</form></body></html>'; |
</form>'.&Apache::loncommon::end_page(); |
&Apache::lonxml::add_messages(\$result); |
&Apache::lonxml::add_messages(\$result); |
$request->print($result); |
$request->print($result); |
} |
} |
Line 935 ENDNEWPROBLEM
|
Line 936 ENDNEWPROBLEM
|
$request->print("<select name=\"template\">$templatelist</select>"); |
$request->print("<select name=\"template\">$templatelist</select>"); |
} |
} |
$request->print("<br /><input type=\"submit\" name=\"newfile\" value=\"".&mt('Create')." $extension\" />"); |
$request->print("<br /><input type=\"submit\" name=\"newfile\" value=\"".&mt('Create')." $extension\" />"); |
$request->print("</form></p></body>"); |
$request->print("</form></p>".&Apache::loncommon::end_page()); |
} |
} |
return ''; |
return ''; |
} |
} |
|
|
sub view_or_edit_menu { |
|
my ($request) = @_; |
|
my $url=&HTML::Entities::encode($request->uri,'<>&"'); |
|
my %lt=&Apache::lonlocal::texthash( 'would' => 'Would you like to', |
|
'view' => 'View', |
|
'Edit' => 'edit', |
|
'or' => 'or', |
|
'the problem' => 'the problem'); |
|
$request->print(<<EDITMENU); |
|
<body bgcolor="#FFFFFF"> |
|
<form action="$url" method="POST"> |
|
$lt{'would'} <input type="submit" name="problemmode" accesskey="v" value="<{'view'}"> |
|
<{'or'} <input type="submit" name="problemmode" accesskey="e" value="<{'Edit'}"> |
|
<{'the problem'}. |
|
</form> |
|
</body> |
|
EDITMENU |
|
} |
|
|
|
sub handler { |
sub handler { |
#my $t0 = [&gettimeofday()]; |
#my $t0 = [&gettimeofday()]; |
my $request=$_[0]; |
my $request=$_[0]; |
Line 990 sub handler {
|
Line 972 sub handler {
|
&Apache::lonxml::debug("Problem Mode ".$env{'form.problemmode'}); |
&Apache::lonxml::debug("Problem Mode ".$env{'form.problemmode'}); |
my ($symb) = &Apache::lonxml::whichuser(); |
my ($symb) = &Apache::lonxml::whichuser(); |
&Apache::lonxml::debug('symb is '.$symb); |
&Apache::lonxml::debug('symb is '.$symb); |
if ($env{'request.state'} eq "construct" || $symb eq '') { |
|
if ($env{'form.resetdata'} eq &mt('Reset Submissions') || |
|
$env{'form.resetdata'} eq &mt('New Problem Variation') || |
|
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
|
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
|
&Apache::lonnet::tmpreset($symb,'',$domain,$name); |
|
&Apache::lonxml::debug("Attempt reset"); |
|
} |
|
} |
|
if ($env{'request.state'} eq "construct") { |
if ($env{'request.state'} eq "construct") { |
if ( -e $file ) { |
if ( -e $file ) { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['problemmode']); |
['problemmode']); |
if (!(defined $env{'form.problemmode'})) { |
if (!(defined $env{'form.problemmode'})) { |
#first visit to problem in construction space |
#first visit to problem in construction space |
#&view_or_edit_menu($request); |
|
$env{'form.problemmode'}='View'; |
$env{'form.problemmode'}='View'; |
&renderpage($request,$file); |
&renderpage($request,$file); |
} elsif ($env{'form.problemmode'} eq &mt('EditXML') || |
} elsif ($env{'form.problemmode'} eq &mt('EditXML') || |
Line 1027 sub handler {
|
Line 999 sub handler {
|
} |
} |
#my $td=&tv_interval($t0); |
#my $td=&tv_interval($t0); |
#&Apache::lonxml::debug("Spent $td seconds processing"); |
#&Apache::lonxml::debug("Spent $td seconds processing"); |
# &Apache::lonhomework::send_footer($request); |
|
# always turn off debug messages |
# always turn off debug messages |
$Apache::lonxml::debug=0; |
$Apache::lonxml::debug=0; |
return OK; |
return OK; |