--- loncom/auth/lonroles.pm 2003/03/24 18:46:44 1.55
+++ loncom/auth/lonroles.pm 2003/06/18 15:05:32 1.61
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.55 2003/03/24 18:46:44 albertel Exp $
+# $Id: lonroles.pm,v 1.61 2003/06/18 15:05:32 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -50,6 +50,7 @@ use Apache::Constants qw(:common);
use Apache::File();
use Apache::lonmenu;
use Apache::loncommon;
+use Apache::lonannounce;
sub handler {
@@ -72,6 +73,7 @@ sub handler {
"request.course.uri" => '',
"request.course.sec" => '',
"request.role" => 'cm',
+ "request.role.adv" => $ENV{'user.adv'},
"request.role.domain" => $ENV{'user.domain'});
foreach $envkey (keys %ENV) {
next if ($envkey!~/^user\.role\./);
@@ -129,9 +131,15 @@ ENDENTERKEY
}
}
}
- &Apache::lonnet::appenv('request.role' => $trolecode,
- 'request.role.domain' => $cdom,
- 'request.course.sec' => $csec);
+ my $tadv=0;
+ if (($trolecode!~/^st/) &&
+ ($trolecode!~/^ta/) &&
+ ($trolecode!~/^cm/)) { $tadv=1; }
+ &Apache::lonnet::appenv(
+ 'request.role' => $trolecode,
+ 'request.role.adv' => $tadv,
+ 'request.role.domain' => $cdom,
+ 'request.course.sec' => $csec);
my $msg='Entering course ...';
if (($cnum) && ($role ne 'ca')) {
my ($furl,$ferr)=
@@ -144,10 +152,23 @@ ENDENTERKEY
unless ($ENV{'request.course.id'}) {
&Apache::lonnet::appenv(
"request.course.id" => $cdom.'_'.$cnum);
- $furl='/adm/notfound.html';
+ $furl='/adm/roles?tryagain=1';
$msg=
- '
Could not initialize top-level map.
';
+ '
Could not initialize course at this time.
Please try again.
';
}
+
+ # Check to see if the user is a CC entering a course
+ # for the first time
+ my (undef, undef, $role, $courseid) = split(/\./, $envkey);
+ if (substr($courseid, 0, 1) eq '/') {
+ $courseid = substr($courseid, 1);
+ }
+ $courseid =~ s/\//_/;
+ if ($role eq 'cc' && $ENV{'course.' . $courseid .
+ '.course.helper.not.run'}) {
+ $furl = "/adm/helper/course.initialization.helper";
+ }
+
$r->content_type('text/html');
&Apache::loncommon::no_cache($r);
$r->send_http_header;
@@ -207,15 +228,11 @@ ENDHEADER
"$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn);
}
-# ---------------------------------------------------------------- Who is this?
+# ------------------------------------------------- Can this user re-init, etc?
- my $advanced=0;
- foreach $envkey (keys %ENV) {
- if ($envkey=~/^user\.role\./) {
- my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
- if ($role ne 'st') { $advanced=1; }
- }
- }
+ my $advanced=$ENV{'user.adv'};
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['tryagain']);
+ my $tryagain=$ENV{'form.tryagain'};
# -------------------------------------------------------- Generate Page Output
# --------------------------------------------------------------- Error Header?
@@ -255,7 +272,7 @@ ENDHEADER
$r->print("Author and Co-Author roles may not be available on ".
"servers other than your home server.");
} else {
- $r->print("