--- loncom/homework/structuretags.pm 2007/08/31 19:31:16 1.392 +++ loncom/homework/structuretags.pm 2007/09/11 23:36:39 1.396 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.392 2007/08/31 19:31:16 albertel Exp $ +# $Id: structuretags.pm,v 1.396 2007/09/11 23:36:39 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -765,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') { @@ -1070,16 +1070,19 @@ sub start_definetag { my $name = $token->[2]->{'name'}; my $skip=&Apache::lonxml::get_all_text("/definetag",$parser,$style); - if ($name=~/^\//) { - $result= - '
'; - } else { - $result= - '
END '.$name.'
'; + if ($target eq 'web') { + if ($name=~/^\//) { + $result= + '
BEGIN '.$name.'
'; + } else { + $result= + '
'. + &mt('END [_1]'.''.$name.'').'
'; + } + $skip = &HTML::Entities::encode($skip, '<>&"'); + $result.='
'. + &mt('BEGIN [_1]'.''.$name.'').'
'.$skip.'
'; } - $skip=~s/\/\>\;/gs; - $result.='
'.$skip.'
'; return $result; } @@ -1140,17 +1143,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 ) {