Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1194 and 1.1195

version 1.1194, 2012/11/08 18:37:52 version 1.1195, 2012/11/09 17:27:18
Line 2800  sub is_course_upload { Line 2800  sub is_course_upload {
 }  }
   
 sub in_course {  sub in_course {
     my ($udom,$uname,$cdom,$cnum,$type) = @_;      my ($udom,$uname,$cdom,$cnum,$type,$hideprivileged) = @_;
       if ($hideprivileged) {
           my $skipuser;
           if (&privileged($uname,$udom)) {
               $skipuser = 1;
               my %coursehash = &coursedescription($cdom.'_'.$cnum);
               if ($coursehash{'nothideprivileged'}) {
                   foreach my $item (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) {
                       my $user;
                       if ($item =~ /:/) {
                           $user = $item;
                       } else {
                           $user = join(':',split(/[\@]/,$item));
                       }
                       if ($user eq $uname.':'.$udom) {
                           undef($skipuser);
                           last;
                       }
                   }
               }
               if ($skipuser) {
                   return 0;
               }
           }
       }
     $type ||= 'any';      $type ||= 'any';
     if (!defined($cdom) || !defined($cnum)) {      if (!defined($cdom) || !defined($cnum)) {
         my $cid  = $env{'request.course.id'};          my $cid  = $env{'request.course.id'};
Line 2808  sub in_course { Line 2832  sub in_course {
         $cnum = $env{'course.'.$cid.'.num'};          $cnum = $env{'course.'.$cid.'.num'};
     }      }
     my $typesref;      my $typesref;
     if ($type eq 'all') {      if (($type eq 'any') || ($type eq 'all')) {
         $typesref = ['active','previous','future'];          $typesref = ['active','previous','future'];
     } elsif ($type eq 'previous' || $type eq 'future') {      } elsif ($type eq 'previous' || $type eq 'future') {
         $typesref = [$type];          $typesref = [$type];
Line 12233  of role statuses (active, future or prev Line 12257  of role statuses (active, future or prev
 to restrict the list of roles reported. If no array ref is   to restrict the list of roles reported. If no array ref is 
 provided for types, will default to return only active roles.  provided for types, will default to return only active roles.
   
   =item *
   
   in_course($udom,$uname,$cdom,$cnum,$type,$hideprivileged) : determine if
   user: $uname:$udom has a role in the course: $cdom_$cnum. Additional
   optional arguments are: $type (if role checking is to be restricted to
   certain user status types -- previous (expired roles), active (currently
   available roles) or future (roles available in the future), and
   $hideprivileged -- if true will not report course roles for users who
   have active Domain Coordinator or Super User roles.
   
 =back  =back
   
 =head2 User Modification  =head2 User Modification
Line 12435  data base, returning a hash that is keye Line 12469  data base, returning a hash that is keye
 values that are the resource value.  I believe that the timestamps and  values that are the resource value.  I believe that the timestamps and
 versions are also returned.  versions are also returned.
   
   
 =back  =back
   
 =head2 Course Modification  =head2 Course Modification
Line 12596  expirespread($uname,$udom,$stype,$usymb) Line 12629  expirespread($uname,$udom,$stype,$usymb)
 devalidate($symb) : devalidate temporary spreadsheet calculations,  devalidate($symb) : devalidate temporary spreadsheet calculations,
 forcing spreadsheet to reevaluate the resource scores next time.  forcing spreadsheet to reevaluate the resource scores next time.
   
   =item * 
   
   can_edit_resource($file,$cnum,$cdom,$resurl,$symb,$group)
   
   Determine if the current user should be able to edit a particular resource,
   when viewing in course context.
   (a) When viewing resource used to determine if "Edit" item is included in
        Functions.
   (b) When displaying folder contents in course editor, used to determine if
       "Edit" link will be displayed alongside resource.
   
    input: 3 args -- filename (decluttered), course number and course domain.
    output: array of four scalars --
            $cfile -- url for file editing if editable on current server
            $home -- homeserver of resource (i.e., for author if published,
                                             or course if uploaded.).
            $switchserver --  1 if server switch will be needed.
            $uploaded -- 1 if resource is a file uploaded to a course.
   
   =item *
   
   is_course_upload($file,$cnum,$cdom)
   
   Used in course context to determine if current file was uploaded to 
   the course (i.e., would be found in /userfiles/docs on the course's 
   homeserver.
   
     input: 3 args -- filename (decluttered), course number and course domain.
     output: boolean -- 1 if file was uploaded.
   
 =back  =back
   
 =head2 Storing/Retreiving Data  =head2 Storing/Retreiving Data

Removed from v.1.1194  
changed lines
  Added in v.1.1195


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