Annotation of loncom/interface/lonsearchcat.pm, revision 1.41
1.1 www 1: # The LearningOnline Network
2: # Search Catalog
3: #
1.2 harris41 4: # 03/08/2001 Scott Harrison
1.1 www 5: #
1.41 ! harris41 6: # Functions
! 7: #
! 8: # handler(server reference) : interacts with the Apache server layer
! 9: # (for /adm/searchcat URLs)
! 10: # simpletextfield(name,value) : returns HTML formatted string for simple text
! 11: # field
! 12: # simplecheckbox(name,value) : returns HTML formatted string for simple
! 13: # checkbox
! 14: # searchphrasefield(title,name,value) : returns HTML formatted string for
! 15: # a search expression phrase field
! 16: # dateboxes(name, defaultmonth, defaultday, defaultyear) : returns HTML
! 17: # formatted string
! 18: # for a calendar date
! 19: # selectbox(title,name,value,%HASH=options) : returns HTML formatted string for
! 20: # a selection box field
! 21: # advancedsearch() :
! 22: # filled(field) : determines whether a given field has been filled
! 23: # basicsearch() :
! 24: # output_blank_field_error() : outputs a message saying that more fields need
! 25: # to be filled in
! 26: # output_results() : outputs results from search
! 27: # build_SQL_query() : builds a SQL query string from a logical expression
! 28: # with AND/OR keywords
! 29:
1.1 www 30: package Apache::lonsearchcat;
31:
32: use strict;
33: use Apache::Constants qw(:common);
1.6 harris41 34: use Apache::lonnet();
35: use Apache::File();
1.7 harris41 36: use CGI qw(:standard);
1.41 ! harris41 37: use Text::Query;
1.1 www 38:
1.3 harris41 39: my %language;
40: my $scrout;
41: my %metadatafields;
42: my %cprtag;
43: my %mimetag;
44:
1.1 www 45: sub handler {
46: my $r = shift;
1.7 harris41 47:
48: # -------------------------------------- see if called from an interactive mode
49: map {
50: my ($name, $value) = split(/=/,$_);
51: $value =~ tr/+/ /;
52: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
53: if ($name eq 'catalogmode') {
54: $ENV{'form.'.$name}=$value;
55: }
56: } (split(/&/,$ENV{'QUERY_STRING'}));
57:
1.1 www 58: $r->content_type('text/html');
59: $r->send_http_header;
60: return OK if $r->header_only;
61:
1.3 harris41 62: %metadatafields=();
63:
1.8 harris41 64: my $hidden='';
65: $hidden=<<END if $ENV{'form.catalogmode'} eq 'interactive';
66: <input type='hidden' name='catalogmode' value='interactive'>
67: END
68:
1.3 harris41 69: # ------------------------------------------------ First, check out environment
70: $metadatafields{'owner'}=$ENV{'user.name'}.'@'.$ENV{'user.domain'};
71:
1.8 harris41 72: # --------------------------------- Compute various listings of metadata values
1.3 harris41 73:
74: %language=();
75: $language{'any'}='Any language';
76: {
77: my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab');
78: map {
79: $_=~/(\w+)\s+([\w\s\-]+)/;
80: $language{$1}=$2;
81: } <$fh>;
82: }
83:
84: %cprtag=();
85: $cprtag{'any'}='Any copyright/distribution';
86: {
87: my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab');
88: map {
89: $_=~/(\w+)\s+([\w\s\-]+)/;
90: $cprtag{$1}=$2;
91: } <$fh>;
92: }
93:
94: %mimetag=();
95: $mimetag{'any'}='Any type';
96: {
97: my $fh=Apache::File->new($r->dir_config('lonTabDir').'/filetypes.tab');
98: map {
99: $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/;
100: $mimetag{$1}=".$1 $3";
101: } <$fh>;
102: }
103:
1.6 harris41 104: if ($ENV{'form.basicsubmit'} eq 'SEARCH') {
1.19 harris41 105: return &basicsearch($r,\%ENV);
1.6 harris41 106: }
1.18 harris41 107: elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') {
108: return &advancedsearch($r,\%ENV);
109: }
1.6 harris41 110:
1.8 harris41 111: $scrout=''; # building a part of screen output
1.3 harris41 112: $scrout.=&searchphrasefield('Limit by title','title',
1.11 harris41 113: $ENV{'form.title'});
1.3 harris41 114:
115: $scrout.=&searchphrasefield('Limit by author','author',
1.11 harris41 116: $ENV{'form.author'});
1.3 harris41 117:
118: $scrout.=&searchphrasefield('Limit by subject','subject',
1.11 harris41 119: $ENV{'form.subject'});
120:
121: $scrout.=&searchphrasefield('Limit by keywords','keywords',
122: $ENV{'form.keywords'});
123:
124: $scrout.=&searchphrasefield('Limit by URL','url',
125: $ENV{'form.url'});
126:
127: $scrout.=&searchphrasefield('Limit by version','version',
128: $ENV{'form.version'});
1.3 harris41 129:
130: $scrout.=&searchphrasefield('Limit by notes','notes',
1.11 harris41 131: $ENV{'form.notes'});
1.3 harris41 132:
133: $scrout.=&searchphrasefield('Limit by abstract','abstract',
1.11 harris41 134: $ENV{'form.abstract'});
1.3 harris41 135:
1.11 harris41 136: $ENV{'form.mime'}='notxxx' unless length($ENV{'form.mime'});
1.3 harris41 137: $scrout.=&selectbox('Limit by MIME type','mime',
1.11 harris41 138: $ENV{'form.mime'},%mimetag);
139:
140: $ENV{'form.language'}='any' unless length($ENV{'form.language'});
1.3 harris41 141:
142: $scrout.=&selectbox('Limit by language','language',
1.11 harris41 143: $ENV{'form.language'},%language);
1.3 harris41 144:
1.8 harris41 145:
146: # ------------------------------------------------ Compute date selection boxes
147: $scrout.=<<CREATIONDATESTART;
1.3 harris41 148: <p>
149: <font color="#800000" face="helvetica"><b>LIMIT BY CREATION DATE RANGE:</b>
150: </font>
151: <br>
1.8 harris41 152: between:
153: CREATIONDATESTART
1.11 harris41 154: $scrout.=&dateboxes('creationdatestart',1,1,1976,
155: $ENV{'form.creationdatestart_month'},
156: $ENV{'form.creationdatestart_day'},
157: $ENV{'form.creationdatestart_year'},
158: );
1.8 harris41 159: $scrout.=<<CREATIONDATEEND;
160: and:
161: CREATIONDATEEND
1.11 harris41 162: $scrout.=&dateboxes('creationdateend',12,31,2051,
163: $ENV{'form.creationdateend_month'},
164: $ENV{'form.creationdateend_day'},
165: $ENV{'form.creationdateend_year'},
166: );
1.8 harris41 167: $scrout.="</p>";
168:
169: $scrout.=<<LASTREVISIONDATESTART;
170: <p>
171: <font color="#800000" face="helvetica"><b>LIMIT BY LAST REVISION DATE RANGE:
172: </b></font>
173: <br>between:
174: LASTREVISIONDATESTART
1.11 harris41 175: $scrout.=&dateboxes('lastrevisiondatestart',1,1,1976,
176: $ENV{'form.lastrevisiondatestart_month'},
177: $ENV{'form.lastrevisiondatestart_day'},
178: $ENV{'form.lastrevisiondatestart_year'},
179: );
1.8 harris41 180: $scrout.=<<LASTREVISIONDATEEND;
181: and:
182: LASTREVISIONDATEEND
1.11 harris41 183: $scrout.=&dateboxes('lastrevisiondateend',12,31,2051,
184: $ENV{'form.lastrevisiondateend_month'},
185: $ENV{'form.lastrevisiondateend_day'},
186: $ENV{'form.lastrevisiondateend_year'},
187: );
1.8 harris41 188: $scrout.='</p>';
189:
190: $scrout.=&searchphrasefield('Limit by publisher/owner','owner',
1.11 harris41 191: $ENV{'form.owner'});
192: # $metadatafields{'owner'});
1.8 harris41 193:
1.11 harris41 194: $ENV{'form.copyright'}='any' unless length($ENV{'form.copyright'});
1.8 harris41 195: $scrout.=&selectbox('Limit by copyright/distribution','copyright',
1.11 harris41 196: $ENV{'form.copyright'},%cprtag);
1.8 harris41 197:
1.14 harris41 198: # ------------------------------------------- Compute customized metadata field
199: $scrout.=<<CUSTOMMETADATA;
200: <p>
201: <font color="#800000" face="helvetica"><b>LIMIT BY OTHER METADATA FIELDS:</b>
202: </font>
203: For author-specific metadata, enter in an expression in the form of
204: <i>key</i>=<i>value</i> separated by operators such as AND or OR.<br>
205: <b>Example:</b> grandmother=75 OR grandfather=85
206: <br>
207: CUSTOMMETADATA
208: $scrout.=&simpletextfield('custommetadata',$ENV{'form.custommetadata'});
1.15 harris41 209: $scrout.=' <i>initial users of this system do not need to worry about this option</i>';
1.14 harris41 210:
1.8 harris41 211: # ---------------------------------------------------------------- Print screen
212: $r->print(<<ENDDOCUMENT);
213: <html>
214: <head>
215: <title>The LearningOnline Network with CAPA</title>
216: </head>
217: <body bgcolor="#FFFFFF">
218: <img align=right src=/adm/lonIcons/lonlogos.gif>
219: <h1>Search Catalog</h1>
220: <form method="post" action="/adm/searchcat">
221: $hidden
222: <hr>
223: <h3>Basic Search</h3>
224: <p>
225: Enter terms or phrases separated by search operators
226: such as AND or OR then press SEARCH below. Terms should be specific
227: to the title, author, subject, notes, or abstract information associated
228: with a resource.
229: <br>
1.11 harris41 230: ENDDOCUMENT
231: $r->print(&simpletextfield('basicexp',$ENV{'form.basicexp'}));
232: $r->print(' ');
233: $r->print(&simplecheckbox('titleonly',$ENV{'form.titleonly'}));
234: $r->print('<font color="#800000">Title only</font> ');
235: $r->print(&simplecheckbox('allversions',$ENV{'form.allversions'}));
236: $r->print(<<ENDDOCUMENT);
237: <font color="#800000">Search historic archives</font>
1.8 harris41 238: <br>
239: <input type="submit" name="basicsubmit" value="SEARCH">
240: <input type="reset" name="reset" value="RESET">
241: <input type="button" name="close" value="CLOSE" onClick="self.close()">
242: </p>
243: <hr>
244: <h3>Advanced Search</h3>
245: $scrout
246: <p>
247: <input type="submit" name="advancedsubmit" value="SEARCH">
248: <input type="reset" name="reset" value="RESET">
249: <input type="button" name="close" value="CLOSE" onClick="self.close()">
1.3 harris41 250: </p>
1.8 harris41 251: </form>
252: </body>
253: </html>
254: ENDDOCUMENT
255: return OK;
256: }
257:
258: # --------------------------------------------------------- Various form fields
259:
1.11 harris41 260: sub simpletextfield {
261: my ($name,$value)=@_;
262: return '<input type=text name="'.$name.'" size=20 value="'.$value.'">';
263: }
264:
265: sub simplecheckbox {
266: my ($name,$value)=@_;
267: my $checked='';
268: $checked="CHECKED" if $value eq 'on';
269: return '<input type=checkbox name="'.$name.'" '. $checked . '>';
270: }
271:
1.8 harris41 272: sub searchphrasefield {
273: my ($title,$name,$value)=@_;
274: my $instruction=<<END;
275: Enter terms or phrases separated by search operators such
276: as AND or OR.
277: END
278: my $uctitle=uc($title);
279: return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:</b>".
280: "</FONT> $instruction<br>".
281: '<input type=text name="'.$name.'" size=80 value="'.$value.'">';
282: }
1.3 harris41 283:
1.8 harris41 284: sub dateboxes {
1.11 harris41 285: my ($name,$defaultmonth,$defaultday,$defaultyear,
286: $currentmonth,$currentday,$currentyear)=@_;
287: ($defaultmonth,$defaultday,$defaultyear)=('','','');
288: my $month=<<END;
1.8 harris41 289: <select name="${name}_month">
1.11 harris41 290: <option value='$defaultmonth'> </option>
291: <option value="1">January</option>
292: <option value="2">February</option>
293: <option value="3">March</option>
294: <option value="4">April</option>
295: <option value="5">May</option>
296: <option value="6">June</option>
297: <option value="7">July</option>
298: <option value="8">August</option>
299: <option value="9">September</option>
1.3 harris41 300: <option value="10">October</option>
301: <option value="11">November</option>
302: <option value="12">December</option>
303: </select>
1.11 harris41 304: END
305: $month=~s/(\"$currentmonth\")/$1 SELECTED/ if length($currentmonth);
306: my $day=<<END;
1.8 harris41 307: <select name="${name}_day">
1.11 harris41 308: <option value='$defaultday'> </option>
309: <option value="1">1</option>
310: <option value="2">2</option>
311: <option value="3">3</option>
312: <option value="4">4</option>
313: <option value="5">5</option>
314: <option value="6">6</option>
315: <option value="7">7</option>
316: <option value="8">8</option>
317: <option value="9">9</option>
318: <option value="10">10</option>
319: <option value="11">11</option>
320: <option value="12">12</option>
321: <option value="13">13</option>
322: <option value="14">14</option>
323: <option value="15">15</option>
324: <option value="16">16</option>
325: <option value="17">17</option>
326: <option value="18">18</option>
327: <option value="19">19</option>
328: <option value="20">20</option>
329: <option value="21">21</option>
330: <option value="22">22</option>
331: <option value="23">23</option>
332: <option value="24">24</option>
333: <option value="25">25</option>
334: <option value="26">26</option>
335: <option value="27">27</option>
336: <option value="28">28</option>
337: <option value="29">29</option>
338: <option value="30">30</option>
339: <option value="31">31</option>
1.3 harris41 340: </select>
1.11 harris41 341: END
342: $day=~s/(\"$currentday\")/$1 SELECTED/ if length($currentday);
343: my $year=<<END;
1.8 harris41 344: <select name="${name}_year">
1.11 harris41 345: <option value='$defaultyear'> </option>
346: <option value="1976">1976</option>
347: <option value="1977">1977</option>
348: <option value="1978">1978</option>
349: <option value="1979">1979</option>
350: <option value="1980">1980</option>
351: <option value="1981">1981</option>
352: <option value="1982">1982</option>
353: <option value="1983">1983</option>
354: <option value="1984">1984</option>
355: <option value="1985">1985</option>
356: <option value="1986">1986</option>
357: <option value="1987">1987</option>
358: <option value="1988">1988</option>
359: <option value="1989">1989</option>
360: <option value="1990">1990</option>
361: <option value="1991">1991</option>
362: <option value="1992">1992</option>
363: <option value="1993">1993</option>
364: <option value="1994">1994</option>
365: <option value="1995">1995</option>
366: <option value="1996">1996</option>
367: <option value="1997">1997</option>
368: <option value="1998">1998</option>
369: <option value="1999">1999</option>
370: <option value="2000">2000</option>
371: <option value="2001">2001</option>
372: <option value="2002">2002</option>
373: <option value="2003">2003</option>
374: <option value="2004">2004</option>
375: <option value="2005">2005</option>
376: <option value="2006">2006</option>
377: <option value="2007">2007</option>
378: <option value="2008">2008</option>
379: <option value="2009">2009</option>
380: <option value="2010">2010</option>
381: <option value="2011">2011</option>
382: <option value="2012">2012</option>
383: <option value="2013">2013</option>
384: <option value="2014">2014</option>
385: <option value="2015">2015</option>
386: <option value="2016">2016</option>
387: <option value="2017">2017</option>
388: <option value="2018">2018</option>
389: <option value="2019">2019</option>
390: <option value="2020">2020</option>
391: <option value="2021">2021</option>
392: <option value="2022">2022</option>
393: <option value="2023">2023</option>
394: <option value="2024">2024</option>
395: <option value="2025">2025</option>
396: <option value="2026">2026</option>
397: <option value="2027">2027</option>
398: <option value="2028">2028</option>
399: <option value="2029">2029</option>
400: <option value="2030">2030</option>
401: <option value="2031">2031</option>
402: <option value="2032">2032</option>
403: <option value="2033">2033</option>
404: <option value="2034">2034</option>
405: <option value="2035">2035</option>
406: <option value="2036">2036</option>
407: <option value="2037">2037</option>
408: <option value="2038">2038</option>
409: <option value="2039">2039</option>
410: <option value="2040">2040</option>
411: <option value="2041">2041</option>
412: <option value="2042">2042</option>
413: <option value="2043">2043</option>
414: <option value="2044">2044</option>
415: <option value="2045">2045</option>
416: <option value="2046">2046</option>
417: <option value="2047">2047</option>
418: <option value="2048">2048</option>
419: <option value="2049">2049</option>
420: <option value="2050">2050</option>
421: <option value="2051">2051</option>
1.3 harris41 422: </select>
423: END
1.11 harris41 424: $year=~s/(\"$currentyear\")/$1 SELECTED/ if length($currentyear);
425: return "$month$day$year";
1.3 harris41 426: }
427:
428: sub selectbox {
429: my ($title,$name,$value,%options)=@_;
430: my $uctitle=uc($title);
431: my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
432: "</b></font><br>".'<select name="'.$name.'">';
433: map {
434: $selout.='<option value="'.$_.'"';
435: if ($_ eq $value) { $selout.=' selected'; }
436: $selout.='>'.$options{$_}.'</option>';
437: } sort keys %options;
438: return $selout.'</select>';
1.6 harris41 439: }
440:
1.18 harris41 441: # ------------------------------------------------ Performing a advanced search
442: sub advancedsearch {
443: my ($r,$envhash)=@_;
444: my %ENV=%{$envhash};
445:
1.32 harris41 446: my $fillflag=0;
447: for my $field ('title','author','subject','keywords','url','version',
448: 'notes','abstract','mime','language','owner',
449: 'custommetadata') {
1.40 harris41 450: if (&filled($ENV{"form.$field"})) {
1.32 harris41 451: $fillflag++;
452: }
453: }
454:
455: unless ($fillflag) {
456: &output_blank_field_error($r);
457: return OK;
458: }
1.39 harris41 459:
460: my $query='';
461: # my $concatarg=join('," ",',
462: # ('title', 'author', 'subject', 'notes', 'abstract'));
463:
464: $query="select * from metadata where concat(title) like '\%$ENV{'form.title'}\%'";
465: my $reply=&Apache::lonnet::metadata_query($query);
466:
1.38 harris41 467: &output_results($r,$envhash,$reply);
1.24 harris41 468: return OK;
1.18 harris41 469: }
470:
1.26 harris41 471: # ---------------------------------------------------- see if a field is filled
472: sub filled {
1.31 harris41 473: my ($field)=@_;
474: if ($field=~/\S/) {
1.28 harris41 475: return 1;
476: }
477: else {
478: return 0;
479: }
1.26 harris41 480: }
481:
1.6 harris41 482: # --------------------------------------------------- Performing a basic search
483: sub basicsearch {
1.19 harris41 484: my ($r,$envhash)=@_;
485: my %ENV=%{$envhash};
1.6 harris41 486:
1.26 harris41 487: unless (&filled($ENV{'form.basicexp'})) {
1.24 harris41 488: &output_blank_field_error($r);
489: return OK;
490: }
1.22 harris41 491:
1.39 harris41 492: my $query='';
1.33 harris41 493: my $concatarg=join('," ",',
494: ('title', 'author', 'subject', 'notes', 'abstract'));
495:
496: $query="select * from metadata where concat($concatarg) like '\%$ENV{'form.basicexp'}\%'";
1.13 harris41 497: my $reply=&Apache::lonnet::metadata_query($query);
1.36 harris41 498: &output_results($r,$envhash,$reply);
1.18 harris41 499: return OK;
1.22 harris41 500: }
501:
502: sub output_blank_field_error {
503: my ($r)=@_;
504: # make query information persistent to allow for subsequent revision
505: my $persistent='';
506: map {
507: if (/^form\./ && !/submit/) {
508: my $name=$_;
509: my $key=$name;
510: $name=~s/^form\.//;
511: $persistent.=<<END;
512: <INPUT TYPE='hidden' NAME='$name' VALUE='$ENV{$key}'>
513: END
514: }
515: } (keys %ENV);
516:
517: $r->print(<<BEGINNING);
518: <html>
519: <head>
520: <title>The LearningOnline Network with CAPA</title>
521: BEGINNING
522: $r->print(<<RESULTS);
523: </head>
524: <body bgcolor="#ffffff">
525: <img align=right src=/adm/lonIcons/lonlogos.gif>
526: <h1>Search Catalog</h1>
527: <form method="post" action="/adm/searchcat">
528: $persistent
529: <input type='button' value='Revise search request'
530: onClick='this.form.submit();'>
531: <input type='button' value='CLOSE'
532: onClick='self.close();'>
533: <hr>
534: <h3>Helpful Message</h3>
535: <p>
536: Incorrect search query due to blank entry fields.
537: You need to fill in the relevant
538: fields on the search page in order for a query to be
539: processed.
540: </p>
541: </body>
542: </html>
543: RESULTS
1.18 harris41 544: }
1.6 harris41 545:
1.18 harris41 546: # ----------------------------- format and output results based on a reply list
547: sub output_results {
1.36 harris41 548: my ($r,$envhash,@replylist)=@_;
1.19 harris41 549: my %ENV=%{$envhash};
1.18 harris41 550: foreach my $reply (@replylist) {
551:
552: my @results;
553:
554: my $replyfile='';
555: $reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting
556: $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1;
557: $reply=~/(.*?)\_/;
558: my $hostname=$1;
559:
560: {
561: while (1) {
562: last if -e $replyfile;
563: sleep 1;
564: }
565: # QUESTION: how should I handle this error condition..
566: # I'm sure there is syntax elsewhere I can use..
567: my $fh=Apache::File->new($replyfile) or
568: ($r->print('file cannot be opened') and return OK);
569: @results=<$fh>;
1.6 harris41 570: }
571:
1.18 harris41 572: my $compiledresult='';
1.6 harris41 573:
1.18 harris41 574: foreach my $result (@results) {
575: my ($title,$author,$subject,$url,$keywords,$version,
576: $notes,$abstract,$mime,$lang,
577: $creationdate,$lastrevisiondate,$owner,$copyright
578: )=map {&Apache::lonnet::unescape($_)} (split(/\,/,$result));
579: my $shortabstract=$abstract;
580: $shortabstract=substr($abstract,0,200) if length($abstract)>200;
581: $compiledresult.=<<END;
1.6 harris41 582: <p>
1.8 harris41 583: END
1.18 harris41 584: $compiledresult.=<<END if $ENV{'form.catalogmode'} eq 'interactive';
1.8 harris41 585: <font size='-1'><INPUT TYPE="button" NAME="returnvalues" VALUE="SELECT"
1.10 harris41 586: onClick="javascript:select_data('$title','$url')">
1.8 harris41 587: </font>
588: <br>
589: END
1.18 harris41 590: $compiledresult.=<<END;
1.21 harris41 591: <b>URL: </b> <A HREF="http://$ENV{'HTTP_HOST'}$url" TARGET='search_preview'>$url</A>
1.17 harris41 592: <br>
1.6 harris41 593: <b>Title:</b> $title<br>
594: <b>Author(s):</b> $author<br>
595: <b>Subject:</b> $subject<br>
1.9 harris41 596: <b>Keyword(s):</b> $keywords<br>
1.6 harris41 597: <b>Notes:</b> $notes<br>
598: <b>Abstract:</b> $shortabstract<br>
599: <b>MIME Type:</b> $mimetag{$mime}<br>
600: <b>Language:</b> $language{$lang}<br>
601: <b>Creation Date:</b> $creationdate<br>
602: <b>Last Revision Date:</b> $lastrevisiondate<br>
603: <b>Publisher/Owner:</b> $owner<br>
604: <b>Copyright/Distribution:</b> $copyright<br>
605: <b>Repository Location:</b> $hostname
606: </p>
607: END
1.18 harris41 608: }
1.6 harris41 609:
1.18 harris41 610: unless ($compiledresult) {
611: $compiledresult="There were no results that matched your query";
612: }
1.6 harris41 613:
1.18 harris41 614: # make query information persistent to allow for subsequent revision
615: my $persistent='';
616: map {
617: if (/^form\./ && !/submit/) {
618: my $name=$_;
619: my $key=$name;
620: $name=~s/^form\.//;
621: $persistent.=<<END;
1.9 harris41 622: <INPUT TYPE='hidden' NAME='$name' VALUE='$ENV{$key}'>
623: END
1.18 harris41 624: }
625: } (keys %ENV);
1.9 harris41 626:
1.18 harris41 627: $r->print(<<BEGINNING);
1.6 harris41 628: <html>
629: <head>
630: <title>The LearningOnline Network with CAPA</title>
1.8 harris41 631: BEGINNING
1.18 harris41 632: $r->print(<<SCRIPT) if $ENV{'form.catalogmode'} eq 'interactive';
1.8 harris41 633: <script>
634: function select_data(title,url) {
635: changeTitle(title);
636: changeURL(url);
637: }
638: function changeTitle(val) {
639: if (opener.inf.document.forms.resinfo.elements.t) {
640: opener.inf.document.forms.resinfo.elements.t.value=val;
641: }
642: }
643: function changeURL(val) {
644: if (opener.inf.document.forms.resinfo.elements.u) {
645: opener.inf.document.forms.resinfo.elements.u.value=val;
646: }
647: }
648: </script>
649: SCRIPT
1.18 harris41 650: $r->print(<<RESULTS);
1.6 harris41 651: </head>
652: <body bgcolor="#ffffff">
653: <img align=right src=/adm/lonIcons/lonlogos.gif>
654: <h1>Search Catalog</h1>
655: <form method="post" action="/adm/searchcat">
1.9 harris41 656: <input type='button' value='Revise search request'
657: onClick='this.form.submit();'>
1.11 harris41 658: <input type='button' value='CLOSE'
659: onClick='self.close();'>
1.9 harris41 660: $persistent
1.6 harris41 661: <hr>
662: <h3>Search Query</h3>
663: <p>
1.19 harris41 664: <b>Basic search:</b> $ENV{'form.basicexp'}
1.6 harris41 665: </p>
666: <h3>Search Results</h3>
667: $compiledresult
668: </body>
669: </html>
670: RESULTS
1.18 harris41 671: }
1.41 ! harris41 672: }
! 673:
! 674: # ------------------------------------------------------------- build_SQL_query
! 675: sub build_SQL_query {
! 676:
1.3 harris41 677: }
1.1 www 678:
679: 1;
680: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>