-
-LON-CAPA User Roles
-
-$bodytag
-
ENDHEADER
# ------------------------------------------ Get Error Message from Environment
- my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$ENV{'user.error.msg'});
- if ($ENV{'user.error.msg'}) {
- $r->log_reason(
- "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn);
+ my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$env{'user.error.msg'});
+ if ($env{'user.error.msg'}) {
+ $r->log_reason(
+ "$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'};
+ my $reinit=$env{'user.reinit'};
+ delete $env{'user.reinit'};
# -------------------------------------------------------- Generate Page Output
# --------------------------------------------------------------- Error Header?
if ($error) {
- $r->print("LON-CAPA Access Control
");
- $r->print("
Access : ".
- Apache::lonnet::plaintext($priv)."\n");
- $r->print("Resource: $fn\n");
- $r->print("Action : $msg\n
");
- } else {
- if ($ENV{'user.error.msg'}) {
- $r->print(
- 'You need to choose another user role or '.
- 'enter a specific course for this function
');
+ $r->print("".&mt('LON-CAPA Access Control')."
");
+ $r->print("
");
+ if ($priv ne '') {
+ $r->print(&mt('Access : ').&Apache::lonnet::plaintext($priv)."\n");
+ }
+ if ($fn ne '') {
+ $r->print(&mt('Resource: ').&Apache::lonenc::check_encrypt($fn)."\n");
+ }
+ if ($msg ne '') {
+ $r->print(&mt('Action : ').$msg."\n");
}
+ $r->print("
");
+ my $url=$fn;
+ my $last;
+ if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
+ &GDBM_READER(),0640)) {
+ $last=$hash{'last_known'};
+ untie(%hash);
+ }
+ if ($last) { $fn.='?symb='.&escape($last); }
+
+ &Apache::londocs::changewarning($r,undef,'You have modified your course recently, [_1] may fix this access problem.',
+ &Apache::lonenc::check_encrypt($fn));
+ } else {
+ if ($env{'user.error.msg'}) {
+ if ($reinit) {
+ $r->print(
+ ''.
+ &mt('As your session file for the course has expired, you will need to re-select the course.').'
');
+ } else {
+ $r->print(
+ ''.
+ &mt('You need to choose another user role or enter a specific course for this function').'
');
+ }
+ }
}
# -------------------------------------------------------- Choice or no choice?
if ($nochoose) {
- if ($advanced) {
- $r->print("Assigned User Roles
\n");
- } else {
- $r->print("Sorry ...
\nThis resource might be part of");
- if ($ENV{'request.course.id'}) {
- $r->print(' another');
- } else {
- $r->print(' a certain');
- }
- $r->print(' course.