--- loncom/auth/lonroles.pm 2006/10/20 22:05:55 1.169
+++ loncom/auth/lonroles.pm 2006/12/11 21:56:53 1.173
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.169 2006/10/20 22:05:55 albertel Exp $
+# $Id: lonroles.pm,v 1.173 2006/12/11 21:56:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,7 +42,7 @@ use Apache::lonlocal;
use Apache::lonpageflip();
use Apache::lonnavdisplay();
use GDBM_File;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub redirect_user {
@@ -126,7 +126,7 @@ sub handler {
if ($numdc > 0) {
foreach my $envkey (keys %env) {
if (my ($domain,$coursenum) =
- ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-)) {
+ ($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) {
if ($dcroles{$domain}) {
&check_privs($domain,$coursenum,$then,$now);
}
@@ -165,7 +165,7 @@ sub handler {
my $authnum=$cnum;
if ($env{'course.'.$cdom.'_'.$cnum.'.keyauth'}) {
($authnum,$authdom)=
- split(/\W/,$env{'course.'.$cdom.'_'.$cnum.'.keyauth'});
+ split(/:/,$env{'course.'.$cdom.'_'.$cnum.'.keyauth'});
}
# check with key authority
unless (&Apache::lonnet::validate_access_key(
@@ -639,14 +639,14 @@ ENDHEADER
# More than one possible role
# ----------------------------------------------------------------------- Table
unless (($advanced) || ($nochoose)) {
- $r->print("
".&mt('Select a Course/Group to Enter')."
\n");
+ $r->print("".&mt('Select a Course to Enter')."
\n");
}
$r->print('
');
unless ($nochoose) { $r->print(' | '); }
$r->print(''.&mt('User Role').' | '.&mt('Extent').
' | '.&mt('Start').' | '.&mt('End').' |
'."\n");
my $doheaders=-1;
- foreach my $type ('Domain','Construction Space','Course','Group','Unavailable','System') {
+ foreach my $type ('Domain','Construction Space','Course','Unavailable','System') {
my $haverole=0;
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
@@ -663,7 +663,8 @@ ENDHEADER
foreach (sort(keys(%recent_roles))) {
if (defined($roletext{'user.role.'.$_})) {
$output.=$roletext{'user.role.'.$_};
- if ($_ =~ m-dc\./(\w+)/- && $dcroles{$1}) {
+ if ($_ =~ m-dc\./($match_domain)/-
+ && $dcroles{$1}) {
$output .= &allcourses_row($1,'recent');
}
} elsif ($numdc > 0) {
@@ -685,12 +686,12 @@ ENDHEADER
$r->print(&coursepick_jscript());
$r->print(&Apache::loncommon::coursebrowser_javascript());
}
- foreach my $type ('Construction Space','Domain','Course','Group','Unavailable','System') {
+ foreach my $type ('Construction Space','Domain','Course','Unavailable','System') {
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 ($sortrole{$which} =~ m-dc\./(\w+)/-) {
+ if ($sortrole{$which} =~ m-dc\./($match_domain)/-) {
if ($dcroles{$1}) {
$output .= &allcourses_row($1,'');
}
@@ -890,7 +891,7 @@ sub check_fordc {
my $numdc = 0;
if ($env{'user.adv'}) {
foreach my $envkey (sort keys %env) {
- if ($envkey=~/^user\.role\.dc\.\/(\w+)\/$/) {
+ if ($envkey=~/^user\.role\.dc\.\/($match_domain)\/$/) {
my $dcdom = $1;
my $livedc = 1;
my ($tstart,$tend)=split(/\./,$env{$envkey});
@@ -911,7 +912,7 @@ sub courselink {
my $courseform=&Apache::loncommon::selectcourse_link
('rolechoice','dccourse'.$rowtype.'_'.$dcdom,
'dcdomain'.$rowtype.'_'.$dcdom,'coursedesc'.$rowtype.'_'.
- $dcdom,$dcdom,undef,$selecttype);
+ $dcdom,$dcdom,undef);
my $hiddenitems = ''.
''.
''.
@@ -987,7 +988,7 @@ sub display_cc_role {
my $advanced = $env{'user.adv'};
my $tryagain = $env{'form.tryagain'};
unless ($rolekey =~/^error\:/) {
- if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) {
+ if ($rolekey =~ m-^user\.role.cc\./($match_domain)/($match_courseid)$-) {
my $tcourseid = $1.'_'.$2;
my $trolecode = 'cc./'.$1.'/'.$2;
my $twhere;
@@ -1017,13 +1018,11 @@ sub allcourses_row {
my ($dcdom,$rowtype) = @_;
my $output = ''.
' ';
- foreach my $type ('Course','Group') {
- my $selectlink = &courselink($dcdom,$rowtype,$type);
- my $ccrole = &Apache::lonnet::plaintext('cc',$type);
- $output.= ''.$ccrole.''.
+ my $selectlink = &courselink($dcdom,$rowtype);
+ my $ccrole = &Apache::lonnet::plaintext('cc');
+ $output.= ''.$ccrole.''.
' '.$selectlink.''.
' from '.&mt('Domain').' '.$dcdom.' ';
- }
$output .= ' |
|
'."\n";
return $output;
}