version 1.372, 2006/12/11 01:07:07
|
version 1.380, 2007/06/11 20:52:29
|
Line 88 sub page_start {
|
Line 88 sub page_start {
|
$parstack,$parser,$safeeval); |
$parstack,$parser,$safeeval); |
} |
} |
|
|
|
$extra_head.= ' |
|
<script type="text/javascript"> |
|
function setSubmittedPart (part) { |
|
this.document.lonhomework.submitted.value="part_"+part; |
|
} |
|
</script> |
|
'; |
|
|
my %body_args; |
my %body_args; |
if (defined($found{'html'})) { |
if (defined($found{'html'})) { |
$body_args{'skip_phases'}{'head'}=1; |
$body_args{'skip_phases'}{'head'}=1; |
Line 95 sub page_start {
|
Line 103 sub page_start {
|
|
|
$extra_head .= &Apache::lonhtmlcommon::spellheader(); |
$extra_head .= &Apache::lonhtmlcommon::spellheader(); |
|
|
my $css_href = &Apache::lonnet::EXT('resource.0.cssfile'); |
$extra_head .= &Apache::londefdef::generate_css_links(); |
if ($css_href =~ /\S/) { |
|
&Apache::lonxml::extlink($css_href); |
|
$extra_head .= |
|
'<link rel="stylesheet" type="text/css" href="'.$css_href.'" />'; |
|
} |
|
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$extra_head.=&Apache::edit::js_change_detection(). |
$extra_head.=&Apache::edit::js_change_detection(). |
"<script type=\"text/javascript\">\n". |
"<script type=\"text/javascript\">\n". |
Line 213 sub setup_rndseed {
|
Line 217 sub setup_rndseed {
|
} |
} |
$env{'form.rndseed'}=$rndseed; |
$env{'form.rndseed'}=$rndseed; |
} |
} |
if ($env{'form.resetdata'} eq &mt('New Problem Variation') || |
if ( ($env{'form.resetdata'} eq &mt('New Problem Variation') |
|
&& $env{'form.submitted'} eq 'yes') || |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
srand(time); |
srand(time); |
$rndseed=int(rand(2100000000)); |
$rndseed=int(rand(2100000000)); |
Line 276 sub option {
|
Line 281 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').'" />'; |
if (!$Apache::lonhomework::parsing_a_task) { |
$result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />'; |
$result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />'; |
|
} |
|
$result .= '<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
$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').'" /> |
Line 337 Feedback Mode:
|
Line 340 Feedback Mode:
|
'.'.&Apache::loncommon::help_open_topic("Analyze_Problem", |
'.'.&Apache::loncommon::help_open_topic("Analyze_Problem", |
'',undef,undef,300). |
'',undef,undef,300). |
'<hr />'; |
'<hr />'; |
|
} elsif ($Apache::lonhomework::parsing_a_task) { |
|
$result.=" |
|
<nobr> |
|
Problem Status: |
|
<select name='problemstate'> |
|
<option value=''></option> |
|
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
|
".&option('CAN_ANSWER' ,'problemstate').&mt("Answerable")."</option> |
|
".&option('WEB_GRADE' ,'problemstate').&mt("Criteria Grading")."</option> |
|
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Feedback")."</option> |
|
</select> |
|
</nobr> |
|
<input type='submit' name='changeproblemmode' value='".&mt("Change")."' /> |
|
<hr />"; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 360 sub initialize_storage {
|
Line 377 sub initialize_storage {
|
|
|
my $namespace = $symb || $env{'request.uri'}; |
my $namespace = $symb || $env{'request.uri'}; |
if ($env{'form.resetdata'} eq &mt('Reset Submissions') || |
if ($env{'form.resetdata'} eq &mt('Reset Submissions') || |
$env{'form.resetdata'} eq &mt('New Problem Variation') || |
($env{'form.resetdata'} eq &mt('New Problem Variation') |
|
&& $env{'form.submitted'} eq 'yes') || |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
&Apache::lonnet::tmpreset($namespace,'',$domain,$name); |
&Apache::lonnet::tmpreset($namespace,'',$domain,$name); |
&Apache::lonxml::debug("Attempt reset"); |
&Apache::lonxml::debug("Attempt reset"); |
Line 731 sub start_problem {
|
Line 749 sub start_problem {
|
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
$style); |
$style); |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result .= &Apache::bridgetask::proctor_validation_screen(); |
$result .= |
|
&Apache::bridgetask::proctor_validation_screen($slot); |
} elsif ($target eq 'grade') { |
} elsif ($target eq 'grade') { |
&Apache::bridgetask::proctor_check_auth($slot_name,$slot, |
&Apache::bridgetask::proctor_check_auth($slot_name,$slot, |
'problem'); |
'problem'); |
Line 769 sub start_problem {
|
Line 788 sub start_problem {
|
$result.=$temp; |
$result.=$temp; |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$result=$token->[4]; |
$result=$token->[4]; |
$result.=&Apache::edit::handle_insert(); |
|
} else { |
} else { |
# page_start returned a starting result, delete it if we don't need it |
# page_start returned a starting result, delete it if we don't need it |
$result = ''; |
$result = ''; |
Line 787 sub end_problem {
|
Line 805 sub end_problem {
|
} |
} |
|
|
if ($target eq 'tex') { |
if ($target eq 'tex') { |
|
|
# Figure out the front matter and replace the |
# Figure out the front matter and replace the |
# INSERTTEXFRONTMATTERHERE in result with it. note that we do |
# INSERTTEXFRONTMATTERHERE in result with it. note that we do |
# this in end_problem because whether or not we display due |
# this in end_problem because whether or not we display due |
Line 947 sub end_problem {
|
Line 964 sub end_problem {
|
$result .= &problem_edit_footer(); |
$result .= &problem_edit_footer(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$result .= $token->[2]; |
$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 976 sub start_library {
|
Line 992 sub start_library {
|
$result.=$temp; |
$result.=$temp; |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$result=$token->[4]; |
$result=$token->[4]; |
$result.=&Apache::edit::handle_insert(); |
|
} elsif (($target eq 'web' || $target eq 'webgrade') |
} elsif (($target eq 'web' || $target eq 'webgrade') |
&& ($#$tagstack eq 0 && $$tagstack[0] eq 'library') |
&& ($#$tagstack eq 0 && $$tagstack[0] eq 'library') |
&& $env{'request.state'} eq "construct" ) { |
&& $env{'request.state'} eq "construct" ) { |
Line 1207 sub end_while {
|
Line 1222 sub end_while {
|
while ($return) { |
while ($return) { |
if (time-$starttime > |
if (time-$starttime > |
$Apache::lonnet::perlvar{'lonScriptTimeout'}) { |
$Apache::lonnet::perlvar{'lonScriptTimeout'}) { |
#$return = 0; $error=1; next; |
$return = 0; $error=1; next; |
} |
} |
$result.=&Apache::scripttag::xmlparse($bodytext); |
$result.=&Apache::scripttag::xmlparse($bodytext); |
|
if ($target eq 'grade' || $target eq 'answer' || |
|
$target eq 'analyze') { |
|
# grade/answer/analyze should produce no output but if we |
|
# are redirecting, the redirecter should know what to do |
|
# with the output |
|
if (!$Apache::lonxml::redirection) { undef($result); } |
|
} |
$return = &Apache::run::run($code,$safeeval); |
$return = &Apache::run::run($code,$safeeval); |
} |
} |
if ($error) { |
if ($error) { |
Line 1423 sub start_part {
|
Line 1445 sub start_part {
|
#limiting ids to only letters numbers, and space |
#limiting ids to only letters numbers, and space |
$token->[2]->{'id'}=~s/[^A-Za-z0-9 ]//gs; |
$token->[2]->{'id'}=~s/[^A-Za-z0-9 ]//gs; |
$result = &Apache::edit::rebuild_tag($token); |
$result = &Apache::edit::rebuild_tag($token); |
$result.=&Apache::edit::handle_insert(); |
|
} |
} |
} |
} |
return $result; |
return $result; |
Line 1461 sub end_part {
|
Line 1482 sub end_part {
|
$result.=&Apache::edit::end_table(); |
$result.=&Apache::edit::end_table(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$result .= $token->[2]; |
$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 1630 sub start_endouttext {
|
Line 1650 sub start_endouttext {
|
if ($target eq "edit" ) { $result="</td></tr>".&Apache::edit::end_table()."\n"; } |
if ($target eq "edit" ) { $result="</td></tr>".&Apache::edit::end_table()."\n"; } |
if ($target eq "modified") { |
if ($target eq "modified") { |
$result='<endouttext />'. |
$result='<endouttext />'. |
&Apache::edit::handle_insertafter('startouttext'); } |
&Apache::edit::handle_insertafter('startouttext'); |
|
} |
return $result; |
return $result; |
} |
} |
|
|