--- loncom/interface/lonindexer.pm 2009/03/17 20:07:45 1.190 +++ loncom/interface/lonindexer.pm 2009/07/17 15:42:07 1.199 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.190 2009/03/17 20:07:45 schulted Exp $ +# $Id: lonindexer.pm,v 1.199 2009/07/17 15:42:07 droeschl 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<=14; $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<=14; $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; } } @@ -448,6 +467,8 @@ ENDHEADER 'nt' => 'Notes', 'ab' => 'Abstract', 'ln' => 'Language', + 'gl' => 'Grade Level', + 'sd' => 'Standards', 'sa' => 'Source Available', 'sr' => 'Show resource', 'li' => 'Linked/Related Resources', @@ -459,31 +480,33 @@ ENDHEADER 'hd' => 'Display Options' ); $r->print(<
$lt{'hd'} -
- + - - - - - + + + + + + - - - - - + + + + + + - - - - + + + + +
 
 
@@ -507,7 +530,6 @@ END $r->print($type_element .'
'); $r->print(< $closebutton $groupimportbutton @@ -527,7 +549,7 @@ END # -------------------------------------------------------- Resource Home Button my $reshome=$env{'course.'.$env{'request.course.id'}.'.reshome'}; if ($reshome) { - $r->print("print('javascript:document.forms.fileattr.action="'.&Apache::loncommon::inhibit_menu_check($reshome).'";document.forms.fileattr.submit();'); } else { @@ -541,15 +563,15 @@ 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_tableOfContent") + $r->print(&Apache::loncommon::start_data_table("LC_tableBrowseRes") .&Apache::loncommon::start_data_table_header_row()); $r->print("".&mt('Name')."\n"); $r->print("".&mt('Title')."\n") @@ -581,6 +603,10 @@ END if ($hash{'display_attrs_13'} == 1); $r->print("".&mt("Abstract")."\n") 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()); @@ -850,7 +876,7 @@ sub display_line { my $tabtag=''; my $i=0; - while ($i<=14) { + while ($i<=16) { $tabtag=join('',$tabtag," ") if ($i != 9 && $hash{'display_attrs_'.$i} == 1); @@ -871,16 +897,16 @@ 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_icon" />'. + $r->print ('print (' alt="'.$msg.'" class="LC_fileicon" />'. "\n"); $r->print(&mt("Up")."$tabtag"); $r->print(&Apache::loncommon::end_data_table_row()); @@ -906,16 +932,16 @@ sub display_line { $anchor =~ s/\W//g; $r->print (''); $r->print (''); - $r->print ('print (' name="'.$msg.'" type="image" class="LC_icon" />'. + $r->print ('print (' alt="'.$msg.'" class="LC_fileicon" />'. "\n"); my $quotable_filecom = &Apache::loncommon::escape_single($filecom[0]); $r->print ('print (' class="LC_icon" />'."\n"); + $r->print (' class="LC_fileicon" />'."\n"); $r->print (&mt("Domain")." - $listname "); if (&Apache::lonnet::domain($listname,'description')) { - $r->print("(".&Apache::lonnet::domain($listname,'description'). + $r->print("
(".&Apache::lonnet::domain($listname,'description'). ")"); } $r->print("$tabtag"); @@ -936,15 +962,15 @@ $r->print (''."\n"); $r->print (''); - $r->print (''); + $r->print (''); $r->print ('print (' name="'.$msg.'" type="image" class="LC_indexer_icon" />'. + '.gif" class="LC_fileicon"'); + $r->print (' alt="'.$msg.'"/>'. "\n"); my $quotable_curdir = &Apache::loncommon::escape_single($curdir); $r->print (''.$msg.''); + $iconpath.'quill.gif" class="LC_fileicon" />'); my $domain=(split(m|/|,$startdir))[2]; my $plainname=&Apache::loncommon::plainname($listname,$domain); $r->print ($listname.''); @@ -984,17 +1010,17 @@ $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"}) { @@ -1011,8 +1037,8 @@ $r->print ('\n"); + $r->print(''); $count++; } # Sequence open/close icon @@ -1021,13 +1047,15 @@ $r->print (''); - $r->print ('print (' name="'.$msg.'" type="image" class="LC_icon" />'. + $r->print (''); + $r->print (''); + $r->print ('print (' alt="'.$msg.'" />'. "\n"); } # Filetype icons - $r->print("\"\"\n"); + $r->print("\"\"\n"); my $quotable_filelink = &Apache::loncommon::escape_single($filelink); $r->print (" print ('\n"); + $r->print("\n"); if ($hash{'display_attrs_0'} == 1) { $r->print(' '.($title eq '' ? ' ' : $title). ' '."\n"); @@ -1059,7 +1087,7 @@ $r->print (' '.($author eq '' ? ' ' : $author). " \n"); } if ($hash{'display_attrs_5'} == 1) { @@ -1079,17 +1107,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"); } @@ -1112,11 +1136,9 @@ $r->print (''.($output eq '' ? ' ':$output). " \n"); } @@ -1147,6 +1169,18 @@ $r->print ('\n"); } + if ($hash{'display_attrs_15'} == 1) { + my $gradelevel = &Apache::lonnet::metadata($filelink,'gradelevel'); + $r->print(' '.($gradelevel eq '' ? ' ' : $gradelevel). + " \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()); } @@ -1165,15 +1199,15 @@ $r->print ('\n"); + $r->print (''); $count++; } $r->print (''); $r->print (''); - $r->print ('print (' name="'.$msg.'" class="LC_icon" />'. + $r->print (' alt="'.$msg.'" class="LC_fileicon" />'. "\n"); my $quotable_curdir = &Apache::loncommon::escape_single($curdir); @@ -1181,7 +1215,7 @@ $r->print ('print ('' - .''.&mt('Open Folder').''. "\n"); $r->print ("$listname\n"); @@ -1250,6 +1284,19 @@ $r->print ('\n"); } + if ($hash{'display_attrs_15'} == 1) { + my $gradelevel = &Apache::lonnet::metadata($filelink,'gradelevel'); + $r->print(' '.($gradelevel eq '' ? ' ' : $gradelevel). + " \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()); } @@ -1299,7 +1346,6 @@ sub showpreview { close(FH); } } - $output=''.$output.''; } elsif ($embstyle eq 'img') { $output=''.&mt('Preview').''; } elsif ($filelink=~m{^/res/($match_domain)/($match_username)/}) { @@ -1330,7 +1376,7 @@ sub begin_form { $uri=&Apache::loncommon::escape_single($uri); $r->print ('
'."\n"); $r->print (''.