source: main/tags/2.62/gsdl/macros/pref.dm@ 32110

Last change on this file since 32110 was 10660, checked in by kjdon, 19 years ago

fixed a bug where query form type wasn't updating unless set prefs was clicked

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 14.7 KB
Line 
1# this file must be UTF-8 encoded
2
3package preferences
4
5# set within server
6
7# collectionoption is only set when cross-collection searching is turned on
8_collectionoption_ {}
9
10# this macro will be set to "1" when the "source docs retrived from dl/web
11# button is required - i.e. whenever PreferenceDocsFromWeb isn't set to false
12# in collect.cfg
13_PreferenceDocsFromWeb_ {}
14
15# this macro will be set to _textprefschanged_ when the "set preferences"
16# button has been pressed
17_prefschanged_ {}
18
19#######################################################################
20# java images/scripts
21#######################################################################
22
23# the _javalinks_ macros are the flashy image links at the top right of
24# the page. this is overridden here as we don't want a 'preferences'
25# link on this page
26
27_javalinks_ {_imagehome_ _imagehelp_}
28_javalinks_ [v=1] {
29_imagehome_<br>
30_imagehelp_<br>
31}
32
33
34#######################################################################
35# scripts
36# note that changing either the "m" or the "o" argument
37# from the preferences page necessitates reseting the "r"
38# argument to 1
39#######################################################################
40
41_ccsfunctions_ {argcc = "";
42savedccs = new Object();
43
44function initialize () \{
45 for (i = 0; i < document.links.length; i++)
46 savedhrefs[i] = document.links[i].href;
47
48 s = "_cgiargcc_";
49 a = s.split (",");
50 for (i = 0; i < a.length ;i++) \{
51 for (j = 0; j < document.PrefForm.cc.length; j++) \{
52 if (a[i] == document.PrefForm.elements["cc"][j].value) \{
53 document.PrefForm.elements["cc"][j].checked = true;
54 savedccs[a[i]] = 1;
55 argcc = argcc + "&cc=" + a[i];
56 break;
57 \} else \{
58 savedccs[a[i]] = 0;
59 \}
60 \}
61 \}
62 updatehrefs();
63\}
64
65function updatecc (collection) \{
66 if (savedccs[collection] == 1) savedccs[collection] = 0;
67 else savedccs[collection] = 1;
68
69 var i;
70 argcc = "";
71 var changed = 0;
72 for (i in savedccs)
73 if (savedccs[i] == 1) \{
74 argcc += "&cc=" + i;
75 changed = 1;
76 \}
77 if (changed == 1) argcc += "&r=1";
78 updatehrefs();
79\}
80}
81
82_standardfunctions_ {
83function initialize () \{
84 for (i = 0; i < document.links.length; i++)
85 savedhrefs[i] = document.links[i].href;
86
87\}
88
89}
90
91_getargsfunction_ {
92function getargs () \{
93 return argk + args + argm + argo + argrd + arghd + argb + argqf + argqb + argfqn_If_(_collectionoption_,_ccsargs_)_If_(_htmloptions_,_htmlargs_);
94\}
95}
96
97_ccsargs_ {+ argcc}
98_htmlargs_ {+ argel + argil + argfc + arghl}
99
100_htmlfunctions_ {argel = "";
101argil = "";
102argfc = "";
103arghl = "";
104
105function updateel () \{
106 value = document.PrefForm.el.options[document.PrefForm.el.selectedIndex].value;
107 if (value != "_cgiargel_") argel = "&el=" + value;
108 else argel = "";
109 updatehrefs();
110\}
111
112function updateil () \{
113 value = document.PrefForm.il.options[document.PrefForm.il.selectedIndex].value;
114 if (value != "_cgiargil_") argil = "&il=" + value;
115 else argil = "";
116 updatehrefs();
117\}
118
119function updatefc(value) \{
120 if (value != _cgiargfc_) argfc = "&fc=" + value + "&f=" + value;
121 else argfc = "";
122 updatehrefs();
123\}
124
125function updatehl(value) \{
126 if (value != _cgiarghl_) arghl = "&hl=" + value;
127 else arghl = "";
128 updatehrefs();
129\}
130}
131
132_pagescriptextra_ {
133// preferences scripts generated from \_preferences:pagescriptextra\_
134
135savedhrefs = new Object();
136
137argk = "";
138args = "";
139argm = "";
140argrd = "";
141argo = "";
142argb = "";
143argqf = "";
144arghd = "";
145argqb = "";
146argfqn = "";
147
148_If_(_collectionoption_,_ccsfunctions_,_standardfunctions_)
149_If_(_htmloptions_,_htmlfunctions_)
150_getargsfunction_
151function updatehrefs () \{
152 for (i = 0; i < document.links.length; i++)
153 document.links[i].href = savedhrefs[i] + getargs();
154\}
155
156function updatek (value) \{
157 if (value != _cgiargk_) argk = "&k=" + value;
158 else argk = "";
159 updatehrefs();
160\}
161
162function updates (value) \{
163 if (value != _cgiargs_) args = "&s=" + value;
164 else args = "";
165 updatehrefs();
166\}
167
168function updatem () \{
169 value = document.PrefForm.m.options[document.PrefForm.m.selectedIndex].value;
170 if (value != _cgiargm_) argm = "&r=1&m=" + value;
171 else argm = "";
172 updatehrefs();
173\}
174
175function updaterd () \{
176 if (document.PrefForm.rd.checked)
177 _If_("_cgiargrd_" eq "1",argrd="";,argrd="&rd=1";)
178 else
179 _If_("_cgiargrd_" ne "1",argrd="";,argrd="&rd=0";)
180 updatehrefs();
181\}
182
183function updateo () \{
184 value = document.PrefForm.o.options[document.PrefForm.o.selectedIndex].value;
185 if (value != _cgiargo_) argo = "&r=1&o=" + value;
186 else argo = "";
187 updatehrefs();
188\}
189
190function updatefqn () \{
191 value = document.PrefForm.fqn.options[document.PrefForm.fqn.selectedIndex].value;
192 if (value != _cgiargfqn_) argfqn = "&fqn=" + value;
193 else argfqn = "";
194 updatehrefs();
195\}
196
197function updateb (value) \{
198 if (value != _cgiargb_) argb = "&b=" + value;
199 else argb = "";
200 updatehrefs();
201\}
202function updateqf (value) \{
203 if (value != _cgiargqf_) argqf = "&qf=" + value;
204 else argqf = "";
205 updatehrefs();
206\}
207
208function updatehd() \{
209 arghd="";
210 if (document.PrefForm.hd[0].checked) \{
211 if ("_cgiarghd_" != "0") arghd = "&hd=0";
212 \}
213 else \{
214 value = document.PrefForm.hdn[document.PrefForm.hdn.selectedIndex].value;
215 if (_cgiarghd_ != value) arghd = "&hd="+value;
216 \}
217 updatehrefs();
218\}
219
220function updateqb(value) \{
221 if (value != _cgiargqb_) argqb = "&qb=" + value;
222 else argqb = "";
223 updatehrefs();
224\}
225
226function updatel () \{
227 value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
228 href = location.href;
229 if (href.match(/&l=[\\w\\-]+/)) href = href.replace(/&l=[\\w\\-]+/, "&l=" + value);
230 else href += "&l=" + value;
231 if (!location.href.match(/&nl=1$/)) href += "&nl=1";
232 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
233 location.href = href + getargs();
234\}
235
236function updatev () \{
237 value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
238 href = location.href;
239 if (href.match(/&v=\\d/)) href = href.replace(/&v=\\d/, "&v=" + value);
240 else href += "&v=" + value;
241 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
242 location.href = href + getargs();
243\}
244
245function updatew () \{
246 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
247 href = location.href;
248 if (href.match(/&nw=[^&]+/)) href = href.replace(/&nw=[^&]+/, "&nw=" + value);
249 else href += "&nw=" + value;
250 if (!location.href.match(/&nl=0$/)) href += "&nl=0";
251 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
252 location.href = href + getargs();
253\}
254
255function updateqt (value) \{
256 if (value != _cgiargqt_) \{
257 href = location.href;
258 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
259 location.href = href + "&qt=" + value + getargs();
260 \}
261\}
262}
263
264
265#######################################################################
266# headers
267# these are overridden so we can put an onLoad event handler
268# in the <body> tag of this page
269#######################################################################
270
271
272_header_ {_cgihead_
273_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
274}
275
276# this declaration ends up being the same as style=restrict, never mind
277_header_[v=1] {_cgihead_
278_htmlhead_(onLoad="initialize();")_pagebanner_
279}
280
281
282#######################################################################
283# page content
284#######################################################################
285
286_pagetitle_ {_collectionname_: _textpreferences_}
287_imagethispage_ {_iconthispage_}
288
289_htmloptions_ {}
290
291_htmloptionson_ {
292<p>
293<tr>_fcoption_</tr>
294<p>
295<tr>_hloption_</tr>
296<p>
297<tr>_extlinkoption_</tr>
298_If_(_PreferenceDocsFromWeb_,<p>
299<tr>_intlinkoption_</tr>)
300}
301
302_fcoption_ {
303<td valign=baseline>Document page layout</td>
304<td><input type=radio name=fc value=1 onClick="updatefc(1);"
305 _If_(_cgiargfc_, checked)>navigation bar at top<br>
306<input type=radio name=fc value=0 onClick="updatefc(0);"
307 _If_(_cgiargfc_,, checked)>no navigation bar</td>
308}
309
310_hloption_ {
311<td valign=baseline>Search term highlighting</td>
312<td><input type=radio name=hl value=1 onClick="updatehl(1);"
313 _If_(_cgiarghl_, checked)>highlight search terms<br>
314<input type=radio name=hl value=0 onClick="updatehl(0);"
315 _If_(_cgiarghl_,, checked)>don't highlight search terms</td>
316}
317
318#search pref options
319_boxsizeoption_{
320<td valign=baseline>_textqueryboxsize_</td>
321<td><input type=radio name=qb value=0 onClick="updateqb(0);"
322 _If_(_cgiargqb_,, checked)>_textregbox_<br>
323<input type=radio name=qb value=1 onClick="updateqb(1);"
324 _If_(_cgiargqb_, checked)>_textbigbox_</td>
325}
326
327_caseoption_ {
328<td valign=baseline>_textcasediffs_</td>
329<td><input type=radio name=k value=1 onClick="updatek(1);"
330 _If_(_cgiargk_, checked)>_textignorecase_<br>
331<input type=radio name=k value=0 onClick="updatek(0);"
332 _If_(_cgiargk_,, checked)>_textmatchcase_</td>
333}
334
335_caseoption_ [l=ar] {}
336_caseoption_ [l=zh] {}
337
338_stemoption_ {
339<td valign=baseline>_textwordends_</td>
340<td><input type=radio name=s value=1 onClick="updates(1);"
341 _If_(_cgiargs_, checked)>_textstem_<br>
342<input type=radio name=s value=0 onClick="updates(0);"
343 _If_(_cgiargs_,, checked)>_textnostem_</td>
344}
345
346_stemoption_ [l=zh] {}
347
348
349_modeoption_ {
350<td valign=baseline>_textquerymode_</td>
351<td><input type=radio name=b value=0 onClick="updateb(0);"
352 _If_(_cgiargb_,, checked)>_textsimplemode_<br>
353<input type=radio name=b value=1 onClick="updateb(1);"
354 _If_(_cgiargb_, checked)>_textadvancedmode_</td>
355}
356
357_formmodeoption_{
358<td valign=baseline>_textformtype_</td>
359<td><input type=radio name=qf value=0 onClick="updateqf(0);"
360 _If_(_cgiargf_,, checked)>_textsimple_<br>
361<input type=radio name=qf value=1 onClick="updateqf(1);"
362 _If_(_cgiargqf_, checked)>_textadvanced_</td>
363}
364
365_formnumfieldoption_ {<td></td><td>_textwith_
366<select name="fqn" onChange="updatefqn();">
367 <option value="2"_If_("_cgiargfqn_" eq "2", selected)>2
368 <option value="4"_If_("_cgiargfqn_" eq "4", selected)>4
369 <option value="6"_If_("_cgiargfqn_" eq "6", selected)>6
370 <option value="8"_If_("_cgiargfqn_" eq "8", selected)>8
371</select>_textfields_</td>
372}
373
374_searchhistoryop_ {
375<td valign=baseline>_textsearchhistory_</td>
376<td><input type=radio name="hd" value=0 onClick="updatehd();"
377 _If_("_cgiarghd_" eq "0", checked)>_textnohistorydisplay_<br>
378<input type=radio name="hd" value=1 onClick="updatehd();"
379 _If_("_cgiarghd_" eq "0",, checked)>_texthistorydisplay_</td>
380}
381
382_relateddocop_ {
383<td colspan=2><nobr><input type=checkbox name="rd" value=1 onClick="updaterd();" _If_("_cgiargrd_" eq "1", checked)>
384Display related documents</nobr></td>
385}
386
387_historynumrecords_{<select name="hdn" onChange="updatehd();">
388 <option value="5"_If_("_cgiarghd_" eq "5", selected)>5
389 <option value="10"_If_("_cgiarghd_" eq "10", selected)>10
390 <option value="15"_If_("_cgiarghd_" eq "15", selected)>15
391 <option value="20"_If_("_cgiarghd_" eq "20", selected)>20
392</select>}
393
394_maxdocoption_ {
395<select name="m" onChange="updatem();">
396 <option value="50"_If_("_cgiargm_" eq "50", selected)>50
397 <option value="100"_If_("_cgiargm_" eq "100", selected)>100
398 <option value="200"_If_("_cgiargm_" eq "200", selected)>200
399</select>
400}
401
402_hitsperpageoption_ {
403<select name="o" onChange="updateo();">
404 <option value="10"_If_("_cgiargo_" eq "10", selected)>10
405 <option value="20"_If_("_cgiargo_" eq "20", selected)>20
406 <option value="50"_If_("_cgiargo_" eq "50", selected)>50
407 <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
408</select>
409}
410
411_extlinkoption_ {
412<td>_textextlink_</td>
413<td><select name="el" onChange="updateel();">
414 <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
415 _textlinkinterm_
416 <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
417 _textlinkdirect_
418</select></td>
419}
420
421_intlinkoption_ {
422<td>_textintlink_</td>
423<td><select name="il" onChange="updateil();">
424 <option value="l"_If_("_cgiargil_" eq "l", selected)>
425 _textdigitlib_
426 <option value="w"_If_("_cgiargil_" eq "w", selected)>
427 _textweb_
428</select></td>
429}
430
431# set from within pageaction
432_languageoption_ {}
433_encodingoption_ {}
434
435_formatoption_ {
436<td>_textformat_</td>
437<td><select name="v" onChange="updatev();">
438 <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
439 <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
440</select></td>
441}
442
443_content_ {
444<center>
445_optnavigationbar_
446</center>
447_If_(_prefschanged_,<p>_prefschanged_<br><center>_iconblankbar_</center>)
448
449<blockquote>
450
451<form name=PrefForm method=get action="_gwcgi_">
452
453<input type="hidden" name="e" value="_decodedcompressedoptions_">
454_If_(_collectionoption_,_collectionprefs_)
455_presentationprefs_
456_searchprefs_
457</blockquote>
458</form>
459}
460
461#search prefs
462_searchprefs_ {
463<center><table border=0 cellpadding=0 cellspacing=0 width=_pagewidth_><tr>
464<td><h3>_textsearchprefs_</h3></td>
465<td align=right><input type=submit name="bp" value="_textsetprefs_"></td>
466</tr></table></center>
467
468<table>
469_querytypedependantoptions_
470
471<tr>_caseoption_</tr>
472
473<tr>_stemoption_</tr>
474
475<tr>_searchhistoryop_</tr>
476
477<!--
478Don't include this for now
479<tr>_relateddocop_</tr>
480-->
481
482<tr><td colspan=2>_textprefop_</td></tr>
483</table>
484</blockquote>
485_iconblankbar_
486<blockquote>
487}
488
489_querytypedependantoptions_ {
490_If_("_cgiargct_" eq "0", _plainqueryoptions_,_mgppqueryoptions_)
491}
492
493_mgppqueryoptions_{
494 _If_("_cgiargqto_" eq "1", _plainqueryoptions_)
495 _If_("_cgiargqto_" eq "2", _formqueryoptions_)
496 _If_("_cgiargqto_" eq "3", _dualqueryoptions_)
497}
498
499#query options for mg colls and mgpp colls with only plain searching
500_plainqueryoptions_ {
501<tr>_modeoption_</tr>
502
503<tr>_boxsizeoption_</tr>
504}
505
506#query options for mgpp colls with only form searching
507_formqueryoptions_ {
508<noscript><tr><td colspan=2><b>_query:textnojsformwarning_</b></td></tr></noscript>
509<tr>_formmodeoption_</tr>
510<tr>_formnumfieldoption_</tr>
511}
512
513#query options for mgpp colls with both types of search available
514_dualqueryoptions_ {
515<tr><td colspan=2><input type=radio name=qt value=0 onClick="updateqt(0);" _If_(_cgiargqt_,, checked)>_textplainsearch_</td></tr>
516<tr><td></td><td><table>_plainqueryoptions_</table></td></tr>
517<tr><td colspan=2><input type=radio name=qt value=1 onClick="updateqt(1);" _If_(_cgiargqt_,checked)>_textformsearch_</td></tr>
518<tr><td></td><td><table>_formqueryoptions_</table></td></tr>
519}
520
521_collectionprefs_ {
522<h3>_textcollectionprefs_</h3>
523_collectionoption_
524</blockquote>
525_iconblankbar_
526<blockquote>
527}
528
529_presentationprefs_ {
530<h3>_textpresentationprefs_</h3>
531<table>_htmloptions_
532
533_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
534
535_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
536
537<tr>_formatoption_</tr></table>
538</blockquote>
539_iconblankbar_
540<blockquote>
541}
542
543
544#######################################################################
545# icons
546#######################################################################
547
548_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" title="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
Note: See TracBrowser for help on using the repository browser.