Annotation of loncom/interface/lonsearchcat.pm, revision 1.6
1.1 www 1: # The LearningOnline Network
2: # Search Catalog
3: #
1.2 harris41 4: # 03/08/2001 Scott Harrison
1.1 www 5: #
6: package Apache::lonsearchcat;
7:
8: use strict;
9: use Apache::Constants qw(:common);
1.6 ! harris41 10: use Apache::lonnet();
! 11: use Apache::File();
1.1 www 12:
1.3 harris41 13: my %language;
14: my $scrout;
15: my %metadatafields;
16: my %cprtag;
17: my %mimetag;
18:
1.1 www 19: sub handler {
20: my $r = shift;
21: $r->content_type('text/html');
22: $r->send_http_header;
23: return OK if $r->header_only;
24:
1.3 harris41 25: %metadatafields=();
26:
27: # ------------------------------------------------ First, check out environment
28: $metadatafields{'owner'}=$ENV{'user.name'}.'@'.$ENV{'user.domain'};
29:
30:
31: %language=();
32: $language{'any'}='Any language';
33: {
34: my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab');
35: map {
36: $_=~/(\w+)\s+([\w\s\-]+)/;
37: $language{$1}=$2;
38: } <$fh>;
39: }
40:
41: %cprtag=();
42: $cprtag{'any'}='Any copyright/distribution';
43: {
44: my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab');
45: map {
46: $_=~/(\w+)\s+([\w\s\-]+)/;
47: $cprtag{$1}=$2;
48: } <$fh>;
49: }
50:
51: %mimetag=();
52: $mimetag{'any'}='Any type';
53: {
54: my $fh=Apache::File->new($r->dir_config('lonTabDir').'/filetypes.tab');
55: map {
56: $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/;
57: $mimetag{$1}=".$1 $3";
58: } <$fh>;
59: }
60:
1.6 ! harris41 61: if ($ENV{'form.basicsubmit'} eq 'SEARCH') {
! 62: return &basicsearch($r,$ENV{'form.basicexp'});
! 63: }
! 64:
1.3 harris41 65: $scrout="";
66: $scrout.=&searchphrasefield('Limit by title','title',
67: '');
68:
69: $scrout.=&searchphrasefield('Limit by author','author',
70: '');
71:
72: $scrout.=&searchphrasefield('Limit by subject','subject',
73: '');
74:
75: $scrout.=&searchphrasefield('Limit by notes','notes',
76: '');
77:
78: $scrout.=&searchphrasefield('Limit by abstract','abstract',
79: '');
80:
81: $scrout.=&selectbox('Limit by MIME type','mime',
82: 'notxxx',%mimetag);
83:
84: $scrout.=&selectbox('Limit by language','language',
85: 'any',%language);
86:
87: $scrout.=<<CREATIONDATEEND;
88: <p>
89: <font color="#800000" face="helvetica"><b>LIMIT BY CREATION DATE RANGE:</b>
90: </font>
91: <br>
92: between:<select name="creationdatemonthstart">
93: <option value="01"> </option>
94: <option value="01">January</option>
95: <option value="02">February</option>
96: <option value="03">March</option>
97: <option value="04">April</option>
98: <option value="05">May</option>
99: <option value="06">June</option>
100: <option value="07">July</option>
101: <option value="08">August</option>
102: <option value="09">September</option>
103: <option value="10">October</option>
104: <option value="11">November</option>
105: <option value="12">December</option>
106: </select>
107: <select name="creationdatedaystart">
108: <option value="1"> </option>
109: <option value=1>1</option>
110: <option value=2>2</option>
111: <option value=3>3</option>
112: <option value=4>4</option>
113: <option value=5>5</option>
114: <option value=6>6</option>
115: <option value=7>7</option>
116: <option value=8>8</option>
117: <option value=9>9</option>
118: <option value=10>10</option>
119: <option value=11>11</option>
120: <option value=12>12</option>
121: <option value=13>13</option>
122: <option value=14>14</option>
123: <option value=15>15</option>
124: <option value=16>16</option>
125: <option value=17>17</option>
126: <option value=18>18</option>
127: <option value=19>19</option>
128: <option value=20>20</option>
129: <option value=21>21</option>
130: <option value=22>22</option>
131: <option value=23>23</option>
132: <option value=24>24</option>
133: <option value=25>25</option>
134: <option value=26>26</option>
135: <option value=27>27</option>
136: <option value=28>28</option>
137: <option value=29>29</option>
138: <option value=30>30</option>
139: <option value=31>31</option>
140: </select>
141: <select name="creationdateyearstart">
142: <option value=1976> </option>
143: <option value=1976>1976</option>
144: <option value=1977>1977</option>
145: <option value=1978>1978</option>
146: <option value=1979>1979</option>
147: <option value=1980>1980</option>
148: <option value=1981>1981</option>
149: <option value=1982>1982</option>
150: <option value=1983>1983</option>
151: <option value=1984>1984</option>
152: <option value=1985>1985</option>
153: <option value=1986>1986</option>
154: <option value=1987>1987</option>
155: <option value=1988>1988</option>
156: <option value=1989>1989</option>
157: <option value=1990>1990</option>
158: <option value=1991>1991</option>
159: <option value=1992>1992</option>
160: <option value=1993>1993</option>
161: <option value=1994>1994</option>
162: <option value=1995>1995</option>
163: <option value=1996>1996</option>
164: <option value=1997>1997</option>
165: <option value=1998>1998</option>
166: <option value=1999>1999</option>
167: <option value=2000>2000</option>
168: <option value=2001>2001</option>
169: <option value=2002>2002</option>
170: <option value=2003>2003</option>
171: <option value=2004>2004</option>
172: <option value=2005>2005</option>
173: <option value=2006>2006</option>
174: <option value=2007>2007</option>
175: <option value=2008>2008</option>
176: <option value=2009>2009</option>
177: <option value=2010>2010</option>
178: <option value=2011>2011</option>
179: <option value=2012>2012</option>
180: <option value=2013>2013</option>
181: <option value=2014>2014</option>
182: <option value=2015>2015</option>
183: <option value=2016>2016</option>
184: <option value=2017>2017</option>
185: <option value=2018>2018</option>
186: <option value=2019>2019</option>
187: <option value=2020>2020</option>
188: <option value=2021>2021</option>
189: <option value=2022>2022</option>
190: <option value=2023>2023</option>
191: <option value=2024>2024</option>
192: <option value=2025>2025</option>
193: <option value=2026>2026</option>
194: <option value=2027>2027</option>
195: <option value=2028>2028</option>
196: <option value=2029>2029</option>
197: <option value=2030>2030</option>
198: <option value=2031>2031</option>
199: <option value=2032>2032</option>
200: <option value=2033>2033</option>
201: <option value=2034>2034</option>
202: <option value=2035>2035</option>
203: <option value=2036>2036</option>
204: <option value=2037>2037</option>
205: <option value=2038>2038</option>
206: <option value=2039>2039</option>
207: <option value=2040>2040</option>
208: <option value=2041>2041</option>
209: <option value=2042>2042</option>
210: <option value=2043>2043</option>
211: <option value=2044>2044</option>
212: <option value=2045>2045</option>
213: <option value=2046>2046</option>
214: <option value=2047>2047</option>
215: <option value=2048>2048</option>
216: <option value=2049>2049</option>
217: <option value=2050>2050</option>
218: <option value=2051>2051</option>
219: </select>
220: and:<select name="creationdatemonthend">
221: <option value="12"> </option>
222: <option value="01">January</option>
223: <option value="02">February</option>
224: <option value="03">March</option>
225: <option value="04">April</option>
226: <option value="05">May</option>
227: <option value="06">June</option>
228: <option value="07">July</option>
229: <option value="08">August</option>
230: <option value="09">September</option>
231: <option value="10">October</option>
232: <option value="11">November</option>
233: <option value="12">December</option>
234: </select>
235: <select name="creationdatedayend">
236: <option value=28> </option>
237: <option value=1>1</option>
238: <option value=2>2</option>
239: <option value=3>3</option>
240: <option value=4>4</option>
241: <option value=5>5</option>
242: <option value=6>6</option>
243: <option value=7>7</option>
244: <option value=8>8</option>
245: <option value=9>9</option>
246: <option value=10>10</option>
247: <option value=11>11</option>
248: <option value=12>12</option>
249: <option value=13>13</option>
250: <option value=14>14</option>
251: <option value=15>15</option>
252: <option value=16>16</option>
253: <option value=17>17</option>
254: <option value=18>18</option>
255: <option value=19>19</option>
256: <option value=20>20</option>
257: <option value=21>21</option>
258: <option value=22>22</option>
259: <option value=23>23</option>
260: <option value=24>24</option>
261: <option value=25>25</option>
262: <option value=26>26</option>
263: <option value=27>27</option>
264: <option value=28>28</option>
265: <option value=29>29</option>
266: <option value=30>30</option>
267: <option value=31>31</option>
268: </select>
269: <select name="creationdateyearend">
270: <option value=2051> </option>
271: <option value=1976>1976</option>
272: <option value=1977>1977</option>
273: <option value=1978>1978</option>
274: <option value=1979>1979</option>
275: <option value=1980>1980</option>
276: <option value=1981>1981</option>
277: <option value=1982>1982</option>
278: <option value=1983>1983</option>
279: <option value=1984>1984</option>
280: <option value=1985>1985</option>
281: <option value=1986>1986</option>
282: <option value=1987>1987</option>
283: <option value=1988>1988</option>
284: <option value=1989>1989</option>
285: <option value=1990>1990</option>
286: <option value=1991>1991</option>
287: <option value=1992>1992</option>
288: <option value=1993>1993</option>
289: <option value=1994>1994</option>
290: <option value=1995>1995</option>
291: <option value=1996>1996</option>
292: <option value=1997>1997</option>
293: <option value=1998>1998</option>
294: <option value=1999>1999</option>
295: <option value=2000>2000</option>
296: <option value=2001>2001</option>
297: <option value=2002>2002</option>
298: <option value=2003>2003</option>
299: <option value=2004>2004</option>
300: <option value=2005>2005</option>
301: <option value=2006>2006</option>
302: <option value=2007>2007</option>
303: <option value=2008>2008</option>
304: <option value=2009>2009</option>
305: <option value=2010>2010</option>
306: <option value=2011>2011</option>
307: <option value=2012>2012</option>
308: <option value=2013>2013</option>
309: <option value=2014>2014</option>
310: <option value=2015>2015</option>
311: <option value=2016>2016</option>
312: <option value=2017>2017</option>
313: <option value=2018>2018</option>
314: <option value=2019>2019</option>
315: <option value=2020>2020</option>
316: <option value=2021>2021</option>
317: <option value=2022>2022</option>
318: <option value=2023>2023</option>
319: <option value=2024>2024</option>
320: <option value=2025>2025</option>
321: <option value=2026>2026</option>
322: <option value=2027>2027</option>
323: <option value=2028>2028</option>
324: <option value=2029>2029</option>
325: <option value=2030>2030</option>
326: <option value=2031>2031</option>
327: <option value=2032>2032</option>
328: <option value=2033>2033</option>
329: <option value=2034>2034</option>
330: <option value=2035>2035</option>
331: <option value=2036>2036</option>
332: <option value=2037>2037</option>
333: <option value=2038>2038</option>
334: <option value=2039>2039</option>
335: <option value=2040>2040</option>
336: <option value=2041>2041</option>
337: <option value=2042>2042</option>
338: <option value=2043>2043</option>
339: <option value=2044>2044</option>
340: <option value=2045>2045</option>
341: <option value=2046>2046</option>
342: <option value=2047>2047</option>
343: <option value=2048>2048</option>
344: <option value=2049>2049</option>
345: <option value=2050>2050</option>
346: <option value=2051>2051</option>
347: </select>
348: </p>
349: CREATIONDATEEND
350:
351: $scrout.=<<LASTREVISIONDATEEND;
352: <p>
353: <font color="#800000" face="helvetica"><b>LIMIT BY LAST REVISION DATE RANGE:
354: </b></font>
355: <br>between:<select name="lastrevisiondatemonthstart">
356: <option value="00"> </option>
357: <option value="01">January</option>
358: <option value="02">February</option>
359: <option value="03">March</option>
360: <option value="04">April</option>
361: <option value="05">May</option>
362: <option value="06">June</option>
363: <option value="07">July</option>
364: <option value="08">August</option>
365: <option value="09">September</option>
366: <option value="10">October</option>
367: <option value="11">November</option>
368: <option value="12">December</option>
369: </select>
370: <select name="lastrevisiondatedaystart">
371: <option value=1> </option>
372: <option value=1>1</option>
373: <option value=2>2</option>
374: <option value=3>3</option>
375: <option value=4>4</option>
376: <option value=5>5</option>
377: <option value=6>6</option>
378: <option value=7>7</option>
379: <option value=8>8</option>
380: <option value=9>9</option>
381: <option value=10>10</option>
382: <option value=11>11</option>
383: <option value=12>12</option>
384: <option value=13>13</option>
385: <option value=14>14</option>
386: <option value=15>15</option>
387: <option value=16>16</option>
388: <option value=17>17</option>
389: <option value=18>18</option>
390: <option value=19>19</option>
391: <option value=20>20</option>
392: <option value=21>21</option>
393: <option value=22>22</option>
394: <option value=23>23</option>
395: <option value=24>24</option>
396: <option value=25>25</option>
397: <option value=26>26</option>
398: <option value=27>27</option>
399: <option value=28>28</option>
400: <option value=29>29</option>
401: <option value=30>30</option>
402: <option value=31>31</option>
403: </select>
404: <select name="lastrevisiondateyearstart">
405: <option value=1976> </option>
406: <option value=1976>1976</option>
407: <option value=1977>1977</option>
408: <option value=1978>1978</option>
409: <option value=1979>1979</option>
410: <option value=1980>1980</option>
411: <option value=1981>1981</option>
412: <option value=1982>1982</option>
413: <option value=1983>1983</option>
414: <option value=1984>1984</option>
415: <option value=1985>1985</option>
416: <option value=1986>1986</option>
417: <option value=1987>1987</option>
418: <option value=1988>1988</option>
419: <option value=1989>1989</option>
420: <option value=1990>1990</option>
421: <option value=1991>1991</option>
422: <option value=1992>1992</option>
423: <option value=1993>1993</option>
424: <option value=1994>1994</option>
425: <option value=1995>1995</option>
426: <option value=1996>1996</option>
427: <option value=1997>1997</option>
428: <option value=1998>1998</option>
429: <option value=1999>1999</option>
430: <option value=2000>2000</option>
431: <option value=2001>2001</option>
432: <option value=2002>2002</option>
433: <option value=2003>2003</option>
434: <option value=2004>2004</option>
435: <option value=2005>2005</option>
436: <option value=2006>2006</option>
437: <option value=2007>2007</option>
438: <option value=2008>2008</option>
439: <option value=2009>2009</option>
440: <option value=2010>2010</option>
441: <option value=2011>2011</option>
442: <option value=2012>2012</option>
443: <option value=2013>2013</option>
444: <option value=2014>2014</option>
445: <option value=2015>2015</option>
446: <option value=2016>2016</option>
447: <option value=2017>2017</option>
448: <option value=2018>2018</option>
449: <option value=2019>2019</option>
450: <option value=2020>2020</option>
451: <option value=2021>2021</option>
452: <option value=2022>2022</option>
453: <option value=2023>2023</option>
454: <option value=2024>2024</option>
455: <option value=2025>2025</option>
456: <option value=2026>2026</option>
457: <option value=2027>2027</option>
458: <option value=2028>2028</option>
459: <option value=2029>2029</option>
460: <option value=2030>2030</option>
461: <option value=2031>2031</option>
462: <option value=2032>2032</option>
463: <option value=2033>2033</option>
464: <option value=2034>2034</option>
465: <option value=2035>2035</option>
466: <option value=2036>2036</option>
467: <option value=2037>2037</option>
468: <option value=2038>2038</option>
469: <option value=2039>2039</option>
470: <option value=2040>2040</option>
471: <option value=2041>2041</option>
472: <option value=2042>2042</option>
473: <option value=2043>2043</option>
474: <option value=2044>2044</option>
475: <option value=2045>2045</option>
476: <option value=2046>2046</option>
477: <option value=2047>2047</option>
478: <option value=2048>2048</option>
479: <option value=2049>2049</option>
480: <option value=2050>2050</option>
481: <option value=2051>2051</option>
482: </select>
483: and:<select name="lastrevisiondatemonthend">
484: <option value="12"> </option>
485: <option value="01">January</option>
486: <option value="02">February</option>
487: <option value="03">March</option>
488: <option value="04">April</option>
489: <option value="05">May</option>
490: <option value="06">June</option>
491: <option value="07">July</option>
492: <option value="08">August</option>
493: <option value="09">September</option>
494: <option value="10">October</option>
495: <option value="11">November</option>
496: <option value="12">December</option>
497: </select>
498: <select name="lastrevisiondatedayend">
499: <option value=28> </option>
500: <option value=1>1</option>
501: <option value=2>2</option>
502: <option value=3>3</option>
503: <option value=4>4</option>
504: <option value=5>5</option>
505: <option value=6>6</option>
506: <option value=7>7</option>
507: <option value=8>8</option>
508: <option value=9>9</option>
509: <option value=10>10</option>
510: <option value=11>11</option>
511: <option value=12>12</option>
512: <option value=13>13</option>
513: <option value=14>14</option>
514: <option value=15>15</option>
515: <option value=16>16</option>
516: <option value=17>17</option>
517: <option value=18>18</option>
518: <option value=19>19</option>
519: <option value=20>20</option>
520: <option value=21>21</option>
521: <option value=22>22</option>
522: <option value=23>23</option>
523: <option value=24>24</option>
524: <option value=25>25</option>
525: <option value=26>26</option>
526: <option value=27>27</option>
527: <option value=28>28</option>
528: <option value=29>29</option>
529: <option value=30>30</option>
530: <option value=31>31</option>
531: </select>
532: <select name="lastrevisiondateyearend">
533: <option value=2051> </option>
534: <option value=1976>1976</option>
535: <option value=1977>1977</option>
536: <option value=1978>1978</option>
537: <option value=1979>1979</option>
538: <option value=1980>1980</option>
539: <option value=1981>1981</option>
540: <option value=1982>1982</option>
541: <option value=1983>1983</option>
542: <option value=1984>1984</option>
543: <option value=1985>1985</option>
544: <option value=1986>1986</option>
545: <option value=1987>1987</option>
546: <option value=1988>1988</option>
547: <option value=1989>1989</option>
548: <option value=1990>1990</option>
549: <option value=1991>1991</option>
550: <option value=1992>1992</option>
551: <option value=1993>1993</option>
552: <option value=1994>1994</option>
553: <option value=1995>1995</option>
554: <option value=1996>1996</option>
555: <option value=1997>1997</option>
556: <option value=1998>1998</option>
557: <option value=1999>1999</option>
558: <option value=2000>2000</option>
559: <option value=2001>2001</option>
560: <option value=2002>2002</option>
561: <option value=2003>2003</option>
562: <option value=2004>2004</option>
563: <option value=2005>2005</option>
564: <option value=2006>2006</option>
565: <option value=2007>2007</option>
566: <option value=2008>2008</option>
567: <option value=2009>2009</option>
568: <option value=2010>2010</option>
569: <option value=2011>2011</option>
570: <option value=2012>2012</option>
571: <option value=2013>2013</option>
572: <option value=2014>2014</option>
573: <option value=2015>2015</option>
574: <option value=2016>2016</option>
575: <option value=2017>2017</option>
576: <option value=2018>2018</option>
577: <option value=2019>2019</option>
578: <option value=2020>2020</option>
579: <option value=2021>2021</option>
580: <option value=2022>2022</option>
581: <option value=2023>2023</option>
582: <option value=2024>2024</option>
583: <option value=2025>2025</option>
584: <option value=2026>2026</option>
585: <option value=2027>2027</option>
586: <option value=2028>2028</option>
587: <option value=2029>2029</option>
588: <option value=2030>2030</option>
589: <option value=2031>2031</option>
590: <option value=2032>2032</option>
591: <option value=2033>2033</option>
592: <option value=2034>2034</option>
593: <option value=2035>2035</option>
594: <option value=2036>2036</option>
595: <option value=2037>2037</option>
596: <option value=2038>2038</option>
597: <option value=2039>2039</option>
598: <option value=2040>2040</option>
599: <option value=2041>2041</option>
600: <option value=2042>2042</option>
601: <option value=2043>2043</option>
602: <option value=2044>2044</option>
603: <option value=2045>2045</option>
604: <option value=2046>2046</option>
605: <option value=2047>2047</option>
606: <option value=2048>2048</option>
607: <option value=2049>2049</option>
608: <option value=2050>2050</option>
609: <option value=2051>2051</option>
610: </select>
611: </p>
612: LASTREVISIONDATEEND
613:
614: $scrout.=&searchphrasefield('Limit by publisher/owner','owner',
615: $metadatafields{'owner'});
616:
617: $scrout.=&selectbox('Limit by copyright/distribution','copyright',
618: 'any',%cprtag);
619:
1.2 harris41 620: # ---------------------------------------------------------------- Print screen
1.1 www 621: $r->print(<<ENDDOCUMENT);
622: <html>
623: <head>
624: <title>The LearningOnline Network with CAPA</title>
625: </head>
626: <body bgcolor="#FFFFFF">
1.5 harris41 627: <img align=right src=/adm/lonIcons/lonlogos.gif>
1.1 www 628: <h1>Search Catalog</h1>
1.3 harris41 629: <form method="post" action="/adm/searchcat">
630: <hr>
631: <h3>Basic Search</h3>
632: <p>
633: Enter terms or phrases separated by search operators
634: such as AND or OR then press SEARCH below. Terms should be specific
635: to the title, author, subject, notes, or abstract information associated
636: with a resource.
637: <br>
638: <input type="text" name="basicexp">
639: <input type="checkbox" name="titleonly">
640: <font color="#800000">Title only</font>
641: <br>
642: <input type="submit" name="basicsubmit" value="SEARCH">
643: </p>
644: <hr>
645: <h3>Advanced Search</h3>
646: $scrout
647: <p>
648: <input type="submit" name="advancedsubmit" value="SEARCH">
649: </p>
650: </form>
1.1 www 651: </body>
652: </html>
653: ENDDOCUMENT
654: return OK;
655: }
1.3 harris41 656:
657: # --------------------------------------------------------- Various form fields
658:
659: sub textfield {
660: my ($title,$name,$value)=@_;
661: return "\n<p><b>$title:</b><br>".
662: '<input type=text name="'.$name.'" size=80 value="'.$value.'">';
663: }
664:
665: sub searchphrasefield {
666: my ($title,$name,$value)=@_;
667: my $instruction=<<END;
668: Enter terms or phrases separated by search operators such
669: as AND or OR.
670: END
671: my $uctitle=uc($title);
672: return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:</b>".
673: ":</FONT> $instruction<br>".
674: '<input type=text name="'.$name.'" size=80 value="'.$value.'">';
675: }
676:
677: sub selectbox {
678: my ($title,$name,$value,%options)=@_;
679: my $uctitle=uc($title);
680: my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
681: "</b></font><br>".'<select name="'.$name.'">';
682: map {
683: $selout.='<option value="'.$_.'"';
684: if ($_ eq $value) { $selout.=' selected'; }
685: $selout.='>'.$options{$_}.'</option>';
686: } sort keys %options;
687: return $selout.'</select>';
1.6 ! harris41 688: }
! 689:
! 690: # --------------------------------------------------- Performing a basic search
! 691: sub basicsearch {
! 692: my ($r,$expression)=@_;
! 693:
! 694: my $query=$expression;
! 695: # $query="select * from metadata where concat(title,':\@:',author) like '\%Sci\%'";
! 696: $query="select * from metadata where concat(title,\" \",author) like '\%$expression\%'";
! 697: # my $reply=&Apache::lonnet::reply("querysend:DESCRIBE metadata","msul3");
! 698: my $reply=&Apache::lonnet::reply("querysend:$query",'msul3');
! 699: # my $reply=&Apache::lonnet::reply('querysend:select * from metadata','msul3');
! 700:
! 701: my @results;
! 702:
! 703: my $replyfile='';
! 704: $reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting
! 705: $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1;
! 706: $reply=~/(.*?)\_/;
! 707: my $hostname=$1;
! 708:
! 709: {
! 710: while (1) {
! 711: last if -e $replyfile;
! 712: sleep 1;
! 713: }
! 714: # QUESTION: how should I handle this error condition..
! 715: # I'm sure there is syntax elsewhere I can use..
! 716: my $fh=Apache::File->new($replyfile) or
! 717: ($r->print('file cannot be opened') and return OK);
! 718: @results=<$fh>;
! 719: }
! 720:
! 721: my $compiledresult='';
! 722:
! 723: foreach my $result (@results) {
! 724: my ($title,$author,$subject,$notes,$abstract,$mime,$lang,
! 725: $creationdate,$lastrevisiondate,$owner,$copyright
! 726: )=map {&Apache::lonnet::unescape($_)} (split(/\,/,$result));
! 727: my $shortabstract=$abstract;
! 728: $shortabstract=substr($abstract,0,200) if length($abstract)>200;
! 729: $compiledresult=<<END;
! 730: <p>
! 731: <b>Title:</b> $title<br>
! 732: <b>Author(s):</b> $author<br>
! 733: <b>Subject:</b> $subject<br>
! 734: <b>Keyword(s):</b> <i>not available yet</i><br>
! 735: <b>Notes:</b> $notes<br>
! 736: <b>Abstract:</b> $shortabstract<br>
! 737: <b>MIME Type:</b> $mimetag{$mime}<br>
! 738: <b>Language:</b> $language{$lang}<br>
! 739: <b>Creation Date:</b> $creationdate<br>
! 740: <b>Last Revision Date:</b> $lastrevisiondate<br>
! 741: <b>Publisher/Owner:</b> $owner<br>
! 742: <b>Copyright/Distribution:</b> $copyright<br>
! 743: <b>Repository Location:</b> $hostname
! 744: </p>
! 745: END
! 746: }
! 747:
! 748: unless ($compiledresult) {
! 749: $compiledresult="There were no results that matched your query";
! 750: }
! 751:
! 752: # Question... allow to ask question from this page, or click to
! 753: # search again?
! 754: $r->print(<<RESULTS);
! 755: <html>
! 756: <head>
! 757: <title>The LearningOnline Network with CAPA</title>
! 758: </head>
! 759: <body bgcolor="#ffffff">
! 760: <img align=right src=/adm/lonIcons/lonlogos.gif>
! 761: <h1>Search Catalog</h1>
! 762: <form method="post" action="/adm/searchcat">
! 763: <hr>
! 764: <h3>Search Query</h3>
! 765: <p>
! 766: $expression
! 767: </p>
! 768: <h3>Search Results</h3>
! 769: $compiledresult
! 770: </body>
! 771: </html>
! 772: RESULTS
! 773:
! 774: return OK;
1.3 harris41 775: }
1.1 www 776:
777: 1;
778: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>