Diff for /loncom/interface/lonhelper.pm between versions 1.194 and 1.195

version 1.194, 2015/08/14 15:34:01 version 1.195, 2015/08/15 20:11:57
Line 64  messages, resource selections, or date q Line 64  messages, resource selections, or date q
   
 The helper tag is required to have one attribute, "title", which is the name  The helper tag is required to have one attribute, "title", which is the name
 of the helper itself, such as "Parameter helper". The helper tag may optionally  of the helper itself, such as "Parameter helper". The helper tag may optionally
 have a "requiredpriv" attribute, specifying the priviledge a user must have  have a "requiredpriv" attribute, specifying the privilege a user must have
 to use the helper, or get denied access. See loncom/auth/rolesplain.tab for  to use the helper, or get denied access. See loncom/auth/rolesplain.tab for
 useful privs. Default is full access, which is often wrong!  useful privs. You may add the modifier &S at the end of the three letter priv
   if you want to grant access to users for whom the corresponding privilege is 
   section-specific. The default is full access, which is often wrong!
   
 =head2 State tags  =head2 State tags
   
Line 283  sub real_handler { Line 285  sub real_handler {
   
     my $allowed = $helper->allowedCheck();      my $allowed = $helper->allowedCheck();
     if (!$allowed) {      if (!$allowed) {
         $env{'user.error.msg'} = $env{'request.uri'}.':'.$helper->{REQUIRED_PRIV}.          my ($priv,$modifier) = split(/\&/,$helper->{REQUIRED_PRIV});
           $env{'user.error.msg'} = $env{'request.uri'}.':'.$priv.
             ":0:0:Permission denied to access this helper.";              ":0:0:Permission denied to access this helper.";
         return HTTP_NOT_ACCEPTABLE;          return HTTP_NOT_ACCEPTABLE;
     }      }
Line 508  sub allowedCheck { Line 511  sub allowedCheck {
     if (!defined($self->{REQUIRED_PRIV})) {       if (!defined($self->{REQUIRED_PRIV})) { 
         return 1;          return 1;
     }      }
       my ($priv,$modifier) = split(/\&/,$self->{REQUIRED_PRIV});
     return Apache::lonnet::allowed($self->{REQUIRED_PRIV}, $env{'request.course.id'});      my $allowed = &Apache::lonnet::allowed($priv,$env{'request.course.id'});
       if ((!$allowed) && ($modifier eq 'S') && ($env{'request.course.sec'} ne '')) {
           $allowed = &Apache::lonnet::allowed($priv,$env{'request.course.id'}.'/'.
                                                     $env{'request.course.sec'});
       }
       return $allowed;
 }  }
   
 sub changeState {  sub changeState {
Line 2689  sub render { Line 2697  sub render {
  delete($defaultUsers{''});   delete($defaultUsers{''});
     }      }
   
   
     my ($course_personnel,       my ($course_personnel, 
  $current_members,    $current_members, 
  $expired_members,    $expired_members, 
  $future_members) =    $future_members) = 
     &Apache::lonselstudent::get_people_in_class($env{'request.course.sec'});      &Apache::lonselstudent::get_people_in_class($env{'request.course.sec'});
   
   
   
     # Load up the non-students, if necessary      # Load up the non-students, if necessary
   
     if ($self->{'coursepersonnel'}) {      if ($self->{'coursepersonnel'}) {
Line 3185  sub start_section { Line 3190  sub start_section {
   
     # Populate the CHOICES element      # Populate the CHOICES element
     my %choices;      my %choices;
       my $usersec = $Apache::lonnet::env{'request.course.sec'};
   
     my $section = Apache::loncoursedata::CL_SECTION();      if ($usersec ne '') {
     my $classlist = Apache::loncoursedata::get_classlist();          $choices{$usersec} = $usersec;
     foreach my $user (keys(%$classlist)) {      } else {
         my $section_name = $classlist->{$user}[$section];          my $section = Apache::loncoursedata::CL_SECTION();
         if (!$section_name) {          my $classlist = Apache::loncoursedata::get_classlist();
             $choices{"No section assigned"} = "";          foreach my $user (keys(%$classlist)) {
         } else {              my $section_name = $classlist->{$user}[$section];
             $choices{$section_name} = $section_name;              if (!$section_name) {
                   $choices{"No section assigned"} = "";
               } else {
                   $choices{$section_name} = $section_name;
               }
           }
    
           if (exists($choices{"No section assigned"})) {
       push(@{$paramHash->{CHOICES}}, 
            ['No section assigned','No section assigned']);
       delete($choices{"No section assigned"});
         }          }
     }   
      
     if (exists($choices{"No section assigned"})) {  
  push(@{$paramHash->{CHOICES}},   
      ['No section assigned','No section assigned']);  
  delete($choices{"No section assigned"});  
     }      }
     for my $section_name (sort {lc($a) cmp lc($b) } (keys(%choices))) {      for my $section_name (sort {lc($a) cmp lc($b) } (keys(%choices))) {
  push @{$paramHash->{CHOICES}}, [$section_name, $section_name];   push @{$paramHash->{CHOICES}}, [$section_name, $section_name];

Removed from v.1.194  
changed lines
  Added in v.1.195


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