version 1.612, 2005/03/17 21:18:12
|
version 1.614, 2005/03/21 18:53:51
|
Line 1293 sub finishuserfileupload {
|
Line 1293 sub finishuserfileupload {
|
} |
} |
# Notify homeserver to grep it |
# Notify homeserver to grep it |
# |
# |
&Apache::lonnet::logthis("fetching ".$path.$file); |
|
my $fetchresult= &reply('fetchuserfile:'.$path.$file,$docuhome); |
my $fetchresult= &reply('fetchuserfile:'.$path.$file,$docuhome); |
if ($fetchresult eq 'ok') { |
if ($fetchresult eq 'ok') { |
# |
# |
Line 1309 sub finishuserfileupload {
|
Line 1308 sub finishuserfileupload {
|
sub removeuploadedurl { |
sub removeuploadedurl { |
my ($url)=@_; |
my ($url)=@_; |
my (undef,undef,$udom,$uname,$fname)=split('/',$url,5); |
my (undef,undef,$udom,$uname,$fname)=split('/',$url,5); |
return &Apache::lonnet::removeuserfile($uname,$udom,$fname); |
return &removeuserfile($uname,$udom,$fname); |
} |
} |
|
|
sub removeuserfile { |
sub removeuserfile { |
Line 3716 sub is_locked {
|
Line 3715 sub is_locked {
|
my @check; |
my @check; |
my $is_locked; |
my $is_locked; |
push @check, $file_name; |
push @check, $file_name; |
my %locked = &Apache::lonnet::get('file_permissions',\@check, |
my %locked = &get('file_permissions',\@check, |
$ENV{'user.domain'},$ENV{'user.name'}); |
$ENV{'user.domain'},$ENV{'user.name'}); |
|
# my ($tmp)=keys(%locked); |
|
# if ($tmp=~/^error:/) { undef(%locked); } |
|
|
if (ref($locked{$file_name}) eq 'ARRAY') { |
if (ref($locked{$file_name}) eq 'ARRAY') { |
$is_locked = 'true'; |
$is_locked = 'true'; |
} else { |
} else { |
Line 3729 sub is_locked {
|
Line 3731 sub is_locked {
|
|
|
sub mark_as_readonly { |
sub mark_as_readonly { |
my ($domain,$user,$files,$what) = @_; |
my ($domain,$user,$files,$what) = @_; |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
my %current_permissions = &dump('file_permissions',$domain,$user); |
|
# my ($tmp)=keys(%current_permissions); |
|
# if ($tmp=~/^error:/) { undef(%current_permissions); } |
|
|
foreach my $file (@{$files}) { |
foreach my $file (@{$files}) { |
push(@{$current_permissions{$file}},$what); |
push(@{$current_permissions{$file}},$what); |
} |
} |
&Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user); |
&put('file_permissions',\%current_permissions,$domain,$user); |
return; |
return; |
} |
} |
|
|
Line 3810 sub files_not_in_path {
|
Line 3815 sub files_not_in_path {
|
|
|
sub get_marked_as_readonly { |
sub get_marked_as_readonly { |
my ($domain,$user,$what) = @_; |
my ($domain,$user,$what) = @_; |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
my %current_permissions = &dump('file_permissions',$domain,$user); |
|
# my ($tmp)=keys(%current_permissions); |
|
# if ($tmp=~/^error:/) { undef(%current_permissions); } |
|
|
my @readonly_files; |
my @readonly_files; |
while (my ($file_name,$value) = each(%current_permissions)) { |
while (my ($file_name,$value) = each(%current_permissions)) { |
if (ref($value) eq "ARRAY"){ |
if (ref($value) eq "ARRAY"){ |
Line 3829 sub get_marked_as_readonly {
|
Line 3837 sub get_marked_as_readonly {
|
|
|
sub get_marked_as_readonly_hash { |
sub get_marked_as_readonly_hash { |
my ($domain,$user,$what) = @_; |
my ($domain,$user,$what) = @_; |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
my %current_permissions = &dump('file_permissions',$domain,$user); |
|
# my ($tmp)=keys(%current_permissions); |
|
# if ($tmp=~/^error:/) { undef(%current_permissions); } |
|
|
my %readonly_files; |
my %readonly_files; |
while (my ($file_name,$value) = each(%current_permissions)) { |
while (my ($file_name,$value) = each(%current_permissions)) { |
if (ref($value) eq "ARRAY"){ |
if (ref($value) eq "ARRAY"){ |
Line 3850 sub unmark_as_readonly {
|
Line 3861 sub unmark_as_readonly {
|
# unmarks all files locked by $what |
# unmarks all files locked by $what |
# for portfolio submissions, $what contains $crsid and $symb |
# for portfolio submissions, $what contains $crsid and $symb |
my ($domain,$user,$what) = @_; |
my ($domain,$user,$what) = @_; |
my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user); |
my %current_permissions = &dump('file_permissions',$domain,$user); |
my @readonly_files = &Apache::lonnet::get_marked_as_readonly($domain,$user,$what); |
# my ($tmp)=keys(%current_permissions); |
|
# if ($tmp=~/^error:/) { undef(%current_permissions); } |
|
|
|
my @readonly_files = &get_marked_as_readonly($domain,$user,$what); |
foreach my $file(@readonly_files){ |
foreach my $file(@readonly_files){ |
my $current_locks = $current_permissions{$file}; |
my $current_locks = $current_permissions{$file}; |
my @new_locks; |
my @new_locks; |
Line 3866 sub unmark_as_readonly {
|
Line 3880 sub unmark_as_readonly {
|
$current_permissions{$file} = \@new_locks; |
$current_permissions{$file} = \@new_locks; |
} else { |
} else { |
push(@del_keys, $file); |
push(@del_keys, $file); |
&Apache::lonnet::del('file_permissions',\@del_keys, $domain, $user); |
&del('file_permissions',\@del_keys, $domain, $user); |
delete $current_permissions{$file}; |
delete $current_permissions{$file}; |
} |
} |
} |
} |
} |
} |
&Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user); |
&put('file_permissions',\%current_permissions,$domain,$user); |
return; |
return; |
} |
} |
|
|
Line 4470 sub metadata {
|
Line 4484 sub metadata {
|
} else { |
} else { |
$metaentry{':packages'}=$package.$keyroot; |
$metaentry{':packages'}=$package.$keyroot; |
} |
} |
foreach (keys %packagetab) { |
foreach (sort keys %packagetab) { |
my $part=$keyroot; |
my $part=$keyroot; |
$part=~s/^\_//; |
$part=~s/^\_//; |
if ($_=~/^\Q$package\E\&/ || |
if ($_=~/^\Q$package\E\&/ || |
Line 4687 sub gettitle {
|
Line 4701 sub gettitle {
|
if (!$title) { $title=(split('/',$urlsymb))[-1]; } |
if (!$title) { $title=(split('/',$urlsymb))[-1]; } |
return $title; |
return $title; |
} |
} |
|
|
|
sub get_slot { |
|
my ($which,$cnum,$cdom)=@_; |
|
if (!$cnum || !$cdom) { |
|
(undef,my $courseid)=&Apache::lonxml::whichuser(); |
|
$cdom=$ENV{'course.'.$courseid.'.domain'}; |
|
$cnum=$ENV{'course.'.$courseid.'.num'}; |
|
} |
|
my %slotinfo=&get('slots',[$which],$cdom,$cnum); |
|
&Apache::lonhomework::showhash(%slotinfo); |
|
my ($tmp)=keys(%slotinfo); |
|
if ($tmp=~/^error:/) { return (); } |
|
return %{$slotinfo{$which}}; |
|
} |
# ------------------------------------------------- Update symbolic store links |
# ------------------------------------------------- Update symbolic store links |
|
|
sub symblist { |
sub symblist { |