--- loncom/homework/structuretags.pm 2007/11/13 19:48:09 1.410 +++ loncom/homework/structuretags.pm 2008/05/27 19:48:55 1.420 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.410 2007/11/13 19:48:09 albertel Exp $ +# $Id: structuretags.pm,v 1.420 2008/05/27 19:48:55 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)=@_; @@ -307,14 +320,15 @@ sub problem_edit_header { '.&mt('Problem Editing').&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').'
- - - + + +
- - + +

'.&Apache::lonxml::message_location().' @@ -324,8 +338,23 @@ sub problem_edit_header { } sub problem_edit_footer { - return '
- '. + return '
+ +'. + &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields()). "\n\n".&Apache::loncommon::end_page(); } @@ -422,13 +451,28 @@ $show_all $show_all "; } - + if (($env{'form.problemlanguage'}) && ($env{'form.problemlanguage'}!~/notset/)) { + $env{'environment.languages'}=$env{'form.problemlanguage'}; + } + my %langchoices=('' => ''); + foreach (&Apache::loncommon::languageids()) { + if (&Apache::loncommon::supportedlanguagecode($_)) { + $langchoices{&Apache::loncommon::supportedlanguagecode($_)} + = &Apache::loncommon::plainlanguagedescription($_); + } + } $result.=' '.&mt('Apply style file: ').' &').'" /> '.&mt('Select').' +
+ '. + &mt('Language: '). + &Apache::loncommon::select_form($env{'environment.languages'},'problemlanguage', + %langchoices).' +
@@ -447,8 +491,9 @@ $show_all if (!$numtoanalyze) { $numtoanalyze=20; } $result .= ''. &mt('[_1] for [_2] versions.', - '', - '' + ,''). &Apache::loncommon::help_open_topic("Analyze_Problem",'',undef,undef,300). ''; @@ -458,9 +503,11 @@ $show_all $result.='
'; - $result.=''; - $result .= ''; - $result .= ''; + $result.=''; + $result .= ''; + $result .= ''; $result.='
'.&Apache::lonxml::message_location().' @@ -606,17 +653,37 @@ 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 $result; + my @interval=&Apache::lonnet::EXT("resource.0.interval"); + if ($interval[1] eq 'map') { + my ($map)=&Apache::lonnet::decode_symb($symb); + my $foldertitle=&Apache::lonnet::gettitle($map); + + &Apache::lonxml::debug("map is $map title is $foldertitle"); + $result .= "

".&mt('The resources in "[_1]" are open for a limited time.' + .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".' + ,$foldertitle,$time)."

"; + } elsif ($interval[1] eq 'course') { + my $course = $env{'course.'.$env{'request.course.id'}.'.description'}; + $result .= "

".&mt('The resources in "[_1]" are open for a limited time.' + .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".' + ,$course,$time)."

"; + } else { + my $title=&Apache::lonnet::gettitle($symb); + $result .= "

".&mt('This resource "[_1]" is open for a limited time.' + .' Once you click the "Show Resource" button below you have [_2] to complete this resource "[_1]".' + ,$title,$time)."

"; + } 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". + my $buttontext = &mt('Show Resource'); + my $timertext = &mt('Start Timer?'); + $result .= (< - + ENDCHECKOUT + return $result; } sub init_problem_globals { @@ -721,7 +788,8 @@ 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') && $env{'form.problemtype'} =~ /\S/) { $Apache::lonhomework::type=$env{'form.problemtype'}; @@ -784,7 +852,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); @@ -809,6 +878,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.='
'; }