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