--- loncom/homework/structuretags.pm 2011/12/10 18:23:13 1.465.2.15 +++ loncom/homework/structuretags.pm 2010/10/28 00:27:56 1.477 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.465.2.15 2011/12/10 18:23:13 raeburn Exp $ +# $Id: structuretags.pm,v 1.477 2010/10/28 00:27:56 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -128,17 +128,8 @@ sub homework_js { &setmode_javascript(). <<'JS'; JS } @@ -162,55 +153,10 @@ JS sub setmode_javascript { return <<"ENDSCRIPT"; -ENDSCRIPT -} - -sub file_delchk_js { - my $delfilewarn = &mt('You have indicated you wish to remove some files previously included in your submission.').'\\n'. - &mt('Continue submission with these files removed?'); - return <<"ENDSCRIPT"; - ENDSCRIPT } @@ -239,10 +185,6 @@ sub page_start { ); $extra_head .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args); } - my $is_task = ($env{'request.uri'} =~ /\.task$/); - if ($is_task) { - $extra_head .= &file_delchk_js(); - } my %body_args; if (defined($found{'html'})) { @@ -268,9 +210,6 @@ sub page_start { } elsif (!defined($found{'body'}) && $env{'request.state'} eq 'construct') { if ($target eq 'web' || $target eq 'edit') { - if ($env{'environment.remote'} ne 'off') { - $body_args{'only_body'} = 1; - } # Breadcrumbs for Construction Space &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({ @@ -304,8 +243,7 @@ sub page_start { # $body_args{'no_title'} = 1; $body_args{'force_register'} = 1; $body_args{'add_entries'} = \%add_entries; - if ($env{'environment.remote'} eq 'off' - && $env{'request.state'} eq 'construct') { + if ( $env{'request.state'} eq 'construct') { $body_args{'only_body'} = 1; } } @@ -339,9 +277,6 @@ sub page_start { if ($target eq 'edit') { $form_tag_start.=&Apache::edit::form_change_detection(); } - if ($is_task) { - $form_tag_start .= ' onsubmit="return file_deletion_check(this);"'; - } $form_tag_start.='>'."\n"; my $symb=&Apache::lonnet::symbread(); @@ -383,15 +318,9 @@ sub get_resource_name { } sub setup_rndseed { - my ($safeeval,$target)=@_; + my ($safeeval)=@_; + my $rndseed; my ($symb)=&Apache::lonnet::whichuser(); - my ($questiontype,$set_safespace,$rndseed); - if ($target eq 'analyze') { - $questiontype = $env{'form.grade_questiontype'}; - } - unless (defined($questiontype)) { - $questiontype = $Apache::lonhomework::type; - } if ($env{'request.state'} eq "construct" || $symb eq '' || $Apache::lonhomework::type eq 'practice' @@ -406,14 +335,6 @@ sub setup_rndseed { } $env{'form.rndseed'}=$rndseed; } - if (($env{'request.state'} eq "construct") && - ($Apache::lonhomework::type eq 'randomizetry')) { - my $tries = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.tries"}; - if ($tries) { - $rndseed += $tries; - } - $env{'form.'.$Apache::inputtags::part.'.rndseed'}=$rndseed; - } if ( ($env{'form.resetdata'} eq &mt('New Problem Variation') && $env{'form.submitted'} eq 'yes') || $env{'form.newrandomization'} eq &mt('New Randomization')) { @@ -429,42 +350,10 @@ sub setup_rndseed { if ($Apache::lonhomework::history{'resource.CODE'}) { $rndseed=&Apache::lonnet::rndseed(); } - $set_safespace = 1; - } elsif ($questiontype eq 'randomizetry') { - if ($target eq 'analyze') { - if (defined($env{'form.grade_rndseed'})) { - $rndseed = $env{'form.grade_rndseed'}; - } - } - unless (($target eq 'analyze') && (defined($rndseed))) { - $rndseed=&Apache::lonnet::rndseed(); - my $curr_try = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.tries"}; - if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { - $curr_try ++; - } - if ($rndseed =~/^(\d+)[,:](\d+)$/) { - $rndseed = $1; - } - if ($curr_try) { - my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries"); - if (($reqtries =~ /^\d+$/) && ($reqtries > 1)) { - my $inc = int(($curr_try-1)/$reqtries); - $rndseed += $inc; - } else { - $rndseed += $curr_try; - } - } - } - $set_safespace = 1; - } - if ($set_safespace) { - if ($safeeval) { - &Apache::lonxml::debug("Setting rndseed to $rndseed"); - &Apache::run::run('$external::randomseed="'.$rndseed.'";',$safeeval); - } - } - unless (($env{'request.state'} eq "construct") || ($symb eq '')) { - $env{'form.'.$Apache::inputtags::part.'.rndseed'}=$rndseed; + if ($safeeval) { + &Apache::lonxml::debug("Setting rndseed to $rndseed"); + &Apache::run::run('$external::randomseed="'.$rndseed.'";',$safeeval); + } } return $rndseed; } @@ -476,48 +365,27 @@ sub remember_problem_state { '; } -sub problem_edit_action_button { - my ($name,$action,$accesskey,$text,$flag)=@_; - my $actionscript="setmode(this.form,'$action')"; - return "\n"; -} - sub problem_edit_buttons { - my ($mode)=@_; -# Buttons that do not save - my $result='