source: trunk/gsdl/macros/pref.dm@ 8206

Last change on this file since 8206 was 8108, checked in by mdewsnip, 20 years ago

Added spaces to separate the top_nav_buttons (in _javalinks_).

  • 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 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
258 location.href = location.href + "&qt=" + value + getargs();
259 \}
260\}
261}
262
263
264#######################################################################
265# headers
266# these are overridden so we can put an onLoad event handler
267# in the <body> tag of this page
268#######################################################################
269
270
271_header_ {_cgihead_
272_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
273}
274
275# this declaration ends up being the same as style=restrict, never mind
276_header_[v=1] {_cgihead_
277_htmlhead_(onLoad="initialize();")_pagebanner_
278}
279
280
281#######################################################################
282# page content
283#######################################################################
284
285_pagetitle_ {_collectionname_: _textpreferences_}
286_imagethispage_ {_iconthispage_}
287
288_htmloptions_ {}
289
290_htmloptionson_ {
291<p>
292<tr>_fcoption_</tr>
293<p>
294<tr>_hloption_</tr>
295<p>
296<tr>_extlinkoption_</tr>
297_If_(_PreferenceDocsFromWeb_,<p>
298<tr>_intlinkoption_</tr>)
299}
300
301_fcoption_ {
302<td valign=baseline>Document page layout</td>
303<td><input type=radio name=fc value=1 onClick="updatefc(1);"
304 _If_(_cgiargfc_, checked)>navigation bar at top<br>
305<input type=radio name=fc value=0 onClick="updatefc(0);"
306 _If_(_cgiargfc_,, checked)>no navigation bar</td>
307}
308
309_hloption_ {
310<td valign=baseline>Search term highlighting</td>
311<td><input type=radio name=hl value=1 onClick="updatehl(1);"
312 _If_(_cgiarghl_, checked)>highlight search terms<br>
313<input type=radio name=hl value=0 onClick="updatehl(0);"
314 _If_(_cgiarghl_,, checked)>don't highlight search terms</td>
315}
316
317#search pref options
318_boxsizeoption_{
319<td valign=baseline>_textqueryboxsize_</td>
320<td><input type=radio name=qb value=0 onClick="updateqb(0);"
321 _If_(_cgiargqb_,, checked)>_textregbox_<br>
322<input type=radio name=qb value=1 onClick="updateqb(1);"
323 _If_(_cgiargqb_, checked)>_textbigbox_</td>
324}
325
326_caseoption_ {
327<td valign=baseline>_textcasediffs_</td>
328<td><input type=radio name=k value=1 onClick="updatek(1);"
329 _If_(_cgiargk_, checked)>_textignorecase_<br>
330<input type=radio name=k value=0 onClick="updatek(0);"
331 _If_(_cgiargk_,, checked)>_textmatchcase_</td>
332}
333
334_caseoption_ [l=ar] {}
335_caseoption_ [l=zh] {}
336
337_stemoption_ {
338<td valign=baseline>_textwordends_</td>
339<td><input type=radio name=s value=1 onClick="updates(1);"
340 _If_(_cgiargs_, checked)>_textstem_<br>
341<input type=radio name=s value=0 onClick="updates(0);"
342 _If_(_cgiargs_,, checked)>_textnostem_</td>
343}
344
345_stemoption_ [l=zh] {}
346
347
348_modeoption_ {
349<td valign=baseline>_textquerymode_</td>
350<td><input type=radio name=b value=0 onClick="updateb(0);"
351 _If_(_cgiargb_,, checked)>_textsimplemode_<br>
352<input type=radio name=b value=1 onClick="updateb(1);"
353 _If_(_cgiargb_, checked)>_textadvancedmode_</td>
354}
355
356_formmodeoption_{
357<td valign=baseline>_textformtype_</td>
358<td><input type=radio name=qf value=0 onClick="updateqf(0);"
359 _If_(_cgiargf_,, checked)>_textsimple_<br>
360<input type=radio name=qf value=1 onClick="updateqf(1);"
361 _If_(_cgiargqf_, checked)>_textadvanced_</td>
362}
363
364_formnumfieldoption_ {<td></td><td>_textwith_
365<select name="fqn" onChange="updatefqn();">
366 <option value="2"_If_("_cgiargfqn_" eq "2", selected)>2
367 <option value="4"_If_("_cgiargfqn_" eq "4", selected)>4
368 <option value="6"_If_("_cgiargfqn_" eq "6", selected)>6
369 <option value="8"_If_("_cgiargfqn_" eq "8", selected)>8
370</select>_textfields_</td>
371}
372
373_searchhistoryop_ {
374<td valign=baseline>_textsearchhistory_</td>
375<td><input type=radio name="hd" value=0 onClick="updatehd();"
376 _If_("_cgiarghd_" eq "0", checked)>_textnohistorydisplay_<br>
377<input type=radio name="hd" value=1 onClick="updatehd();"
378 _If_("_cgiarghd_" eq "0",, checked)>_texthistorydisplay_</td>
379}
380
381_relateddocop_ {
382<td colspan=2><nobr><input type=checkbox name="rd" value=1 onClick="updaterd();" _If_("_cgiargrd_" eq "1", checked)>
383Display related documents</nobr></td>
384}
385
386_historynumrecords_{<select name="hdn" onChange="updatehd();">
387 <option value="5"_If_("_cgiarghd_" eq "5", selected)>5
388 <option value="10"_If_("_cgiarghd_" eq "10", selected)>10
389 <option value="15"_If_("_cgiarghd_" eq "15", selected)>15
390 <option value="20"_If_("_cgiarghd_" eq "20", selected)>20
391</select>}
392
393_maxdocoption_ {
394<select name="m" onChange="updatem();">
395 <option value="50"_If_("_cgiargm_" eq "50", selected)>50
396 <option value="100"_If_("_cgiargm_" eq "100", selected)>100
397 <option value="200"_If_("_cgiargm_" eq "200", selected)>200
398</select>
399}
400
401_hitsperpageoption_ {
402<select name="o" onChange="updateo();">
403 <option value="10"_If_("_cgiargo_" eq "10", selected)>10
404 <option value="20"_If_("_cgiargo_" eq "20", selected)>20
405 <option value="50"_If_("_cgiargo_" eq "50", selected)>50
406 <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
407</select>
408}
409
410_extlinkoption_ {
411<td>_textextlink_</td>
412<td><select name="el" onChange="updateel();">
413 <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
414 _textlinkinterm_
415 <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
416 _textlinkdirect_
417</select></td>
418}
419
420_intlinkoption_ {
421<td>_textintlink_</td>
422<td><select name="il" onChange="updateil();">
423 <option value="l"_If_("_cgiargil_" eq "l", selected)>
424 _textdigitlib_
425 <option value="w"_If_("_cgiargil_" eq "w", selected)>
426 _textweb_
427</select></td>
428}
429
430# set from within pageaction
431_languageoption_ {}
432_encodingoption_ {}
433
434_formatoption_ {
435<td>_textformat_</td>
436<td><select name="v" onChange="updatev();">
437 <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
438 <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
439</select></td>
440}
441
442_content_ {
443<center>
444_optnavigationbar_
445</center>
446_If_(_prefschanged_,<p>_prefschanged_<br><center>_iconblankbar_</center>)
447
448<blockquote>
449
450<form name=PrefForm method=get action="_gwcgi_">
451
452<input type="hidden" name="e" value="_decodedcompressedoptions_">
453_If_(_collectionoption_,_collectionprefs_)
454_presentationprefs_
455_searchprefs_
456</blockquote>
457</form>
458}
459
460#search prefs
461_searchprefs_ {
462<center><table border=0 cellpadding=0 cellspacing=0 width=_pagewidth_><tr>
463<td><h3>_textsearchprefs_</h3></td>
464<td align=right><input type=submit name="bp" value="_textsetprefs_"></td>
465</tr></table></center>
466
467<table>
468_querytypedependantoptions_
469
470<tr>_caseoption_</tr>
471
472<tr>_stemoption_</tr>
473
474<tr>_searchhistoryop_</tr>
475
476<!--
477Don't include this for now
478<tr>_relateddocop_</tr>
479-->
480
481<tr><td colspan=2>_textprefop_</td></tr>
482</table>
483</blockquote>
484_iconblankbar_
485<blockquote>
486}
487
488_querytypedependantoptions_ {
489_If_("_cgiargct_" eq "0", _plainqueryoptions_,_mgppqueryoptions_)
490}
491
492_mgppqueryoptions_{
493 _If_("_cgiargqto_" eq "1", _plainqueryoptions_)
494 _If_("_cgiargqto_" eq "2", _formqueryoptions_)
495 _If_("_cgiargqto_" eq "3", _dualqueryoptions_)
496}
497
498#query options for mg colls and mgpp colls with only plain searching
499_plainqueryoptions_ {
500<tr>_modeoption_</tr>
501
502<tr>_boxsizeoption_</tr>
503}
504
505#query options for mgpp colls with only form searching
506_formqueryoptions_ {
507<noscript><tr><td colspan=2><b>_query:textnojsformwarning_</b></td></tr></noscript>
508<tr>_formmodeoption_</tr>
509<tr>_formnumfieldoption_</tr>
510}
511
512#query options for mgpp colls with both types of search available
513_dualqueryoptions_ {
514<tr><td colspan=2><input type=radio name=qt value=0 onClick="updateqt(0);" _If_(_cgiargqt_,, checked)>_textplainsearch_</td></tr>
515<tr><td></td><td><table>_plainqueryoptions_</table></td></tr>
516<tr><td colspan=2><input type=radio name=qt value=1 onClick="updateqt(1);" _If_(_cgiargqt_,checked)>_textformsearch_</td></tr>
517<tr><td></td><td><table>_formqueryoptions_</table></td></tr>
518}
519
520_collectionprefs_ {
521<h3>_textcollectionprefs_</h3>
522_collectionoption_
523</blockquote>
524_iconblankbar_
525<blockquote>
526}
527
528_presentationprefs_ {
529<h3>_textpresentationprefs_</h3>
530<table>_htmloptions_
531
532_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
533
534_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
535
536<tr>_formatoption_</tr></table>
537</blockquote>
538_iconblankbar_
539<blockquote>
540}
541
542
543#######################################################################
544# icons
545#######################################################################
546
547_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" title="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
Note: See TracBrowser for help on using the repository browser.