version 1.297, 2005/07/05 18:59:03
|
version 1.332, 2006/01/27 23:36:48
|
Line 42 BEGIN {
|
Line 42 BEGIN {
|
} |
} |
|
|
sub start_web { |
sub start_web { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $bodytext=&Apache::lonxml::get_all_text("/web",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/web",$parser,$style); |
if ($target eq 'web') { |
if ($target eq 'web') { |
return $bodytext; |
return $bodytext; |
} |
} |
Line 55 sub end_web {
|
Line 55 sub end_web {
|
} |
} |
|
|
sub start_tex { |
sub start_tex { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result=''; |
my $result=''; |
my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style); |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
return $bodytext.' '; |
return $bodytext.' '; |
} |
} |
Line 74 sub body_tag_start {
|
Line 74 sub body_tag_start {
|
'onunload="'.&Apache::lonmenu::unloadevents().'" '; |
'onunload="'.&Apache::lonmenu::unloadevents().'" '; |
if ($env{'browser.imagesuppress'} eq 'on') { $background=''; } |
if ($env{'browser.imagesuppress'} eq 'on') { $background=''; } |
if ($background) { |
if ($background) { |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
&Apache::lonxml::extlink($background); |
$background; |
|
$body_tag_start.='background="'.$background.'" '; |
$body_tag_start.='background="'.$background.'" '; |
} else { |
} else { |
if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) { |
if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) { |
Line 114 sub page_start {
|
Line 113 sub page_start {
|
&Apache::lonhtmlcommon::htmlareaheaders(). |
&Apache::lonhtmlcommon::htmlareaheaders(). |
&Apache::lonhtmlcommon::spellheader(). |
&Apache::lonhtmlcommon::spellheader(). |
&Apache::lonxml::fontsettings(); |
&Apache::lonxml::fontsettings(); |
|
if ($target eq 'edit') { |
|
$head_tag_start.=&Apache::edit::js_change_detection(); |
|
} |
} |
} |
my $body_tag_start; |
my $body_tag_start; |
if (!defined($found{'body'}) && $env{'request.state'} eq 'construct' |
if (!defined($found{'body'}) && $env{'request.state'} eq 'construct') { |
&& $env{'environment.remote'} eq 'off') { |
if ($env{'environment.remote'} eq 'off') { |
if ($target eq 'web') { |
if ($target eq 'web' || $target eq 'edit') { |
$body_tag_start=&Apache::loncommon::bodytag(); |
$body_tag_start=&Apache::loncommon::bodytag(); |
$body_tag_start.=&Apache::lonxml::message_location(); |
$body_tag_start.=&Apache::lonxml::message_location(); |
|
} |
|
} else { |
|
if ($target eq 'web' || $target eq 'edit') { |
|
$body_tag_start=&Apache::loncommon::bodytag(undef,undef,undef,1); |
|
$body_tag_start.=&Apache::lonxml::message_location(); |
|
} |
} |
} |
} elsif (!defined($found{'body'})) { |
} elsif (!defined($found{'body'})) { |
my $background=&Apache::lonxml::get_param('background',$parstack, |
my $background=&Apache::lonxml::get_param('background',$parstack, |
$safeeval); |
$safeeval); |
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, |
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, |
$safeeval); |
$safeeval); |
$body_tag_start=&body_tag_start($background,$bgcolor); |
$body_tag_start=&body_tag_start($target,$background,$bgcolor); |
if ( ($target eq 'web' || $target eq 'webgrade') |
if ( ($target eq 'web' || $target eq 'webgrade') |
&& $env{'request.state'} ne 'construct') { |
&& $env{'request.state'} ne 'construct') { |
my ($symb,undef,undef,undef,$publicuser)= |
my ($symb,undef,undef,undef,$publicuser)= |
Line 145 sub page_start {
|
Line 153 sub page_start {
|
$form_tag_start='<form name="lonhomework" enctype="multipart/form-data" method="POST" action="'; |
$form_tag_start='<form name="lonhomework" enctype="multipart/form-data" method="POST" action="'; |
my $uri=$env{'request.uri'}; |
my $uri=$env{'request.uri'}; |
if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); } |
if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); } |
$form_tag_start.=$uri.'">'; |
$form_tag_start.=$uri.'" '; |
|
if ($target eq 'edit') { |
|
$form_tag_start.=&Apache::edit::form_change_detection(); |
|
} |
|
$form_tag_start.='>'; |
} |
} |
return ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
return ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
} |
} |
Line 176 sub setup_rndseed {
|
Line 188 sub setup_rndseed {
|
my ($symb)=&Apache::lonxml::whichuser(); |
my ($symb)=&Apache::lonxml::whichuser(); |
if ($env{'request.state'} eq "construct" || $symb eq '' || |
if ($env{'request.state'} eq "construct" || $symb eq '' || |
$Apache::lonhomework::history{'resource.CODE'}) { |
$Apache::lonhomework::history{'resource.CODE'}) { |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['rndseed']); |
$rndseed=$env{'form.rndseed'}; |
$rndseed=$env{'form.rndseed'}; |
if (!$rndseed) { |
if (!$rndseed) { |
$rndseed=$Apache::lonhomework::history{'rndseed'}; |
$rndseed=$Apache::lonhomework::history{'rndseed'}; |
Line 193 sub setup_rndseed {
|
Line 207 sub setup_rndseed {
|
delete($env{'form.newrandomization'}); |
delete($env{'form.newrandomization'}); |
} |
} |
if (defined($rndseed) && $rndseed ne int($rndseed)) { |
if (defined($rndseed) && $rndseed ne int($rndseed)) { |
$rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed)); |
$rndseed=join(':',&Apache::lonnet::digest($rndseed)); |
} |
} |
if ($Apache::lonhomework::history{'resource.CODE'}) { |
if ($Apache::lonhomework::history{'resource.CODE'}) { |
$rndseed=&Apache::lonnet::rndseed(); |
$rndseed=&Apache::lonnet::rndseed(); |
Line 218 sub problem_edit_header {
|
Line 232 sub problem_edit_header {
|
&Apache::structuretags::remember_problem_state().' |
&Apache::structuretags::remember_problem_state().' |
<input type="hidden" name="problemmode" value="'.&mt('Edit').'" /> |
<input type="hidden" name="problemmode" value="'.&mt('Edit').'" /> |
<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="x" value="'.&mt('EditXML').'" /> |
<input '.&Apache::edit::submit_ask_anyway().' type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
<input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" /> <hr /> |
<input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" /> <hr /> |
<input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'. |
<input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'. |
Line 246 sub option {
|
Line 260 sub option {
|
|
|
sub problem_web_to_edit_header { |
sub problem_web_to_edit_header { |
my ($rndseed)=@_; |
my ($rndseed)=@_; |
my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" /> |
my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />'; |
<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" /> |
if (!$Apache::lonhomework::parsing_a_task) { |
<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
$result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />'; |
|
} |
|
$result .= '<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
Line 256 sub problem_web_to_edit_header {
|
Line 272 sub problem_web_to_edit_header {
|
$rndseed.'" |
$rndseed.'" |
onchange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
onchange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
<label><input type="checkbox" name="showallfoils" '; |
<label><input type="checkbox" name="showallfoils" '; |
|
my $show_all_foils_text = |
|
($Apache::lonhomework::parsing_a_task) ? |
|
&mt(' Show All Instances') |
|
: &mt(' Show All Foils'); |
|
|
if (defined($env{'form.showallfoils'})) { $result.='checked="on"'; } |
if (defined($env{'form.showallfoils'})) { $result.='checked="on"'; } |
$result.= ' />'.&mt(' Show All Foils'). |
$result.= ' />'.$show_all_foils_text. |
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems'). |
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems'). |
'</label><hr />'; |
'</label><hr />'; |
$result.=" |
if (!$Apache::lonhomework::parsing_a_task) { |
|
$result.=" |
<nobr> |
<nobr> |
Problem Status: |
Problem Status: |
<select name='problemstate'> |
<select name='problemstate'> |
Line 291 Feedback Mode:
|
Line 313 Feedback Mode:
|
</nobr> |
</nobr> |
<input type='submit' name='changeproblemmode' value='".&mt("Change")."' /> |
<input type='submit' name='changeproblemmode' value='".&mt("Change")."' /> |
<hr />"; |
<hr />"; |
my $numtoanalyze=$env{'form.numtoanalyze'}; |
my $numtoanalyze=$env{'form.numtoanalyze'}; |
if (!$numtoanalyze) { $numtoanalyze=20; } |
if (!$numtoanalyze) { $numtoanalyze=20; } |
$result.= '<input type="submit" name="problemmode" value='. |
$result.= '<input type="submit" name="problemmode" value='. |
&mt('"Calculate answers').'" /> for |
&mt('"Calculate answers').'" /> for |
<input type="text" name="numtoanalyze" value="'. |
<input type="text" name="numtoanalyze" value="'. |
$numtoanalyze.'" size="5" /> '.&mt('versions of this problem'). |
$numtoanalyze.'" size="5" /> '.&mt('versions of this problem'). |
'.'.&Apache::loncommon::help_open_topic("Analyze_Problem", |
'.'.&Apache::loncommon::help_open_topic("Analyze_Problem", |
'',undef,undef,300). |
'',undef,undef,300). |
'<hr />'; |
'<hr />'; |
|
} |
return $result; |
return $result; |
} |
} |
|
|
Line 330 sub initialize_storage {
|
Line 353 sub initialize_storage {
|
sub finalize_storage { |
sub finalize_storage { |
my $result; |
my $result; |
if (%Apache::lonhomework::results) { |
if (%Apache::lonhomework::results) { |
|
my @remove = grep(/^INTERNAL_/,keys(%Apache::lonhomework::results)); |
|
delete(@Apache::lonhomework::results{@remove}); |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
if ($env{'request.state'} eq 'construct' || $symb eq '') { |
if ($env{'request.state'} eq 'construct' || $symb eq '') { |
$Apache::lonhomework::results{'rndseed'}=$env{'form.rndseed'}; |
$Apache::lonhomework::results{'rndseed'}=$env{'form.rndseed'}; |
Line 344 sub finalize_storage {
|
Line 369 sub finalize_storage {
|
&store_aggregates($symb,$courseid); |
&store_aggregates($symb,$courseid); |
} |
} |
} |
} |
|
} else { |
|
&Apache::lonxml::debug('Nothing to store'); |
} |
} |
return $result; |
return $result; |
} |
} |
Line 426 ENDCHECKOUT
|
Line 453 ENDCHECKOUT
|
sub init_problem_globals { |
sub init_problem_globals { |
my ($type)=@_; |
my ($type)=@_; |
#initialize globals |
#initialize globals |
|
# For problems, we start out in part 0 (outside a <part> tag). |
|
# and part 0 is used to describe the main body of the <problem> |
|
# |
if ($type eq 'problem') { |
if ($type eq 'problem') { |
$Apache::inputtags::part='0'; |
$Apache::inputtags::part='0'; |
@Apache::inputtags::partlist=('0'); |
@Apache::inputtags::partlist=('0'); |
$Apache::lonhomework::problemstatus=&get_problem_status('0'); |
$Apache::lonhomework::problemstatus=&get_problem_status('0'); |
$Apache::lonhomework::ignore_response_errors=0; |
$Apache::lonhomework::ignore_response_errors=0; |
|
|
} elsif ($type eq 'library') { |
} elsif ($type eq 'library') { |
$Apache::inputtags::part=''; |
$Apache::inputtags::part=''; |
@Apache::inputtags::partlist=(); |
@Apache::inputtags::partlist=(); |
$Apache::lonhomework::problemstatus=''; |
$Apache::lonhomework::problemstatus=''; |
$Apache::lonhomework::ignore_response_errors=1; |
$Apache::lonhomework::ignore_response_errors=1; |
|
|
|
} elsif ($type eq 'Task') { |
|
$Apache::inputtags::part='0'; |
|
@Apache::inputtags::partlist=('0'); |
|
$Apache::lonhomework::problemstatus=''; |
|
$Apache::lonhomework::ignore_response_errors=1; |
} |
} |
@Apache::inputtags::responselist = (); |
@Apache::inputtags::responselist = (); |
@Apache::inputtags::importlist = (); |
@Apache::inputtags::importlist = (); |
Line 484 sub get_problem_status {
|
Line 521 sub get_problem_status {
|
} |
} |
|
|
sub start_problem { |
sub start_problem { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
|
# We'll use the redirection to fix up printing of duedates. |
|
if (!$Apache::lonxml::metamode) { |
|
&Apache::lonxml::startredirection(); |
|
} |
|
|
|
# Problems don't nest and we don't allow more than one <problem> in |
|
# a .problem file. |
|
# |
if ( $Apache::inputtags::part ne '' || |
if ( $Apache::inputtags::part ne '' || |
$Apache::lonhomework::parsing_a_problem) { |
$Apache::lonhomework::parsing_a_problem) { |
&Apache::lonxml::error('Only one <problem> allowed in a .problem file'); |
&Apache::lonxml::error('Only one <problem> allowed in a .problem file'); |
#my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser); |
#my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,$style); |
return ''; |
return ''; |
} |
} |
|
|
Line 511 sub start_problem {
|
Line 556 sub start_problem {
|
defined($env{'form.problemtype'})) { |
defined($env{'form.problemtype'})) { |
$Apache::lonhomework::type=$env{'form.problemtype'}; |
$Apache::lonhomework::type=$env{'form.problemtype'}; |
} |
} |
$Apache::lonhomework::default_type = $Apache::lonhomework::type; |
&Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:"); |
&Apache::lonxml::debug("Found this to be of type :$Apache::ltonhomework::type:"); |
|
} |
} |
if ($Apache::lonhomework::type eq '' ) { |
if ($Apache::lonhomework::type eq '' ) { |
my $uri=$env{'request.uri'}; |
my $uri=$env{'request.uri'}; |
Line 524 sub start_problem {
|
Line 568 sub start_problem {
|
&Apache::lonxml::debug("Using default type, problem, :$uri:"); |
&Apache::lonxml::debug("Using default type, problem, :$uri:"); |
} |
} |
} |
} |
|
$Apache::lonhomework::default_type = $Apache::lonhomework::type; |
|
|
#added vars to the scripting enviroment |
#added vars to the scripting enviroment |
my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; |
my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; |
Line 566 sub start_problem {
|
Line 611 sub start_problem {
|
value="'.$env{'form.username'}.'" />'; |
value="'.$env{'form.username'}.'" />'; |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
$form_tag_start.= |
$form_tag_start.= |
' <input type="checkbox" name="showallfoils" '; |
' <label><input type="checkbox" name="showallfoils" '; |
if (defined($env{'form.showallfoils'})) { |
if (defined($env{'form.showallfoils'})) { |
$form_tag_start.='checked="on"'; |
$form_tag_start.='checked="on"'; |
} |
} |
$form_tag_start.= ' />'.&mt(' Show All Foils'); |
$form_tag_start.= ' />'.&mt(' Show All Foils'). |
|
'</label>'; |
} |
} |
$form_tag_start.='<hr />'; |
$form_tag_start.='<hr />'; |
} |
} |
($status,$accessmsg) = &Apache::lonhomework::check_access('0'); |
|
|
($status,$accessmsg,my $slot_name,my $slot) = |
|
&Apache::lonhomework::check_slot_access('0','problem'); |
push (@Apache::inputtags::status,$status); |
push (@Apache::inputtags::status,$status); |
|
|
my $expression='$external::datestatus="'.$status.'";'; |
my $expression='$external::datestatus="'.$status.'";'; |
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";'; |
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";'; |
&Apache::run::run($expression,$safeeval); |
&Apache::run::run($expression,$safeeval); |
&Apache::lonxml::debug("Got $status"); |
&Apache::lonxml::debug("Got $status"); |
|
|
if (( $status eq 'CLOSED' ) || |
if (( $status eq 'CLOSED' ) || |
( $status eq 'UNCHECKEDOUT') || |
( $status eq 'UNCHECKEDOUT') || |
( $status eq 'NOT_YET_VIEWED') || |
( $status eq 'NOT_YET_VIEWED') || |
( $status eq 'BANNED') || |
( $status eq 'BANNED') || |
( $status eq 'UNAVAILABLE') || |
( $status eq 'UNAVAILABLE') || |
|
( $status eq 'NOT_IN_A_SLOT') || |
( $status eq 'INVALID_ACCESS')) { |
( $status eq 'INVALID_ACCESS')) { |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
|
$style); |
if ( $target eq "web" ) { |
if ( $target eq "web" ) { |
$result.= $head_tag_start.'</head>'; |
$result.= $head_tag_start.'</head>'; |
my $msg=$body_tag_start; |
my $msg=$body_tag_start; |
Line 601 sub start_problem {
|
Line 653 sub start_problem {
|
$msg.=&checkout_msg; |
$msg.=&checkout_msg; |
} elsif ($status eq 'NOT_YET_VIEWED') { |
} elsif ($status eq 'NOT_YET_VIEWED') { |
$msg.=&firstaccess_msg($accessmsg,$symb); |
$msg.=&firstaccess_msg($accessmsg,$symb); |
|
} elsif ($status eq 'NOT_IN_A_SLOT') { |
|
$msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work."); |
} |
} |
$result.=$msg.'<br />'; |
$result.=$msg.'<br />'; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$result.='\begin{document}\noindent \vskip 1 mm \begin{minipage}{\textwidth}\vskip 0 mm'; |
my $startminipage = ($env{'form.problem_split'}=~/yes/i)? '' |
|
: '\begin{minipage}{\textwidth}'; |
|
$result.='\begin{document}\noindent \vskip 1 mm '. |
|
$startminipage.'\vskip 0 mm'; |
if ($status eq 'UNAVAILABLE') { |
if ($status eq 'UNAVAILABLE') { |
$result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm '; |
$result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm '; |
} else { |
} else { |
$result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm "; |
$result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm "; |
} |
} |
} |
} |
|
} elsif ($status eq 'NEEDS_CHECKIN') { |
|
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
|
$style); |
|
if ($target eq 'web') { |
|
$result .= $head_tag_start.'</head>'; |
|
$result .= $body_tag_start; |
|
$result .= &Apache::bridgetask::proctor_validation_screen(); |
|
} elsif ($target eq 'grade') { |
|
&Apache::bridgetask::proctor_check_auth($slot_name,$slot, |
|
'problem'); |
|
} |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
my $name= &get_resource_name($parstack,$safeeval); |
my $name= &get_resource_name($parstack,$safeeval); |
$result.="$head_tag_start<title>$name</title></head> |
$result.="$head_tag_start<title>$name</title></head> |
Line 628 sub start_problem {
|
Line 696 sub start_problem {
|
} |
} |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $startminipage = ''; |
$result .= 'INSERTTEXFRONTMATTERHERE'; |
if (not $env{'form.problem_split'}=~/yes/) { |
|
$startminipage = '\begin{minipage}{\textwidth}'; |
|
} |
|
my $id = $Apache::inputtags::part; |
|
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
|
my $packages=&Apache::lonnet::metadata($env{'request.uri'},'packages'); |
|
my @packages = split /,/,$packages; |
|
my $allow_print_points = 0; |
|
foreach my $partial_key (@packages) { |
|
if ($partial_key=~m/^part_0$/) { |
|
$allow_print_points=1; |
|
} |
|
} |
|
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
|
if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; } |
|
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); |
|
$duedate = POSIX::strftime("%c",localtime($duedate)); |
|
my $temp_file; |
|
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; |
|
if (-e $filename) { |
|
$temp_file = Apache::File->new($filename); |
|
} else { |
|
$temp_file = Apache::File->new('>>'.$filename); |
|
} |
|
my @due_file_content = <$temp_file>; |
|
my $due_file_content = $due_file_content[$#due_file_content]; |
|
chomp $due_file_content; |
|
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header'); |
|
if ($due_file_content ne $duedate) { |
|
$temp_file = Apache::File->new('>'.$filename); |
|
print $temp_file "$duedate\n"; |
|
if (not $env{'request.symb'} =~ m/\.page_/) { |
|
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') { |
|
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent '.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}'; |
|
} else { |
|
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}'; |
|
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
|
} |
|
} else { |
|
$result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'; |
|
} |
|
} else { |
|
if (not $env{'request.symb'} =~ m/\.page_/) { |
|
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}'; |
|
if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
|
} else { |
|
$result .= '\vskip 1mm \\\\\\\\'; |
|
} |
|
} |
|
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start. |
$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start. |
Line 698 sub start_problem {
|
Line 718 sub start_problem {
|
|
|
sub end_problem { |
sub end_problem { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result=''; |
my $result; |
|
|
|
if (!$Apache::lonxml::metamode) { |
|
$result = &Apache::lonxml::endredirection(); #started in &start_problem |
|
$Apache::lonxml::post_evaluate=0; |
|
} |
|
|
|
if ($target eq 'tex') { |
|
|
|
# Figure out the front matter and replace the |
|
# INSERTTEXFRONTMATTERHERE in result with it. note that we do |
|
# this in end_problem because whether or not we display due |
|
# dates depends on whether due dates have already been |
|
# displayed in the problem parts. |
|
|
|
my $frontmatter = ''; |
|
my $startminipage = ''; |
|
if (not $env{'form.problem_split'}=~/yes/) { |
|
$startminipage = '\begin{minipage}{\textwidth}'; |
|
} |
|
my $id = $Apache::inputtags::part; |
|
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
|
my $packages=&Apache::lonnet::metadata($env{'request.uri'},'packages'); |
|
my @packages = split /,/,$packages; |
|
my $allow_print_points = 0; |
|
foreach my $partial_key (@packages) { |
|
if ($partial_key=~m/^part_0$/) { |
|
$allow_print_points=1; |
|
} |
|
} |
|
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
|
if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; } |
|
if (lc($env{'course.'.$env{'request.course.id'}. |
|
'.disableexampointprint'}) eq 'yes') { |
|
$allow_print_points=0; |
|
} |
|
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header'); |
|
my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent '; |
|
my $toc_line='\vskip 1 mm\noindent '.$startminipage. |
|
'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}'; |
|
|
|
# Figure out what the due date is and if we need to print |
|
# it in the problem header. We have been logging the |
|
# last due date written to file. |
|
|
|
my $duetime = &Apache::lonnet::EXT("resource.$id.duedate"); |
|
my $duedate = POSIX::strftime("%c",localtime($duetime)); |
|
my $temp_file; |
|
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; |
|
|
|
# Figure out what the last printed due date is or set it |
|
# to the epoch if no duedates have been printed. |
|
|
|
my $due_file_content = 0; # If the file does not yet exist, time is the epoch. |
|
if (-e $filename) { |
|
$temp_file = Apache::File->new($filename); |
|
my @due_file = <$temp_file>; |
|
$due_file_content = $due_file[$#due_file]; |
|
chomp $due_file_content; |
|
} |
|
|
|
# We display the due date iff it is not the same as the last |
|
# duedate in problem header ($due_file_content), and |
|
# none of our parts displayed a duedate. |
|
# |
|
my $parts_with_displayduedate; |
|
if (defined $Apache::outputtags::showonce{'displayduedate'}) { |
|
$parts_with_displayduedate = |
|
scalar(@{$Apache::outputtags::showonce{'displayduedate'}}); |
|
} else { |
|
$parts_with_displayduedate = 0; |
|
} |
|
if (($due_file_content != $duetime) && ($parts_with_displayduedate == 0) ) { |
|
$temp_file = Apache::File->new('>'.$filename); |
|
print $temp_file "$duetime\n"; |
|
if (not $env{'request.symb'} =~ m/\.page_/) { |
|
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') { |
|
$frontmatter .= $begin_doc. |
|
'\textit{Due date: '.$duedate.'} '.$toc_line; |
|
} else { |
|
$frontmatter.= $begin_doc.$toc_line; |
|
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';} |
|
} |
|
} else { |
|
$frontmatter .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'; |
|
} |
|
} else { |
|
if (not $env{'request.symb'} =~ m/\.page_/) { |
|
$frontmatter .= $begin_doc.$toc_line; |
|
if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';} |
|
} else { |
|
$frontmatter .= '\vskip 1mm \\\\\\\\'; |
|
} |
|
} |
|
$result =~ s/INSERTTEXFRONTMATTERHERE/$frontmatter/; |
|
} |
|
|
my $status=$Apache::inputtags::status['-1']; |
my $status=$Apache::inputtags::status['-1']; |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
Line 706 sub end_problem {
|
Line 822 sub end_problem {
|
# if part is zero, no <part>s existed, so we need to the grading |
# if part is zero, no <part>s existed, so we need to the grading |
if ($status eq 'CAN_ANSWER' ||$Apache::lonhomework::scantronmode) { |
if ($status eq 'CAN_ANSWER' ||$Apache::lonhomework::scantronmode) { |
&Apache::inputtags::grade; |
&Apache::inputtags::grade; |
|
} elsif ($status eq 'NEEDS_CHECKIN') { |
|
# no need to grade, and don't want to hide data |
} else { |
} else { |
# move any submission data to .hidden |
# move any submission data to .hidden |
&Apache::inputtags::hidealldata($Apache::inputtags::part); |
&Apache::inputtags::hidealldata($Apache::inputtags::part); |
Line 766 sub end_problem {
|
Line 884 sub end_problem {
|
$result.=&Apache::response::meta_response_order(); |
$result.=&Apache::response::meta_response_order(); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
&Apache::lonxml::debug("in end_problem with $target, edit"); |
&Apache::lonxml::debug("in end_problem with $target, edit"); |
$result = &problem_edit_footer(); |
$result .= &problem_edit_footer(); |
|
} elsif ($target eq 'modified') { |
|
$result .= $token->[2]; |
|
$result.=&Apache::edit::handle_insertafter($token->[1]); |
} |
} |
|
|
if ($env{'request.state'} eq 'construct' && $target eq 'web') { |
if ($env{'request.state'} eq 'construct' && $target eq 'web') { |
Line 825 sub end_library {
|
Line 946 sub end_library {
|
} |
} |
|
|
sub start_definetag { |
sub start_definetag { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
my $result; |
my $result; |
|
|
my $name = $token->[2]->{'name'}; |
my $name = $token->[2]->{'name'}; |
my $skip=&Apache::lonxml::get_all_text("/definetag",$parser); |
my $skip=&Apache::lonxml::get_all_text("/definetag",$parser,$style); |
if ($name=~/^\//) { |
if ($name=~/^\//) { |
$result= |
$result= |
'<br /><table bgcolor="#FFBBBB"><tr><th>END <tt>'.$name.'</tt></th></tr>'; |
'<br /><table bgcolor="#FFBBBB"><tr><th>END <tt>'.$name.'</tt></th></tr>'; |
Line 976 sub end_instructorcomment {
|
Line 1097 sub end_instructorcomment {
|
} |
} |
|
|
sub start_while { |
sub start_while { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
my $result; |
my $result; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
Line 988 sub start_while {
|
Line 1109 sub start_while {
|
&Apache::lonxml::default_homework_load($safeeval); |
&Apache::lonxml::default_homework_load($safeeval); |
} |
} |
my $result = &Apache::run::run($code,$safeeval); |
my $result = &Apache::run::run($code,$safeeval); |
my $bodytext=&Apache::lonxml::get_all_text("/while",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/while",$parser,$style); |
push( @Apache::structuretags::whilebody, $bodytext); |
push( @Apache::structuretags::whilebody, $bodytext); |
push( @Apache::structuretags::whileline, $token->[5]); |
push( @Apache::structuretags::whileline, $token->[5]); |
&Apache::lonxml::debug("s code $code got -$result-"); |
&Apache::lonxml::debug("s code $code got -$result-"); |
Line 1044 sub end_while {
|
Line 1165 sub end_while {
|
# ... |
# ... |
# </randomlist> |
# </randomlist> |
sub start_randomlist { |
sub start_randomlist { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result; |
my $result; |
if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' || |
if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' || |
$target eq 'tex' || $target eq 'analyze') { |
$target eq 'tex' || $target eq 'analyze') { |
my $body= &Apache::lonxml::get_all_text("/randomlist",$parser); |
my $body= &Apache::lonxml::get_all_text("/randomlist",$parser); |
my $b_parser= HTML::TokeParser->new(\$body); |
my $b_parser= HTML::LCParser->new(\$body); |
|
$b_parser->xml_mode(1); |
|
$b_parser->marked_sections(1); |
my $b_tok; |
my $b_tok; |
my @randomlist; |
my @randomlist; |
my $list_item; |
my $list_item; |
Line 1073 sub start_randomlist {
|
Line 1196 sub start_randomlist {
|
# print "<b>END-TAG $b_tok->[1]</b><br />"; |
# print "<b>END-TAG $b_tok->[1]</b><br />"; |
# } |
# } |
} |
} |
my @idx_arr = (0 .. $#randomlist); |
if (@randomlist) { |
&Apache::structuretags::shuffle(\@idx_arr); |
my @idx_arr = (0 .. $#randomlist); |
my $bodytext = ''; |
&Apache::structuretags::shuffle(\@idx_arr); |
my $show=$#randomlist; |
my $bodytext = ''; |
my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval); |
my $show=$#randomlist; |
$showarg--; |
my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval); |
if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; } |
$showarg--; |
for(0 .. $show) { |
if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; } |
$bodytext .= "$randomlist[ $idx_arr[$_] ]"; |
for(0 .. $show) { |
|
$bodytext .= "$randomlist[ $idx_arr[$_] ]"; |
|
} |
|
&Apache::lonxml::newparser($parser,\$bodytext); |
} |
} |
&Apache::lonxml::newparser($parser,\$bodytext); |
|
} elsif ($target eq 'edit' ) { |
} elsif ($target eq 'edit' ) { |
$result .=&Apache::edit::tag_start($target,$token); |
$result .=&Apache::edit::tag_start($target,$token); |
$result .=&Apache::edit::text_arg('Maximum Tags to Show:','show', |
$result .=&Apache::edit::text_arg('Maximum Tags to Show:','show', |
Line 1100 sub start_randomlist {
|
Line 1225 sub start_randomlist {
|
sub shuffle { |
sub shuffle { |
my $a=shift; |
my $a=shift; |
my $i; |
my $i; |
if (defined(@$a)) { |
if (ref($a) eq 'ARRAY' && @$a) { |
&Apache::response::pushrandomnumber(); |
&Apache::response::pushrandomnumber(); |
for($i=@$a;--$i;) { |
for($i=@$a;--$i;) { |
my $j=int(&Math::Random::random_uniform() * ($i+1)); |
my $j=int(&Math::Random::random_uniform() * ($i+1)); |
Line 1133 sub ordered_show_check {
|
Line 1258 sub ordered_show_check {
|
} |
} |
|
|
sub start_part { |
sub start_part { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
if (!$Apache::lonxml::metamode) { |
|
&Apache::lonxml::startredirection(); # we'll use redirection to fix up |
|
# duedates. |
|
} |
my $result=''; |
my $result=''; |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; } |
if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; } |
Line 1158 sub start_part {
|
Line 1287 sub start_part {
|
} elsif ($target eq 'web' || $target eq 'grade' || |
} elsif ($target eq 'web' || $target eq 'grade' || |
$target eq 'answer' || $target eq 'tex') { |
$target eq 'answer' || $target eq 'tex') { |
if ($hidden || !$in_order_show) { |
if ($hidden || !$in_order_show) { |
my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/part",$parser,$style); |
} else { |
} else { |
my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); |
my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); |
push (@Apache::inputtags::status,$status); |
push (@Apache::inputtags::status,$status); |
Line 1174 sub start_part {
|
Line 1303 sub start_part {
|
( $status eq 'BANNED') || |
( $status eq 'BANNED') || |
( $status eq 'UNAVAILABLE') || |
( $status eq 'UNAVAILABLE') || |
( $status eq 'INVALID_ACCESS')) { |
( $status eq 'INVALID_ACCESS')) { |
my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/part",$parser, |
|
$style); |
if ( $target eq "web" ) { |
if ( $target eq "web" ) { |
$result="<br />".&mt('Part is not open to be viewed. It')." $accessmsg<br />"; |
$result="<br />".&mt('Part is not open to be viewed. It')." $accessmsg<br />"; |
} elsif ( $target eq 'tex' ) { |
} elsif ( $target eq 'tex' ) { |
Line 1206 sub start_part {
|
Line 1336 sub start_part {
|
if (defined($maxtries) && $maxtries < 0) { |
if (defined($maxtries) && $maxtries < 0) { |
$allow_print_points=0; |
$allow_print_points=0; |
} |
} |
|
if (lc($env{'course.'.$env{'request.course.id'}. |
|
'.disableexampointprint'}) eq 'yes') { |
|
$allow_print_points=0; |
|
} |
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
$result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />'; |
$result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />'; |
Line 1238 sub end_part {
|
Line 1372 sub end_part {
|
my $status=$Apache::inputtags::status['-1']; |
my $status=$Apache::inputtags::status['-1']; |
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); |
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); |
my $in_order_show=&ordered_show_check(); |
my $in_order_show=&ordered_show_check(); |
my $result=''; |
my $result; |
if ( $target eq 'meta' ) { |
if (!$Apache::lonxml::metamode) { |
$result=''; |
$result = &Apache::lonxml::endredirection(); # started in &start_part |
} elsif ($target eq 'grade') { |
$Apache::lonxml::post_evaluate=0; |
|
} |
|
if ($target eq 'grade') { |
if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) && |
if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) && |
!$hidden && $in_order_show) { |
!$hidden && $in_order_show) { |
$result=&Apache::inputtags::grade; |
$result.=&Apache::inputtags::grade; |
} else { |
} else { |
# move any submission data to .hidden |
# move any submission data to .hidden |
&Apache::inputtags::hidealldata($Apache::inputtags::part); |
&Apache::inputtags::hidealldata($Apache::inputtags::part); |
Line 1256 sub end_part {
|
Line 1392 sub end_part {
|
if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') { |
if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') { |
$gradestatus=''; |
$gradestatus=''; |
} |
} |
$result=$gradestatus; |
$result.=$gradestatus; |
if ($$tagstack[-2] eq 'td' and $target eq 'tex') {$result.='\end{minipage}';} |
if ($$tagstack[-2] eq 'td' and $target eq 'tex') {$result.='\end{minipage}';} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result=&Apache::edit::end_table(); |
$result.=&Apache::edit::end_table(); |
|
} elsif ($target eq 'modified') { |
|
$result .= $token->[2]; |
|
$result.=&Apache::edit::handle_insertafter($token->[1]); |
} |
} |
pop @Apache::inputtags::status; |
pop @Apache::inputtags::status; |
$Apache::inputtags::part=''; |
$Apache::inputtags::part=''; |
Line 1268 sub end_part {
|
Line 1407 sub end_part {
|
} |
} |
|
|
sub start_preduedate { |
sub start_preduedate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
&Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']); |
&Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']); |
if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && |
if (!$Apache::lonhomework::scantronmode && |
|
$Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { |
&Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER')); |
&Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER')); |
&Apache::lonxml::get_all_text("/preduedate",$parser); |
&Apache::lonxml::get_all_text("/preduedate",$parser,$style); |
} |
} |
} |
} |
return ''; |
return ''; |
Line 1285 sub end_preduedate {
|
Line 1425 sub end_preduedate {
|
} |
} |
|
|
sub start_postanswerdate { |
sub start_postanswerdate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
if ($target eq 'web' || $target eq 'grade') { |
if ($target eq 'web' || $target eq 'grade') { |
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
if ($Apache::lonhomework::scantronmode || |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
$Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
|
&Apache::lonxml::get_all_text("/postanswerdate",$parser,$style); |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
&Apache::lonxml::get_all_text("/postanswerdate",$parser,$style); |
} |
} |
return ''; |
return ''; |
} |
} |
Line 1301 sub end_postanswerdate {
|
Line 1442 sub end_postanswerdate {
|
} |
} |
|
|
sub start_notsolved { |
sub start_notsolved { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
Line 1309 sub start_notsolved {
|
Line 1450 sub start_notsolved {
|
if ($gradestatus =~ /^correct/ && |
if ($gradestatus =~ /^correct/ && |
&Apache::response::show_answer()) { |
&Apache::response::show_answer()) { |
&Apache::lonxml::debug("skipping"); |
&Apache::lonxml::debug("skipping"); |
&Apache::lonxml::get_all_text("/notsolved",$parser); |
&Apache::lonxml::get_all_text("/notsolved",$parser,$style); |
} |
} |
} |
} |
return ''; |
return ''; |
Line 1320 sub end_notsolved {
|
Line 1461 sub end_notsolved {
|
} |
} |
|
|
sub start_solved { |
sub start_solved { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
if ($gradestatus !~ /^correct/ || |
if ($gradestatus !~ /^correct/ || |
!&Apache::response::show_answer()) { |
!&Apache::response::show_answer()) { |
&Apache::lonxml::get_all_text("/solved",$parser); |
&Apache::lonxml::get_all_text("/solved",$parser,$style); |
} |
} |
} |
} |
return ''; |
return ''; |
Line 1337 sub end_solved {
|
Line 1478 sub end_solved {
|
} |
} |
|
|
sub start_problemtype { |
sub start_problemtype { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result; |
my $result; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex' || $target eq 'analyze') { |
$target eq 'tex' || $target eq 'analyze') { |
Line 1349 sub start_problemtype {
|
Line 1490 sub start_problemtype {
|
if ($Apache::lonhomework::type eq lc($type)) { $found=1; } |
if ($Apache::lonhomework::type eq lc($type)) { $found=1; } |
} |
} |
if ($mode eq 'show' && !$found) { |
if ($mode eq 'show' && !$found) { |
&Apache::lonxml::get_all_text("/problemtype",$parser); |
&Apache::lonxml::get_all_text("/problemtype",$parser,$style); |
} |
} |
if ($mode eq 'hide' && $found) { |
if ($mode eq 'hide' && $found) { |
&Apache::lonxml::get_all_text("/problemtype",$parser); |
&Apache::lonxml::get_all_text("/problemtype",$parser,$style); |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result .=&Apache::edit::tag_start($target,$token); |
$result .=&Apache::edit::tag_start($target,$token); |
Line 1386 sub start_startouttext {
|
Line 1527 sub start_startouttext {
|
} |
} |
|
|
sub end_startouttext { |
sub end_startouttext { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result=''; |
my $result=''; |
my $text=''; |
my $text=''; |
|
|
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$text=&Apache::lonxml::get_all_text("endouttext",$parser); |
$text=&Apache::lonxml::get_all_text("endouttext",$parser,$style); |
$result.=&Apache::edit::start_table($token)."<tr><td>".&mt('Text Block')."</td> |
$result.=&Apache::edit::start_table($token)."<tr><td>".&mt('Text Block')."</td> |
<td>".&mt('Delete:'). |
<td>".&mt('Delete:'). |
&Apache::edit::deletelist($target,$token) |
&Apache::edit::deletelist($target,$token) |
Line 1430 sub end_endouttext {
|
Line 1571 sub end_endouttext {
|
} |
} |
|
|
sub delete_startouttext { |
sub delete_startouttext { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
# my $text=&Apache::lonxml::get_all_text("endouttext",$parser); |
# my $text=&Apache::lonxml::get_all_text("endouttext",$parser,$style); |
my $text=$$parser['-1']->get_text("/endouttext"); |
my $text=$$parser['-1']->get_text("/endouttext"); |
my $ntoken=$$parser['-1']->get_token(); |
my $ntoken=$$parser['-1']->get_token(); |
&Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext"); |
&Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext"); |
Line 1448 sub start_simpleeditbutton {
|
Line 1589 sub start_simpleeditbutton {
|
my $result=''; |
my $result=''; |
if (($env{'form.simple_edit_button'} ne 'off') && |
if (($env{'form.simple_edit_button'} ne 'off') && |
($target eq 'web') && |
($target eq 'web') && |
(&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) { |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { |
my $url=$env{'request.noversionuri'}; |
my $url=$env{'request.noversionuri'}; |
$url=~s/\?.*$//; |
$url=~s/\?.*$//; |
my ($symb) = &Apache::lonxml::whichuser(); |
my ($symb) = &Apache::lonxml::whichuser(); |