version 1.147, 2006/04/05 22:39:55
|
version 1.151, 2006/05/30 19:47:36
|
Line 39 use Apache::loncommon;
|
Line 39 use Apache::loncommon;
|
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::lonannounce; |
use Apache::lonannounce; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonpageflip(); |
use GDBM_File; |
use GDBM_File; |
|
use LONCAPA; |
|
|
|
|
sub redirect_user { |
sub redirect_user { |
my ($r,$title,$url,$msg,$launch_nav) = @_; |
my ($r,$title,$url,$msg,$launch_nav) = @_; |
Line 74 ENDREDIR
|
Line 77 ENDREDIR
|
return; |
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'). |
|
'<script type="text/javascript">'. |
|
&Apache::lonmenu::rawconfig().'</script>'. |
|
'<p>'.&mt('The following problems occurred:'). |
|
$error. |
|
'</p><br /><a href="'.$dest.'>'.&mt('Continue').'</a>'. |
|
&Apache::loncommon::end_page()); |
|
} |
|
|
sub handler { |
sub handler { |
|
|
my $r = shift; |
my $r = shift; |
Line 83 sub handler {
|
Line 101 sub handler {
|
my $envkey; |
my $envkey; |
my %dcroles = (); |
my %dcroles = (); |
my $numdc = &check_fordc(\%dcroles,$then); |
my $numdc = &check_fordc(\%dcroles,$then); |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($env{'form.selectrole'}) { |
if ($env{'form.selectrole'}) { |
Line 238 ENDENTERKEY
|
Line 257 ENDENTERKEY
|
my $dest=$env{'form.orgurl'}; |
my $dest=$env{'form.orgurl'}; |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
&Apache::lonnet::appenv('request.role.adv'=>$tadv); |
&Apache::lonnet::appenv('request.role.adv'=>$tadv); |
$r->internal_redirect($dest); |
if (($ferr) && ($tadv)) { |
|
&error_page($r,$ferr,$dest); |
|
} else { |
|
$r->internal_redirect($dest); |
|
} |
return OK; |
return OK; |
} else { |
} else { |
unless ($env{'request.course.id'}) { |
unless ($env{'request.course.id'}) { |
Line 252 ENDENTERKEY
|
Line 275 ENDENTERKEY
|
} |
} |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
&Apache::lonnet::appenv('request.role.adv'=>$tadv); |
&Apache::lonnet::appenv('request.role.adv'=>$tadv); |
|
if (($ferr) && ($tadv)) { |
# Check to see if the user is a CC entering a course |
&error_page($r,$ferr,$furl); |
# for the first time |
} else { |
my (undef, undef, $role, $courseid) = split(/\./, $envkey); |
# Check to see if the user is a CC entering a course |
if (substr($courseid, 0, 1) eq '/') { |
# for the first time |
$courseid = substr($courseid, 1); |
my (undef, undef, $role, $courseid) = split(/\./, $envkey); |
} |
if (substr($courseid, 0, 1) eq '/') { |
$courseid =~ s/\//_/; |
$courseid = substr($courseid, 1); |
if ($role eq 'cc' && $env{'course.' . $courseid . |
} |
'.course.helper.not.run'}) { |
$courseid =~ s/\//_/; |
$furl = "/adm/helper/course.initialization.helper"; |
if ($role eq 'cc' && $env{'course.' . $courseid . |
# Send the user to the course they selected |
'.course.helper.not.run'}) { |
} elsif ($env{'request.course.id'}) { |
$furl = "/adm/helper/course.initialization.helper"; |
if (&Apache::lonnet::allowed('whn', |
# Send the user to the course they selected |
$env{'request.course.id'}) |
} elsif ($env{'request.course.id'}) { |
|| &Apache::lonnet::allowed('whn', |
if (&Apache::lonnet::allowed('whn', |
$env{'request.course.id'}.'/' |
$env{'request.course.id'}) |
.$env{'request.course.sec'}) |
|| &Apache::lonnet::allowed('whn', |
) { |
$env{'request.course.id'}.'/' |
my $startpage = &courseloadpage($courseid); |
.$env{'request.course.sec'}) |
unless ($startpage eq 'firstres') { |
) { |
$msg = &mt('Entering course ....'); |
my $startpage = &courseloadpage($courseid); |
&redirect_user($r,&mt('New in course'), |
unless ($startpage eq 'firstres') { |
'/adm/whatsnew?refpage=start',$msg, |
$msg = &mt('Entering course ....'); |
$env{'environment.remotenavmap'}); |
&redirect_user($r,&mt('New in course'), |
return OK; |
'/adm/whatsnew?refpage=start',$msg, |
} |
$env{'environment.remotenavmap'}); |
} |
return OK; |
|
} |
|
} |
|
} |
|
# Are we allowed to look at the first resource? |
|
if (!&Apache::lonnet::allowed('bre',$furl)) { |
|
# Guess not ... |
|
$furl=&Apache::lonpageflip::first_accessible_resource(); |
|
} |
|
&redirect_user($r,&mt('Entering Course'), |
|
$furl,$msg, |
|
$env{'environment.remotenavmap'}); |
} |
} |
&redirect_user($r,&mt('Entering Course'), |
|
$furl,$msg, |
|
$env{'environment.remotenavmap'}); |
|
return OK; |
return OK; |
} |
} |
} |
} |
Line 378 ENDHEADER
|
Line 409 ENDHEADER
|
$last=$hash{'last_known'}; |
$last=$hash{'last_known'}; |
untie(%hash); |
untie(%hash); |
} |
} |
if ($last) { $fn.='?symb='.&Apache::lonnet::escape($last); } |
if ($last) { $fn.='?symb='.&escape($last); } |
|
|
&Apache::londocs::changewarning($r,undef,'You have modified your course recently, [_1] may fix this access problem.', |
&Apache::londocs::changewarning($r,undef,'You have modified your course recently, [_1] may fix this access problem.', |
&Apache::lonenc::check_encrypt($fn)); |
&Apache::lonenc::check_encrypt($fn)); |
Line 391 ENDHEADER
|
Line 422 ENDHEADER
|
} |
} |
# -------------------------------------------------------- Choice or no choice? |
# -------------------------------------------------------- Choice or no choice? |
if ($nochoose) { |
if ($nochoose) { |
if ($advanced) { |
$r->print("<h2>".&mt('Sorry ...')."</h2>\n". |
$r->print("<h2>".&mt('Assigned User Roles')."</h2>\n"); |
&mt('This action is currently not authorized.'). |
} else { |
&Apache::loncommon::end_page()); |
$r->print("<h2>".&mt('Sorry ...')."</h2>\n". |
return OK; |
&mt('This resource might be part of')); |
|
if ($env{'request.course.id'}) { |
|
$r->print(&mt(' another')); |
|
} else { |
|
$r->print(&mt(' a certain')); |
|
} |
|
$r->print(&mt(' course.'). |
|
&Apache::loncommon::end_page()); |
|
return OK; |
|
} |
|
} else { |
} else { |
if ($advanced) { |
if ($advanced) { |
$r->print(&mt("Your home server is "). |
$r->print(&mt("Your home server is "). |
Line 989 sub allcourses_row {
|
Line 1010 sub allcourses_row {
|
|
|
sub recent_filename { |
sub recent_filename { |
my $area=shift; |
my $area=shift; |
return 'nohist_recent_'.&Apache::lonnet::escape($area); |
return 'nohist_recent_'.&escape($area); |
} |
} |
|
|
sub set_privileges { |
sub set_privileges { |