+//
+
+$navwindow
+$msg
+$end_page
+ENDREDIR
+ return;
+}
+
+sub error_page {
+ my ($r,$error,$dest)=@_;
+ &Apache::loncommon::content_type($r,'text/html');
+ &Apache::loncommon::no_cache($r);
$r->send_http_header;
return OK if $r->header_only;
+ $r->print(&Apache::loncommon::start_page('Problems during Course Initialization').
+ ''.
+ ''.&mt('The following problems occurred:').
+ '
'.
+ $error.
+ '
'.&mt('Continue').''.
+ &Apache::loncommon::end_page());
+}
-# ---------------------------------------------------------------- Print Header
- $r->print(<
-
-LON-CAPA User Roles
-ENDHEADER
- if ($ENV{'form.orgurl'}) {
- $r->print('');
- }
- $r->print('');
+sub handler {
+
+ my $r = shift;
my $now=time;
- my $then=$ENV{'user.login.time'};
+ my $then=$env{'user.login.time'};
+ my $refresh=$env{'user.refresh.time'};
+ if (!$refresh) {
+ $refresh = $then;
+ }
my $envkey;
+ my %dcroles = ();
+ my $numdc = &check_fordc(\%dcroles,$then);
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
# ================================================================== Roles Init
+ if ($env{'form.selectrole'}) {
- if ($ENV{'form.selectrole'}) {
- foreach $envkey (keys %ENV) {
- if ($envkey=~/^user\.role\./) {
- my ($dum1,$dum2,$role,@pwhere)=split(/\./,$envkey);
- my $where=join('.',@pwhere);
- my $trolecode=$role.'.'.$where;
- if ($ENV{'form.'.$trolecode}) {
- my ($tstart,$tend)=split(/\./,$ENV{$envkey});
- my $tstatus='is';
- if ($tstart) {
- if ($tstart>$then) {
- $tstatus='future';
- }
- }
- if ($tend) {
- if ($tend<$then) { $tstatus='expired'; }
- if ($tend>$now) { $tstatus='will_not'; }
- }
- if ($tstatus eq 'is') {
- &Apache::lonnet::appenv('request.role' => $trolecode);
- my ($cdom,$cnum)=split(/\//,$where);
- if ($cnum) {
- &Apache::lonuserstate::readmap($where);
- $r->print('Role initialized