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

Last change on this file since 11094 was 11094, checked in by jrm21, 18 years ago

move the div tags around the navigation bar into the _optnavigationbar_
macro

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