--- loncom/homework/structuretags.pm 2007/10/31 01:37:52 1.408 +++ loncom/homework/structuretags.pm 2008/01/28 21:42:28 1.417 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.408 2007/10/31 01:37:52 albertel Exp $ +# $Id: structuretags.pm,v 1.417 2008/01/28 21:42:28 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -94,6 +94,7 @@ sub end_tex { sub homework_js { return &Apache::loncommon::resize_textarea_js(). + &setmode_javascript(). <<'JS'; JS } +sub setmode_javascript { + return <<"ENDSCRIPT"; + +ENDSCRIPT +} + sub page_start { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, $extra_head)=@_; @@ -199,7 +212,7 @@ sub page_start { } } - if (!defined($found{'body'})) { + if (!defined($found{'body'}) && $env{'request.state'} ne 'construct') { $page_start .= &Apache::lonxml::message_location(); } @@ -307,24 +320,41 @@ sub problem_edit_header { '.&mt('Problem Editing').&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').'
- - - + + +
- - + +

+'.&Apache::lonxml::message_location().' '. '
'; } sub problem_edit_footer { - return '

- '. + return '
+ +'. + &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields()). "\n\n".&Apache::loncommon::end_page(); } @@ -446,8 +476,9 @@ $show_all if (!$numtoanalyze) { $numtoanalyze=20; } $result .= ''. &mt('[_1] for [_2] versions.', - '', - ' + '). &Apache::loncommon::help_open_topic("Analyze_Problem",'',undef,undef,300). ''; @@ -457,12 +488,14 @@ $show_all $result.='
'; - $result.=''; - $result .= ''; - $result .= ''; - + $result.=''; + $result .= ''; + $result .= ''; $result.='
+ '.&Apache::lonxml::message_location().' '; return $result; } @@ -605,17 +638,36 @@ ENDCHECKOUT sub firstaccess_msg { my ($time,$symb)=@_; - my ($map)=&Apache::lonnet::decode_symb($symb); - my $foldertitle=&Apache::lonnet::gettitle($map); - &Apache::lonxml::debug("map is $map title is $foldertitle"); - my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'}); - return (<The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle". +ENDCHECKOUT + } elsif ($interval[1] eq 'course') { + my $course = $env{'course.'.$env{'request.course.id'}.'.description'}; + $result .= (<The resources in "$course" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources in "$course". +ENDCHECKOUT + } else { + my $title=&Apache::lonnet::gettitle($symb); + $result .= (<This resource "$title" is open for a limited time. Once you click the 'Show Resource' button below you have $time to complete this resource "$title". +ENDCHECKOUT + + } + my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'}); + $result .= (< ENDCHECKOUT + return $result; } sub init_problem_globals { @@ -720,9 +772,10 @@ sub start_problem { } if ($target ne 'analyze') { - $Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type'); + my $type = &Apache::lonnet::EXT('resource.0.type'); + $Apache::lonhomework::type=$type; if (($env{'request.state'} eq 'construct') && - defined($env{'form.problemtype'})) { + $env{'form.problemtype'} =~ /\S/) { $Apache::lonhomework::type=$env{'form.problemtype'}; } &Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:"); @@ -783,7 +836,8 @@ sub start_problem { $result.=&Apache::lonxml::printtokenheader($target,$token); } if ($env{'form.markaccess'}) { - &Apache::lonnet::set_first_access('map'); + my @interval=&Apache::lonnet::EXT("resource.0.interval"); + &Apache::lonnet::set_first_access($interval[1]); } #handle rand seed in construction space my $rndseed=&setup_rndseed($safeeval); @@ -808,6 +862,10 @@ sub start_problem { $form_tag_start.= ' />'.&mt(' Show All Foils'). ''; } + if ($Apache::lonhomework::type eq 'practice') { + $form_tag_start.='

'.&mt('Practice Problem').'

'. + ''.&mt('Submissions are not permanently recorded').''; + } $form_tag_start.='
'; }