version 1.57, 2003/05/21 20:10:53
|
version 1.62, 2003/06/24 15:52:32
|
Line 52 use Apache::lonmenu;
|
Line 52 use Apache::lonmenu;
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonannounce; |
use Apache::lonannounce; |
|
|
|
sub redirect_user { |
|
my ($r,$title,$url,$msg) = @_; |
|
$msg = $title if (! defined($msg)); |
|
$r->content_type('text/html'); |
|
&Apache::loncommon::no_cache($r); |
|
$r->send_http_header; |
|
my $swinfo=&Apache::lonmenu::rawconfig(); |
|
my $bodytag=&Apache::loncommon::bodytag('Switching Role'); |
|
$r->print (<<ENDREDIR); |
|
<head><title>$title</title> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=$url"> |
|
</head> |
|
<html> |
|
$bodytag |
|
<script> |
|
$swinfo |
|
</script> |
|
<h1>$msg</h1> |
|
</body> |
|
</html> |
|
ENDREDIR |
|
return; |
|
} |
|
|
sub handler { |
sub handler { |
|
|
my $r = shift; |
my $r = shift; |
Line 141 ENDENTERKEY
|
Line 165 ENDENTERKEY
|
'request.role.domain' => $cdom, |
'request.role.domain' => $cdom, |
'request.course.sec' => $csec); |
'request.course.sec' => $csec); |
my $msg='Entering course ...'; |
my $msg='Entering course ...'; |
|
|
if (($cnum) && ($role ne 'ca')) { |
if (($cnum) && ($role ne 'ca')) { |
my ($furl,$ferr)= |
my ($furl,$ferr)= |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
Line 152 ENDENTERKEY
|
Line 177 ENDENTERKEY
|
unless ($ENV{'request.course.id'}) { |
unless ($ENV{'request.course.id'}) { |
&Apache::lonnet::appenv( |
&Apache::lonnet::appenv( |
"request.course.id" => $cdom.'_'.$cnum); |
"request.course.id" => $cdom.'_'.$cnum); |
$furl='/adm/notfound.html'; |
$furl='/adm/roles?tryagain=1'; |
$msg= |
$msg= |
'<h1><font color=red>Could not initialize top-level map.</font></h1>'; |
'<h1><font color=red>Could not initialize course at this time.</font></h1><h3>Please try again.</h3>'; |
} |
} |
$r->content_type('text/html'); |
|
&Apache::loncommon::no_cache($r); |
# Check to see if the user is a CC entering a course |
$r->send_http_header; |
# for the first time |
my $swinfo=&Apache::lonmenu::rawconfig(); |
my (undef, undef, $role, $courseid) = split(/\./, $envkey); |
my $bodytag=&Apache::loncommon::bodytag('Switching Role'); |
if (substr($courseid, 0, 1) eq '/') { |
print (<<ENDREDIR); |
$courseid = substr($courseid, 1); |
<head><title>Entering Course</title> |
} |
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=$furl"> |
$courseid =~ s/\//_/; |
</head> |
if ($role eq 'cc' && $ENV{'course.' . $courseid . |
<html> |
'.course.helper.not.run'}) { |
$bodytag |
$furl = "/adm/helper/course.initialization.helper"; |
<script> |
} |
$swinfo |
# |
</script> |
# Send the user to the course they selected |
<h1>$msg</h1> |
&redirect_user($r,'Entering Course', |
</body> |
$furl,$msg); |
</html> |
|
ENDREDIR |
|
return OK; |
return OK; |
} |
} |
} |
} |
|
# |
|
# Send the user to the construction space they selected |
|
if ($role =~ /^(au|ca)$/) { |
|
my $redirect_url = '/priv/'; |
|
if ($role eq 'au') { |
|
$redirect_url.=$ENV{'user.name'}; |
|
} else { |
|
$where =~ /\/(.*)$/; |
|
$redirect_url .= $1; |
|
} |
|
$redirect_url .= '/'; |
|
&redirect_user($r,'Entering Construction Space', |
|
$redirect_url); |
|
return OK; |
|
} |
} |
} |
} |
} |
} |
} |
Line 215 ENDHEADER
|
Line 253 ENDHEADER
|
"$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn); |
"$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn); |
} |
} |
|
|
# ---------------------------------------------------------------- Who is this? |
# ------------------------------------------------- Can this user re-init, etc? |
|
|
my $advanced=0; |
my $advanced=$ENV{'user.adv'}; |
foreach $envkey (keys %ENV) { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['tryagain']); |
if ($envkey=~/^user\.role\./) { |
my $tryagain=$ENV{'form.tryagain'}; |
my (undef,undef,$role,@pwhere)=split(/\./,$envkey); |
|
if ($role ne 'st') { $advanced=1; } |
|
} |
|
} |
|
|
|
# -------------------------------------------------------- Generate Page Output |
# -------------------------------------------------------- Generate Page Output |
# --------------------------------------------------------------- Error Header? |
# --------------------------------------------------------------- Error Header? |
Line 263 ENDHEADER
|
Line 297 ENDHEADER
|
$r->print("Author and Co-Author roles may not be available on ". |
$r->print("Author and Co-Author roles may not be available on ". |
"servers other than your home server."); |
"servers other than your home server."); |
} else { |
} else { |
$r->print("<h2>Enter a Course</h2>\n"); |
$r->print("<h2>Select a Course to Enter</h2>\n"); |
} |
} |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
Line 430 ENDHEADER
|
Line 464 ENDHEADER
|
} elsif ($tstatus eq 'is') { |
} elsif ($tstatus eq 'is') { |
$r->print('<td><input type=submit value=Select name="'. |
$r->print('<td><input type=submit value=Select name="'. |
$trolecode.'"></td>'); |
$trolecode.'"></td>'); |
} elsif ($ENV{'user.adv'}) { |
} elsif ($tryagain) { |
|
$r->print |
|
('<td><input type=submit value="Try Selecting Again"'. |
|
' name="'.$trolecode.'"></td>'); |
|
} elsif ($advanced) { |
$r->print |
$r->print |
('<td><input type=submit value="Re-Initialize"'. |
('<td><input type=submit value="Re-Initialize"'. |
' name="'.$trolecode.'"></td>'); |
' name="'.$trolecode.'"></td>'); |