--- loncom/interface/lonhtmlcommon.pm 2002/07/24 14:52:32 1.3 +++ loncom/interface/lonhtmlcommon.pm 2002/07/25 21:23:51 1.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.3 2002/07/24 14:52:32 stredwic Exp $ +# $Id: lonhtmlcommon.pm,v 1.4 2002/07/25 21:23:51 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -57,10 +57,14 @@ sub MapOptions { } sub StudentOptions { - my ($cache, $students, $selectedName, $page)=@_; + my ($cache, $students, $selectedName, $page, $formName)=@_; my $Str = ''; - $Str = '[$index]; - my $linkdata=$studentInformation->[$index]; + my $currentHeading=$headings->[$index]; + if($format eq 'preformatted') { + my @dataLength=split(//,$currentHeading); + my $length=scalar @dataLength; + $formatting = (' 'x + ($data->{$keyID->[$index].':columnWidth'}-$length)); + } + my $linkdata=$keyID->[$index]; + my $tempString = $displayString; $tempString =~ s/LINKDATA/$linkdata/; - $tempString =~ s/DISPLAYDATA/$data/; + $tempString =~ s/DISPLAYDATA/$currentHeading/; + $tempString =~ s/FORMATTING/$formatting/; + $Str .= $tempString; } @@ -229,13 +240,13 @@ username, domain, section, full name, an =over 4 -Input: $cache, $name, $studentInformation, $spacePadding +Input: $cache, $name, $keyID, $spacePadding $cache: This is a pointer to a hash that is tied to the cached data $name: The name and domain of the current student in name:domain format -$studentInformation: A pointer to an array holding the names used to +$keyID: A pointer to an array holding the names used to remove data from the hash. They represent the name of the data to be removed. @@ -250,22 +261,24 @@ $Str: Formatted string. =cut sub FormatStudentInformation { - my ($cache,$name,$studentInformation,$spacePadding)=@_; + my ($data,$name,$keyID,$displayString,$format)=@_; my $Str=''; - my $data; + my $currentColumn; + + for(my $index=0; $index<(scalar @$keyID); $index++) { + $currentColumn=$data->{$name.':'.$keyID->[$index]}; - for(my $index=0; $index<(scalar @$studentInformation); $index++) { - if(!&ShouldShowColumn($cache, 'ChartHeading'.$index)) { - next; + if($format eq 'preformatted') { + my @dataLength=split(//,$currentColumn); + my $length=scalar @dataLength; + $currentColumn.= (' 'x + ($data->{$keyID->[$index].':columnWidth'}-$length)); } - $data=$cache->{$name.':'.$studentInformation->[$index]}; - $Str .= $data; - my @dataLength=split(//,$data); - my $length=scalar @dataLength; - $Str .= (' 'x($cache->{$studentInformation->[$index].'Length'}- - $length)); - $Str .= $spacePadding; + my $tempString = $displayString; + $tempString =~ s/DISPLAYDATA/$currentColumn/; + + $Str .= $tempString; } return $Str;