[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 26 Feb 2004 19:43:13 -0000
albertel Thu Feb 26 14:43:13 2004 EDT
Modified files:
/loncom/interface loncreateuser.pm
Log:
- CUSR now sorts and looks more like the roles screen
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.78 loncom/interface/loncreateuser.pm:1.79
--- loncom/interface/loncreateuser.pm:1.78 Sun Feb 1 15:42:01 2004
+++ loncom/interface/loncreateuser.pm Thu Feb 26 14:43:13 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.78 2004/02/01 20:42:01 www Exp $
+# $Id: loncreateuser.pm,v 1.79 2004/02/26 19:43:13 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -250,7 +250,7 @@
'<option value="default" selected>default</option>'."\n".
&Apache::loncommon::home_server_option_list($ccdomain);
- my %lt=&Apache::lonlocal::texthash(
+ my %lt=&Apache::lonlocal::texthash(
'cnu' => "Create New User",
'nu' => "New User",
'id' => "in domain",
@@ -296,7 +296,7 @@
<p>$authformloc </p>
ENDNEWUSER
} else { # user already exists
- my %lt=&Apache::lonlocal::texthash(
+ my %lt=&Apache::lonlocal::texthash(
'cup' => "Change User Privileges",
'usr' => "User",
'id' => "in domain",
@@ -353,14 +353,16 @@
$r->print(<<END);
<hr />
<h3>$lt{'rer'}</h3>
-<table border=2>
+<table>
<tr><th>$lt{'rev'}</th><th>$lt{'del'}</th><th>$lt{'rol'}</th><th>$lt{'ext'}</th><th>$lt{'sta'}</th><th>$lt{'end'}</th>
END
+ my (%roletext,%sortrole,%roleclass);
foreach my $area (sort { my $a1=join('_',(split('_',$a))[1,0]);
my $b1=join('_',(split('_',$b))[1,0]);
return $a1 cmp $b1;
} keys(%rolesdump)) {
next if ($area =~ /^rolesdef/);
+ my $envkey=$area;
my $role = $rolesdump{$area};
my $thisrole=$area;
$area =~ s/\_\w\w$//;
@@ -372,18 +374,24 @@
my $bgcol='ffffff';
my $allowed=0;
my $delallowed=0;
+ my $sortkey=$role_code;
+ my $class='Unknown';
if ($area =~ /^\/(\w+)\/(\d\w+)/ ) {
+ $class='Course';
my ($coursedom,$coursedir) = ($1,$2);
+ $sortkey.="\0$1";
# $1.'_'.$2 is the course id (eg. 103_12345abcef103l3).
my %coursedata=
&Apache::lonnet::coursedescription($1.'_'.$2);
my $carea;
if (defined($coursedata{'description'})) {
- $carea=&mt('Course').': '.$coursedata{'description'}.
+ $carea=$coursedata{'description'}.
'<br />'.&mt('Domain').': '.$coursedom.(' 'x8).
&Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom);
+ $sortkey.="\0".$coursedata{'description'};
} else {
$carea=&mt('Unavailable course').': '.$area;
+ $sortkey.="\0".&mt('Unavailable course');
}
$inccourses{$1.'_'.$2}=1;
if ((&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) ||
@@ -410,6 +418,7 @@
}
$area=$carea;
} else {
+ $sortkey.="\0".$area;
# Determine if current user is able to revoke privileges
if ($area=~ /^\/(\w+)\//) {
if ((&Apache::lonnet::allowed('c'.$role_code,$1)) ||
@@ -426,6 +435,13 @@
$allowed=1;
}
}
+ if ($role_code eq 'ca' || $role_code eq 'au') {
+ $class='Construction Space';
+ } elsif ($role_code eq 'su') {
+ $class='System';
+ } else {
+ $class='Domain';
+ }
}
if ($role_code eq 'ca') {
$area=~/\/(\w+)\/(\w+)/;
@@ -435,6 +451,7 @@
$allowed=0;
}
}
+ $bgcol='77FF77';
my $row = '';
$row.='<tr bgcolor="#'.$bgcol.'"><td>';
my $active=1;
@@ -468,8 +485,24 @@
'</td><td>'.($role_end_time ?localtime($role_end_time)
: ' ' )
."</td></tr>\n";
- $r->print($row);
+ $sortrole{$sortkey}=$envkey;
+ $roletext{$envkey}=$row;
+ $roleclass{$envkey}=$class;
+ #$r->print($row);
} # end of foreach (table building loop)
+ foreach my $type ('Construction Space','Course','Domain','System','Unknown') {
+ my $output;
+ foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
+ if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
+ $output.=$roletext{$sortrole{$which}};
+ }
+ }
+ if (defined($output)) {
+ $r->print("<tr bgcolor='#BBffBB'>".
+ "<td align='center' colspan='7'>".&mt($type)."</td>");
+ }
+ $r->print($output);
+ }
$r->print('</table>');
} # End of unless
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);