--- loncom/interface/lonindexer.pm 2009/03/18 13:47:14 1.193
+++ loncom/interface/lonindexer.pm 2025/03/18 19:36:59 1.232
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Directory Indexer
#
-# $Id: lonindexer.pm,v 1.193 2009/03/18 13:47:14 jms Exp $
+# $Id: lonindexer.pm,v 1.232 2025/03/18 19:36:59 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -34,9 +34,8 @@
## 1. Description of functions ##
## 2. Modules used by this module ##
## 3. Choices for different output views (detailed, summary, xml, etc) ##
-## 4. BEGIN block (to be run once after compilation) ##
-## 5. Handling routine called via Apache and mod_perl ##
-## 6. Other subroutines ##
+## 4. Handling routine called via Apache and mod_perl ##
+## 5. Other subroutines ##
## ##
###############################################################################
@@ -60,7 +59,6 @@ use LONCAPA qw(:match);
# ---------------------------------------- variables used throughout the module
my %hash; # global user-specific gdbm file
my %dirs; # keys are directories, values are the open/close status
-my %language; # has the reference information present in language.tab
my %dynhash; # hash of hashes for dynamic metadata
my %dynread; # hash of directories already read for dynamic metadata
my %fieldnames; # Metadata fieldnames
@@ -94,15 +92,9 @@ sub handler {
undef (@Omit);
%fieldnames=&Apache::lonmeta::fieldnames();
-# ------------------------------------- read in machine configuration variables
+# --------------------------------------------------------------- get icon path
my $iconpath= $r->dir_config('lonIconsURL') . "/";
- my $domain = $r->dir_config('lonDefDomain');
- my $role = $r->dir_config('lonRole');
- my $loadlim = $r->dir_config('lonLoadLim');
- my $servadm = $r->dir_config('lonAdmEMail');
- my $sysadm = $r->dir_config('lonSysEMail');
- my $lonhost = $r->dir_config('lonHostID');
- my $tabdir = $r->dir_config('lonTabDir');
+ my $defdom = &Apache::lonnet::default_login_domain();
#SB my $fileclr='#ffffe6';
my $line;
@@ -120,8 +112,8 @@ sub handler {
my $colspan='';
$extrafield='';
- my $diropendb =
- "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_sel_res.db";
+ my $diropendb = LONCAPA::tempdir() .
+ "$env{'user.domain'}_$env{'user.name'}_sel_res.db";
%hash = ();
{
my %dbfile;
@@ -165,6 +157,8 @@ sub handler {
ENDSUBM
$r->print(&Apache::loncommon::start_page(undef,$js,
{'only_body' =>1,
+ 'add_modal' => 1,
+ 'add_wishlist' => 1,
'add_entries' =>
{'onload' => "load();"},}
).
@@ -178,29 +172,29 @@ ENDSUBM
# --------------------- define extra fields and buttons in case of special mode
if ($env{'form.catalogmode'} eq 'interactive') {
#SB $extrafield='
'.
- $extrafield='
'.
+ $extrafield='
'.
'
';
$colspan=" colspan='2' ";
my $cl=&mt('Close');
$closebutton=<
+
END
}
elsif ($env{'form.catalogmode'} eq 'import') {
#SB $extrafield='
'.
- $extrafield='
'.
+ $extrafield='
'.
'
';
$colspan=" colspan='2' ";
my $cl=&mt('Close');
my $gi=&mt('Import');
$closebutton=<
+
END
$groupimportbutton=<
+onclick="javascript:select_group()" />
END
}
# Additions made by Matthew to make the browser a little easier to deal
@@ -321,10 +315,8 @@ function select_group() {
function changeURL(val) {
if (window.opener.document) {
- var elementname = "$element"+"_value";
- var checkboxname = "$element"+"_setparmval";
+ var elementname = "$element";
window.opener.document.forms["$form"].elements[elementname].value=val;
- window.opener.document.forms["$form"].elements[checkboxname].checked=true;
} else {
alert("The file you selected is: "+val);
}
@@ -361,6 +353,7 @@ END
my $js = <<"ENDHEADER";
ENDHEADER
my ($headerdom)=($uri=~m{^/res/($match_domain)/});
- $r->print(&Apache::loncommon::start_page('Browse Resources',$js,
- {'domain' => $headerdom,}));
+
+ if ($env{'form.catalogmode'}) {
+ # "Popup mode"
+ $r->print(&Apache::loncommon::start_page('Browse published resources',$js,
+ {'only_body' => 1, 'add_wishlist'=>1, 'add_modal' =>1,
+ 'domain' => $headerdom,}));
+ } else {
+ # Only display page header and breadcrumbs in non-popup mode
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ 'text' => 'Browse published resources',
+ 'href' => '/res/'.$headerdom.'/?launch=1',
+ });
+ $r->print(&Apache::loncommon::start_page('Browse published resources',$js,
+ {'domain' => $headerdom,})
+ .&Apache::lonhtmlcommon::breadcrumbs()
+ );
+ }
+
# ---------------------------------- get state of file types to be showing
if ($env{'form.only'}) {
$typeselect = $env{'form.only'};
@@ -429,30 +442,33 @@ ENDHEADER
}
} else {
for (my $i=0; $i<=16; $i++) {
- $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;
+ $attrchk[$i] = 'checked="checked"' if $hash{'display_attrs_'.$i} == 1;
}
}
+ my @file_categories = &Apache::loncommon::filecategories();
+ my %select_file_categories;
+ my @select_form_order = ('');
+ $select_file_categories{''} = &mt('All file types');
+ foreach my $cat (@file_categories) {
+ my $types = join(",",&Apache::loncommon::filecategorytypes($cat));
+ $select_file_categories{$types} = &mt($cat);
+ push(@select_form_order,$types);
+ }
+ $select_file_categories{'select_form_order'} = \@select_form_order;
+ my $onchange = 'this.form.submit();';
+ my $type_element=
+ &Apache::loncommon::select_form(
+ $typeselect,
+ 'only',
+ \%select_file_categories,$onchange);
+ my $type_selector = '';
+
# ------------------------------- output state of file attributes to be showing
# All versions has to the last item
# since it does not take an extra col
my %lt=&Apache::lonlocal::texthash(
- 'ti' => 'Title',
- 'si' => 'Size',
- 'la' => 'Last access',
- 'lm' => 'Last modified',
- 'st' => 'Statistics',
- 'au' => 'Author',
- 'kw' => 'Keywords',
- 'sb' => 'Subject',
- 'nt' => 'Notes',
- 'gl' => 'Grade Level',
- 'ab' => 'Abstract',
- 'sd' => 'Standards',
- 'ln' => 'Language',
- 'sa' => 'Source Available',
- 'sr' => 'Show resource',
- 'li' => 'Linked/Related Resources',
'av' => 'All versions',
'ud' => 'Update Display',
'pr' => 'Problems',
@@ -460,59 +476,61 @@ ENDHEADER
'at' => 'All types',
'hd' => 'Display Options'
);
- $r->print(< 'Title',
+ 4 => 'Author',
+ 5 => 'Keywords',
+ 6 => 'Language',
+ 13 => 'Notes',
+ 1 => 'Size',
+ 2 => 'Last access',
+ 3 => 'Last modified',
+ 10 => 'Source Available',
+ 14 => 'Abstract',
+ 8 => 'Statistics',
+ 11 => 'Linked/Related Resources',
+ 7 => 'Show resource',
+ 12 => 'Subject',
+ 15 => 'Grade Level',
+ 16 => 'Standards',
+ );
+ my $cell = 0;
+ my $numinrow = 4;
+ $r->print('
+