--- loncom/interface/lonhelper.pm 2004/04/27 18:07:18 1.78
+++ loncom/interface/lonhelper.pm 2004/10/07 22:12:47 1.88
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.78 2004/04/27 18:07:18 sakharuk Exp $
+# $Id: lonhelper.pm,v 1.88 2004/10/07 22:12:47 albertel 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,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 .= "
@@ -2106,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 = <
+
-
+
@@ -2178,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";
@@ -2366,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 = '';
@@ -2452,7 +2478,7 @@ BUTTONS
}
# Sort the fileList into order
- @fileList = sort @fileList;
+ @fileList = sort {lc($a) cmp lc($b)} @fileList;
$result .= $buttons;
@@ -2504,14 +2530,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++;
@@ -2539,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);
@@ -2790,6 +2822,8 @@ be able to call methods on it.
=cut
+use Apache::lonlocal;
+
BEGIN {
&Apache::lonhelper::register('Apache::lonhelper::general',
'exec', 'condition', 'clause',
@@ -3113,7 +3147,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};
@@ -3123,7 +3156,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};
@@ -3180,7 +3212,7 @@ sub render {
$result .= ''.&mt('for all students in course').'';
} elsif ($vars->{TARGETS} eq 'section') {
my $section = $vars->{SECTION_NAME};
- $result .= &mt('for section [_1]',$section);
+ $result .= ''.&mt('for section [_1]',"$section").'';
$level -= 3;
$result .= "&"') . "' />\n";
@@ -3191,8 +3223,7 @@ sub render {
# Chop off everything after the last colon (section)
$username = substr($username, 0, rindex($username, ':'));
my $name = $classlist->{$username}->[6];
- $result .= &mt('for [_1]',$name);
-## $result .= "".&mt('for [_1]',"$name")."";
+ $result .= ''.&mt('for [_1]',"$name").'';
$level -= 6;
my ($uname, $udom) = split /:/, $vars->{USER_NAME};
$result .= "{ACTION_TYPE} ne 'weight') {
- $result .= "".&mt('to')." " . ctime($vars->{PARM_DATE}) . " (" .
- Apache::lonnavmaps::timeToHumanString($vars->{PARM_DATE})
- . ")\n";
+ $result .= ''.&mt('to [_1] ([_2])',"".ctime($vars->{PARM_DATE})."",Apache::lonnavmaps::timeToHumanString($vars->{PARM_DATE}))."\n";
}
# print pres_marker
|