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

Last change on this file since 4787 was 4782, checked in by kjdon, 21 years ago

made some text into macros, and added a warning to teh form search options to be added if there is no javascript

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