root/main/trunk/greenstone2/macros/query.dm @ 28526

Revision 28526, 29.9 KB (checked in by kjdon, 6 years ago)

removed the heading 'Field ..in word(s)' from sql search forms, as it didn't make sense and it's not really needed anyway

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
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+"&fqaf="+argfqaf;
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+"&fqaf="+argfqaf;
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_";
213argfqaf="_cgiargfqaf_";
214argfqc="_cgiargfqc_";
215_If_("_cgiarga_" eq "sqlq",
216argsqlfqf="_cgiargsqlfqf_";
217argsqlfqc="_cgiargsqlfqc_";
218)
219argq = "";
220
221function initialize () \{
222
223   if (document.QueryForm.fqf != null) \{initfqf(); \}
224   if (document.QueryForm.fqv != null) \{initfqv(); \}
225   if (document.QueryForm.fqs != null) \{initfqs(); \}
226   if (document.QueryForm.fqk != null) \{initfqk(); \}
227   if (document.QueryForm.fqaf != null) \{initfqaf(); \}
228   if (document.QueryForm.fqc != null) \{initfqc(); \}
229_If_("_cgiarga_" eq "sqlq",
230   if (document.QueryForm.sqlfqf != null) \{initsqlfqf(); \}
231   if (document.QueryForm.sqlfqc != null) \{initsqlfqc(); \}
232)
233   if (document.QueryForm.q != null) \{initq(); \}   
234\}
235
236// makes a form submit itself when enter is pressed in a text field
237function entersubmit(event) \{
238     
239  if (window.event && window.event.keyCode == 13) \{
240    beginSearch();
241  \} else \{
242     if (event && event.which == 13) \{
243       beginSearch();
244     \} else \{
245        return true;
246    \}
247  \}
248\}
249
250   
251// fqf - the field selection box
252function initfqf() \{
253   var i;
254   fqf = argfqf.split(",");
255   num_opts = document.QueryForm.fqf[0].options.length; // assumes all have the same  options   
256   for (i=0; i<fqf.length && i<document.QueryForm.fqf.length; i++) \{
257     if (fqf[i] != "")\{           
258       for (j=0;j<num_opts;j++) \{
259       if (fqf[i]== document.QueryForm.fqf[i].options[j].value) \{
260          document.QueryForm.fqf[i].options[j].selected = true;
261          break;   
262       \}
263    \}
264     \}
265   \}
266   if (fqf.length < document.QueryForm.fqf.length) \{ // initialize remaining ones
267      for (i=fqf.length;i<document.QueryForm.fqf.length;i++) \{
268      var z=i;
269      while (z >= num_opts) \{
270         z = z-(num_opts);
271      \}
272      document.QueryForm.fqf[i].options[z].selected = true;
273     
274      \}
275   \}
276   updatefqf();
277
278\}
279
280function updatefqf() \{
281
282   var i;
283   argfqf = "";
284   var j = document.QueryForm.fqf[0].selectedIndex;
285   argfqf += document.QueryForm.fqf[0].options[j].value;
286   for (i=1; i<document.QueryForm.fqf.length;i++) \{
287      j = document.QueryForm.fqf[i].selectedIndex;
288      argfqf += "," + document.QueryForm.fqf[i].options[j].value;
289   \}
290
291\}
292
293
294function clearfqf() \{
295   var i;
296   for (i=0;i<document.QueryForm.fqf.length;i++) \{
297       var z = i;
298       if (i >= document.QueryForm.fqf[i].options.length) z = z-document.QueryForm.fqf[i].options.length;
299       document.QueryForm.fqf[i].options[z].selected = true;
300   \}
301   updatefqf();
302\}
303
304   
305// sqlfqf - the field selection box
306function initsqlfqf() \{
307   var i;
308   sqlfqf = argsqlfqf.split(",");
309   num_opts = document.QueryForm.sqlfqf[0].options.length; // assumes all have the same  options   
310   for (i=0; i<sqlfqf.length && i<document.QueryForm.sqlfqf.length; i++) \{
311     if (sqlfqf[i] != "")\{         
312       for (j=0;j<num_opts;j++) \{
313       if (sqlfqf[i]== document.QueryForm.sqlfqf[i].options[j].value) \{
314          document.QueryForm.sqlfqf[i].options[j].selected = true;
315          break;   
316       \}
317    \}
318     \}
319   \}
320   if (sqlfqf.length < document.QueryForm.sqlfqf.length) \{ // initialize remaining ones
321      for (i=sqlfqf.length;i<document.QueryForm.sqlfqf.length;i++) \{
322      var z=i;
323      while (z >= num_opts) \{
324         z = z-(num_opts);
325      \}
326      document.QueryForm.sqlfqf[i].options[z].selected = true;
327     
328      \}
329   \}
330   updatesqlfqf();
331
332\}
333
334function updatesqlfqf() \{
335
336   var i;
337   argsqlfqf = "";
338   var j = document.QueryForm.sqlfqf[0].selectedIndex;
339   argsqlfqf += document.QueryForm.sqlfqf[0].options[j].value;
340   for (i=1; i<document.QueryForm.sqlfqf.length;i++) \{
341      j = document.QueryForm.sqlfqf[i].selectedIndex;
342      argsqlfqf += "," + document.QueryForm.sqlfqf[i].options[j].value;
343   \}
344
345\}
346
347
348function clearsqlfqf() \{
349   var i;
350   for (i=0;i<document.QueryForm.sqlfqf.length;i++) \{
351       var z = i;
352       if (i >= document.QueryForm.sqlfqf[i].options.length) z = z-document.QueryForm.sqlfqf[i].options.length;
353       document.QueryForm.sqlfqf[i].options[z].selected = true;
354   \}
355   updatesqlfqf();
356\}
357
358
359
360
361// fqc - the boolean operator selection box
362function initfqc() \{
363   var i,j;
364   fqc = argfqc.split(",");
365   if (_cgiargfqn_ == 2) \{ // there will only be one fqc element
366       for (j=0;j<document.QueryForm.fqc.options.length;j++) \{
367       if (fqc[0] == document.QueryForm.fqc.options[j].value) \{
368          document.QueryForm.fqc.options[j].selected = true;
369          break;
370       \}
371       \}   
372   \}
373   else \{   
374   for (i=0; i<fqc.length;i++) \{
375       for (j=0;j<document.QueryForm.fqc[i].options.length;j++) \{
376       if (fqc[i] == document.QueryForm.fqc[i].options[j].value) \{
377          document.QueryForm.fqc[i].options[j].selected = true;
378          break;
379       \}
380       \}
381   \}
382   \}
383   updatefqc();
384
385\}
386
387function updatefqc() \{
388 
389   var i,j;
390   argfqc = "";
391   if (_cgiargfqn_ == 2) \{
392      j = document.QueryForm.fqc.selectedIndex;
393      argfqc += document.QueryForm.fqc.options[j].value;
394   \}
395   else \{
396    j = document.QueryForm.fqc[0].selectedIndex;
397    argfqc += document.QueryForm.fqc[0].options[j].value;
398    for (i=1;i<document.QueryForm.fqc.length;i++) \{
399        j = document.QueryForm.fqc[i].selectedIndex;
400        argfqc += "," + document.QueryForm.fqc[i].options[j].value;
401    \}
402   \}
403
404\}
405
406
407function clearfqc() \{
408   
409   var i;
410   if (_cgiargfqn_ == 2) \{
411       document.QueryForm.fqc.options[0].selected = true;
412   \}
413   else \{
414    for (i=0; i<document.QueryForm.fqc.length; i++) \{
415        document.QueryForm.fqc[i].options[0].selected = true;
416    \}
417   \}
418   updatefqc();
419\}
420
421
422
423// sqlfqc - the SQL operator selection box
424function initsqlfqc() \{
425   var i,j;
426   sqlfqc = argsqlfqc.split(",");
427   if (_cgiargsqlfqn_ == 2) \{ // there will only be one sqlfqc element
428       for (j=0;j<document.QueryForm.sqlfqc.options.length;j++) \{
429       if (sqlfqc[0] == document.QueryForm.sqlfqc.options[j].value) \{
430          document.QueryForm.sqlfqc.options[j].selected = true;
431          break;
432       \}
433       \}   
434   \}
435   else \{   
436   for (i=0; i<sqlfqc.length;i++) \{
437       for (j=0;j<document.QueryForm.sqlfqc[i].options.length;j++) \{
438       if (sqlfqc[i] == document.QueryForm.sqlfqc[i].options[j].value) \{
439          document.QueryForm.sqlfqc[i].options[j].selected = true;
440          break;
441       \}
442       \}
443   \}
444   \}
445   updatesqlfqc();
446
447\}
448
449function updatesqlfqc() \{
450 
451   var i,j;
452   argsqlfqc = "";
453   if (_cgiargsqlfqn_ == 2) \{
454      j = document.QueryForm.sqlfqc.selectedIndex;
455      argsqlfqc += document.QueryForm.sqlfqc.options[j].value;
456   \}
457   else \{
458    j = document.QueryForm.sqlfqc[0].selectedIndex;
459    argsqlfqc += document.QueryForm.sqlfqc[0].options[j].value;
460    for (i=1;i<document.QueryForm.sqlfqc.length;i++) \{
461        j = document.QueryForm.sqlfqc[i].selectedIndex;
462        argsqlfqc += "," + document.QueryForm.sqlfqc[i].options[j].value;
463    \}
464   \}
465
466\}
467
468
469function clearsqlfqc() \{
470   
471   var i;
472   if (_cgiargsqlfqn_ == 2) \{
473       document.QueryForm.sqlfqc.options[0].selected = true;
474   \}
475   else \{
476    for (i=0; i<document.QueryForm.sqlfqc.length; i++) \{
477        document.QueryForm.sqlfqc[i].options[0].selected = true;
478    \}
479   \}
480   updatesqlfqc();
481\}
482
483
484
485
486// fqv - the query word/phrase text box       
487function initfqv() \{
488   var i;
489   fqv= argfqv.split(",");
490   for (i=0; i<fqv.length && i<document.QueryForm.fqv.length; i++) \{
491       document.QueryForm.fqv[i].value = fqv[i];
492   \}
493   updatefqv();
494
495
496\}
497
498   //argfqv += escape(format(document.QueryForm.fqv[0].value));
499
500function updatefqv() \{ 
501   var i;
502   argfqv="";
503   argfqv += format(document.QueryForm.fqv[0].value);
504   for (i=1; i<document.QueryForm.fqv.length;i++) \{
505       argfqv += ",";
506       argfqv +=  format(document.QueryForm.fqv[i].value);
507   \}
508\}
509
510function clearfqv() \{
511   var i;
512   for (i=0; i< document.QueryForm.fqv.length;i++) \{
513       document.QueryForm.fqv[i].value = "";
514   \}
515   updatefqv();
516\}
517
518// fqs - the stemming checkboxes
519function initfqs() \{
520
521   var i;
522   fqs = argfqs.split(",");
523   for (i=0; i<fqs.length; i++) \{
524       if (fqs[i]=="1") \{
525      document.QueryForm.fqs[i].checked = true;
526       \}
527   \}
528   updatefqs();
529
530\}
531
532function updatefqs() \{
533   argfqs="";
534   if (document.QueryForm.fqs[0].checked) \{
535      argfqs += "1";
536   \}
537   else \{
538      argfqs += "0";   
539   \}
540   var i;
541   for (i=1; i<document.QueryForm.fqs.length; i++) \{
542       if (document.QueryForm.fqs[i].checked) \{
543      argfqs += ",1";
544    \}
545    else \{
546      argfqs += ",0";
547    \}
548   \}
549\}
550
551
552function clearfqs() \{
553   var i;
554   for (i=0; i<document.QueryForm.fqs.length; i++) \{
555       document.QueryForm.fqs[i].checked = false;
556   \}
557   updatefqs();
558\}
559
560// fqk - the casefolding checkboxes
561function initfqk() \{
562   var i;
563   fqk = argfqk.split(",");
564   for (i=0; i<fqk.length; i++) \{
565       if (fqk[i]=="1") \{
566      document.QueryForm.fqk[i].checked = true;
567       \}
568   \}
569   updatefqk();
570
571\}
572
573
574function updatefqk() \{
575   argfqk="";
576   if (document.QueryForm.fqk[0].checked) \{
577      argfqk += "1";
578   \}
579   else \{
580      argfqk += "0";   
581   \}
582   var i;
583   for (i=1; i<document.QueryForm.fqk.length; i++) \{
584       if (document.QueryForm.fqk[i].checked) \{
585      argfqk += ",1";
586    \}
587    else \{
588      argfqk += ",0";
589    \}
590   \}
591\}
592
593function clearfqk() \{
594   var i;
595   for (i=0; i<document.QueryForm.fqk.length; i++) \{
596       document.QueryForm.fqk[i].checked = false;
597   \}
598   updatefqk();
599\}
600
601// fqaf - the casefolding checkboxes
602function initfqaf() \{
603   var i;
604   fqaf = argfqaf.split(",");
605   for (i=0; i<fqaf.length; i++) \{
606       if (fqaf[i]=="1") \{
607      document.QueryForm.fqaf[i].checked = true;
608       \}
609   \}
610   updatefqaf();
611
612\}
613
614
615function updatefqaf() \{
616   argfqaf="";
617   if (document.QueryForm.fqaf[0].checked) \{
618      argfqaf += "1";
619   \}
620   else \{
621      argfqaf += "0";   
622   \}
623   var i;
624   for (i=1; i<document.QueryForm.fqaf.length; i++) \{
625       if (document.QueryForm.fqaf[i].checked) \{
626      argfqaf += ",1";
627    \}
628    else \{
629      argfqaf += ",0";
630    \}
631   \}
632\}
633
634function clearfqaf() \{
635   var i;
636   for (i=0; i<document.QueryForm.fqaf.length; i++) \{
637       document.QueryForm.fqaf[i].checked = false;
638   \}
639   updatefqaf();
640\}
641
642// q - the advanced query box
643function initq() \{
644   updateq();
645\}
646
647function updateq() \{
648 
649   argq = "";   
650   _If_("_cgiarga_" eq "sqlq",argq += format(document.QueryForm.q.value, 1);)
651   _If_("_cgiarga_" eq "q",argq += format(document.QueryForm.q.value);)
652\}
653
654function clearq() \{
655   document.QueryForm.q.value="";
656   updateq();
657\}
658
659// convert spaces to plus
660// also convert other illegal characters to %xx codes
661// This routine used to treat commas like spaces (replacing them with a plus),
662// but this is no longer good enough for handling sql-queries.
663// Now if keepcommas == 1, URL encode commas, else (if undefined or 0),
664// convert commas to plus.
665function format(string, keepcommas) \{
666   var str = "" + string;
667   var out = "", flag = 0;
668   var ch = "";
669   var j;
670   for (j = 0; j < str.length; j++) \{   
671       ch=str.charAt(j);
672       
673       if(ch == ",") \{
674        if(keepcommas == 1) \{
675            out += escape(ch);
676            flag=0;
677            continue;
678        \}         
679        else \{ // can be undefined or maybe 0?
680            if (flag == 0) \{     
681              out += "+";
682              flag=1;
683             \}
684        \}
685        continue;
686       \}
687       
688       if (ch == " ") \{
689           if (flag == 0) \{     
690          out += "+";
691          flag=1;
692        \}
693        continue;
694    \}
695    if (ch == ";" || ch == ":" || ch == "/" || ch == "?" ||
696            ch == "@" || ch == "&" || ch == "=" || ch == "#" ||
697        ch == "%") \{
698        out += escape(ch);
699        flag=0;
700        continue;
701     \}       
702    out += str.charAt(j);
703    flag=0;
704   \}
705   return out;
706\}
707
708}
709
710#_httpquery_ has a=q&e=compressedargs
711#if adv form, need to set k=0 and s=0
712_advformargs_{_If_(_cgiargb_,&k=0&s=0)}
713
714_searchfunctions_ {
715
716function beginSearch() \{
717  window.location="_httpquery_"+getstdargs()+"_advformargs_"+getsearchargs();
718\}
719
720function runQuery() \{
721  window.location="_httpquery_"+getstdargs()+"_advformargs_"+getqueryargs();
722\}
723
724function clearForm() \{
725_If_("_cgiarga_" eq "sqlq",
726   clearsqlfqf(), clearfqf();
727)
728   clearfqv();
729
730   if ("_cgiargb_" == "1") \{
731      if (document.QueryForm.fqk != null) \{clearfqk();\}
732      if (document.QueryForm.fqs != null) \{clearfqs();\}
733      if (document.QueryForm.fqaf != null) \{clearfqaf();\}
734      if (document.QueryForm.fqc != null) \{clearfqc();\}
735_If_("_cgiarga_" eq "sqlq",
736      clearsqlfqc();
737)
738    if (document.QueryForm.q != null) \{clearq(); \}   
739   \}
740
741\}
742
743}
744
745#######################################################################
746# headers
747# these are overridden so we can put an onLoad event handler
748# in the <body> tag of this page - for mgpp, form search pages
749#######################################################################
750
751#copied from prefs
752
753_header_ {_cgihead_
754_htmlhead_(class="bgimage" onLoad="initialize();")_startspacer__pagebanner_
755}
756
757# this declaration ends up being the same as style=restrict, never mind
758_header_[v=1] {_cgihead_
759_htmlhead_(onLoad="initialize();")_pagebanner_
760}
761
762#######################################################################
763# page content
764#######################################################################
765
766
767_pagetitle_ {_If_(_cgiargq_,_textquerytitle_,_textnoquerytitle_)}
768
769
770_content_ {
771
772_optnavigationbar_
773<div class="document">
774<div class="queryform">
775
776_If_("_cgiarga_" eq "sqlq",
777
778  _If_("_cgiargqt_" eq "2",_sqlfieldqueryform_,_sqlqueryform_)
779,
780  _If_(_cgiargct_,_selectqueryform_,_queryform_)
781)
782
783</div>
784
785_If_(_searchhistorylist_,<center>_searchhistorybar_</center><br>
786<center>
787_searchhistorylist_
788</center>)
789_If_(_cgiargq_,_queryresultsbar_
790<small>
791_freqmsg_
792_textpostprocess_
793_If_(_stopwordsmsg_,(_stopwordsmsg_))</small><br />
794_resultline_
795,<div class="divbar">&nbsp;</div>)
796}
797
798_selectqueryform_{_If_("_cgiargqt_" ge "1",_fieldqueryform_,_queryform_)}
799
800_queryform_ {
801<!-- query form (\_query:plainqueryform\_) -->
802<form name="QueryForm" method="get" action="_gwcgi_">
803<p>
804<input type="hidden" name="a" value="q">
805<input type="hidden" name="r" value="1">
806<input type="hidden" name="hs" value="1">
807<input type="hidden" name="e" value="_decodedcompressedoptions_">
808_queryformcontent_
809_optdatesearch_
810</p>
811</form>
812<!-- end of query form -->
813}
814
815
816_sqlqueryform_ {
817
818<!-- simple query box that requires you to type SQL where clause directly -->
819<!-- sqlquery form (\_query:plainqueryform\_) -->
820<form name="QueryForm" method="get" action="_gwcgi_">
821<p>
822<input type="hidden" name="a" value="sqlq">
823<input type="hidden" name="r" value="1">
824<input type="hidden" name="hs" value="1">
825<input type="hidden" name="e" value="_decodedcompressedoptions_">
826_sqlqueryformcontent_
827</p>
828</form>
829<!-- end of sqlquery form -->
830}
831
832
833_ifeellucky_ { <br><input type="checkbox" name="ifl" value="1">_textifeellucky_ }
834_useifeellucky_ { }  # Set this to _ifeellucky_ if you want this functionality available
835
836_allowformbreak_{</span>  <span class="textselect">}
837
838_queryformcontent_{
839<span class="textselect">
840_textselect_
841</span>
842
843<span class="querybox">
844_If_(_cgiargqb_,_largequerybox_,_smallquerybox_)
845_useifeellucky_
846</span>
847}
848
849
850_sqlqueryformcontent_ {
851<span class="querybox">
852_If_(_cgiargqb_,_query:largequerybox_,_query:smallquerybox_)
853_query:useifeellucky_
854</span>
855}
856
857# Automatically set by receptionist if config file switches
858# date searching on
859_optdatesearch_ { }
860
861
862_datesearch_
863{<table><tr><td>
864    <center>
865_textstartdate_
866<input type="text" name="ds" value="_cgiargds_" size="4" maxlength="4">
867<select name="dsbc" value="_cgiargdsbc_" size="1">
868    <option value="0"_If_(_cgiargdsbc_,, selected)>_textad_
869    <option value="1"_If_(_cgiargdsbc_, selected)>_textbc_
870</select>
871_textenddate_
872<input type="text" name="de" value="_cgiargde_" size="4" maxlength="4"> 
873<select name="debc" size="1">
874    <option value="0" _If_(_cgiargdebc_,, selected)>_textad_
875    <option value="1" _If_(_cgiargdebc_, selected)>_textbc_
876</select>
877</center>     
878</td></tr>
879<tr><td>
880_textexplaineras_
881</td></tr>
882</table>
883</center>
884}
885
886_smallquerybox_ {<nobr><input type="text" name="q" value="_cgiargq_" size="50">&nbsp;<input type="submit" value="_textbeginsearch_"></nobr>}
887
888_largequerybox_ {
889<tr><td><textarea name="q" cols="63" rows="10">
890_cgiargq_
891</textarea></td></tr>
892<tr align="right"><td><table>
893<tr><td><input type="submit" value="_textbeginsearch_"></td>
894</tr></table></td></tr>}
895
896
897_fieldqueryform_ {
898<noscript>
899<p><b>_textnojsformwarning_</b></p>
900</noscript>
901<!-- field query form (\_query:fieldqueryform\_) -->
902<form name="QueryForm" method="get" action="_gwcgi_">
903
904<table><tr><td align="left">
905
906_textformselect_
907</td></tr>
908<tr><td>
909_If_(_cgiargb_,_advancedforms_,_simpleforms_)
910</td></tr>
911</table>
912_If_(_cgiargb_,<div class="divbar">&nbsp;</div>
913_advancedformextra_)
914
915</form>
916<!-- end of query form -->
917}
918
919_sqlfieldqueryform_ {
920<noscript>
921<p><b>_textnojsformwarning_</b></p>
922</noscript>
923<!--sql  field query form (\_query:fieldqueryform\_) -->
924<form name="QueryForm" method="get" action="_gwcgi_">
925
926<table><tr><td align="left">
927_textformselect_
928</td></tr>
929<tr><td>
930_If_(_cgiargb_,_sqladvancedforms_,_sqlsimpleforms_)
931</td></tr>
932</table>
933_If_(_cgiargb_,<div class="divbar">&nbsp;</div>
934_advancedformextra_)
935
936</form>
937<!-- end of sql query form -->
938}
939
940_stemcaseheader_ {
941_If_("_cgiargct_" eq "1",_If_("_cgiargks_" eq "1",<th align="center" style="font-size:smaller;">_textformcasefold_</th>)
942_If_("_cgiargafs_" eq "1",<th align="center" style="font-size:smaller;">_textformaccentfold_</th>)_If_("_cgiargss_" eq "1",<th align="center" style="font-size:smaller;">_textformstem_</th>)
943
944}
945_advancedforms_{
946<table border="0" cellspacing="0" cellpadding="0" width="90%">
947<tr><th></th><th align="left">_textwordphrase_</th>_stemcaseheader_<th align="center">&nbsp;&nbsp;_textinfield_</th></tr>  
948_advformlist_
949<tr>
950<td colspan="2" align="left"><input type="button" value="_textclearform_" onClick="clearForm();"></td>
951<td colspan="3" align="right"><input type="button" value="_textbeginsearch_" onClick="beginSearch();"></td>
952</tr>
953</table>
954}
955
956_sqladvancedforms_{
957<table border="0" cellspacing="0" cellpadding="0" width="90%">
958    _sqladvformlist_
959  <tr>
960    <td colspan="2" align="left">
961      <input type="button" value="_textclearform_" onClick="clearForm();">
962    </td>
963    <td colspan="3" align="right">
964      <input type="button" value="_textbeginsearch_" onClick="beginSearch();">
965    </td>
966  </tr>
967</table>
968}
969
970
971
972_advancedformextra_{
973<table>
974<tr><td align="left">_textadvquery_</td></tr>
975<tr><td><textarea name="q" cols="57" rows="3" onChange="updateq();">_cgiargq_</textarea></td>
976<td valign="bottom">
977<input type="button" value="_textrunquery_" onClick="runQuery();"></td></tr>
978</table>
979
980
981_If_("_cgiarga_" eq "sqlq",
982<p>For example:<br>
983<i>
984  element in (\'dc.Keywords\') AND value=\'Farming\'<br>
985  element in (\'dls.Title\') AND value LIKE \'F%\'<br>
986  element in (\'dls.Title\') AND value<\'F%\'<br>
987</i>
988)
989
990}
991
992_simpleforms_{
993<table border="0" cellspacing="0" cellpadding="0" width="90%">
994<tr><th align="left">_textwordphrase_</th><th align="left">&nbsp;&nbsp;_textinfield_</th></tr> 
995_regformlist_
996<tr>
997<td align="left"><input type="button" value="_textclearform_" onClick="clearForm();"></td>
998<td align="right"><input type="button" value="_textbeginsearch_" onClick="beginSearch();"></td>
999</tr>
1000</table>}
1001
1002_sqlsimpleforms_{
1003<table border="0" cellspacing="0" cellpadding="0" width="90%">
1004    _sqlregformlist_
1005  <tr>
1006    <td align="left">
1007      <input type="button" value="_textclearform_" onClick="clearForm();">
1008    </td>
1009    <td align="right">
1010      <input type="button" value="_textbeginsearch_" onClick="beginSearch();">
1011    </td>
1012  </tr>
1013</table>
1014}
1015
1016#
1017# Full-text versions
1018#
1019
1020_stemcaseboxes_ {
1021_If_("_cgiargks_" eq "1",<td align="center"><input type="checkbox" name="fqk" onClick="updatefqk();"></td>)
1022_If_("_cgiargafs_" eq "1",<td align="center"><input type="checkbox" name="fqaf" onClick="updatefqaf();"></td>)
1023_If_("_cgiargss_" eq "1",<td align="center"><input type="checkbox" name="fqs" onClick="updatefqs();"></td>)
1024}
1025_regformelement_{
1026<tr><td><input type="text" size="39" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);"></td>
1027<td>_fqfselection_</td></tr>}
1028
1029#has no and/or/not selection box
1030_firstadvformelement_{
1031<tr><td></td><td><input type="text" size="31" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);"></td>
1032_stemcaseboxes_
1033<td align="right">_fqfselection_</td></tr>}
1034
1035_advformelement_{
1036<tr><td>_fqcselection_</td>
1037<td><input type="text" size="31" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);"></td>
1038_stemcaseboxes_
1039<td align="right">_fqfselection_</td></tr>}
1040
1041
1042
1043_fqcselection_ {
1044<select name="fqc" onChange="updatefqc();">
1045<option value="and">_textand_
1046<option value="or">_textor_
1047<option value="not">_textandnot_
1048</select>}
1049
1050
1051_andorfqcselection_ {
1052<select name="fqc" onChange="updatefqc();">
1053<option value="and">_textand_
1054<option value="or">_textor_
1055</select>}
1056
1057
1058#
1059# SQL versions of regformelement, firstsqladvformelement, advformelement
1060#
1061
1062_sqlregformelement_{
1063<tr>
1064  <td>
1065    _sqlfqfselection_
1066  </td>
1067  <td>
1068    _sqlfqcselection_
1069  </td>
1070  <td>
1071    <input type="text" size="39" name="fqv" onChange="updatefqv();"
1072           onkeypress="updatefqv(); entersubmit(event);">
1073  </td>
1074</tr>
1075}
1076
1077_firstsqladvformelement_{
1078<tr>
1079  <td>
1080  </td>
1081  <td align="right">
1082    _sqlfqfselection_
1083  </td>
1084  <td>
1085    _sqlfqcselection_
1086  </td>
1087  <td>
1088    <input type="text" size="31" name="fqv" onChange="updatefqv();"
1089           onkeypress="updatefqv(); entersubmit(event);">
1090  </td>
1091</tr>
1092}
1093
1094_sqladvformelement_{
1095<tr>
1096  <td>
1097    _andorfqcselection_
1098  </td>
1099  <td align="right">
1100    _sqlfqfselection_
1101  </td>
1102  <td>
1103    _sqlfqcselection_
1104  </td>
1105  <td>
1106    <input type="text" size="31" name="fqv" onChange="updatefqv();" onkeypress="updatefqv(); entersubmit(event);">
1107  </td>
1108</tr>
1109}
1110
1111
1112_sqlfqcselection_ {
1113<select name="sqlfqc" onChange="updatesqlfqc();">
1114  <option value="=">matches
1115  <option value="&lt;">&lt;
1116  <option value="&lt;=">&lt;=
1117  <option value="LIKE">like
1118  <option value="&gt;=">&gt;=
1119  <option value="&gt;">&gt;
1120  <option value="&lt;&gt;">&lt;&gt;
1121
1122</select>}
1123
1124#
1125# end of SQL version
1126#
1127
1128_textselect_ {_If_(_cgiargb_,_chooseadvancedsearch_,_choosesimplesearch_)}
1129
1130_choosesimplesearch_ {_If_("_cgiargqt_" eq "2",_textsimplesqlsearch_,_textsimplesearch_)}
1131
1132_chooseadvancedsearch_ {_If_("_cgiarqt_" eq "2",_textadvancedsqlsearch_,_chooseadvancedsearchct_)}
1133_chooseadvancedsearchct_ {_If_(_cgiargct_,_If_("_cgiargct_" eq "2",_textadvancedlucenesearch_,_textadvancedmgppsearch_),_textadvancedsearch_}
1134
1135# formed based versions
1136_textformselect_ {_If_(_cgiargb_,_chooseformadvancedsearch_,_chooseformsimplesearch_)}
1137_chooseformsimplesearch_ {_If_("_cgiargqt_" eq "2",_textformsimplesearchsql_,_textformsimplesearch_)}
1138
1139_chooseformadvancedsearch_ {_If_("_cgiargqt_" eq "2",_textformadvancedsearchsql_,_chooseformadvancedsearchct_)}
1140_chooseformadvancedsearchct_ {_If_("_cgiargct_" eq "1",_textformadvancedsearchmgpp_)_If_("_cgiargct_" eq "2",_textformadvancedsearchlucene_)}
1141
1142# mg uses hselection for index, mgpp uses fqfselection
1143_indexselection_{_If_(_cgiargct_,_fqfselection_,_hselection_)}
1144
1145# we want to put the links to previous/next pages of results
1146# in the footer
1147_pagefooterextra_ {
1148<center>
1149<table cellspacing="0" cellpadding="0" width="_pagewidth_">
1150<tr>
1151<td align="left">_If_(_prevfirst_,<a href="_httpquery_&amp;r=_prevfirst_">_iconprev__textmatches__prevfirst_ - _prevlast_</a>)</td>
1152<td align="right">_If_(_nextfirst_,<a href="_httpquery_&amp;r=_nextfirst_">_textmatches__nextfirst_ - _nextlast__iconnext_</a>)</td>
1153</tr></table>
1154</center>
1155
1156</div> <!-- document -->
1157}
1158
1159_querytypeselection_ {
1160<select name="t">
1161<option value="1"_If_(_cgiargt_, selected)>_If_(_cgiargb_,_textranked_,_textsome_)
1162<option value="0"_If_(_cgiargt_,, selected)>_If_(_cgiargb_,_textboolean_,_textall_)
1163</select>
1164}
1165
1166_sortorderselection_ {
1167<select name="so">
1168<option value="0"_If_(_cgiargso_,, selected)>_textascending_
1169<option value="1"_If_(_cgiargso_, selected)>_textdescending_
1170</select>
1171}
1172_formquerytypesimpleselection_ {
1173<select name="t">
1174<option value="1"_If_(_cgiargt_, selected)>_textsome_
1175<option value="0"_If_(_cgiargt_,, selected)>_textall_
1176</select>
1177}
1178
1179_formquerytypeadvancedselection_ {
1180<select name="t">
1181<option value="1"_If_(_cgiargt_, selected)>_textranked_
1182<option value="0"_If_(_cgiargt_,, selected)>_textnatural_
1183</select>
1184}
1185
1186# 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.
1187_formquerytypeselection_ {
1188<select name="t">
1189<option value="1"_If_(_cgiargt_, selected)>_If_(_cgiargb_,_textranked_,_textsome_)
1190<option value="0"_If_(_cgiargt_,, selected)>_If_(_cgiargb_,_textnatural_,_textall_)
1191</select>
1192}
1193
Note: See TracBrowser for help on using the browser.