--- loncom/interface/lonhelper.pm 2004/08/12 07:45:03 1.86 +++ loncom/interface/lonhelper.pm 2005/01/10 12:15:23 1.92 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.86 2004/08/12 07:45:03 albertel Exp $ +# $Id: lonhelper.pm,v 1.92 2005/01/10 12:15:23 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1174,6 +1174,13 @@ sub end_choice { return ''; } +{ + # used to generate unique id attributes for tags. + # internal use only. + my $id = 0; + sub new_id { return $id++; } +} + sub render { my $self = shift; my $var = $self->{'variable'}; @@ -1256,14 +1263,16 @@ BUTTONS my $type = "radio"; if ($self->{'multichoice'}) { $type = 'checkbox'; } foreach my $choice (@{$self->{CHOICES}}) { + my $id = &new_id(); $result .= "\n \n"; $result .= "&"') + HTML::Entities::encode($choice->[1],"<>&\"'") . "'"; if ($checkedChoices{$choice->[1]}) { $result .= " checked "; } + $result .= qq{id="$id"}; my $choiceLabel = $choice->[0]; if ($choice->[4]) { # if we need to evaluate this choice $choiceLabel = "sub { my $helper = shift; my $state = shift;" . @@ -1271,7 +1280,8 @@ BUTTONS $choiceLabel = eval($choiceLabel); $choiceLabel = &$choiceLabel($helper, $self); } - $result .= "/> " . &mtn($choiceLabel) . "\n"; + $result .= "/> ".qq{\n"; } $result .= "\n\n\n"; $result .= $buttons; @@ -1414,7 +1424,7 @@ sub render { $result .= "&\"'"); + if($option_vars) { + foreach my $option_var (@$option_vars) { + $col .= + " "; + } + } + + $col .= "&"') - . "' />"; - return $col; + $col .= "value='" . $resource_name . "' />"; + return $result.$col; } }; @@ -2122,13 +2194,25 @@ SCRIPT $buttons = < - -
- -
- -  - + + + + + + + + + + + + + + + + + + +


 

BUTTONS } @@ -2207,7 +2291,10 @@ BUTTONS $checked = 1; } $result .= - " value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3],'<>&"') + " value='" . HTML::Entities::encode($choice->[0] . ':' + .$choice->[2] . ':' + .$choice->[1] . ':' + .$choice->[3], "<>&\"'") . "' />" . HTML::Entities::encode($choice->[1],'<>&"') . "" @@ -2375,6 +2462,13 @@ sub start_filefilter { sub end_filefilter { return ''; } +{ + # used to generate unique id attributes for tags. + # internal use only. + my $id=0; + sub new_id { return $id++;} +} + sub render { my $self = shift; my $result = ''; @@ -2513,14 +2607,16 @@ BUTTONS if ($status eq 'Published' && $helper->{VARS}->{'construction'}) { $onclick = 'onclick="a=1" '; } + my $id = &new_id(); $result .= '" . "&"'). + . ".forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,"<>&\"'"). "'"; if (!$self->{'multichoice'} && $choices == 0) { $result .= ' checked'; } - $result .= "/>" . $file . "" . + $result .= "/>". + qq{" . "$title" . "$status" . "\n"; $choices++; @@ -3128,7 +3224,6 @@ sub render { my $res = $navmap->getByMapPc($vars->{RESOURCE_ID}); my $title = $res->compTitle(); $symb = $res->symb(); - $navmap->untieHashes(); $resourceString .= '
  • '.&mt('for the map named [_1]',"$title").'
  • '; $level = 8; $affectedResourceId = $vars->{RESOURCE_ID}; @@ -3138,7 +3233,6 @@ sub render { my $res = $navmap->getById($vars->{RESOURCE_ID}); $symb = $res->symb(); my $title = $res->compTitle(); - $navmap->untieHashes(); $resourceString .= '
  • '.&mt('for the resource named [_1]',"$title").'
  • '; $level = 7; $affectedResourceId = $vars->{RESOURCE_ID}; @@ -3198,7 +3292,7 @@ sub render { $result .= '
  • '.&mt('for section [_1]',"$section").'
  • '; $level -= 3; $result .= "&"') . "' />\n"; + HTML::Entities::encode($section,"'<>&\"") . "' />\n"; } else { # FIXME: This is probably wasteful! Store the name! my $classlist = Apache::loncoursedata::get_classlist(); @@ -3210,9 +3304,9 @@ sub render { $level -= 6; my ($uname, $udom) = split /:/, $vars->{USER_NAME}; $result .= "&"') . "' />\n"; + HTML::Entities::encode($uname,"'<>&\"") . "' />\n"; $result .= "&"') . "' />\n"; + HTML::Entities::encode($udom,"'<>&\"") . "' />\n"; } # Print value