--- loncom/homework/structuretags.pm 2007/08/14 01:45:20 1.389 +++ loncom/homework/structuretags.pm 2007/09/10 17:02:32 1.395 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.389 2007/08/14 01:45:20 albertel Exp $ +# $Id: structuretags.pm,v 1.395 2007/09/10 17:02:32 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -157,6 +157,10 @@ function setSubmittedPart (part) { $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') { + $body_args{'only_body'} = 1; + } } $body_args{'no_auto_mt_title'} = 1; my $page_start = &Apache::loncommon::start_page($name,$extra_head, @@ -207,7 +211,7 @@ sub get_resource_name { $name = $Apache::lonhomework::name; } else { my ($symb)=&Apache::lonnet::whichuser(); - my $name=&Apache::lonnet::gettitle($symb); + $name=&Apache::lonnet::gettitle($symb); if ($name eq '') { $name=&Apache::lonnet::EXT('resource.title'); if ($name eq 'con_lost') { $name = ''; } @@ -644,7 +648,6 @@ sub start_problem { } if ($target ne 'analyze') { - if ($env{'request.state'} eq 'construct') { &set_problem_state('0'); } $Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type'); if (($env{'request.state'} eq 'construct') && defined($env{'form.problemtype'})) { @@ -762,7 +765,7 @@ sub start_problem { $msg.='

'.&mt('Not open to be viewed').'

'; } if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') { - $msg.='The problem '.$accessmsg; + $msg.=&mt('The problem ').$accessmsg; } elsif ($status eq 'UNCHECKEDOUT') { $msg.=&checkout_msg(); } elsif ($status eq 'NOT_YET_VIEWED') { @@ -1137,17 +1140,25 @@ sub start_languageblock { $target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') { my $include = $token->[2]->{'include'}; my $exclude = $token->[2]->{'exclude'}; - my %languages=&Apache::loncommon::display_languages(); + my $preferred_language=(&Apache::loncommon::preferred_languages)[0]; +# This should not even happen, since we should at least have the server language + if (!$preferred_language) { $preferred_language='en'; } +# If the languageblock has no arguments, show the contents $result='1'; +# Do we have an include argument? if ($include) { +# If include is specified, by default, don't render the block $result=''; - foreach (split(/\,/,$include)) { - if ($languages{$_}) { $result='1'; } + foreach my $included_language (split(/\,/,$include)) { +# ... but if my preferred language is included, render it + if ($included_language eq $preferred_language) { $result='1'; } } } +# Do we have an exclude argument? if ($exclude) { - foreach (split(/\,/,$exclude)) { - if ($languages{$_}) { $result='0'; } + $result='1'; + foreach my $excluded_language (split(/\,/,$exclude)) { + if ($excluded_language eq $preferred_language) { $result='0'; } } } if ( ! $result ) {