--- loncom/interface/lonindexer.pm 2006/05/31 16:22:10 1.143
+++ loncom/interface/lonindexer.pm 2010/04/14 16:11:34 1.181.4.6
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Directory Indexer
#
-# $Id: lonindexer.pm,v 1.143 2006/05/31 16:22:10 www Exp $
+# $Id: lonindexer.pm,v 1.181.4.6 2010/04/14 16:11:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -53,7 +53,9 @@ use Apache::lonmeta;
use Apache::File;
use Apache::lonlocal;
use Apache::lonsource();
+use Apache::groupsort();
use GDBM_File;
+use LONCAPA qw(:match);
# ---------------------------------------- variables used throughout the module
my %hash; # global user-specific gdbm file
@@ -104,7 +106,7 @@ sub handler {
my $fileclr='#ffffe6';
my $line;
- my (@attrchk,@openpath);
+ my (@attrchk,@openpath,$typeselect);
my $uri=$r->uri;
# -------------------------------------- see if called from an interactive mode
@@ -119,21 +121,26 @@ sub handler {
$extrafield='';
my $diropendb =
- "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_indexer.db";
+ "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_sel_res.db";
%hash = ();
{
my %dbfile;
- if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_READER(),0640)) {
+ if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRITER(),0640)) {
+ if ($env{'form.launch'} eq '1') {
+ &start_fresh_session(\%dbfile);
+ }
while(my($key,$value)=each(%dbfile)) {
$hash{$key}=$value;
}
untie(%dbfile);
}
}
- {
- if ($env{'form.launch'} eq '1') {
- &start_fresh_session();
+# - Evaluate actions from previous page (both cumulatively and chronologically)
+ if ($env{'form.catalogmode'} eq 'import' || $hash{'form.catalogmode'} eq 'import') {
+ &Apache::groupsort::update_actions_hash(\%hash);
}
+
+ {
#Hijack lonindexer to verify a title and be close down.
if ($env{'form.launch'} eq '2') {
&Apache::loncommon::content_type($r,'text/html');
@@ -171,27 +178,27 @@ ENDSUBM
# --------------------- define extra fields and buttons in case of special mode
if ($env{'form.catalogmode'} eq 'interactive') {
$extrafield='
');
+# ---------------------------- embed hidden information useful for group import
+ $r->print("");
+# -------------------------------------------------------------- end the tables
$r->print('');
# --------------------------------------------------- end the output and return
@@ -621,7 +691,7 @@ sub scanDir {
next if($strip =~ /.*\.meta$/ | $obs eq '1');
my (@fileparts) = split(/\./,$strip);
if ($hash{'display_attrs_9'} != 1) {
-# if not all versions to be shown
+ # if not all versions to be shown
if (scalar(@fileparts) >= 3) {
my $fext = pop @fileparts;
my $ov = pop @fileparts;
@@ -677,7 +747,7 @@ sub get_list {
$uri=~s/\/+/\//g;
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$uri))) {
my @ratpart=split(/\:/,$_);
- push @list,$ratpart[1];
+ push(@list,&LONCAPA::map::qtescape($ratpart[1]));
}
$hash{'dirlist_files_'.$luri} = join("\n",@list);
} else {
@@ -686,7 +756,7 @@ sub get_list {
$hash{'dirlist_files_'.$luri} = join("\n",@list);
$hash{'dirlist_timestamp_files_'.$luri} = time;
}
- return @list=&match_ext($r,@list);
+ return @list=&match_ext($r,@list);
}
sub dynmetaread {
@@ -794,9 +864,10 @@ sub display_line {
my $tabtag='';
my $i=0;
- while ($i<=11) {
+ while ($i<=16) {
$tabtag=join('',$tabtag,"
")
- if $hash{'display_attrs_'.$i} == 1;
+ if ($i != 9 &&
+ $hash{'display_attrs_'.$i} == 1);
$i++;
}
my $valign = ($hash{'display_attrs_7'} == 1 ? 'top' : 'bottom');
@@ -808,26 +879,27 @@ sub display_line {
$updir='/'.(split(/\.(page|sequence)\/\//,$startdir))[-1];
$updir=~s/\/+/\//g;
- $r->print("
$extrafield");
+ $r->print("
$extrafield");
$r->print("
\n");
$r->print ('$tabtag
\n");
return OK;
}
# Do we have permission to look at this?
- if($filecom[15] ne '1') { return OK if (!&Apache::lonnet::allowed('bre',$pathprefix.$filecom[0])); }
+ if($filecom[15] ne '1') { return OK if ((!&Apache::lonnet::allowed('bre',$pathprefix.$filecom[0])) && (!&Apache::lonnet::allowed('bro',$pathprefix.$filecom[0]))); }
# make absolute links appear on different background
if ($absolute) { $fileclr='#ccdd99'; }
@@ -836,24 +908,24 @@ sub display_line {
if ($filecom[1] eq 'domain') {
$r->print (''."\n")
if ($env{'form.dirPointer'} eq "on");
- $r->print("