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

Last change on this file since 12789 was 12779, checked in by kjdon, 18 years ago

hide stem adn casefolding prefs for lucene collections

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 13.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# 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 + argqb + argfqn + argqt_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 = "";
136arghd = "";
137argqb = "";
138argfqn = "";
139argqt= "";
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 updateqt (value) \{
184 if (value != _cgiargqt_) argqt = "&qt=" + value;
185 else argqt = "";
186 updatehrefs();
187\}
188
189function updatefqn () \{
190 value = document.PrefForm.fqn.options[document.PrefForm.fqn.selectedIndex].value;
191 if (value != _cgiargfqn_) argfqn = "&fqn=" + value;
192 else argfqn = "";
193 updatehrefs();
194\}
195
196function updateb (value) \{
197 if (value != _cgiargb_) argb = "&b=" + value;
198 else argb = "";
199 updatehrefs();
200\}
201
202function updatehd() \{
203 arghd="";
204 if (document.PrefForm.hd[0].checked) \{
205 if ("_cgiarghd_" != "0") arghd = "&hd=0";
206 \}
207 else \{
208 value = document.PrefForm.hdn[document.PrefForm.hdn.selectedIndex].value;
209 if (_cgiarghd_ != value) arghd = "&hd="+value;
210 \}
211 updatehrefs();
212\}
213
214
215function updateqb() \{
216
217 value = document.PrefForm.qb.options[document.PrefForm.qb.selectedIndex].value;
218 if (value != _cgiargqb_) argqb = "&qb=" + value;
219 else argqb = "";
220 updatehrefs();
221\}
222
223function updatel () \{
224 value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
225 href = location.href;
226 if (href.match(/&l=[\\w\\-]+/)) href = href.replace(/&l=[\\w\\-]+/, "&l=" + value);
227 else href += "&l=" + value;
228 if (!location.href.match(/&nl=1$/)) href += "&nl=1";
229 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
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 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
239 location.href = href + getargs();
240\}
241
242function updatew () \{
243 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
244 href = location.href;
245 if (href.match(/&nw=[^&]+/)) href = href.replace(/&nw=[^&]+/, "&nw=" + value);
246 else href += "&nw=" + value;
247 if (!location.href.match(/&nl=0$/)) href += "&nl=0";
248 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
249 location.href = href + getargs();
250\}
251
252}
253
254
255#######################################################################
256# headers
257# these are overridden so we can put an onLoad event handler
258# in the <body> tag of this page
259#######################################################################
260
261
262_header_ {_cgihead_
263_htmlhead_(class="bgimage" onLoad="initialize();")_startspacer__pagebanner_
264}
265
266# this declaration ends up being the same as style=restrict, never mind
267_header_[v=1] {_cgihead_
268_htmlhead_(onLoad="initialize();")_pagebanner_
269}
270
271
272#######################################################################
273# page content
274#######################################################################
275
276_pagetitle_ {_collectionname_: _textpreferences_}
277_imagethispage_ {_textpreferences_}
278
279_htmloptions_ {}
280
281_htmloptionson_ {
282<p>
283<tr>_fcoption_</tr>
284<p>
285<tr>_hloption_</tr>
286<p>
287<tr>_extlinkoption_</tr>
288_If_(_PreferenceDocsFromWeb_,<p>
289<tr>_intlinkoption_</tr>)
290}
291
292_fcoption_ {
293<td valign=baseline>Document page layout</td>
294<td><input type=radio name=fc value=1 onClick="updatefc(1);"
295 _If_(_cgiargfc_, checked)>navigation bar at top<br>
296<input type=radio name=fc value=0 onClick="updatefc(0);"
297 _If_(_cgiargfc_,, checked)>no navigation bar</td>
298}
299
300_hloption_ {
301<td valign=baseline>Search term highlighting</td>
302<td><input type=radio name=hl value=1 onClick="updatehl(1);"
303 _If_(_cgiarghl_, checked)>highlight search terms<br>
304<input type=radio name=hl value=0 onClick="updatehl(0);"
305 _If_(_cgiarghl_,, checked)>don't highlight search terms</td>
306}
307
308#search pref options
309
310
311# search type option
312_searchtypeoptionplain_ {
313<td valign=baseline>_textsearchtype_</td>
314<td>_textplainsearchtype_</td>
315}
316_searchtypeoptionform_ {
317<td valign=baseline>_textsearchtype_</td>
318<td>_textformsearchtype_</td>
319}
320_searchtypeoptionboth_ {
321<td valign=baseline>_textsearchtype_</td>
322<td><input type=radio name=qt value=0 onClick="updateqt(0);"
323 _If_(_cgiargqt_,, checked)>_textplainsearchtype_<br>
324<input type=radio name=qt value=1 onClick="updateqt(1);"
325 _If_(_cgiargqt_, checked)>_textformsearchtype_</td>
326}
327
328_boxsizeoption_{
329<select name="qb" onChange="updateqb();">
330 <option value="0"_If_("_cgiargqb_" eq "0", selected)>_textregularbox_
331 <option value="1"_If_("_cgiargqb_" eq "1", selected)>_textlargebox_
332</select>
333}
334
335_formnumfieldoption_ {
336<select name="fqn" onChange="updatefqn();">
337 <option value="2"_If_("_cgiargfqn_" eq "2", selected)>2
338 <option value="4"_If_("_cgiargfqn_" eq "4", selected)>4
339 <option value="6"_If_("_cgiargfqn_" eq "6", selected)>6
340 <option value="8"_If_("_cgiargfqn_" eq "8", selected)>8
341</select>
342}
343
344_modeoption_ {
345<td valign=baseline>_textquerymode_</td>
346<td><input type=radio name=b value=0 onClick="updateb(0);"
347 _If_(_cgiargb_,, checked)>_textsimplemode_<br>
348<input type=radio name=b value=1 onClick="updateb(1);"
349 _If_(_cgiargb_, checked)>_textadvancedmode_</td>
350}
351
352_caseoption_ {
353<td valign=baseline>_textcasediffs_</td>
354<td><input type=radio name=k value=1 onClick="updatek(1);"
355 _If_(_cgiargk_, checked)>_textignorecase_<br>
356<input type=radio name=k value=0 onClick="updatek(0);"
357 _If_(_cgiargk_,, checked)>_textmatchcase_</td>
358}
359
360_caseoption_ [l=ar] {}
361_caseoption_ [l=zh] {}
362
363_stemoption_ {
364<td valign=baseline>_textwordends_</td>
365<td><input type=radio name=s value=1 onClick="updates(1);"
366 _If_(_cgiargs_, checked)>_textstem_<br>
367<input type=radio name=s value=0 onClick="updates(0);"
368 _If_(_cgiargs_,, checked)>_textnostem_</td>
369}
370
371_stemoption_ [l=zh] {}
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_optnavigationbar_
445
446_If_(_prefschanged_,<p>_prefschanged_<br><div class="divbar">&nbsp;</div>)
447
448<blockquote>
449
450<form name=PrefForm method=get action="_gwcgi_">
451<input type="hidden" name="e" value="_compressedoptions_">
452_If_(_collectionoption_,_collectionprefs_)
453_presentationprefs_
454_searchprefs_
455</blockquote>
456</form>
457}
458
459#search prefs
460_searchprefs_ {
461<table border=0 cellpadding=0 cellspacing=0 width=_pagewidth_><tr>
462<td><h3>_textsearchprefs_</h3></td>
463<td align=right><input type=submit name="bp" value="_textsetprefs_"></td>
464</tr></table>
465
466<table>
467<tr>_querytypedependantoptions_</tr>
468
469<tr>_modeoption_</tr>
470_If_("_cgiargct_" eq "2",,
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<div class="divbar">&nbsp;</div>
486<blockquote>
487}
488
489_querytypedependantoptions_ {
490_If_("_cgiargct_" eq "0",_searchtypeoptionplain_,_mgppqueryoptions_)
491}
492_mgppqueryoptions_ {
493_If_("_cgiargqto_" eq "1", _searchtypeoptionplain_)
494_If_("_cgiargqto_" eq "2", _searchtypeoptionform_)
495_If_("_cgiargqto_" eq "3", _searchtypeoptionboth_)
496}
497
498# should this go somewhere??
499#<noscript><tr><td colspan=2><b>_query:textnojsformwarning_</b></td></tr></noscript>
500
501_collectionprefs_ {
502<h3>_textcollectionprefs_</h3>
503_collectionoption_
504</blockquote>
505<div class="divbar">&nbsp;</div>
506<blockquote>
507}
508
509_presentationprefs_ {
510<h3>_textpresentationprefs_</h3>
511<table>_htmloptions_
512
513_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
514
515_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
516
517<tr>_formatoption_</tr></table>
518</blockquote>
519<div class="divbar">&nbsp;</div>
520<blockquote>
521}
522
Note: See TracBrowser for help on using the repository browser.