source: main/trunk/greenstone2/macros/query.dm@ 22981

Last change on this file since 22981 was 22981, checked in by ak19, 14 years ago

Additional changes to previous commit: comma separated field values went wrong in normal advanced field queries because of the special comma processing added for sql queries last time. Katherine fixed this now to deal correctly with commas for all kinds of queries.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 28.6 KB
Line 
1# this file must be UTF-8 encoded
2package query
3
4
5#######################################################################
6# Macros whose values are set from within the server at runtime. These
7# are here only for reference and to set default values if required.
8#######################################################################
9
10_quotedquery_ {}
11_freqmsg_ {}
12_stopwordsmsg_ {}
13_resultline_ {}
14_thisfirst_ {}
15_thislast_ {}
16_nextfirst_ {}
17_nextlast_ {}
18_prevfirst_ {}
19_prevlast_ {}
20_searchhistorylist_ {}
21#_histvalue0_ to _histvalue19_
22_advformlist_ {}
23_regformlist_ {}
24_sqladvformlist_ {}
25_sqlregformlist_ {}
26#_fqfselection_ {}
27
28
29#######################################################################
30# icons
31#######################################################################
32
33_queryresultsbar_ {
34<div class="divbar">
35<p class="navbar">_texthresults_</p>
36</div>
37}
38
39_searchhistorybar_ {
40<div class="divbar">
41<p class="navbar">_texticonsearchhistorybar_</p>
42</div>
43}
44
45
46# _iconnext_ and _iconprev_ are overridden in this package as we
47# don't want alt text here
48_iconnext_{<img src="_httpiconmore_" width="_widthmore_" height="_heightmore_" border="0" align="top">}
49_iconnext_ [v=1] {}
50_iconprev_{<img src="_httpiconless_" width="_widthless_" height="_heightless_" border="0" align="top">}
51_iconprev_ [v=1] {}
52
53# the small squares for search history
54## " " ## handmade ## mstds ##
55_httpiconmstdsqrof_ {_httpimg_/mstdsof.gif}
56_httpiconmstdsqron_ {_httpimg_/mstdson.gif}
57_widthmstdsqrx_ {13}
58_heightmstdsqrx_ {13}
59
60#######################################################################
61# images
62#######################################################################
63
64# _imagethispage_ set in nav_css/nav_ns4 macro files
65
66#the buttons for the search history entries
67# takes one arg - the entry number (0-num entries)
68_imagehistbutton_ {<a href="_httpquery_" onMouseover="roll('histbutton_1_',1);" onMouseOut="roll('histbutton_1_',0);" onClick="inputQuery(histvalue_1_); return false;"><img name="histbutton_1_" src="_httpiconmstdsqrof_" onLoad="gbutton(this,'_httpiconmstdsqron_');" border="0" alt="_textusequery_" title="_textusequery_"></a>}
69
70
71#######################################################################
72# scripts (and some macros for the scripts)
73#######################################################################
74
75_pagescriptextra_ {_If_("_cgiargqt_" ge "1", _formpagescriptextra_, _selectpagescriptextra_)
76_If_("_cgiarghd_" ne "0",_historypagescriptextra_) }
77
78_selectpagescriptextra_{_If_("_cgiargqto_" eq "2", _formpagescriptextra_,_dummypagescriptextra_)}
79_dummypagescriptextra_{function initialize() \{
80\} }
81_formpagescriptextra_ {
82// query scripts generated by \_query:pagescriptextra\_
83
84_standardfunctions_
85_formfunctions_
86_searchfunctions_
87
88function getsearchargs () \{
89
90 var args="";
91 args = "&fqa=0&fqv="+argfqv+"&fqf="+argfqf;
92 _If_(_cgiargb_,
93 args += "&fqk="+argfqk+"&fqs="+argfqs+"&fqc="+argfqc;
94 )
95 _If_("_cgiarga_" eq "sqlq",args += "&sqlfqf="+argsqlfqf + "&sqlfqc="+argsqlfqc;)
96
97 return args;
98\}
99
100
101
102function getqueryargs () \{
103 var args = "&fqa=1"+"&q="+argq+"&fqv="+argfqv+"&fqf="+argfqf+
104 "&fqk="+argfqk+"&fqs="+argfqs+"&fqc="+argfqc;
105 _If_("_cgiarga_" eq "sqlq",args += "&sqlfqf="+argsqlfqf + "&sqlfqc="+argsqlfqc;)
106 return args;
107\}
108
109}
110
111_historypagescriptextra_{
112
113var histvalue0='_histvalue0_';
114var histvalue1='_histvalue1_';
115var histvalue2='_histvalue2_';
116var histvalue3='_histvalue3_';
117var histvalue4='_histvalue4_';
118var histvalue5='_histvalue5_';
119var histvalue6='_histvalue6_';
120var histvalue7='_histvalue7_';
121var histvalue8='_histvalue8_';
122var histvalue9='_histvalue9_';
123var histvalue10='_histvalue10_';
124var histvalue11='_histvalue11_';
125var histvalue12='_histvalue12_';
126var histvalue13='_histvalue13_';
127var histvalue14='_histvalue14_';
128var histvalue15='_histvalue15_';
129var histvalue16='_histvalue16_';
130var histvalue17='_histvalue17_';
131var histvalue18='_histvalue18_';
132var histvalue19='_histvalue19_';
133
134function inputQuery(value) \{
135 if ("_cgiargqt_" == "0") \{ // text search
136 document.QueryForm.q.value += " "+value;
137 document.QueryForm.q.focus();
138 \}
139 else \{
140 if ("_cgiargb_" == "1") \{ // advanced query
141 document.QueryForm.q.value += " "+value;
142 document.QueryForm.q.focus();
143 updateq();
144 \}
145 else \{ // simple form search
146 // do something here, what??
147 \}
148 \}
149\}
150
151}
152
153_standardfunctions_{
154
155 function getstdargs() \{
156
157 stdarg = "";
158 _If_(_gselection_,_getgarg_)
159 _If_(_jselection_,_getjarg_)
160 _If_(_nselection_,_getnarg_)
161 _If_(_sqlsfselection_,_getsqlsfarg_)
162 _If_(_sfselection_,_getsfarg_)
163
164 if (document.QueryForm.t != null) \{
165 value = document.QueryForm.t.options[document.QueryForm.t.selectedIndex].value;
166 if (value != "_cgiargt_") stdarg += "&t="+value;
167 \}
168 stdarg += "&r=1&hs=1";
169 return stdarg;
170 \}
171
172}
173
174_getgarg_{
175 if (document.QueryForm.g!= null) \{
176 value = document.QueryForm.g.options[document.QueryForm.g.selectedIndex].value;
177 if (value != "_cgiargg_") stdarg += "&g="+value;
178 \}
179}
180
181_getjarg_{
182 value = document.QueryForm.j.options[document.QueryForm.j.selectedIndex].value;
183 if (value != "_cgiargj_") stdarg += "&j="+value;
184}
185
186_getnarg_{
187 value = document.QueryForm.n.options[document.QueryForm.n.selectedIndex].value;
188 if (value != "_cgiargn_") stdarg += "&n="+value;
189}
190
191# currently only supported in lucene
192_getsfarg_{
193_If_("_cgiarga__cgiargct_" eq "q2",
194 value = document.QueryForm.sf.options[document.QueryForm.sf.selectedIndex].value;
195 if (value != "_cgiargsf_") stdarg += "&sf="+value;
196)
197}
198
199# only when in sql mode
200_getsqlsfarg_{
201_If_("_cgiarga__cgiargqt_" eq "sqlq2",
202 value = document.QueryForm.sqlsf.options[document.QueryForm.sqlsf.selectedIndex].value;
203 if (value != "_cgiargsqlsf_") stdarg += "&sqlsf="+value;
204)
205}
206
207_formfunctions_{
208
209argfqf="_cgiargfqf_";
210argfqv="_cgiargfqv_";
211argfqk="_cgiargfqk_";
212argfqs="_cgiargfqs_";
213argfqc="_cgiargfqc_";
214_If_("_cgiarga_" eq "sqlq",
215argsqlfqf="_cgiargsqlfqf_";
216argsqlfqc="_cgiargsqlfqc_";
217)
218argq = "";
219
220function initialize () \{
221
222 if (document.QueryForm.fqf != null) \{initfqf(); \}
223 if (document.QueryForm.fqv != null) \{initfqv(); \}
224 if (document.QueryForm.fqs != null) \{initfqs(); \}
225 if (document.QueryForm.fqk != null) \{initfqk(); \}
226 if (document.QueryForm.fqc != null) \{initfqc(); \}
227_If_("_cgiarga_" eq "sqlq",
228 if (document.QueryForm.sqlfqf != null) \{initsqlfqf(); \}
229 if (document.QueryForm.sqlfqc != null) \{initsqlfqc(); \}
230)
231 if (document.QueryForm.q != null) \{initq(); \}
232\}
233
234// makes a form submit itself when enter is pressed in a text field
235function entersubmit(event) \{
236
237 if (window.event && window.event.keyCode == 13) \{
238 beginSearch();
239 \} else \{
240 if (event && event.which == 13) \{
241 beginSearch();
242 \} else \{
243 return true;
244 \}
245 \}
246\}
247
248
249// fqf - the field selection box
250function initfqf() \{
251 var i;
252 fqf = argfqf.split(",");
253 num_opts = document.QueryForm.fqf[0].options.length; // assumes all have the same options
254 for (i=0; i<fqf.length && i<document.QueryForm.fqf.length; i++) \{
255 if (fqf[i] != "")\{
256 for (j=0;j<num_opts;j++) \{
257 if (fqf[i]== document.QueryForm.fqf[i].options[j].value) \{
258 document.QueryForm.fqf[i].options[j].selected = true;
259 break;
260 \}
261 \}
262 \}
263 \}
264 if (fqf.length < document.QueryForm.fqf.length) \{ // initialize remaining ones
265 for (i=fqf.length;i<document.QueryForm.fqf.length;i++) \{
266 var z=i;
267 while (z >= num_opts) \{
268 z = z-(num_opts);
269 \}
270 document.QueryForm.fqf[i].options[z].selected = true;
271
272 \}
273 \}
274 updatefqf();
275
276\}
277
278function updatefqf() \{
279
280 var i;
281 argfqf = "";
282 var j = document.QueryForm.fqf[0].selectedIndex;
283 argfqf += document.QueryForm.fqf[0].options[j].value;
284 for (i=1; i<document.QueryForm.fqf.length;i++) \{
285 j = document.QueryForm.fqf[i].selectedIndex;
286 argfqf += "," + document.QueryForm.fqf[i].options[j].value;
287 \}
288
289\}
290
291
292function clearfqf() \{
293 var i;
294 for (i=0;i<document.QueryForm.fqf.length;i++) \{
295 var z = i;
296 if (i >= document.QueryForm.fqf[i].options.length) z = z-document.QueryForm.fqf[i].options.length;
297 document.QueryForm.fqf[i].options[z].selected = true;
298 \}
299 updatefqf();
300\}
301
302
303// sqlfqf - the field selection box
304function initsqlfqf() \{
305 var i;
306 sqlfqf = argsqlfqf.split(",");
307 num_opts = document.QueryForm.sqlfqf[0].options.length; // assumes all have the same options
308 for (i=0; i<sqlfqf.length && i<document.QueryForm.sqlfqf.length; i++) \{
309 if (sqlfqf[i] != "")\{
310 for (j=0;j<num_opts;j++) \{
311 if (sqlfqf[i]== document.QueryForm.sqlfqf[i].options[j].value) \{
312 document.QueryForm.sqlfqf[i].options[j].selected = true;
313 break;
314 \}
315 \}
316 \}
317 \}
318 if (sqlfqf.length < document.QueryForm.sqlfqf.length) \{ // initialize remaining ones
319 for (i=sqlfqf.length;i<document.QueryForm.sqlfqf.length;i++) \{
320 var z=i;
321 while (z >= num_opts) \{
322 z = z-(num_opts);
323 \}
324 document.QueryForm.sqlfqf[i].options[z].selected = true;
325
326 \}
327 \}
328 updatesqlfqf();
329
330\}
331
332function updatesqlfqf() \{
333
334 var i;
335 argsqlfqf = "";
336 var j = document.QueryForm.sqlfqf[0].selectedIndex;
337 argsqlfqf += document.QueryForm.sqlfqf[0].options[j].value;
338 for (i=1; i<document.QueryForm.sqlfqf.length;i++) \{
339 j = document.QueryForm.sqlfqf[i].selectedIndex;
340 argsqlfqf += "," + document.QueryForm.sqlfqf[i].options[j].value;
341 \}
342
343\}
344
345
346function clearsqlfqf() \{
347 var i;
348 for (i=0;i<document.QueryForm.sqlfqf.length;i++) \{
349 var z = i;
350 if (i >= document.QueryForm.sqlfqf[i].options.length) z = z-document.QueryForm.sqlfqf[i].options.length;
351 document.QueryForm.sqlfqf[i].options[z].selected = true;
352 \}
353 updatesqlfqf();
354\}
355
356
357
358
359// fqc - the boolean operator selection box
360function initfqc() \{
361 var i,j;
362 fqc = argfqc.split(",");
363 if (_cgiargfqn_ == 2) \{ // there will only be one fqc element
364 for (j=0;j<document.QueryForm.fqc.options.length;j++) \{
365 if (fqc[0] == document.QueryForm.fqc.options[j].value) \{
366 document.QueryForm.fqc.options[j].selected = true;
367 break;
368 \}
369 \}
370 \}
371 else \{
372 for (i=0; i<fqc.length;i++) \{
373 for (j=0;j<document.QueryForm.fqc[i].options.length;j++) \{
374 if (fqc[i] == document.QueryForm.fqc[i].options[j].value) \{
375 document.QueryForm.fqc[i].options[j].selected = true;
376 break;
377 \}
378 \}
379 \}
380 \}
381 updatefqc();
382
383\}
384
385function updatefqc() \{
386
387 var i,j;
388 argfqc = "";
389 if (_cgiargfqn_ == 2) \{
390 j = document.QueryForm.fqc.selectedIndex;
391 argfqc += document.QueryForm.fqc.options[j].value;
392 \}
393 else \{
394 j = document.QueryForm.fqc[0].selectedIndex;
395 argfqc += document.QueryForm.fqc[0].options[j].value;
396 for (i=1;i<document.QueryForm.fqc.length;i++) \{
397 j = document.QueryForm.fqc[i].selectedIndex;
398 argfqc += "," + document.QueryForm.fqc[i].options[j].value;
399 \}
400 \}
401
402\}
403
404
405function clearfqc() \{
406
407 var i;
408 if (_cgiargfqn_ == 2) \{
409 document.QueryForm.fqc.options[0].selected = true;
410 \}
411 else \{
412 for (i=0; i<document.QueryForm.fqc.length; i++) \{
413 document.QueryForm.fqc[i].options[0].selected = true;
414 \}
415 \}
416 updatefqc();
417\}
418
419
420
421// sqlfqc - the SQL operator selection box
422function initsqlfqc() \{
423 var i,j;
424 sqlfqc = argsqlfqc.split(",");
425 if (_cgiargsqlfqn_ == 2) \{ // there will only be one sqlfqc element
426 for (j=0;j<document.QueryForm.sqlfqc.options.length;j++) \{
427 if (sqlfqc[0] == document.QueryForm.sqlfqc.options[j].value) \{
428 document.QueryForm.sqlfqc.options[j].selected = true;
429 break;
430 \}
431 \}
432 \}
433 else \{
434 for (i=0; i<sqlfqc.length;i++) \{
435 for (j=0;j<document.QueryForm.sqlfqc[i].options.length;j++) \{
436 if (sqlfqc[i] == document.QueryForm.sqlfqc[i].options[j].value) \{
437 document.QueryForm.sqlfqc[i].options[j].selected = true;
438 break;
439 \}
440 \}
441 \}
442 \}
443 updatesqlfqc();
444
445\}
446
447function updatesqlfqc() \{
448
449 var i,j;
450 argsqlfqc = "";
451 if (_cgiargsqlfqn_ == 2) \{
452 j = document.QueryForm.sqlfqc.selectedIndex;
453 argsqlfqc += document.QueryForm.sqlfqc.options[j].value;
454 \}
455 else \{
456 j = document.QueryForm.sqlfqc[0].selectedIndex;
457 argsqlfqc += document.QueryForm.sqlfqc[0].options[j].value;
458 for (i=1;i<document.QueryForm.sqlfqc.length;i++) \{
459 j = document.QueryForm.sqlfqc[i].selectedIndex;
460 argsqlfqc += "," + document.QueryForm.sqlfqc[i].options[j].value;
461 \}
462 \}
463
464\}
465
466
467function clearsqlfqc() \{
468
469 var i;
470 if (_cgiargsqlfqn_ == 2) \{
471 document.QueryForm.sqlfqc.options[0].selected = true;
472 \}
473 else \{
474 for (i=0; i<document.QueryForm.sqlfqc.length; i++) \{
475 document.QueryForm.sqlfqc[i].options[0].selected = true;
476 \}
477 \}
478 updatesqlfqc();
479\}
480
481
482
483
484// fqv - the query word/phrase text box
485function initfqv() \{
486 var i;
487 fqv= argfqv.split(",");
488 for (i=0; i<fqv.length && i<document.QueryForm.fqv.length; i++) \{
489 document.QueryForm.fqv[i].value = fqv[i];
490 \}
491 updatefqv();
492
493
494\}
495
496 //argfqv += escape(format(document.QueryForm.fqv[0].value));
497
498function updatefqv() \{
499 var i;
500 argfqv="";
501 argfqv += format(document.QueryForm.fqv[0].value);
502 for (i=1; i<document.QueryForm.fqv.length;i++) \{
503 argfqv += ",";
504 argfqv += format(document.QueryForm.fqv[i].value);
505 \}
506\}
507
508function clearfqv() \{
509 var i;
510 for (i=0; i< document.QueryForm.fqv.length;i++) \{
511 document.QueryForm.fqv[i].value = "";
512 \}
513 updatefqv();
514\}
515
516// fqs - the stemming checkboxes
517function initfqs() \{
518
519 var i;
520 fqs = argfqs.split(",");
521 for (i=0; i<fqs.length; i++) \{
522 if (fqs[i]=="1") \{
523 document.QueryForm.fqs[i].checked = true;
524 \}
525 \}
526 updatefqs();
527
528\}
529
530function updatefqs() \{
531 argfqs="";
532 if (document.QueryForm.fqs[0].checked) \{
533 argfqs += "1";
534 \}
535 else \{
536 argfqs += "0";
537 \}
538 var i;
539 for (i=1; i<document.QueryForm.fqs.length; i++) \{
540 if (document.QueryForm.fqs[i].checked) \{
541 argfqs += ",1";
542 \}
543 else \{
544 argfqs += ",0";
545 \}
546 \}
547\}
548
549
550function clearfqs() \{
551 var i;
552 for (i=0; i<document.QueryForm.fqs.length; i++) \{
553 document.QueryForm.fqs[i].checked = false;
554 \}
555 updatefqs();
556\}
557
558// kqk - the casefolding checkboxes
559function initfqk() \{
560 var i;
561 fqk = argfqk.split(",");
562 for (i=0; i<fqk.length; i++) \{
563 if (fqk[i]=="1") \{
564 document.QueryForm.fqk[i].checked = true;
565 \}
566 \}
567 updatefqk();
568
569\}
570
571
572function updatefqk() \{
573 argfqk="";
574 if (document.QueryForm.fqk[0].checked) \{
575 argfqk += "1";
576 \}
577 else \{
578 argfqk += "0";
579 \}
580 var i;
581 for (i=1; i<document.QueryForm.fqk.length; i++) \{
582 if (document.QueryForm.fqk[i].checked) \{
583 argfqk += ",1";
584 \}
585 else \{
586 argfqk += ",0";
587 \}
588 \}
589\}
590
591function clearfqk() \{
592 var i;
593 for (i=0; i<document.QueryForm.fqk.length; i++) \{
594 document.QueryForm.fqk[i].checked = false;
595 \}
596 updatefqk();
597\}
598
599// q - the advanced query box
600function initq() \{
601 updateq();
602\}
603
604function updateq() \{
605
606 argq = "";
607 _If_("_cgiarga_" eq "sqlq",argq += format(document.QueryForm.q.value, 1);)
608 _If_("_cgiarga_" eq "q",argq += format(document.QueryForm.q.value);)
609\}
610
611function clearq() \{
612 document.QueryForm.q.value="";
613\}
614
615// convert spaces to plus
616// also convert other illegal characters to %xx codes
617// This routine used to treat commas like spaces (replacing them with a plus),
618// but this is no longer good enough for handling sql-queries.
619// Now if keepcommas == 1, URL encode commas, else (if undefined or 0),
620// convert commas to plus.
621function format(string, keepcommas) \{
622 var str = "" + string;
623 var out = "", flag = 0;
624 var ch = "";
625 var j;
626 for (j = 0; j < str.length; j++) \{
627 ch=str.charAt(j);
628
629 if(ch == ",") \{
630 if(keepcommas == 1) \{
631 out += escape(ch);
632 flag=0;
633 continue;
634 \}
635 else \{ // can be undefined or maybe 0?
636 if (flag == 0) \{
637 out += "+";
638 flag=1;
639 \}
640 \}
641 continue;
642 \}
643
644 if (ch == " ") \{
645 if (flag == 0) \{
646 out += "+";
647 flag=1;
648 \}
649 continue;
650 \}
651 if (ch == ";" || ch == ":" || ch == "/" || ch == "?" ||
652 ch == "@" || ch == "&" || ch == "=" || ch == "#" ||
653 ch == "%") \{
654 out += escape(ch);
655 flag=0;
656 continue;
657 \}
658 out += str.charAt(j);
659 flag=0;
660 \}
661 return out;
662\}
663
664}
665
666#_httpquery_ has a=q&e=compressedargs
667#if adv form, need to set k=0 and s=0
668_advformargs_{_If_(_cgiargb_,&k=0&s=0)}
669
670_searchfunctions_ {
671
672function beginSearch() \{
673 window.location="_httpquery_"+getstdargs()+"_advformargs_"+getsearchargs();
674\}
675
676function runQuery() \{
677 window.location="_httpquery_"+getstdargs()+"_advformargs_"+getqueryargs();
678\}
679
680function clearForm() \{
681 clearfqf();
682_If_("_cgiarga_" eq "sqlq",
683 clearsqlfqf();
684)
685 clearfqv();
686
687 if ("_cgiargb_" == "1") \{
688 clearfqk();
689 clearfqs();
690 clearfqc();
691_If_("_cgiarga_" eq "sqlq",
692 clearsqlfqc();
693)
694 \}
695
696\}
697
698}
699
700#######################################################################
701# headers
702# these are overridden so we can put an onLoad event handler
703# in the <body> tag of this page - for mgpp, form search pages
704#######################################################################
705
706#copied from prefs
707
708_header_ {_cgihead_
709_htmlhead_(class="bgimage" onLoad="initialize();")_startspacer__pagebanner_
710}
711
712# this declaration ends up being the same as style=restrict, never mind
713_header_[v=1] {_cgihead_
714_htmlhead_(onLoad="initialize();")_pagebanner_
715}
716
717#######################################################################
718# page content
719#######################################################################
720
721
722_pagetitle_ {_If_(_cgiargq_,_textquerytitle_,_textnoquerytitle_)}
723
724
725_content_ {
726
727_optnavigationbar_
728<div class="document">
729<div class="queryform">
730
731_If_("_cgiarga_" eq "sqlq",
732
733 _If_("_cgiargqt_" eq "2",_sqlfieldqueryform_,_sqlqueryform_)
734,
735 _If_(_cgiargct_,_selectqueryform_,_queryform_)
736)
737
738</div>
739
740_If_(_searchhistorylist_,<center>_searchhistorybar_</center><br>
741<center>
742_searchhistorylist_
743</center>)
744_If_(_cgiargq_,_queryresultsbar_
745<small>
746_freqmsg_
747_textpostprocess_
748_If_(_stopwordsmsg_,(_stopwordsmsg_))</small><br />
749_resultline_
750,<div class="divbar">&nbsp;</div>)
751}
752
753_selectqueryform_{_If_("_cgiargqt_" ge "1",_fieldqueryform_,_queryform_)}
754
755_queryform_ {
756<!-- query form (\_query:plainqueryform\_) -->
757<form name="QueryForm" method="get" action="_gwcgi_">
758<p>
759<input type="hidden" name="a" value="q">
760<input type="hidden" name="r" value="1">
761<input type="hidden" name="hs" value="1">
762<input type="hidden" name="e" value="_decodedcompressedoptions_">
763_queryformcontent_
764_optdatesearch_
765</p>
766</form>
767<!-- end of query form -->
768}
769
770
771_sqlqueryform_ {
772
773<!-- simple query box that requires you to type SQL where clause directly -->
774<!-- sqlquery form (\_query:plainqueryform\_) -->
775<form name="QueryForm" method="get" action="_gwcgi_">
776<p>
777<input type="hidden" name="a" value="sqlq">
778<input type="hidden" name="r" value="1">
779<input type="hidden" name="hs" value="1">
780<input type="hidden" name="e" value="_decodedcompressedoptions_">
781_sqlqueryformcontent_
782</p>
783</form>
784<!-- end of sqlquery form -->
785}
786
787
788_ifeellucky_ { <br><input type="checkbox" name="ifl" value="1">_textifeellucky_ }
789_useifeellucky_ { } # Set this to _ifeellucky_ if you want this functionality available
790
791_allowformbreak_{</span> <span class="textselect">}
792
793_queryformcontent_{
794<span class="textselect">
795_textselect_
796</span>
797
798<span class="querybox">
799_If_(_cgiargqb_,_largequerybox_,_smallquerybox_)
800_useifeellucky_
801</span>
802}
803
804
805_sqlqueryformcontent_ {
806<span class="querybox">
807_If_(_cgiargqb_,_query:largequerybox_,_query:smallquerybox_)
808_query:useifeellucky_
809</span>
810}
811
812# Automatically set by receptionist if config file switches
813# date searching on
814_optdatesearch_ { }
815
816
817_datesearch_
818{<table><tr><td>
819 <center>
820_textstartdate_
821<input type="text" name="ds" value="_cgiargds_" size="4" maxlength="4">
822<select name="dsbc" value="_cgiargdsbc_" size="1">
823 <option value="0"_If_(_cgiargdsbc_,, selected)>_textad_
824 <option value="1"_If_(_cgiargdsbc_, selected)>_textbc_
825</select>
826_textenddate_
827<input type="text" name="de" value="_cgiargde_" size="4" maxlength="4">
828<select name="debc" size="1">
829 <option value="0" _If_(_cgiargdebc_,, selected)>_textad_
830 <option value="1" _If_(_cgiargdebc_, selected)>_textbc_
831</select>
832</center>
833</td></tr>
834<tr><td>
835_textexplaineras_
836</td></tr>
837</table>
838</center>
839}
840
841_smallquerybox_ {<nobr><input type="text" name="q" value="_cgiargq_" size="50">&nbsp;<input type="submit" value="_textbeginsearch_"></nobr>}
842
843_largequerybox_ {
844<tr><td><textarea name="q" cols="63" rows="10">
845_cgiargq_
846</textarea></td></tr>
847<tr align="right"><td><table>
848<tr><td><input type="submit" value="_textbeginsearch_"></td>
849</tr></table></td></tr>}
850
851
852_fieldqueryform_ {
853<noscript>
854<p><b>_textnojsformwarning_</b></p>
855</noscript>
856<!-- field query form (\_query:fieldqueryform\_) -->
857<form name="QueryForm" method="get" action="_gwcgi_">
858
859<table><tr><td align="left">
860
861_textformselect_
862</td></tr>
863<tr><td>
864_If_(_cgiargb_,_advancedforms_,_simpleforms_)
865</td></tr>
866</table>
867_If_(_cgiargb_,<div class="divbar">&nbsp;</div>
868_advancedformextra_)
869
870</form>
871<!-- end of query form -->
872}
873
874_sqlfieldqueryform_ {
875<noscript>
876<p><b>_textnojsformwarning_</b></p>
877</noscript>
878<!--sql field query form (\_query:fieldqueryform\_) -->
879<form name="QueryForm" method="get" action="_gwcgi_">
880
881<table><tr><td align="left">
882_textformselect_
883</td></tr>
884<tr><td>
885_If_(_cgiargb_,_sqladvancedforms_,_sqlsimpleforms_)
886</td></tr>
887</table>
888_If_(_cgiargb_,<div class="divbar">&nbsp;</div>
889_advancedformextra_)
890
891</form>
892<!-- end of sql query form -->
893}
894
895
896
897_advancedforms_{
898<table border="0" cellspacing="0" cellpadding="0" width="90%">
899<tr><th></th><th align="left">_textwordphrase_</th>_If_("_cgiargct_" eq "1",<th colspan="2"><nobr>_textfoldstem_</nobr></th>)<th align="center">&nbsp;&nbsp;_textinfield_</th></tr>
900_advformlist_
901<tr>
902<td colspan="2" align="left"><input type="button" value="_textclearform_" onClick="clearForm();"></td>
903<td colspan="3" align="right"><input type="button" value="_textbeginsearch_" onClick="beginSearch();"></td>
904</tr>
905</table>
906}
907
908_sqladvancedforms_{
909<table border="0" cellspacing="0" cellpadding="0" width="90%">
910 <tr>
911 <th></th>
912 <th align="left">_textfieldphrase_</th>
913 <th></th>
914 <th align="center">&nbsp;&nbsp;_textinwords_</th>
915 </tr>
916 _sqladvformlist_
917 <tr>
918 <td colspan="2" align="left">
919 <input type="button" value="_textclearform_" onClick="clearForm();">
920 </td>
921 <td colspan="3" align="right">
922 <input type="button" value="_textbeginsearch_" onClick="beginSearch();">
923 </td>
924 </tr>
925</table>
926}
927
928
929
930_advancedformextra_{
931<table>
932<tr><td align="left">_textadvquery_</td></tr>
933<tr><td><textarea name="q" cols="57" rows="3" onChange="updateq();">_cgiargq_</textarea></td>
934<td valign="bottom">
935<input type="button" value="_textrunquery_" onClick="runQuery();"></td></tr>
936</table>
937
938
939_If_("_cgiarga_" eq "sqlq",
940<p>For example:<br>
941<i>
942 element in (\'dc.Keywords\') AND value=\'Farming\'<br>
943 element in (\'dls.Title\') AND value LIKE \'F%\'<br>
944 element in (\'dls.Title\') AND value<\'F%\'<br>
945</i>
946)
947
948}
949
950_simpleforms_{
951<table border="0" cellspacing="0" cellpadding="0" width="90%">
952<tr><th align="left">_textwordphrase_</th><th align="left">&nbsp;&nbsp;_textinfield_</th></tr>
953_regformlist_
954<tr>
955<td align="left"><input type="button" value="_textclearform_" onClick="clearForm();"></td>
956<td align="right"><input type="button" value="_textbeginsearch_" onClick="beginSearch();"></td>
957</tr>
958</table>}
959
960_sqlsimpleforms_{
961<table border="0" cellspacing="0" cellpadding="0" width="90%">
962 <tr>
963 <th align="left">_textfieldphrase_</th>
964 <th></th>
965 <th align="left">&nbsp;&nbsp;_textinwords_</th>
966 </tr>
967 _sqlregformlist_
968 <tr>
969 <td align="left">
970 <input type="button" value="_textclearform_" onClick="clearForm();">
971 </td>
972 <td align="right">
973 <input type="button" value="_textbeginsearch_" onClick="beginSearch();">
974 </td>
975 </tr>
976</table>
977}
978
979#
980# Full-text versions
981#
982
983_regformelement_{
984<tr><td><input type="text" size="39" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);"></td>
985<td>_fqfselection_</td></tr>}
986
987#has no and/or/not selection box
988_firstadvformelement_{
989<tr><td></td><td><input type="text" size="31" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);"></td>
990_If_("_cgiargct_" eq "1",<td align="center"><input type="checkbox" name="fqk" onClick="updatefqk();"></td>
991<td align="center"><input type="checkbox" name="fqs" onClick="updatefqs();"></td>)
992<td align="right">_fqfselection_</td></tr>}
993
994_advformelement_{
995<tr><td>_fqcselection_</td>
996<td><input type="text" size="31" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);"></td>
997_If_("_cgiargct_" eq "1",<td align="center"><input type="checkbox" name="fqk" onClick="updatefqk();"></td>
998<td align="center"><input type="checkbox" name="fqs" onClick="updatefqs();"></td>)
999<td align="right">_fqfselection_</td></tr>}
1000
1001
1002
1003_fqcselection_ {
1004<select name="fqc" onChange="updatefqc();">
1005<option value="and">_textand_
1006<option value="or">_textor_
1007<option value="not">_textandnot_
1008</select>}
1009
1010
1011_andorfqcselection_ {
1012<select name="fqc" onChange="updatefqc();">
1013<option value="and">_textand_
1014<option value="or">_textor_
1015</select>}
1016
1017
1018#
1019# SQL versions of regformelement, firstsqladvformelement, advformelement
1020#
1021
1022_sqlregformelement_{
1023<tr>
1024 <td>
1025 _sqlfqfselection_
1026 </td>
1027 <td>
1028 _sqlfqcselection_
1029 </td>
1030 <td>
1031 <input type="text" size="39" name="fqv" onChange="updatefqv();"
1032 onkeypress="updatefqv(); entersubmit(event);">
1033 </td>
1034</tr>
1035}
1036
1037_firstsqladvformelement_{
1038<tr>
1039 <td>
1040 </td>
1041 <td align="right">
1042 _sqlfqfselection_
1043 </td>
1044 <td>
1045 _sqlfqcselection_
1046 </td>
1047 <td>
1048 <input type="text" size="31" name="fqv" onChange="updatefqv();"
1049 onkeypress="updatefqv(); entersubmit(event);">
1050 </td>
1051</tr>
1052}
1053
1054_sqladvformelement_{
1055<tr>
1056 <td>
1057 _andorfqcselection_
1058 </td>
1059 <td align="right">
1060 _sqlfqfselection_
1061 </td>
1062 <td>
1063 _sqlfqcselection_
1064 </td>
1065 <td>
1066 <input type="text" size="31" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);">
1067 </td>
1068</tr>
1069}
1070
1071
1072_sqlfqcselection_ {
1073<select name="sqlfqc" onChange="updatesqlfqc();">
1074 <option value="=">matches
1075 <option value="&lt;">&lt;
1076 <option value="&lt;=">&lt;=
1077 <option value="LIKE">like
1078 <option value="&gt;=">&gt;=
1079 <option value="&gt;">&gt;
1080 <option value="&lt;&gt;">&lt;&gt;
1081
1082</select>}
1083
1084#
1085# end of SQL version
1086#
1087
1088_textselect_ {_If_(_cgiargb_,_chooseadvancedsearch_,_choosesimplesearch_)}
1089
1090_choosesimplesearch_ {_If_("_cgiargqt_" eq "2",_textsimplesqlsearch_,_textsimplesearch_)}
1091
1092_chooseadvancedsearch_ {_If_("_cgiarqt_" eq "2",_textadvancedsqlsearch_,_chooseadvancedsearchct_)}
1093_chooseadvancedsearchct_ {_If_(_cgiargct_,_If_("_cgiargct_" eq "2",_textadvancedlucenesearch_,_textadvancedmgppsearch_),_textadvancedsearch_}
1094
1095# formed based versions
1096_textformselect_ {_If_(_cgiargb_,_chooseformadvancedsearch_,_chooseformsimplesearch_)}
1097_chooseformsimplesearch_ {_If_("_cgiargqt_" eq "2",_textformsimplesearchsql_,_textformsimplesearch_)}
1098
1099_chooseformadvancedsearch_ {_If_("_cgiargqt_" eq "2",_textformadvancedsearchsql_,_chooseformadvancedsearchct_)}
1100_chooseformadvancedsearchct_ {_If_("_cgiargct_" eq "1",_textformadvancedsearchmgpp_)_If_("_cgiargct_" eq "2",_textformadvancedsearchlucene_)}
1101
1102# mg uses hselection for index, mgpp uses fqfselection
1103_indexselection_{_If_(_cgiargct_,_fqfselection_,_hselection_)}
1104
1105# we want to put the links to previous/next pages of results
1106# in the footer
1107_pagefooterextra_ {
1108<center>
1109<table cellspacing="0" cellpadding="0" width="_pagewidth_">
1110<tr>
1111<td align="left">_If_(_prevfirst_,<a href="_httpquery_&amp;r=_prevfirst_">_iconprev__textmatches__prevfirst_ - _prevlast_</a>)</td>
1112<td align="right">_If_(_nextfirst_,<a href="_httpquery_&amp;r=_nextfirst_">_textmatches__nextfirst_ - _nextlast__iconnext_</a>)</td>
1113</tr></table>
1114</center>
1115
1116</div> <!-- document -->
1117}
1118
1119_querytypeselection_ {
1120<select name="t">
1121<option value="1"_If_(_cgiargt_, selected)>_If_(_cgiargb_,_textranked_,_textsome_)
1122<option value="0"_If_(_cgiargt_,, selected)>_If_(_cgiargb_,_textboolean_,_textall_)
1123</select>
1124}
1125
1126
1127_formquerytypesimpleselection_ {
1128<select name="t">
1129<option value="1"_If_(_cgiargt_, selected)>_textsome_
1130<option value="0"_If_(_cgiargt_,, selected)>_textall_
1131</select>
1132}
1133
1134_formquerytypeadvancedselection_ {
1135<select name="t">
1136<option value="1"_If_(_cgiargt_, selected)>_textranked_
1137<option value="0"_If_(_cgiargt_,, selected)>_textnatural_
1138</select>
1139}
1140
1141# this one is not used by english.dm any more. But I have added it back for the other languages that haven't updated the translations for their form search macros.
1142_formquerytypeselection_ {
1143<select name="t">
1144<option value="1"_If_(_cgiargt_, selected)>_If_(_cgiargb_,_textranked_,_textsome_)
1145<option value="0"_If_(_cgiargt_,, selected)>_If_(_cgiargb_,_textnatural_,_textall_)
1146</select>
1147}
1148
Note: See TracBrowser for help on using the repository browser.