--- loncom/interface/lonsearchcat.pm 2001/03/08 16:55:43 1.5 +++ loncom/interface/lonsearchcat.pm 2001/03/14 15:26:47 1.9 @@ -7,6 +7,9 @@ package Apache::lonsearchcat; use strict; use Apache::Constants qw(:common); +use Apache::lonnet(); +use Apache::File(); +use CGI qw(:standard); my %language; my $scrout; @@ -16,15 +19,32 @@ my %mimetag; sub handler { my $r = shift; + +# -------------------------------------- see if called from an interactive mode + map { + my ($name, $value) = split(/=/,$_); + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + if ($name eq 'catalogmode') { + $ENV{'form.'.$name}=$value; + } + } (split(/&/,$ENV{'QUERY_STRING'})); + $r->content_type('text/html'); $r->send_http_header; return OK if $r->header_only; %metadatafields=(); + my $hidden=''; + $hidden=< +END + # ------------------------------------------------ First, check out environment $metadatafields{'owner'}=$ENV{'user.name'}.'@'.$ENV{'user.domain'}; +# --------------------------------- Compute various listings of metadata values %language=(); $language{'any'}='Any language'; @@ -56,7 +76,11 @@ sub handler { } <$fh>; } - $scrout=""; + if ($ENV{'form.basicsubmit'} eq 'SEARCH') { + return &basicsearch($r,$ENV{'form.basicexp'}); + } + + $scrout=''; # building a part of screen output $scrout.=&searchphrasefield('Limit by title','title', ''); @@ -78,404 +102,108 @@ sub handler { $scrout.=&selectbox('Limit by language','language', 'any',%language); - $scrout.=< LIMIT BY CREATION DATE RANGE:
-between: - - -and: - - -

+between: +CREATIONDATESTART + $scrout.=&dateboxes('creationdatestart',1,1,1976); + $scrout.=< LIMIT BY LAST REVISION DATE RANGE: -
between: - - -and: + +Title only +
+ + + +

+
+

Advanced Search

+$scrout +

+ + + +

+ + + +ENDDOCUMENT + return OK; +} + +# --------------------------------------------------------- Various form fields + +sub textfield { + my ($title,$name,$value)=@_; + return "\n

$title:
". + ''; +} + +sub searchphrasefield { + my ($title,$name,$value)=@_; + my $instruction=<$uctitle:". + " $instruction
". + ''; +} + +sub dateboxes { + my ($name,$defaultmonth,$defaultday,$defaultyear)=@_; + return< + @@ -489,8 +217,8 @@ and: - + @@ -523,8 +251,8 @@ and: + @@ -602,83 +330,148 @@ and:'; + map { + $selout.='

-LASTREVISIONDATEEND +END +} - $scrout.=&searchphrasefield('Limit by publisher/owner','owner', - $metadatafields{'owner'}); + unless ($compiledresult) { + $compiledresult="There were no results that matched your query"; + } - $scrout.=&selectbox('Limit by copyright/distribution','copyright', - 'any',%cprtag); + # make query information persistent to allow for subsequent revision + my $persistent=''; + map { + if (/^form\./ && !/submit/) { + my $name=$_; + my $key=$name; + $name=~s/^form\.//; + $persistent.=< +END + } + } (keys %ENV); -# ---------------------------------------------------------------- Print screen - $r->print(<print(< The LearningOnline Network with CAPA +BEGINNING + $r->print(< + function select_data(title,url) { + changeTitle(title); + changeURL(url); + } + function changeTitle(val) { + if (opener.inf.document.forms.resinfo.elements.t) { + opener.inf.document.forms.resinfo.elements.t.value=val; + } + } + function changeURL(val) { + if (opener.inf.document.forms.resinfo.elements.u) { + opener.inf.document.forms.resinfo.elements.u.value=val; + } + } + +SCRIPT + $r->print(< - +

Search Catalog

+ +$persistent
-

Basic Search

-

-Enter terms or phrases separated by search operators -such as AND or OR then press SEARCH below. Terms should be specific -to the title, author, subject, notes, or abstract information associated -with a resource. -
- - -Title only -
- -

-
-

Advanced Search

-$scrout +

Search Query

- +Basic search: $expression

-
+

Search Results

+$compiledresult -ENDDOCUMENT - return OK; -} +RESULTS -# --------------------------------------------------------- Various form fields - -sub textfield { - my ($title,$name,$value)=@_; - return "\n

$title:
". - ''; -} - -sub searchphrasefield { - my ($title,$name,$value)=@_; - my $instruction=<$uctitle:". - ": $instruction
". - ''; -} - -sub selectbox { - my ($title,$name,$value,%options)=@_; - my $uctitle=uc($title); - my $selout="\n

$uctitle:". - "
".''; + return OK; } 1;