--- loncom/auth/lonroles.pm 2006/06/02 13:58:37 1.153
+++ loncom/auth/lonroles.pm 2006/12/05 02:55:56 1.172
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.153 2006/06/02 13:58:37 raeburn Exp $
+# $Id: lonroles.pm,v 1.172 2006/12/05 02:55:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,8 +40,9 @@ use Apache::lonhtmlcommon;
use Apache::lonannounce;
use Apache::lonlocal;
use Apache::lonpageflip();
+use Apache::lonnavdisplay();
use GDBM_File;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub redirect_user {
@@ -53,8 +54,8 @@ sub redirect_user {
my $swinfo=&Apache::lonmenu::rawconfig();
my $navwindow;
if ($launch_nav eq 'on') {
- $navwindow.=&Apache::lonnavmaps::launch_win('now',undef,undef,
- ($url =~ m-^/adm/whatsnew-));
+ $navwindow.=&Apache::lonnavdisplay::launch_win('now',undef,undef,
+ ($url =~ m-^/adm/whatsnew-));
} else {
$navwindow.=&Apache::lonnavmaps::close();
}
@@ -88,7 +89,7 @@ sub error_page {
&Apache::lonmenu::rawconfig().''.
'
'.&mt('The following problems occurred:').
$error.
- '
'.&mt('Continue').''.
&Apache::loncommon::end_page());
}
@@ -125,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);
}
@@ -149,8 +150,10 @@ sub handler {
# store role if recent_role list being kept
if ($env{'environment.recentroles'}) {
+ my %frozen_roles =
+ &Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'});
&Apache::lonhtmlcommon::store_recent('roles',
- $trolecode,' ');
+ $trolecode,' ',$frozen_roles{$trolecode});
}
@@ -162,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(
@@ -264,20 +267,15 @@ ENDENTERKEY
}
return OK;
} else {
- my $type = 'Course/Group';
- if ($env{'request.course.id'}) {
- if (defined($env{'course.'.
- $env{'request.course.id'}.'.type'})) {
- $type = $env{'course.'.
- $env{'request.course.id'}.'.type'};
- }
+ if (!$env{'request.course.id'}) {
&Apache::lonnet::appenv(
"request.course.id" => $cdom.'_'.$cnum);
$furl='/adm/roles?tryagain=1';
$msg=
- ''.
- &mt('Could not initialize [_1] at this time.',lc($type)).
- '
'.&mt('Please try again.').'
'.$ferr;
+ ''.
+ &mt('Could not initialize [_1] at this time.',
+ $env{'course.'.$cdom.'_'.$cnum.'.description'}).
+ '
'.&mt('Please try again.').'
'.$ferr;
}
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
&Apache::lonnet::appenv('request.role.adv'=>$tadv);
@@ -305,7 +303,8 @@ ENDENTERKEY
) {
my $startpage = &courseloadpage($courseid);
unless ($startpage eq 'firstres') {
- $msg = &mt('Entering [_1] ....',lc($type));
+ $msg = &mt('Entering [_1] ....',
+ $env{'course.'.$courseid.'.description'});
&redirect_user($r,&mt('New in course'),
'/adm/whatsnew?refpage=start',$msg,
$env{'environment.remotenavmap'});
@@ -314,12 +313,14 @@ ENDENTERKEY
}
}
# Are we allowed to look at the first resource?
- if (!&Apache::lonnet::allowed('bre',$furl)) {
+ if ($furl !~ m|^/adm/|) {
# Guess not ...
$furl=&Apache::lonpageflip::first_accessible_resource();
}
- $msg = &mt('Entering [_1] ...',lc($type));
- &redirect_user($r,&mt('Entering [_1]',$type),
+ $msg = &mt('Entering [_1] ...',
+ $env{'course.'.$courseid.'.description'});
+ &redirect_user($r,&mt('Entering [_1]',
+ $env{'course.'.$courseid.'.description'}),
$furl,$msg,
$env{'environment.remotenavmap'});
}
@@ -364,10 +365,10 @@ ENDENTERKEY
my $start_page=&Apache::loncommon::start_page('User Roles');
my $standby=&mt('Role selected. Please stand by.');
$standby=~s/\n/\\n/g;
- my $helptag=''.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).' |
';
+
$r->print(<
+