version 1.1194, 2012/11/08 18:37:52
|
version 1.1197, 2012/11/11 01:48:33
|
Line 2653 sub allowuploaded {
|
Line 2653 sub allowuploaded {
|
# (b) When displaying folder contents in course editor, used to determine if |
# (b) When displaying folder contents in course editor, used to determine if |
# "Edit" link will be displayed alongside resource. |
# "Edit" link will be displayed alongside resource. |
# |
# |
# input: 3 args -- filename (decluttered), course number and course domain. |
# input: six args -- filename (decluttered), course number, course domain, |
# output: array of four scalars -- |
# url, symb (if registered) and group (if this is a group |
|
# item -- e.g., bulletin board, group page etc.). |
|
# output: array of five scalars -- |
# $cfile -- url for file editing if editable on current server |
# $cfile -- url for file editing if editable on current server |
# $home -- homeserver of resource (i.e., for author if published, |
# $home -- homeserver of resource (i.e., for author if published, |
# or course if uploaded.). |
# or course if uploaded.). |
# $switchserver -- 1 if server switch will be needed. |
# $switchserver -- 1 if server switch will be needed. |
# $uploaded -- 1 if resource is a file uploaded to a course. |
# $forceedit -- 1 if icon/link should be to go to edit mode |
|
# $forceview -- 1 if icon/link should be to go to view mode |
# |
# |
|
|
sub can_edit_resource { |
sub can_edit_resource { |
Line 2689 sub can_edit_resource {
|
Line 2692 sub can_edit_resource {
|
if ($group ne '') { |
if ($group ne '') { |
# if this is a group homepage or group bulletin board, check group privs |
# if this is a group homepage or group bulletin board, check group privs |
my $allowed = 0; |
my $allowed = 0; |
if ($resurl =~ m{^/adm/$cdom/$cnum/$group/smppg$}) { |
if ($resurl =~ m{^/?adm/$cdom/$cnum/$group/smppg$}) { |
if ((&Apache::lonnet::allowed('mdg',$env{'request.course.id'}. |
if ((&allowed('mdg',$env{'request.course.id'}. |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) || |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) || |
(&allowed('mgh',$env{'request.course.id'}.'/'.$group)) || $crsedit) { |
(&allowed('mgh',$env{'request.course.id'}.'/'.$group)) || $crsedit) { |
$allowed = 1; |
$allowed = 1; |
} |
} |
} elsif ($resurl =~ m{^/adm/$cdom/$cnum/\d+/bulletinboard$}) { |
} elsif ($resurl =~ m{^/?adm/$cdom/$cnum/\d+/bulletinboard$}) { |
unless ((&allowed(&Apache::lonnet::allowed('mdg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')))) || |
if ((&allowed('mdg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) || |
(&allowed('cgb',$env{'request.course.id'}.$group)) || $crsedit) { |
(&allowed('cgb',$env{'request.course.id'}.'/'.$group)) || $crsedit) { |
$allowed = 1; |
$allowed = 1; |
} |
} |
} |
} |
Line 2800 sub is_course_upload {
|
Line 2803 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 2835 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 12260 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 12473 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 12633 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 current user can edit a particular resource, |
|
when viewing in course context. |
|
|
|
input: six args -- filename (decluttered), course number, course domain, |
|
url, symb (if registered) and group (if this is a |
|
group item -- e.g., bulletin board, group page etc.). |
|
|
|
output: array of five 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. |
|
$forceedit -- 1 if icon/link should be to go to edit mode |
|
$forceview -- 1 if icon/link should be to go to view mode |
|
|
|
=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 |