--- loncom/interface/lonindexer.pm 2007/08/17 21:33:19 1.177 +++ loncom/interface/lonindexer.pm 2010/08/13 13:32:36 1.208 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.177 2007/08/17 21:33:19 banghart Exp $ +# $Id: lonindexer.pm,v 1.208 2010/08/13 13:32:36 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -104,7 +104,7 @@ sub handler { my $lonhost = $r->dir_config('lonHostID'); my $tabdir = $r->dir_config('lonTabDir'); - my $fileclr='#ffffe6'; +#SB my $fileclr='#ffffe6'; my $line; my (@attrchk,@openpath,$typeselect); my $uri=$r->uri; @@ -177,28 +177,30 @@ ENDSUBM # --------------------- define extra fields and buttons in case of special mode if ($env{'form.catalogmode'} eq 'interactive') { - $extrafield=''. +#SB $extrafield=''. + $extrafield=''. ''; $colspan=" colspan='2' "; my $cl=&mt('Close'); $closebutton=< + END } elsif ($env{'form.catalogmode'} eq 'import') { - $extrafield=''. +#SB $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 @@ -319,10 +321,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); } @@ -359,6 +359,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, + '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/fhwfdev/?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'}; @@ -418,7 +437,7 @@ ENDHEADER # ---------------------------------- get state of file attributes to be showing if ($env{'form.attrs'}) { - for (my $i=0; $i<=11; $i++) { + for (my $i=0; $i<=16; $i++) { delete $hash{'display_attrs_'.$i}; if ($env{'form.attr'.$i} == 1) { $attrchk[$i] = 'checked'; @@ -426,100 +445,132 @@ ENDHEADER } } } else { - for (my $i=0; $i<=11; $i++) { - $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; + for (my $i=0; $i<=16; $i++) { + $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', - 'ln' => 'Language', - 'sa' => 'Source Available', - 'sr' => 'Show resource', - 'li' => 'Linked/Related Resources', 'av' => 'All versions', 'ud' => 'Update Display', 'pr' => 'Problems', 'gr' => 'Graphics', - 'at' => 'All types' + 'at' => 'All types', + 'hd' => 'Display Options' ); - $r->print(< - - - - - - - - - - - - - - + my @disp_order = ('0','4','5','6','13','1','2','3','10','14','8','11','7','12','15','16'); + my %disp_options = &Apache::lonlocal::texthash ( + 0 => '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(' + +
+'.$lt{'hd'}.' +
'."\n"); + foreach my $item (@disp_order) { + my $style = 'padding-left: 12px; padding-right: 8px;'; + if ($cell%$numinrow == 0) { + $r->print(''); + } + $cell ++; + if ($cell > 3 * $numinrow) { + $style .= ' padding-bottom: 6px;'; + } + if (defined($disp_options{$item})) { + $r->print(''."\n"); + } + if ($cell > 1 && $cell%$numinrow == 0) { + $r->print(''); + } + } + $r->print(< - - - - + +
'. + '
  + +$type_selector
-