Diff for /loncom/auth/lonroles.pm between versions 1.269.2.32 and 1.269.2.37.2.1

version 1.269.2.32, 2017/03/13 20:43:13 version 1.269.2.37.2.1, 2020/09/08 04:33:36
Line 209  sub handler { Line 209  sub handler {
     my $r = shift;      my $r = shift;
   
     # Check for critical messages and redirect if present.      # Check for critical messages and redirect if present.
     my ($redirect,$url) = &Apache::loncommon::critical_redirect(300);      my ($redirect,$url) = &Apache::loncommon::critical_redirect(300,'roles');
     if ($redirect) {      if ($redirect) {
         &Apache::loncommon::content_type($r,'text/html');          &Apache::loncommon::content_type($r,'text/html');
         $r->header_out(Location => $url);          $r->header_out(Location => $url);
Line 590  ENDENTERKEY Line 590  ENDENTERKEY
                                     {$env{'user.name'}.':'.$env{'user.domain'}.                                      {$env{'user.name'}.':'.$env{'user.domain'}.
                                      ':'.$csec.':'.$role => $now},$cdom,$cnum);                                       ':'.$csec.':'.$role => $now},$cdom,$cnum);
                             }                              }
                               if (($env{"environment.internal.$cdom.$cnum.$role.adhoc"}) &&
                                   (&Apache::lonnet::allowed('vxc',$cdom.'_'.$cnum))) {
                                   my $owner = $env{'course.'.$cdom.'_'.$cnum.'.internal.courseowner'};
                                   my @coowners = split(/,/,$env{'course.'.$env{'request.course.id'}.'.internal.co-owners'});
                                   my %auaccess;
                                   foreach my $user ($owner,@coowners) {
                                       my ($cpname,$cpdom) = split(/:/,$user);
                                       my %auroles = &Apache::lonnet::get_my_roles($cpname,$cpdom,'userroles',undef,['au','ca','aa'],[$cdom]);
                                       foreach my $key (keys(%auroles)) {
                                           my ($auname,$audom,$aurole) = split(/:/,$key);
                                           if ($aurole eq 'au') {
                                               $auaccess{$cpname} = 1;
                                           } else {
                                               $auaccess{$auname} = 1;
                                           }
                                       }
                                   }
                                   &Apache::lonnet::appenv({'request.course.adhocsrcaccess' => join(',',sort(keys(%auaccess))) });
                               }
                             my ($feeds,$syllabus_time);                              my ($feeds,$syllabus_time);
                             &Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds);                              &Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds);
                             &Apache::lonnet::appenv({'request.course.feeds' => $feeds});                              &Apache::lonnet::appenv({'request.course.feeds' => $feeds});
