[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 08 Nov 2003 12:06:38 -0000
albertel Sat Nov 8 07:06:38 2003 EDT
Modified files:
/loncom/auth lonroles.pm
Log:
- changed the sort order of roles
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.74 loncom/auth/lonroles.pm:1.75
--- loncom/auth/lonroles.pm:1.74 Sat Oct 4 14:13:36 2003
+++ loncom/auth/lonroles.pm Sat Nov 8 07:06:38 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.74 2003/10/04 18:13:36 www Exp $
+# $Id: lonroles.pm,v 1.75 2003/11/08 12:06:38 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -327,9 +327,12 @@
'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'.
&mt('Remark').'</th></tr>'."\n");
+ my (%roletext,%sortrole,%roleclass);
foreach $envkey (sort keys %ENV) {
my $button = 1;
my $switchserver='';
+ my $roletext;
+ my $sortkey;
if ($envkey=~/^user\.role\./) {
my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
next if (!defined($role) || $role eq '');
@@ -414,6 +417,7 @@
': '.$tdom.'<br />'.
' '.&mt('Server').': '.$home;
$ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca';
+ $sortkey=$role."$trest:$tdom";
} elsif ($role eq 'au') {
# Authors
my $home = &Apache::lonnet::homeserver
@@ -432,6 +436,7 @@
$twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server').
': '.$home;
$ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca';
+ $sortkey=$role;
} elsif ($trest) {
$ttype=&mt('Course');
if ($tsection) {
@@ -440,6 +445,7 @@
my $tcourseid=$tdom.'_'.$trest;
if ($ENV{'course.'.$tcourseid.'.description'}) {
$twhere=$ENV{'course.'.$tcourseid.'.description'};
+ $sortkey=$twhere."\0".$envkey;
unless ($twhere eq &mt('Currently not available')) {
$twhere.=' <font size="-2">'.
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont).
@@ -449,6 +455,7 @@
my %newhash=Apache::lonnet::coursedescription
($tcourseid);
if (%newhash) {
+ $sortkey=$newhash{'description'}."\0".$envkey;
$twhere=$newhash{'description'}.
' <font size="-2">'.
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont).
@@ -456,54 +463,68 @@
} else {
$twhere=&mt('Currently not available');
$ENV{'course.'.$tcourseid.'.description'}=$twhere;
+ $sortkey=$twhere."\0".$envkey;
}
}
if ($role ne 'st') { $twhere.="<br />".&mt('Domain').":".$tdom; }
} elsif ($tdom) {
$ttype=&mt('Domain');
$twhere=$tdom;
+ $sortkey=$role.$twhere;
} else {
$ttype=&mt('System');
$twhere=&mt('system wide');
+ $sortkey=$role.$twhere;
}
- $r->print('<tr bgcolor='.$tbg.'>');
+ $roletext.='<tr bgcolor='.$tbg.'>';
unless ($nochoose) {
if (!$button) {
if ($switchserver) {
- $r->print('<td><a href="/adm/logout?handover='.
- $switchserver.'">'.&mt('Switch Server').'</a></td>');
+ $roletext.='<td><a href="/adm/logout?handover='.
+ $switchserver.'">'.&mt('Switch Server').'</a></td>';
} else {
- $r->print('<td> </td>');
+ $roletext.=('<td> </td>');
}
} elsif ($tstatus eq 'is') {
- $r->print('<td><input type=submit value="'.
+ $roletext.=('<td><input type=submit value="'.
&mt('Select').'" name="'.
$trolecode.'"></td>');
} elsif ($tryagain) {
- $r->print
- ('<td><input type=submit value="'.
- &mt('Try Selecting Again').'" name="'.$trolecode.'"></td>');
+ $roletext.=
+ '<td><input type=submit value="'.
+ &mt('Try Selecting Again').'" name="'.$trolecode.'"></td>';
} elsif ($advanced) {
- $r->print
- ('<td><input type=submit value="'.
- &mt('Re-Initialize').'" name="'.$trolecode.'"></td>');
+ $roletext.=
+ '<td><input type=submit value="'.
+ &mt('Re-Initialize').'" name="'.$trolecode.'"></td>';
} else {
- $r->print('<td> </td>');
+ $roletext.='<td> </td>';
}
}
$tremark.=&Apache::lonannounce::showday(time,1,
&Apache::lonannounce::readcalendar($tdom.'_'.$trest));
- $r->print('<td><font color="'.$tfont.'">'.$trole.
+ $roletext.='<td><font color="'.$tfont.'">'.$trole.
'</font></td><td><font color="'.$tfont.'">'.$ttype.
'</font></td><td><font color="'.$tfont.'">'.$twhere.
'</font></td><td><font color="'.$tfont.'">'.$tpstart.
'</font></td><td><font color="'.$tfont.'">'.$tpend.
'</font></td><td><font color="'.$tfont.'">'.$tremark.
- ' </font></td></tr>'."\n");
+ ' </font></td></tr>'."\n";
+ $roletext{$envkey}=$roletext;
+ if (!$sortkey) {$sortkey=$twhere."\0".$envkey;}
+ $sortrole{$sortkey}=$envkey;
+ $roleclass{$envkey}=$ttype;
}
}
+ }
+ foreach my $type ('Construction Space','Course','Domain','System') {
+ foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
+ if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
+ $r->print($roletext{$sortrole{$which}});
+ }
+ }
}
my $tremark='';
my $tfont='#003300';