Diff for /loncom/auth/lonroles.pm between versions 1.298 and 1.302

version 1.298, 2014/02/28 19:19:41 version 1.302, 2014/05/04 21:49:05
Line 664  ENDENTERKEY Line 664  ENDENTERKEY
  }   }
     }      }
  }   }
 # Are we allowed to look at the first resource?                                  # Are we allowed to look at the first resource?
  if ($furl !~ m|^/adm/|) {                                  if ($furl =~ m{^(/adm/wrapper|)/ext/}) {
 # Guess not ...                                      # If it's an external resource,
     $furl=&Apache::lonpageflip::first_accessible_resource();                                      # strip off the symb argument and possible query
  }                                      my ($exturl,$symb) = ($furl =~ m{^(.+)(?:\?|\&)symb=(.+)$});
                                       # Unencode $symb
                                       $symb = &unescape($symb);
                                       # Then check for permission
                                       if (!&Apache::lonnet::allowed('bre',$exturl,$symb)) {
                                           $furl = &Apache::lonpageflip::first_accessible_resource();
                                       }
                                   # For other resources just check for permission
                                   } elsif (!&Apache::lonnet::allowed('bre',$furl)) {
                                       $furl = &Apache::lonpageflip::first_accessible_resource();
                                   }
    
                                 $msg = &mt('Entering [_1] ...',                                  $msg = &mt('Entering [_1] ...',
    $env{'course.'.$cdom.'_'.$cnum.'.description'});     $env{'course.'.$cdom.'_'.$cnum.'.description'});
  &redirect_user($r, &mt('Entering [_1]',   &redirect_user($r, &mt('Entering [_1]',
Line 735  ENDENTERKEY Line 746  ENDENTERKEY
   
     my $swinfo=&Apache::lonmenu::rawconfig();      my $swinfo=&Apache::lonmenu::rawconfig();
     my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum});      my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum});
     my $funcs = &get_roles_functions($showcount);      my %domdefs=&Apache::lonnet::get_domain_defaults($env{'user.domain'}); 
       my $cattype = 'std';
       if ($domdefs{'catauth'}) {
           $cattype = $domdefs{'catauth'};
       }
       my $funcs = &get_roles_functions($showcount,$cattype);
     $standby=~s/\n/\\n/g;      $standby=~s/\n/\\n/g;
     my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />';      my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />';
   
Line 878  ENDHEADER Line 894  ENDHEADER
                       \%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev);                        \%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev);
     $refresh = $now;      $refresh = $now;
     &Apache::lonnet::appenv({'user.refresh.time'  => $refresh});      &Apache::lonnet::appenv({'user.refresh.time'  => $refresh});
     unless ($env{'user.adv'}) {       if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'})) {
         if ($countactive > 0) {          if ($countactive > 0) {
             my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');              my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
             my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');               my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); 
Line 907  ENDHEADER Line 923  ENDHEADER
  } else {   } else {
     $r->print('<h2>'.&mt('Currently no active roles, courses or communities').'</h2>');      $r->print('<h2>'.&mt('Currently no active roles, courses or communities').'</h2>');
  }   }
         &findcourse_advice($r);          &requestcourse_advice($r,$cattype); 
         &requestcourse_advice($r);   
  $r->print('</form>');   $r->print('</form>');
         if ($countfuture) {          if ($countfuture) {
             $r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));              $r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
Line 1396  sub print_rolerows { Line 1411  sub print_rolerows {
 }  }
   
 sub findcourse_advice {  sub findcourse_advice {
     my ($r) = @_;      my ($r,$cattype) = @_;
     my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');      my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
     my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');      my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
     if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) {      if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) {
Line 1411  sub findcourse_advice { Line 1426  sub findcourse_advice {
     } else {      } else {
         $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'<br />');          $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'<br />');
     }      }
     $r->print('<h3>'.&mt('Self-Enrollment').'</h3>'.      if (($cattype eq 'std') || ($cattype eq 'domonly')) {
               '<p>'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a>',$domdesc).'<br />');          $r->print('<h3>'.&mt('Self-Enrollment').'</h3>'.
     $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'</p>'.                    '<p>'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a>',$domdesc).'<br />');
               &Apache::loncoursequeueadmin::queued_selfenrollment());          $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'</p>'.
           &Apache::loncoursequeueadmin::queued_selfenrollment());
       }
     return;      return;
 }  }
   
 sub requestcourse_advice {  sub requestcourse_advice {
     my ($r) = @_;      my ($r,$cattype) = @_;
     my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');      my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
     my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');      my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
     my (%can_request,%request_doms);      my (%can_request,%request_doms);
Line 1467  sub requestcourse_advice { Line 1484  sub requestcourse_advice {
             }               } 
             $r->print('</ul>'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','<a href="'.$requrl.'">','</a>').'</p>');              $r->print('</ul>'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','<a href="'.$requrl.'">','</a>').'</p>');
         }          }
       } elsif (!$env{'user.adv'}) {
           &findcourse_advice($r,$cattype);
     }      }
     return;      return;
 }  }
Line 1739  sub check_release_required { Line 1758  sub check_release_required {
             my $otherserver;              my $otherserver;
             if (($major eq '' && $minor eq '') ||               if (($major eq '' && $minor eq '') || 
                 (($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) {                  (($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) {
                 my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'});                  my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'},undef,$required);
                 my $switchlcrev =                   my $switchlcrev = 
                     &Apache::lonnet::get_server_loncaparev($env{'user.domain'},                      &Apache::lonnet::get_server_loncaparev($env{'user.domain'},
                                                            $userdomserver);                                                             $userdomserver);
Line 2693  sub is_active_course { Line 2712  sub is_active_course {
 }  }
   
 sub get_roles_functions {  sub get_roles_functions {
     my ($rolescount) = @_;      my ($rolescount,$cattype) = @_;
     my @links;      my @links;
     push(@links,["javascript:rolesView('doupdate');",'start-here-22x22',&mt('Check for changes')]);      push(@links,["javascript:rolesView('doupdate');",'start-here-22x22',&mt('Check for changes')]);
     if ($env{'environment.canrequest.author'}) {      if ($env{'environment.canrequest.author'}) {
Line 2719  sub get_roles_functions { Line 2738  sub get_roles_functions {
             push(@links,["javascript:rolesView('showall');",'edit-undo-22x22',&mt('Include expired')]);              push(@links,["javascript:rolesView('showall');",'edit-undo-22x22',&mt('Include expired')]);
         }          }
     }      }
     if (&Apache::loncommon::designparm('login.coursecatalog',$env{'user.domain'})) {      unless ($cattype eq 'none') {
         push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]);          push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]);
     }      }
     my $funcs = &Apache::lonhtmlcommon::start_funclist();      my $funcs = &Apache::lonhtmlcommon::start_funclist();

Removed from v.1.298  
changed lines
  Added in v.1.302


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>