--- loncom/interface/lonhelper.pm 2004/04/21 17:29:57 1.71 +++ loncom/interface/lonhelper.pm 2004/09/24 19:49:12 1.87 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.71 2004/04/21 17:29:57 sakharuk Exp $ +# $Id: lonhelper.pm,v 1.87 2004/09/24 19:49:12 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -585,30 +585,6 @@ sub display { $result .= < - $loncapaHelper: $helperTitle @@ -1198,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'}; @@ -1280,6 +1263,7 @@ BUTTONS my $type = "radio"; if ($self->{'multichoice'}) { $type = 'checkbox'; } foreach my $choice (@{$self->{CHOICES}}) { + my $id = &new_id(); $result .= "\n \n"; $result .= " @@ -2130,16 +2124,18 @@ SCRIPT my %lt=&Apache::lonlocal::texthash( 'ocs' => "Select Only Current Students", + 'ues' => "Unselect Expired Students", 'sas' => "Select All Students", 'uas' => "Unselect All Students", - 'sfsg' => "Select for Section/Group", + 'sfsg' => "Select Current Students for Section/Group", 'ufsg' => "Unselect for Section/Group"); $buttons = < +
- +
  @@ -2202,7 +2198,6 @@ BUTTONS } my $name = $self->{'coursepersonnel'} ? &mt('Name') : &mt('Student Name'); - &Apache::lonnet::logthis("THE NAME IS >$name<"); my $type = 'radio'; if ($self->{'multichoice'}) { $type = 'checkbox'; } $result .= "\n"; @@ -2390,6 +2385,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 = ''; @@ -2476,7 +2478,7 @@ BUTTONS } # Sort the fileList into order - @fileList = sort @fileList; + @fileList = sort {lc($a) cmp lc($b)} @fileList; $result .= $buttons; @@ -2528,14 +2530,16 @@ BUTTONS if ($status eq 'Published' && $helper->{VARS}->{'construction'}) { $onclick = 'onclick="a=1" '; } + my $id = &new_id(); $result .= '" . + $result .= "/>" . "" . "" . "\n"; $choices++; @@ -2563,10 +2567,14 @@ sub fileState { my $constructionSpaceDir = shift; my $file = shift; + my ($uname,$udom)=($ENV{'user.name'},$ENV{'user.domain'}); + if ($ENV{'request.role'}=~/^ca\./) { + (undef,$udom,$uname)=split(/\//,$ENV{'request.role'}); + } my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'}; my $subdirpart = $constructionSpaceDir; - $subdirpart =~ s/^\/home\/$ENV{'user.name'}\/public_html//; - my $resdir = $docroot . '/res/' . $ENV{'user.domain'} . '/' . $ENV{'user.name'} . + $subdirpart =~ s/^\/home\/$uname\/public_html//; + my $resdir = $docroot . '/res/' . $udom . '/' . $uname . $subdirpart; my @constructionSpaceFileStat = stat($constructionSpaceDir . '/' . $file); @@ -2695,6 +2703,7 @@ string honors the validation function, i no strict; @ISA = ("Apache::lonhelper::element"); use strict; +use Apache::lonlocal; BEGIN { &Apache::lonhelper::register('Apache::lonhelper::string', @@ -2813,6 +2822,8 @@ be able to call methods on it. =cut +use Apache::lonlocal; + BEGIN { &Apache::lonhelper::register('Apache::lonhelper::general', 'exec', 'condition', 'clause', @@ -3126,7 +3137,7 @@ sub render { # Print the granularity, depending on the action if ($vars->{GRANULARITY} eq 'whole_course') { - $resourceString .= '
  • for all resources in the course
  • '; + $resourceString .= '
  • '.&mt('for all resources in the course').'
  • '; $level = 9; # general course, see lonparmset.pm perldoc $affectedResourceId = "0.0"; $symb = 'a'; @@ -3137,7 +3148,7 @@ sub render { my $title = $res->compTitle(); $symb = $res->symb(); $navmap->untieHashes(); - $resourceString .= "
  • for the map named $title
  • "; + $resourceString .= '
  • '.&mt('for the map named [_1]',"$title").'
  • '; $level = 8; $affectedResourceId = $vars->{RESOURCE_ID}; $paramlevel = 'map'; @@ -3147,7 +3158,7 @@ sub render { $symb = $res->symb(); my $title = $res->compTitle(); $navmap->untieHashes(); - $resourceString .= "
  • for the resource named $title
  • "; + $resourceString .= '
  • '.&mt('for the resource named [_1]',"$title").'
  • '; $level = 7; $affectedResourceId = $vars->{RESOURCE_ID}; $paramlevel = 'full'; @@ -3157,12 +3168,19 @@ sub render { $result .= '

    '.&mt('Confirm that this information is correct, then click "Finish Helper" to complete setting the parameter.').'

    " . "&"'). + . ".forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,'<>&"'). "'"; if (!$self->{'multichoice'} && $choices == 0) { $result .= ' checked'; } - $result .= "/>" . $file . "". + qq{$title$status