--- loncom/interface/lonindexer.pm 2009/03/19 14:24:50 1.194 +++ loncom/interface/lonindexer.pm 2010/03/29 22:42:58 1.204 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.194 2009/03/19 14:24:50 jms Exp $ +# $Id: lonindexer.pm,v 1.204 2010/03/29 22:42:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -184,7 +184,7 @@ ENDSUBM $colspan=" colspan='2' "; my $cl=&mt('Close'); $closebutton=< + END } elsif ($env{'form.catalogmode'} eq 'import') { @@ -196,11 +196,11 @@ END 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 @@ -361,6 +361,7 @@ END my $js = <<"ENDHEADER"; ENDHEADER my ($headerdom)=($uri=~m{^/res/($match_domain)/}); - $r->print(&Apache::loncommon::start_page('Content Library',$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'}; @@ -420,7 +439,7 @@ ENDHEADER # ---------------------------------- get state of file attributes to be showing if ($env{'form.attrs'}) { - for (my $i=0; $i<=15; $i++) { + for (my $i=0; $i<=16; $i++) { delete $hash{'display_attrs_'.$i}; if ($env{'form.attr'.$i} == 1) { $attrchk[$i] = 'checked'; @@ -428,8 +447,8 @@ ENDHEADER } } } else { - for (my $i=0; $i<=15; $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; } } @@ -449,6 +468,7 @@ ENDHEADER 'ab' => 'Abstract', 'ln' => 'Language', 'gl' => 'Grade Level', + 'sd' => 'Standards', 'sa' => 'Source Available', 'sr' => 'Show resource', 'li' => 'Linked/Related Resources', @@ -460,32 +480,33 @@ ENDHEADER 'hd' => 'Display Options' ); $r->print(<
$lt{'hd'} -
- + - - - - - + + + + + + - - - - - + + + + + + - - - - - + + + + +
 
 
@@ -497,19 +518,20 @@ END $select_file_categories{''} = &mt('All file types'); foreach my $cat (@file_categories) { my $types = join(",",&Apache::loncommon::filecategorytypes($cat)); - $select_file_categories{$types} = $cat; + $select_file_categories{$types} = &mt($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); + &Apache::loncommon::select_form( + $typeselect, + 'only', + %select_file_categories); $type_element = ''; $r->print($type_element .'
'); $r->print(< $closebutton $groupimportbutton @@ -521,11 +543,21 @@ END $storeuri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1]; $storeuri=~s/\/+/\//g; # ---------------------------------------------------------------- Bread crumbs - $r->print(&Apache::lonhtmlcommon::crumbs($storeuri,'','', - (($env{'form.catalogmode'} eq 'import')? - 'document.forms.fileattr':'')). - &Apache::lonhtmlcommon::select_recent('residx','resrecent', -'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();')); + $r->print( + '

' + .&Apache::lonhtmlcommon::crumbs( + $storeuri, + '', + '', + (($env{'form.catalogmode'} eq 'import')? + 'document.forms.fileattr':'')) + .'
' + .&Apache::lonhtmlcommon::select_recent( + 'residx', + 'resrecent', + 'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();') + .'

' + ); # -------------------------------------------------------- Resource Home Button my $reshome=$env{'course.'.$env{'request.course.id'}.'.reshome'}; if ($reshome) { @@ -543,14 +575,13 @@ END &Apache::lonhtmlcommon::store_recent('residx',$storeuri,$storeuri); # -------------------------------------------------- Check All and Uncheck all if ($env{'form.catalogmode'} eq 'import') { - $r->print('
'); - $r->print(''); + $r->print('

'); + $r->print('

'); } # ----------------- output starting row to the indexed file/directory hierarchy #$r->print(&initdebug()); #$r->print(&writedebug("Omit:@Omit")) if (@Omit); #$r->print(&writedebug("Only:@Only")) if (@Only); - $r->print('

'); $r->print(&Apache::loncommon::start_data_table("LC_tableBrowseRes") .&Apache::loncommon::start_data_table_header_row()); $r->print("".&mt('Name')."\n"); @@ -585,6 +616,8 @@ END if ($hash{'display_attrs_14'} == 1); $r->print("".&mt("Grade Level")."\n") if ($hash{'display_attrs_15'} == 1); + $r->print("".&mt("Standards")."\n") + if ($hash{'display_attrs_16'} == 1); $r->print(&Apache::loncommon::end_data_table_header_row()); @@ -854,7 +887,7 @@ sub display_line { my $tabtag=''; my $i=0; - while ($i<=15) { + while ($i<=16) { $tabtag=join('',$tabtag," ") if ($i != 9 && $hash{'display_attrs_'.$i} == 1); @@ -875,24 +908,23 @@ sub display_line { $r->print("\n"); $r->print (''."\n"); $r->print(&Apache::loncommon::inhibit_menu_check('input')); - $r->print (''."\n"); $r->print (''."\n"); - $r->print ('print (' name="'.$msg.'" type="image" class="LC_fileicon" />'. + $r->print ('print (' alt="'.$msg.'" class="LC_fileicon" />'. "\n"); $r->print(&mt("Up")."$tabtag"); $r->print(&Apache::loncommon::end_data_table_row()); 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 #SB if ($absolute) { $fileclr='#ccdd99'; } @@ -910,8 +942,8 @@ sub display_line { $anchor =~ s/\W//g; $r->print (''); $r->print (''); - $r->print ('print (' name="'.$msg.'" type="image" class="LC_fileicon" />'. + $r->print ('print (' alt="'.$msg.'" class="LC_fileicon" />'. "\n"); my $quotable_filecom = &Apache::loncommon::escape_single($filecom[0]); $r->print (''."\n"); $r->print (''); - $r->print (''); + $r->print (''); $r->print ('print (' name="'.$msg.'"/>'. + $r->print (' alt="'.$msg.'"/>'. "\n"); my $quotable_curdir = &Apache::loncommon::escape_single($curdir); $r->print ('"); $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"}) { @@ -1015,8 +1047,8 @@ $r->print ('\n"); + $r->print(''); $count++; } # Sequence open/close icon @@ -1026,10 +1058,10 @@ $r->print (''); $r->print (''); - $r->print (''); + $r->print (''); $r->print ('print (' name="'.$msg.'" type="image" class="LC_fileicon" />'. + $r->print (' alt="'.$msg.'" />'. "\n"); } # Filetype icons @@ -1048,7 +1080,7 @@ $r->print ('\n"); + $r->print("\n"); if ($hash{'display_attrs_0'} == 1) { $r->print(' '.($title eq '' ? ' ' : $title). ' '."\n"); @@ -1085,17 +1117,13 @@ $r->print ('"); - &dynmetaprint($r,$filelink,'count'); - &dynmetaprint($r,$filelink,'course'); - &dynmetaprint($r,$filelink,'stdno'); - &dynmetaprint($r,$filelink,'avetries'); - &dynmetaprint($r,$filelink,'difficulty'); - &dynmetaprint($r,$filelink,'disc'); - &dynmetaprint($r,$filelink,'clear'); - &dynmetaprint($r,$filelink,'technical'); - &dynmetaprint($r,$filelink,'correct'); - &dynmetaprint($r,$filelink,'helpful'); - &dynmetaprint($r,$filelink,'depth'); + + for (qw(count course stdno avetries difficulty disc clear technical + correct helpful depth)) { + + dynmetaprint($r,$filelink,$_); + } + $r->print(" \n"); } @@ -1118,11 +1146,9 @@ $r->print (''.($output eq '' ? ' ':$output). " \n"); } @@ -1159,6 +1185,12 @@ $r->print ('\n"); } + if ($hash{'display_attrs_16'} == 1) { + my $standards = &Apache::lonnet::metadata($filelink,'standards'); + $r->print(' '.($standards eq '' ? ' ' : $standards). + " \n"); + } + $r->print(&Apache::loncommon::end_data_table_row()); } @@ -1177,25 +1209,25 @@ $r->print ('\n"); + $r->print (''); $count++; } $r->print (''); $r->print (''); - $r->print ('print (' name="'.$msg.'" class="LC_fileicon" />'. + $r->print (' alt="'.$msg.'" class="LC_fileicon" />'. "\n"); my $quotable_curdir = &Apache::loncommon::escape_single($curdir); my $location = &Apache::loncommon::lonhttpdurl("/adm/lonIcons"); my $icon = "navmap.folder.".($nowOpen ? "open":"closed").'.gif'; - $r->print ('' - .''.&mt('Open Folder').''. - "\n"); + $r->print ('' + .''.&mt('Open Folder').'' + ."\n"); $r->print ("$listname\n"); # Attributes my $filelink = $startdir.$filecom[0].'/default'; @@ -1268,6 +1300,13 @@ $r->print ('\n"); } + if ($hash{'display_attrs_16'} == 1) { + my $standards = &Apache::lonnet::metadata($filelink,'standards'); + $r->print(' '.($standards eq '' ? ' ' : $standards). + " \n"); + } + + $r->print(&Apache::loncommon::end_data_table_row()); } @@ -1317,7 +1356,6 @@ sub showpreview { close(FH); } } - $output=''.$output.''; } elsif ($embstyle eq 'img') { $output=''.&mt('Preview').''; } elsif ($filelink=~m{^/res/($match_domain)/($match_username)/}) { @@ -1348,7 +1386,7 @@ sub begin_form { $uri=&Apache::loncommon::escape_single($uri); $r->print ('
'."\n"); $r->print (''.