Line 669  ENDENTERKEY Line 688  ENDENTERKEY
                                                     }                                                      }
                                                 }                                                  }
                                             }                                              }
                                               if (($dest =~ m{^\Q/public/$cdom/$cnum/syllabus\E.*(\?|\&)usehttp=1}) ||
                                                   ($dest =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) {
                                                   if ($ENV{'SERVER_PORT'} == 443) {
                                                       unless (&Apache::lonnet::uses_sts()) {
                                                           my $hostname = $r->hostname();
                                                           if ($hostname ne '') {
                                                               $dest = 'http://'.$hostname.$dest;
                                                           }
                                                       }
                                                   }
                                               }
                                             if ($dest =~ m{^/enc/}) {                                              if ($dest =~ m{^/enc/}) {
                                                 if ($env{'request.role.adv'}) {                                                  if ($env{'request.role.adv'}) {
                                                     $dest = &Apache::lonenc::unencrypted($dest);                                                      $dest = &Apache::lonenc::unencrypted($dest);
Line 701  ENDENTERKEY Line 731  ENDENTERKEY
                                         unless (($dest =~ m{^/enc/}) || ($dest =~ /(\?|\&)symb=.+___\d+___.+/)) {                                           unless (($dest =~ m{^/enc/}) || ($dest =~ /(\?|\&)symb=.+___\d+___.+/)) { 
                                             if (($destsymb ne '') && ($destsymb !~ m{^/enc/})) {                                              if (($destsymb ne '') && ($destsymb !~ m{^/enc/})) {
                                                 my $esc_symb = &escape($destsymb);                                                  my $esc_symb = &escape($destsymb);
                                                 $dest .= '?symb='.$esc_symb;                                                  $dest .= (($dest =~/\?/)? '&':'?').'symb='.$esc_symb;
                                             }                                              }
                                         }                                          }
                                         &redirect_user($r, &mt('Entering [_1]',                                          &redirect_user($r, &mt('Entering [_1]',
Line 1000  ENDHEADER Line 1030  ENDHEADER
   
 # No active roles  # No active roles
     if ($countactive==0) {      if ($countactive==0) {
         &requestcourse_advice($r,$cattype,$inrole);           my $elapsed = 0;
           if ($now && $update) {
               $elapsed = $now - $update;
           }
           &requestcourse_advice($r,$cattype,$inrole,$elapsed); 
  $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 1033  ENDHEADER Line 1067  ENDHEADER
 # ----------------------------------------------------------------------- Table  # ----------------------------------------------------------------------- Table
   
     if (($numdc > 0) || (($numhelpdesk > 0) && ($numadhoc > 0))) {      if (($numdc > 0) || (($numhelpdesk > 0) && ($numadhoc > 0))) {
         $r->print(&coursepick_jscript());          $r->print(&coursepick_jscript().
         $r->print(&Apache::loncommon::coursebrowser_javascript().                    &Apache::loncommon::coursebrowser_javascript());
                   &Apache::loncommon::authorbrowser_javascript());      }
       if ($numdc > 0) {
           $r->print(&Apache::loncommon::authorbrowser_javascript());
     }      }
   
     unless ((!&Apache::loncommon::show_course()) || ($nochoose) || ($countactive==1)) {      unless ((!&Apache::loncommon::show_course()) || ($nochoose) || ($countactive==1)) {
Line 1516  sub print_rolerows { Line 1552  sub print_rolerows {
 }  }
   
 sub findcourse_advice {  sub findcourse_advice {
     my ($r,$cattype) = @_;      my ($r,$cattype,$elapsed) = @_;
     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'})) {
         $r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'          $r->print('<p>'.&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'
 <ul>  <ul>
  <li>'.&mt('The course has yet to be created.').'</li>   <li>'.&mt('The course has yet to be created.').'</li>
  <li>'.&mt('Automatic enrollment of registered students has not been enabled for the course.').'</li>   <li>'.&mt('Automatic enrollment of registered students has not been enabled for the course.').'</li>
  <li>'.&mt('You are in a section of course for which automatic enrollment in the corresponding LON-CAPA course is not active.').'</li>   <li>'.&mt('You are in a section of course for which automatic enrollment in the corresponding LON-CAPA course is not active.').'</li>
  <li>'.&mt('The start date for automated enrollment has yet to be reached.').'</li>   <li>'.&mt('The start date for automated enrollment has yet to be reached.').'</li>
  <li>'.&mt('You registered for the course recently and there is a time lag between the time you register, and the time this information becomes available for the update of LON-CAPA course rosters.').'</li>   <li>'.&mt('You registered for the course recently and there is a time lag between the time you register, and the time this information becomes available for the update of LON-CAPA course rosters.').'</li>
  </ul>');   <li>'.&mt('Automated enrollment added you to the course in the time since you last logged-in.').' '.&mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'</li>
    </ul></p>');
     } 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('<p>'.&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'</p>');
           if ($elapsed > 600) {
               $r->print('<p>'.&mt('You may also have been assigned to a course in the time since you last logged-in, or checked for changes.').
                         '<br />'.
                         &mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'</p>');
           }
     }      }
     if (($cattype eq 'std') || ($cattype eq 'domonly')) {      if (($cattype eq 'std') || ($cattype eq 'domonly')) {
         $r->print('<h3>'.&mt('Self-Enrollment').'</h3>'.          $r->print('<h3>'.&mt('Self-Enrollment').'</h3>'.
Line 1541  sub findcourse_advice { Line 1583  sub findcourse_advice {
 }  }
   
 sub requestcourse_advice {  sub requestcourse_advice {
     my ($r,$cattype,$inrole) = @_;      my ($r,$cattype,$inrole,$elapsed) = @_;
     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,$output);      my (%can_request,%request_doms,$output);
Line 1602  sub requestcourse_advice { Line 1644  sub requestcourse_advice {
         } else {          } else {
             $r->print('<h3>'.&mt('Currently no active roles, courses or communities').'</h3>');              $r->print('<h3>'.&mt('Currently no active roles, courses or communities').'</h3>');
         }          }
         &findcourse_advice($r,$cattype);          &findcourse_advice($r,$cattype,$elapsed);
     }      }
     return;      return;
 }  }
Line 1991  sub adhoc_roles_row { Line 2033  sub adhoc_roles_row {
     my ($dcdom,$rowtype) = @_;      my ($dcdom,$rowtype) = @_;
     my $output = &Apache::loncommon::continue_data_table_row()      my $output = &Apache::loncommon::continue_data_table_row()
                  .' <td colspan="5" class="LC_textsize_mobile">'                   .' <td colspan="5" class="LC_textsize_mobile">'
                  .&mt('[_1]Ad hoc[_2] roles in domain [_3] --'                   .&mt('[_1]Ad hoc[_2] roles in domain [_3]'
                      ,'<span class="LC_cusr_emph">','</span>',$dcdom)                       ,'<span class="LC_cusr_emph">','</span>',$dcdom)
                  .' ';                   .' -- ';
     my $role = 'cc';      my $role = 'cc';
     my $selectcclink = &courselink($dcdom,$rowtype,$role);      my $selectcclink = &courselink($dcdom,$rowtype,$role);
     my $ccrole = &Apache::lonnet::plaintext('co',undef,undef,1);      my $ccrole = &Apache::lonnet::plaintext('co',undef,undef,1);
Line 2021  sub adhoc_customroles_row { Line 2063  sub adhoc_customroles_row {
         if (scalar(keys(%{$domdefaults{'adhocroles'}})) > 0) {          if (scalar(keys(%{$domdefaults{'adhocroles'}})) > 0) {
             return &Apache::loncommon::continue_data_table_row()              return &Apache::loncommon::continue_data_table_row()
                   .' <td colspan="5" class="LC_textsize_mobile">'                    .' <td colspan="5" class="LC_textsize_mobile">'
                   .&mt('[_1]Ad hoc[_2] course/community roles in domain [_3] --',                    .&mt('[_1]Ad hoc[_2] course/community roles in domain [_3]',
                        '<span class="LC_cusr_emph">','</span>',$dhdom)                         '<span class="LC_cusr_emph">','</span>',$dhdom)
                   .' '.&courselink($dhdom,$rowtype,$role);                    .' -- '.&courselink($dhdom,$rowtype,$role);
         }          }
     }      }
     return;      return;

Removed from v.1.269.2.32  
changed lines
  Added in v.1.269.2.37.2.1


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