--- loncom/interface/lonindexer.pm 2007/08/02 00:10:59 1.175 +++ loncom/interface/lonindexer.pm 2008/12/17 18:49:13 1.181.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.175 2007/08/02 00:10:59 banghart Exp $ +# $Id: lonindexer.pm,v 1.181.2.2 2008/12/17 18:49:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -106,7 +106,7 @@ sub handler { my $fileclr='#ffffe6'; my $line; - my (@attrchk,@openpath,%typechk); + my (@attrchk,@openpath,$typeselect); my $uri=$r->uri; # -------------------------------------- see if called from an interactive mode @@ -411,16 +411,11 @@ ENDHEADER {'domain' => $headerdom,})); # ---------------------------------- get state of file types to be showing if ($env{'form.only'}) { - if ($env{'form.only'} eq 'problem' ) { - $typechk{'problem'} = 'selected'; - } elsif ($env{'form.only'} eq 'gif,jpg,jpeg' ) { - $typechk{'graphic'} = 'selected'; - } + $typeselect = $env{'form.only'}; } else { - $typechk{'all'} = 'selected'; + $typeselect = ''; } - # ---------------------------------- get state of file attributes to be showing if ($env{'form.attrs'}) { for (my $i=0; $i<=11; $i++) { @@ -482,17 +477,31 @@ ENDHEADER - +END + 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} = $cat; + push(@select_form_order,$types); + } + $select_file_categories{'select_form_order'} = \@select_form_order; + my $type_element= + &Apache::loncommon::select_form($typeselect,'only', + %select_file_categories); + $type_element = ''; + $r->print(< $closebutton $groupimportbutton END $r->print(&Apache::loncommon::inhibit_menu_check('input')); + # -------------- Filter out sequence containment in crumbs and "recent folders" my $storeuri=$uri; $storeuri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1]; @@ -533,8 +542,8 @@ END $r->print("".&mt('Name')."\n"); $r->print("".&mt('Title')."\n") if ($hash{'display_attrs_0'} == 1); - $r->print("".&mt("Size")." (".&mt("bytes").") ". - "\n") if ($hash{'display_attrs_1'} == 1); + $r->print(''.&mt('Size').' ('.&mt('bytes').') '. + ''."\n") if ($hash{'display_attrs_1'} == 1); $r->print("".&mt("Last accessed")."\n") if ($hash{'display_attrs_2'} == 1); $r->print("".&mt("Last modified")."\n") @@ -648,7 +657,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; @@ -926,16 +935,17 @@ sub display_line { my @file_ext = split (/\./,$listname); my $curfext = $file_ext[-1]; if (@Omit) { - foreach (@Omit) { return OK if ($curfext eq $_); } + foreach (@Omit) { return OK if (lc($curfext) eq $_); } } if (@Only) { my $skip = 1; - foreach (@Only) { $skip = 0 if ($curfext eq $_); } + foreach (@Only) { $skip = 0 if (lc($curfext) eq $_); } return OK if ($skip > 0); } # Set the icon for the file my $iconname = &Apache::loncommon::icon($listname); - $r->print(""); + $r->print(''. + ''); if ($env{'form.catalogmode'} eq 'interactive') { my $quotable_filelink = &Apache::loncommon::escape_single($filelink); @@ -943,7 +953,7 @@ sub display_line { $quotable_filelink,"')\">"); $r->print("\"\"". "\n"); - $r->print(""); + $r->print(''); } elsif ($env{'form.catalogmode'} eq 'import') { $r->print("
\n"); $r->print("print("checked"); } $r->print(" />\n"); - $r->print("
"); + $r->print('
'); $hash{"pre_${fnum}_link"}=$filelink; $hash{"pre_${fnum}_title"}=$title; if (!$hash{"pre_${fnum}_title"}) { @@ -1005,24 +1015,24 @@ sub display_line { &Apache::loncommon::inhibit_menu_check(\$quotable_filelink); $r->print (" (metadata) "); + " target=\"_self\">".&mt('metadata').") "); # Close form to open/close sequence if ($filelink=~/\.(page|sequence)$/) { $r->print(''); } - $r->print("\n"); + $r->print("\n"); if ($hash{'display_attrs_0'} == 1) { $r->print(' '.($title eq '' ? ' ' : $title). ' '."\n"); } - $r->print(' ', + $r->print(' ', $filecom[8]," \n") if $hash{'display_attrs_1'} == 1; $r->print(' '. - (localtime($filecom[9]))." \n") + (&Apache::lonlocal::locallocaltime($filecom[9]))." \n") if $hash{'display_attrs_2'} == 1; $r->print(' '. - (localtime($filecom[10]))." \n") + (&Apache::lonlocal::locallocaltime($filecom[10]))." \n") if $hash{'display_attrs_3'} == 1; if ($hash{'display_attrs_4'} == 1) { @@ -1071,7 +1081,7 @@ sub display_line { $r->print(''."Yes "."\n"); + " target=\"_self\">".&mt('Source Code')." "."\n"); } else { #A cuddled else. :P $r->print(" \n"); } @@ -1140,14 +1150,14 @@ sub display_line { $r->print(' '.($title eq '' ? ' ' : $title). ' '."\n"); } - $r->print(' ', + $r->print(' ', $filecom[8]," \n") if $hash{'display_attrs_1'} == 1; $r->print(' '. - (localtime($filecom[9]))." \n") + (&Apache::lonlocal::locallocaltime($filecom[9]))." \n") if $hash{'display_attrs_2'} == 1; $r->print(' '. - (localtime($filecom[10]))." \n") + (&Apache::lonlocal::locallocaltime($filecom[10]))." \n") if $hash{'display_attrs_3'} == 1; if ($hash{'display_attrs_4'} == 1) {