--- loncom/metadata_database/searchcat.pl 2006/09/26 15:15:19 1.69 +++ loncom/metadata_database/searchcat.pl 2007/01/03 03:59:48 1.70.2.2 @@ -2,7 +2,7 @@ # The LearningOnline Network # searchcat.pl "Search Catalog" batch script # -# $Id: searchcat.pl,v 1.69 2006/09/26 15:15:19 raeburn Exp $ +# $Id: searchcat.pl,v 1.70.2.2 2007/01/03 03:59:48 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -234,18 +234,18 @@ foreach my $dom (@domains) { foreach my $uname (keys(%portusers)) { my $urlstart = '/uploaded/'.$dom.'/'.$uname; my $pathstart = &propath($dom,$uname).'/userfiles'; - my $is_course = &check_for_course($dom,$uname); + my $is_course = &Apache::lonnet::is_course($dom,$uname); my $curr_perm = &Apache::lonnet::get_portfile_permissions($dom,$uname); my %access = &Apache::lonnet::get_access_controls($curr_perm); foreach my $file (keys(%access)) { my ($group,$url,$fullpath); if ($is_course) { ($group, my ($path)) = ($file =~ /^(\w+)(\/.+)$/); - $fullpath = $pathstart.'/groups/'.$group.'/portfolio/'.$path; + $fullpath = $pathstart.'/groups/'.$group.'/portfolio'.$path; $url = $urlstart.'/groups/'.$group.'/portfolio'.$path; } else { $fullpath = $pathstart.'/portfolio'.$file; - $url .= $urlstart.'/portfolio'.$file; + $url = $urlstart.'/portfolio'.$file; } if (ref($access{$file}) eq 'HASH') { &process_portfolio_access_data($url,$access{$file}); @@ -322,17 +322,6 @@ sub descend_tree { } } -sub check_for_course { - my ($cdom,$cnum) = @_; - my %courses = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,undef, - undef,'.'); - if (exists($courses{$cdom.'_'.$cnum})) { - return 1; - } - return 0; -} - - sub process_portfolio_access_data { my ($url,$access_hash) = @_; foreach my $key (keys(%{$access_hash})) { @@ -341,6 +330,7 @@ sub process_portfolio_access_data { $acc_data->{keynum} = $key; my ($num,$scope,$end,$start) = ($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); + next if (($scope ne 'public') && ($scope ne 'guest')); $acc_data->{scope} = $scope; if ($end != 0) { $acc_data->{end} = &sqltime($end);