--- loncom/interface/lonsearchcat.pm 2002/06/25 15:08:59 1.129 +++ loncom/interface/lonsearchcat.pm 2006/03/15 20:56:16 1.256 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.129 2002/06/25 15:08:59 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.256 2006/03/15 20:56:16 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,14 +25,6 @@ # # http://www.lon-capa.org/ # -# YEAR=2001 -# 3/8, 3/12, 3/13, 3/14, 3/15, 3/19 Scott Harrison -# 3/20, 3/21, 3/22, 3/26, 3/27, 4/2, 8/15, 8/24, 8/25 Scott Harrison -# 10/12,10/14,10/15,10/16,11/28,11/29,12/10,12/12,12/16 Scott Harrison -# YEAR=2002 -# 1/17 Scott Harrison -# 6/17 Matthew Hall -# ############################################################################### ############################################################################### @@ -40,7 +32,7 @@ =head1 NAME -lonsearchcat +lonsearchcat - LONCAPA Search Interface =head1 SYNOPSIS @@ -56,7 +48,7 @@ described at http://www.lon-capa.org. lonsearchcat presents the user with an interface to search the LON-CAPA digital library. lonsearchcat also initiates the execution of a search by sending the search parameters to LON-CAPA servers. The progress of -search (on a server basis) is displayed to the user in a seperate window. +search (on a server basis) is displayed to the user in a separate window. =head1 Internals @@ -67,245 +59,727 @@ search (on a server basis) is displayed ############################################################################### ############################################################################### -############################################################################### -## ## -## ORGANIZATION OF THIS PERL MODULE ## -## ## -## 1. Modules used by this module ## -## 2. Variables used throughout the module ## -## 3. handler subroutine called via Apache and mod_perl ## -## 4. Other subroutines ## -## ## -############################################################################### - package Apache::lonsearchcat; -# ------------------------------------------------- modules used by this module use strict; -use Apache::Constants qw(:common); -use Apache::lonnet(); +use Apache::Constants qw(:common :http); +use Apache::lonnet; use Apache::File(); use CGI qw(:standard); use Text::Query; use GDBM_File; use Apache::loncommon(); - -# ---------------------------------------- variables used throughout the module - -###################################################################### -###################################################################### - -=pod - -=item Global variables - -=over 4 - -=item $closebutton - -button that closes the search window - -=item $importbutton - -button to take the selecte results and go to group sorting - -=item %hash - -The ubiquitous database hash - -=item $diropendb - -The full path to the (temporary) search database file. This is set and -used in &handler() and is also used in &output_results(). - -=back - -=cut - -###################################################################### -###################################################################### - -# -- dynamically rendered interface components -my $closebutton; # button that closes the search window -my $importbutton; # button to take the selected results and go to group sorting - -# -- miscellaneous variables -my %hash; # database hash -my $diropendb = ""; # db file +use Apache::lonmysql(); +use Apache::lonmeta; +use Apache::lonhtmlcommon; +use Apache::lonlocal; +use LONCAPA::lonmetadata(); +use HTML::Entities(); +use Parse::RecDescent; +use Apache::lonnavmaps; +use Apache::lonindexer(); ###################################################################### ###################################################################### - -=pod - -=item &handler() - main handler invoked by httpd child - -=item Variables - -=over 4 - -=item $hidden - -holds 'hidden' html forms - -=item $scrout - -string that holds portions of the screen output - -=back - -=cut +## +## Global variables +## +###################################################################### +###################################################################### +my %groupsearch_db; # Database hash used to save values for the + # groupsearch RAT interface. +my %persistent_db; # gdbm hash which holds data which is supposed to + # persist across calls to lonsearchcat.pm + +# The different view modes and associated functions + +my %Views = ("detailed" => \&detailed_citation_view, + "detailedpreview" => \&detailed_citation_preview, + "summary" => \&summary_view, + "summarypreview" => \&summary_preview, + "fielded" => \&fielded_format_view, + "xml" => \&xml_sgml_view, + "compact" => \&compact_view); ###################################################################### ###################################################################### sub handler { my $r = shift; - untie %hash; +# &set_defaults(); + # + # set form defaults + # + my $hidden_fields;# Hold all the hidden fields used to keep track + # of the search system state + my $importbutton; # button to take the selected results and go to group + # sorting + my $diropendb; # The full path to the (temporary) search database file. + # This is set and used in &handler() and is also used in + # &output_results(). + my $bodytag; # LON-CAPA standard body tag, gotten from + # &Apache::lonnet::bodytag. + # No title, no table, just a
tag. - $r->content_type('text/html'); + my $loaderror=&Apache::lonnet::overloaderror($r); + if ($loaderror) { return $loaderror; } + # + my $closebutton; # button that closes the search window + # This button is different for the RAT compared to + # normal invocation. + # + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; - - my $domain = $r->dir_config('lonDefDomain'); - $diropendb= "/home/httpd/perl/tmp/".&Apache::lonnet::escape($domain). - "\_".&Apache::lonnet::escape($ENV{'user.name'})."_searchcat.db"; - + ## + ## Prevent caching of the search interface window. Hopefully this means + ## we will get the launch=1 passed in a little more. + &Apache::loncommon::no_cache($r); + ## + ## Pick up form fields passed in the links. + ## &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['catalogmode','launch','acts','mode','form','element', - 'reqinterface']); + ['catalogmode','launch','acts','mode','form','element','pause', + 'phase','persistent_db_id','table','start','show', + 'cleargroupsort','titleelement']); + ## + ## The following is a trick - we wait a few seconds if asked to so + ## the daemon running the search can get ahead of the daemon + ## printing the results. We only need (theoretically) to do + ## this once, so the pause indicator is deleted + ## + if (exists($env{'form.pause'})) { + sleep(1); + delete($env{'form.pause'}); + } + ## + ## Initialize global variables + ## + my $domain = $r->dir_config('lonDefDomain'); + $diropendb= "/home/httpd/perl/tmp/". + "$env{'user.domain'}_$env{'user.name'}_searchcat.db"; + # + # set the name of the persistent database + # $env{'form.persistent_db_id'} can only have digits in it. + if (! exists($env{'form.persistent_db_id'}) || + ($env{'form.persistent_db_id'} =~ /\D/) || + ($env{'form.launch'} eq '1')) { + $env{'form.persistent_db_id'} = time; + } + $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); + my $persistent_db_file = "/home/httpd/perl/tmp/". + &Apache::lonnet::escape($domain). + '_'.&Apache::lonnet::escape($env{'user.name'}). + '_'.$env{'form.persistent_db_id'}.'_persistent_search.db'; ## - ## Clear out old values from database + &Apache::lonhtmlcommon::clear_breadcrumbs(); + if (exists($env{'request.course.id'}) && $env{'request.course.id'} ne '') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/searchcat?'. + 'catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, + text=>"Course and Catalog Search", + target=>'_top', + bug=>'Searching',}); + } else { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/searchcat?'. + 'catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, + text=>"Catalog Search", + target=>'_top', + bug=>'Searching',}); + } + # + if ($env{'form.phase'} !~ m/(basic|adv|course)_search/) { + if (! &get_persistent_form_data($persistent_db_file)) { + if ($env{'form.phase'} =~ /(run_search|results)/) { + &Apache::lonnet::logthis('lonsearchcat:'. + 'Unable to recover data from '. + $persistent_db_file); + my $msg = + 'We were unable to retrieve data describing your search. '. + 'This is a serious error and has been logged. '. + 'Please alert your LON-CAPA administrator.'; + return &error_page($r,$msg); + } + } + } else { + &clean_up_environment(); + } + ## + ## Clear out old values from groupsearch database ## - if ($ENV{'form.launch'} eq '1') { - if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) { + untie %groupsearch_db if (tied(%groupsearch_db)); + if (($env{'form.cleargroupsort'} eq '1') || + (($env{'form.launch'} eq '1') && + ($env{'form.catalogmode'} eq 'groupsearch'))) { + if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { &start_fresh_session(); - untie %hash; + untie %groupsearch_db; + delete($env{'form.cleargroupsort'}); } else { - $r->print('Unable to tie hash to db '. - 'file'); - return OK; + # This is a stupid error to give to the user. + # It really tells them nothing. + my $msg = 'Unable to tie hash to db file.'; + return &error_page($r,$msg); } } ## - ## Produce some output, so people know it is working + ## Configure hidden fields ## - $r->print("\n"); - $r->rflush; + $hidden_fields = ''."\n"; + if (exists($env{'form.catalogmode'})) { + $hidden_fields .= &hidden_field('catalogmode'); + } + if (exists($env{'form.form'})) { + $hidden_fields .= &hidden_field('form'); + } + if (exists($env{'form.element'})) { + $hidden_fields .= &hidden_field('element'); + } + if (exists($env{'form.titleelement'})) { + $hidden_fields .= &hidden_field('titleelement'); + } + if (exists($env{'form.mode'})) { + $hidden_fields .= &hidden_field('mode'); + } ## ## Configure dynamic components of interface ## - my $hidden; # Holds 'hidden' html forms - if ($ENV{'form.catalogmode'} eq 'interactive') { - $hidden="". - "\n"; - $closebutton=""."\n"; - } elsif ($ENV{'form.catalogmode'} eq 'groupsearch') { - $hidden=<'.&mt('No matches found in resources').'.
'); + } + +# Check discussions if requested + if ($discuss) { + my $totaldiscussions = 0; + $r->print(''.&mt('No matches found in postings').'.
'); + } + } + +# =================================================== Done going through course + $r->print(&Apache::loncommon::end_page()); +} + +# =============================== This pulls up a resource and its dependencies + +sub checkonthis { + my ($r,$id,$url,$level,$title,$fulltext,$symb,@allwords)=@_; + $alreadyseen{$id}=1; + if (&Apache::loncommon::connection_aborted($r)) { return; } + $r->rflush(); + + my $result=$title.' '; + if ($env{'request.role.adv'} || !$hash{'encrypted_'.$id}) { + $result.=&Apache::lonnet::metadata($url,'title').' '. + &Apache::lonnet::metadata($url,'subject').' '. + &Apache::lonnet::metadata($url,'abstract').' '. + &Apache::lonnet::metadata($url,'keywords'); + } + my ($extension)=($url=~/\.(\w+)$/); + if (&Apache::loncommon::fileembstyle($extension) eq 'ssi' && + ($url) && ($fulltext)) { + $result.=&Apache::lonnet::ssi_body($url.'?symb='.&Apache::lonnet::escape($symb)); + } + $result=~s/\s+/ /gs; + my $applies = 0; + $applies = &checkwords($result,$applies,@allwords); +# Does this resource apply? + if ($applies) { + $r->print('-Enter terms or quoted phrases separated by AND, OR, or NOT -then press SEARCH below. +$lt{'note'}.
-ENDDOCUMENT
- $scrout.=' '.&simpletextfield('basicexp',$ENV{'form.basicexp'},40).
- ' ';
-# $scrout.=&simplecheckbox('allversions',$ENV{'form.allversions'});
-# $scrout.='Search historic archives';
- $scrout.=<Advanced Search | |
-
-$closebutton
-
-
-
-
+ENDCOURSESEARCH
+ $scrout.=' '.
+ &Apache::lonhtmlcommon::textbox('courseexp',
+ $env{'form.courseexp'},40);
+ my $crscheckbox =
+ &Apache::lonhtmlcommon::checkbox('crsfulltext',
+ $env{'form.crsfulltext'});
+ my $relcheckbox =
+ &Apache::lonhtmlcommon::checkbox('crsrelated',
+ $env{'form.crsrelated'});
+ my $discheckbox =
+ &Apache::lonhtmlcommon::checkbox('crsdiscuss',
+ $env{'form.crsrelated'});
+ $scrout.=(<
+
+
+
+
- - +sub print_advanced_search_form{ + my ($r,$closebutton,$hidden_fields) = @_; + my $bread_crumb = + &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching', + 'Search_Advanced', + undef,undef, + $env{'form.catalogmode'} ne 'groupsearch'); + my %lt=&Apache::lonlocal::texthash('srch' => 'Search', + 'reset' => 'Reset', + 'help' => 'Help'); + my $advanced_buttons=<<"END"; + + $closebutton - - - - -
END - my $scrout=<<"ENDHEADER"; - - -\n";
- if ($ENV{'form.catalogmode'} eq 'interactive') {
- my $titleesc=$Fields{'title'};
- $titleesc=~s/\'/\\'/; # '
- $compiledresult.=< \n";
+ if (! defined($Fields{'title'}) || $Fields{'title'} eq '') {
+ $Fields{'title'} = 'Untitled';
+ }
+ my $prefix=&catalogmode_output($Fields{'title'},$Fields{'url'},
+ $Fields{'id'},$checkbox_num++);
+ # Render the result into html
+ $output.= &$viewfunction($prefix,%Fields);
+ # Print them out as they come in.
+ $r->print($output);
+ $r->rflush();
+ }
+ if (@Results < 1) {
+ $r->print(&mt("There were no results matching your query"));
+ } else {
+ $r->print
+ ('
'
+ );
+ if ($total_results == 0) {
+ $r->print(''.
+ ''.
+ ' '.
+ &prev_next_buttons($min,$env{'form.show'},$total_results).
+ ' '.
+ &viewoptions().' '.&mt('There are currently no results').'.
'.
+ "".
+ &Apache::loncommon::end_page());
+ return;
+ } else {
+ $r->print('
END
- }
- if ($ENV{'form.catalogmode'} eq 'groupsearch') {
- $fnum+=0;
- $hash{"pre_${fnum}_link"}=$Fields{'url'};
- $hash{"pre_${fnum}_title"}=$Fields{'title'};
- $compiledresult.=<
END
-#
-#
- $fnum++;
- }
- my $viewselect;
- if ($mode eq 'Basic') {
- $viewselect=$ENV{'form.basicviewselect'};
- }
- elsif ($mode eq 'Advanced') {
- $viewselect=$ENV{'form.advancedviewselect'};
- }
- if ($viewselect eq 'Detailed Citation View') {
- $compiledresult.=&detailed_citation_view
- (%Fields, hostname => $rkey );
- }
- elsif ($viewselect eq 'Summary View') {
- $compiledresult.=&summary_view
- (%Fields, hostname => $rkey );
- }
- elsif ($viewselect eq 'Fielded Format') {
- $compiledresult.=&fielded_format_view
- (%Fields, hostname => $rkey );
- }
- elsif ($viewselect eq 'XML/SGML') {
- $compiledresult.=&xml_sgml_view
- (%Fields, hostname => $rkey );
- }
- }
- untie %hash;
- }
- if ($compiledresult) {
- $resultflag=1;
- $r->print($compiledresult);
- }
- my $percent=sprintf('%3.0f',($servercount/$servernum*100));
- } # End of foreach loop over servers remaining
- } # End of big loop - while($serversleft && $timeremain)
- unless ($resultflag) {
- $r->print("\nThere were no results that matched your query\n");
}
-# $r->print(''."\n"); $r->rflush();
- $r->print("\n\n");
- return;
+ return $output;
+}
+######################################################################
+######################################################################
+
+=pod
+
+=item &parse_row()
+
+Parse a row returned from the database.
+
+=cut
+
+######################################################################
+######################################################################
+sub parse_row {
+ my @Row = @_;
+ my %Fields;
+ if (! scalar(@Datatypes)) {
+ &set_up_table_structure();
+ }
+ for (my $i=0;$i<=$#Row;$i++) {
+ $Fields{$Datatypes[$i]->{'name'}}=&Apache::lonnet::unescape($Row[$i]);
+ }
+ $Fields{'language'} =
+ &Apache::loncommon::languagedescription($Fields{'language'});
+ $Fields{'copyrighttag'} =
+ &Apache::loncommon::copyrightdescription($Fields{'copyright'});
+ $Fields{'mimetag'} =
+ &Apache::loncommon::filedescription($Fields{'mime'});
+ return \%Fields;
}
###########################################################
@@ -1280,13 +2884,10 @@ END
=item &parse_raw_result()
Takes a line from the file of results and parse it. Returns a hash
-with keys for the following fields:
-'title', 'author', 'subject', 'url', 'keywords', 'version', 'notes',
-'abstract', 'mime', 'lang', 'owner', 'copyright', 'creationdate',
-'lastrevisiondate'.
+with keys according to column labels
In addition, the following tags are set by calling the appropriate
-lonnet function: 'language', 'cprtag', 'mimetag'.
+lonnet function: 'language', 'copyrighttag', 'mimetag'.
The 'title' field is set to "Untitled" if the title field is blank.
@@ -1298,59 +2899,11 @@ The 'title' field is set to "Untitled" i
###########################################################
sub parse_raw_result {
my ($result,$hostname) = @_;
- # Check for a comma - if it is there then we do not need to unescape the
- # string. There seems to be some kind of problem with some items in
- # the database - the entire string gets sent out unescaped...?
- unless ($result =~ /,/) {
- $result = &Apache::lonnet::unescape($result);
- }
- my @fields=map {
- &Apache::lonnet::unescape($_);
- } (split(/\,/,$result));
- my ($title,$author,$subject,$url,$keywords,$version,
- $notes,$abstract,$mime,$lang,
- $creationdate,$lastrevisiondate,$owner,$copyright)=@fields;
- my %Fields =
- ( title => &Apache::lonnet::unescape($title),
- author => &Apache::lonnet::unescape($author),
- subject => &Apache::lonnet::unescape($subject),
- url => &Apache::lonnet::unescape($url),
- keywords => &Apache::lonnet::unescape($keywords),
- version => &Apache::lonnet::unescape($version),
- notes => &Apache::lonnet::unescape($notes),
- abstract => &Apache::lonnet::unescape($abstract),
- mime => &Apache::lonnet::unescape($mime),
- lang => &Apache::lonnet::unescape($lang),
- owner => &Apache::lonnet::unescape($owner),
- copyright => &Apache::lonnet::unescape($copyright),
- creationdate => &Apache::lonnet::unescape($creationdate),
- lastrevisiondate => &Apache::lonnet::unescape($lastrevisiondate)
- );
- $Fields{'language'} =
- &Apache::loncommon::languagedescription($Fields{'lang'});
- $Fields{'copyrighttag'} =
- &Apache::loncommon::copyrightdescription($Fields{'copyright'});
- $Fields{'mimetag'} =
- &Apache::loncommon::filedescription($Fields{'mime'});
- # Put spaces in the keyword list, if needed.
- $Fields{'keywords'}=~ s/,([A-z])/, $1/g;
- if ($Fields{'title'}=~ /^\s*$/ ) {
- $Fields{'title'}='Untitled';
- }
- unless ($ENV{'user.adv'}) {
- $Fields{'keywords'} = '- not displayed -';
- $Fields{'notes'} = '- not displayed -';
- $Fields{'abstract'} = '- not displayed -';
- $Fields{'subject'} = '- not displayed -';
- }
- if (length($Fields{'abstract'})>200) {
- $Fields{'abstract'} =
- substr($Fields{'abstract'},0,200).'...';
- }
- if (length($Fields{'keywords'})>200) {
- $Fields{'keywords'} =
- substr($Fields{'keywords'},0,200).'...';
- }
+ # conclude from self to others regarding fields
+ my %Fields=&LONCAPA::lonmetadata::metadata_col_to_hash
+ (map {
+ &Apache::lonnet::unescape($_);
+ } (split(/\,/,$result)) );
return %Fields;
}
@@ -1370,8 +2923,8 @@ sub handle_custom_fields {
my $customshow='';
my $extrashow='';
my @customfields;
- if ($ENV{'form.customshow'}) {
- $customshow=$ENV{'form.customshow'};
+ if ($env{'form.customshow'}) {
+ $customshow=$env{'form.customshow'};
$customshow=~s/[^\w\s]//g;
my @fields=map {
"$_:";
@@ -1400,12 +2953,20 @@ sub handle_custom_fields {
=pod
-=item &search_results_header
+=item &search_results_header()
+
+Output the proper html headers and javascript code to deal with different
+calling modes.
+
+Takes most inputs directly from %env, except $mode.
+
+=over 4
+
+=item $mode is either (at this writing) 'Basic' or 'Advanced'
-Output the proper javascript code to deal with different calling modes.
+=back
-Takes inputs directly from from %ENV. The following environment variables
-are checked:
+The following environment variables are checked:
=over 4
@@ -1419,8 +2980,16 @@ Checked for existance & 'edit' mode.
=item 'form.form'
+Contains the name of the form that has the input fields to set
+
=item 'form.element'
+the name of the input field to put the URL into
+
+=item 'form.titleelement'
+
+the name of the input field to put the title into
+
=back
=cut
@@ -1428,50 +2997,66 @@ Checked for existance & 'edit' mode.
######################################################################
######################################################################
sub search_results_header {
- my $result = '';
+ my ($importbutton,$closebutton) = @_;
+ my $result =
+ &Apache::lonxml::xmlbegin().
+ &Apache::loncommon::headtag();
+
# output beginning of search page
- $result.=<
+ENDSTATUS
+}
+
+sub results_link {
+ my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}.
+ "&persistent_db_id=".$env{'form.persistent_db_id'};
+ my $results_link = $basic_link."&phase=results".
+ "&pause=1"."&start=1";
+ return $results_link;
+}
-=pod
-
-=item &make_popwin()
-
-Returns html with javascript in it to open up the status window.
+######################################################################
+######################################################################
+sub print_frames_interface {
+ my $r = shift;
+ my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}.
+ "&persistent_db_id=".$env{'form.persistent_db_id'};
+ my $run_search_link = $basic_link."&phase=run_search";
+ my $results_link = &results_link();
+ my $html = &Apache::lonxml::xmlbegin();
+ my $head = &Apache::loncommon::headtag('LON-CAPA Digital Library Search Results');
+ my $end_head = &Apache::loncommon::endheadtag();
+ my $result = <<"ENDFRAMES";
+$html
+$head
+
+$end_head
+
+
+ENDFRAMES
-=cut
+ $r->print($result);
+ return;
+}
######################################################################
######################################################################
-sub make_popwin {
- my %rhash = @_;
- my $servernum=(keys %rhash);
- my $hcinit;
- my $grid="'
'+\n";
- # $sn is the server number, used ONLY to make sure we have
- # rows of 10 each. No longer used to index images.
- my $sn=1;
- foreach my $sk (sort keys %rhash) {
- # ''+
- $grid.="'+\"'\"+')\">'+";
- $grid.="\n";
- $grid.="''+\n";
- $grid.="'
'+\n" unless $sn%10;
- $sn++;
+
+sub has_stat_data {
+ my ($values) = @_;
+ if ( (defined($values->{'count'}) && $values->{'count'} ne '') ||
+ (defined($values->{'stdno'}) && $values->{'stdno'} ne '') ||
+ (defined($values->{'disc'}) && $values->{'disc'} ne '') ||
+ (defined($values->{'avetries'}) && $values->{'avetries'} ne '') ||
+ (defined($values->{'difficulty'}) && $values->{'difficulty'} ne '')) {
+ return 1;
}
- my $result.=<$values{'title'}
-$values{'author'}
-
-Subject: $values{'subject'}
-Keyword(s): $values{'keywords'}
-Notes: $values{'notes'}
-MIME Type:
-END
- $result.=&Apache::loncommon::filedescription($values{'mime'});
- $result.=<
-$values{'shortabstract'} -
-END + my ($prefix,%values) = @_; + my $result; + my $jumpurl=$values{'url'}; + $jumpurl=~s/^\/ext\//http\:\/\//; + $result .= ''.$prefix. + ''.' '. + ''.$values{'title'}."\n"; + $result .= "\n";
+ $result .= ''.$values{'author'}.','.
+ ' '.$values{'owner'}.'
';
+ foreach my $field
+ (
+ { name=>'url',
+ translate => 'URL: [_1]',
+ special => 'url link',},
+ { name=>'subject',
+ translate => 'Subject: [_1]',},
+ { name=>'keywords',
+ translate => 'Keywords: [_1]',},
+ { name=>'notes',
+ translate => 'Notes: [_1]',},
+ { name=>'mimetag',
+ translate => 'MIME Type: [_1]',},
+ { name=>'standards',
+ translate => 'Standards:[_1]',},
+ { name=>'copyrighttag',
+ translate => 'Copyright/Distribution: [_1]',},
+ { name=>'count',
+ format => "%d",
+ translate => 'Access Count: [_1]',},
+ { name=>'stdno',
+ format => "%d",
+ translate => 'Number of Students: [_1]',},
+ { name=>'avetries',
+ format => "%.2f",
+ translate => 'Average Tries: [_1]',},
+ { name=>'disc',
+ format => "%.2f",
+ translate => 'Degree of Discrimination: [_1]',},
+ { name=>'difficulty',
+ format => "%.2f",
+ translate => 'Degree of Difficulty: [_1]',},
+ { name=>'clear',
+ format => "%.2f",
+ translate => 'Clear: [_1]',},
+ { name=>'depth',
+ format => "%.2f",
+ translate => 'Depth: [_1]',},
+ { name=>'helpful',
+ format => "%.2f",
+ translate => 'Helpful: [_1]',},
+ { name=>'correct',
+ format => "%.2f",
+ translate => 'Correct: [_1]',},
+ { name=>'technical',
+ format => "%.2f",
+ translate => 'Technical: [_1]',},
+ { name=>'comefrom_list',
+ type => 'list',
+ translate => 'Resources that lead up to this resource in maps',},
+ { name=>'goto_list',
+ type => 'list',
+ translate => 'Resources that follow this resource in maps',},
+ { name=>'sequsage_list',
+ type => 'list',
+ translate => 'Resources using or importing resource',},
+ ) {
+ next if (! exists($values{$field->{'name'}}) ||
+ $values{$field->{'name'}} eq '');
+ if (exists($field->{'type'}) && $field->{'type'} eq 'list') {
+ $result .= ''.&mt($field->{'translate'}).'
'.$values{'extrashow'}.'
'; + } + if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { + $result .= ''.$values{'shortabstract'}.'
'; + } + $result .= ''. + &detailed_citation_view($prefix,%values). + ' | '. + &Apache::lonindexer::showpreview($values{'url'}). + ' |
'. + &summary_view($prefix,%values). + ' | '. + &Apache::lonindexer::showpreview($values{'url'}). + ' |
+$errorstring +
++$revise +
+$end_page +ENDPAGE } ###################################################################### @@ -1809,41 +3606,43 @@ sub filled { =item &output_blank_field_error() +Output a complete page that indicates the user has not filled in enough +information to do a search. + +Inputs: $r (Apache request handle), $closebutton, $parms. + +Returns: nothing + +$parms is extra information to include in the 'Revise search request' link. + =cut ###################################################################### ###################################################################### sub output_blank_field_error { - my ($r)=@_; - # make query information persistent to allow for subsequent revision - my $persistent=&make_persistent(); - - $r->print(<-Incorrect search query due to blank entry fields. -You need to fill in the relevant -fields on the search page in order for a query to be -processed. +$errormsg
- - -RESULTS ++$revise +
+$end_page +ENDPAGE + return; } ###################################################################### @@ -1855,35 +3654,34 @@ RESULTS Output a full html page with an error message. +Inputs: + + $r, the request pointer. + $message, the error message for the user. + $closebutton, the specialized close button needed for groupsearch. + =cut ###################################################################### ###################################################################### sub output_date_error { - my ($r,$message)=@_; + my ($r,$message,$closebutton,$hidden_fields)=@_; # make query information persistent to allow for subsequent revision - my $persistent=&make_persistent(); - + my $start_page = &Apache::loncommon::start_page('Search'); + my $end_page = &Apache::loncommon::end_page(); $r->print(<$message
- -