Diff for /loncom/auth/lonroles.pm between versions 1.301 and 1.305

version 1.301, 2014/03/25 09:41:16 version 1.305, 2014/05/20 20:46:13
Line 128  package Apache::lonroles; Line 128  package Apache::lonroles;
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lonuserstate();  use Apache::lonuserstate();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common REDIRECT);
 use Apache::File();  use Apache::File();
 use Apache::lonmenu;  use Apache::lonmenu;
 use Apache::loncommon;  use Apache::loncommon;
Line 202  sub handler { Line 202  sub handler {
   
     my $r = shift;      my $r = shift;
   
       # Check for critical messages and redirect if present.  
       my ($redirect,$url) = &Apache::loncommon::critical_redirect(300);
       if ($redirect) {
           &Apache::loncommon::content_type($r,'text/html');
           $r->header_out(Location => $url);
           return REDIRECT;
       }
   
     my $now=time;      my $now=time;
     my $then=$env{'user.login.time'};      my $then=$env{'user.login.time'};
     my $refresh=$env{'user.refresh.time'};      my $refresh=$env{'user.refresh.time'};
Line 247  sub handler { Line 255  sub handler {
     my $envkey;      my $envkey;
     my %dcroles = ();      my %dcroles = ();
     my $numdc = &check_fordc(\%dcroles,$update,$then);      my $numdc = &check_fordc(\%dcroles,$update,$then);
     my $loncaparev = $Apache::lonnet::perlvar{'lonVersion'};      my $loncaparev = $r->dir_config('lonVersion');
   
 # ================================================================== Roles Init  # ================================================================== Roles Init
     if ($env{'form.selectrole'}) {      if ($env{'form.selectrole'}) {
Line 746  ENDENTERKEY Line 754  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 889  ENDHEADER Line 902  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 918  ENDHEADER Line 931  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 1407  sub print_rolerows { Line 1419  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 1422  sub findcourse_advice { Line 1434  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 1478  sub requestcourse_advice { Line 1492  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 1750  sub check_release_required { Line 1766  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'},undef,$required);                  my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'},undef,$required,1);
                 my $switchlcrev =                   my $switchlcrev = 
                     &Apache::lonnet::get_server_loncaparev($env{'user.domain'},                      &Apache::lonnet::get_server_loncaparev($env{'user.domain'},
                                                            $userdomserver);                                                             $userdomserver);
Line 1759  sub check_release_required { Line 1775  sub check_release_required {
                     (($reqdmajor == $swmajor) && ($reqdminor > $swminor))) {                      (($reqdmajor == $swmajor) && ($reqdminor > $swminor))) {
                     my $cdom = $env{'course.'.$tcourseid.'.domain'};                      my $cdom = $env{'course.'.$tcourseid.'.domain'};
                     if ($cdom ne $env{'user.domain'}) {                      if ($cdom ne $env{'user.domain'}) {
                         my ($coursedomserver,$coursehostname) = &Apache::lonnet::choose_server($cdom);                           my ($coursedomserver,$coursehostname) = &Apache::lonnet::choose_server($cdom,undef,$required,1); 
                         my $serverhomeID = &Apache::lonnet::get_server_homeID($coursehostname);                          my $serverhomeID = &Apache::lonnet::get_server_homeID($coursehostname);
                         my $serverhomedom = &Apache::lonnet::host_domain($serverhomeID);                          my $serverhomedom = &Apache::lonnet::host_domain($serverhomeID);
                         my %defdomdefaults = &Apache::lonnet::get_domain_defaults($serverhomedom);                          my %defdomdefaults = &Apache::lonnet::get_domain_defaults($serverhomedom);
Line 2704  sub is_active_course { Line 2720  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 2730  sub get_roles_functions { Line 2746  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.301  
changed lines
  Added in v.1.305


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