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

Last change on this file since 7032 was 5482, checked in by mdewsnip, 21 years ago

The "l" (language code) argument now updates correctly when set to longer language codes (such as pt-pt or pt-br).

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 14.4 KB
RevLine 
[128]1package preferences
2
[876]3# set within server
[128]4
[876]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
[2415]13# this macro will be set to _textprefschanged_ when the "set preferences"
14# button has been pressed
15_prefschanged_ {}
[876]16
[148]17#######################################################################
[283]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
[548]25_javalinks_ {_imagehome__imagehelp_}
26_javalinks_ [v=1] {
[283]27_imagehome_<br>
28_imagehelp_<br>
29}
30
31
32#######################################################################
[276]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
[876]39_ccsfunctions_ {argcc = "";
40savedccs = new Object();
[276]41
[876]42function initialize () \{
43 for (i = 0; i < document.links.length; i++)
44 savedhrefs[i] = document.links[i].href;
[276]45
[876]46 s = "_cgiargcc_";
47 a = s.split (",");
[1950]48 for (i = 0; i < a.length ;i++) \{
[876]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\}
[276]62
[876]63function updatecc (collection) \{
64 if (savedccs[collection] == 1) savedccs[collection] = 0;
65 else savedccs[collection] = 1;
[1950]66
[876]67 var i;
68 argcc = "";
[1717]69 var changed = 0;
[876]70 for (i in savedccs)
[1950]71 if (savedccs[i] == 1) \{
72 argcc += "&cc=" + i;
73 changed = 1;
74 \}
[1717]75 if (changed == 1) argcc += "&r=1";
[876]76 updatehrefs();
77\}
78}
[276]79
[876]80_standardfunctions_ {
81function initialize () \{
82 for (i = 0; i < document.links.length; i++)
83 savedhrefs[i] = document.links[i].href;
[4763]84
[876]85\}
[4763]86
[876]87}
[276]88
[876]89_getargsfunction_ {
90function getargs () \{
[4763]91 return argk + args + argm + argo + argrd + arghd + argb + argqf + argqb + argfqn_If_(_collectionoption_,_ccsargs_)_If_(_htmloptions_,_htmlargs_);
[876]92\}
93}
[276]94
[876]95_ccsargs_ {+ argcc}
96_htmlargs_ {+ argel + argil + argfc + arghl}
[276]97
[876]98_htmlfunctions_ {argel = "";
99argil = "";
100argfc = "";
101arghl = "";
[276]102
[876]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\}
[276]109
[876]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\}
[548]116
[2496]117function updatefc(value) \{
118 if (value != _cgiargfc_) argfc = "&fc=" + value + "&f=" + value;
119 else argfc = "";
[876]120 updatehrefs();
121\}
[725]122
[2496]123function updatehl(value) \{
124 if (value != _cgiarghl_) arghl = "&hl=" + value;
125 else arghl = "";
[876]126 updatehrefs();
127\}
128}
[725]129
[876]130_pagescriptextra_ {
131// preferences scripts generated from \_preferences:pagescriptextra\_
[591]132
[876]133savedhrefs = new Object();
134
135argk = "";
136args = "";
137argm = "";
[1950]138argrd = "";
[876]139argo = "";
140argb = "";
[4763]141argqf = "";
[942]142arghd = "";
[1922]143argqb = "";
144argfqn = "";
145
[901]146_If_(_collectionoption_,_ccsfunctions_,_standardfunctions_)
[876]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
[1950]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
[876]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
[1950]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
[876]195function updateb (value) \{
196 if (value != _cgiargb_) argb = "&b=" + value;
197 else argb = "";
198 updatehrefs();
199\}
[4763]200function updateqf (value) \{
201 if (value != _cgiargqf_) argqf = "&qf=" + value;
202 else argqf = "";
203 updatehrefs();
204\}
[876]205
[1922]206function updatehd() \{
[1950]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\}
[1946]217
218function updateqb(value) \{
[1950]219 if (value != _cgiargqb_) argqb = "&qb=" + value;
220 else argqb = "";
[1922]221 updatehrefs();
222\}
223
[876]224function updatel () \{
225 value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
[2265]226 href = location.href;
[5482]227 if (href.match(/&l=[\\w\\-]+/)) href = href.replace(/&l=[\\w\\-]+/, "&l=" + value);
[2265]228 else href += "&l=" + value;
229 if (!location.href.match(/&nl=1$/)) href += "&nl=1";
230 location.href = href + getargs();
[876]231\}
232
233function updatev () \{
234 value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
[2265]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();
[876]239\}
240
241function updatew () \{
242 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
[2265]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();
[876]248\}
[1922]249
[4763]250function updateqt (value) \{
251 if (value != _cgiargqt_) location.href = location.href + "&qt=" + value + getargs();
[1950]252\}
[276]253}
254
[1950]255
[276]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
[548]268_header_[v=1] {_cgihead_
[276]269_htmlhead_(onLoad="initialize();")_pagebanner_
270}
271
272
273#######################################################################
[148]274# page content
275#######################################################################
[128]276
[148]277_pagetitle_ {_collectionname_: _textpreferences_}
278_imagethispage_ {_iconthispage_}
279
[876]280_htmloptions_ {}
281
282_htmloptionson_ {
283<p>
[2496]284<tr>_fcoption_</tr>
[876]285<p>
[2496]286<tr>_hloption_</tr>
[876]287<p>
[1922]288<tr>_extlinkoption_</tr>
[876]289_If_(_PreferenceDocsFromWeb_,<p>
[1922]290<tr>_intlinkoption_</tr>)
[876]291}
292
293_fcoption_ {
[2496]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>
[876]299}
300
301_hloption_ {
[2496]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>
[876]307}
308
[1950]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] {}
[666]327_caseoption_ [l=zh] {}
328
[128]329_stemoption_ {
[1950]330<td valign=baseline>_textwordends_</td>
331<td><input type=radio name=s value=1 onClick="updates(1);"
[876]332 _If_(_cgiargs_, checked)>_textstem_<br>
[591]333<input type=radio name=s value=0 onClick="updates(0);"
[1922]334 _If_(_cgiargs_,, checked)>_textnostem_</td>
[128]335}
336
[666]337_stemoption_ [l=zh] {}
338
[1950]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
[4763]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}
[1950]355
[4763]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
[1950]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_ {
[2106]374<td colspan=2><nobr><input type=checkbox name="rd" value=1 onClick="updaterd();" _If_("_cgiargrd_" eq "1", checked)>
[1950]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
[128]385_maxdocoption_ {
[591]386<select name="m" onChange="updatem();">
[180]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
[128]390</select>
391}
392
393_hitsperpageoption_ {
[591]394<select name="o" onChange="updateo();">
[180]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
[876]398 <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
[128]399</select>
400}
401
[725]402_extlinkoption_ {
[1922]403<td>_textextlink_</td>
[1950]404<td><select name="el" onChange="updateel();">
[725]405 <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
[876]406 _textlinkinterm_
[725]407 <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
[876]408 _textlinkdirect_
[1922]409</select></td>
[725]410}
411
412_intlinkoption_ {
[1922]413<td>_textintlink_</td>
[1950]414<td><select name="il" onChange="updateil();">
[725]415 <option value="l"_If_("_cgiargil_" eq "l", selected)>
[876]416 _textdigitlib_
[725]417 <option value="w"_If_("_cgiargil_" eq "w", selected)>
[876]418 _textweb_
[1922]419</select></td>
[725]420}
421
[1950]422# set from within pageaction
[876]423_languageoption_ {}
[1856]424_encodingoption_ {}
[725]425
[276]426_formatoption_ {
[1922]427<td>_textformat_</td>
[1950]428<td><select name="v" onChange="updatev();">
[644]429 <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
430 <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
[1922]431</select></td>
[276]432}
433
[128]434_content_ {
[276]435<center>
436_navigationbar_
437</center>
[2415]438_If_(_prefschanged_,<p>_prefschanged_<br><center>_iconblankbar_</center>)
[1950]439
[128]440<blockquote>
441
442<form name=PrefForm method=get action="_gwcgi_">
443
[876]444<input type="hidden" name="e" value="_decodedcompressedoptions_">
[128]445
[876]446_If_(_collectionoption_,_collectionprefs_)
447_presentationprefs_
[4763]448_searchprefs_
[876]449</blockquote>
450</form>
451}
452
[4763]453#search prefs
454_searchprefs_ {
[2424]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
[1950]460<table>
[4763]461_querytypedependantoptions_
[128]462
[1950]463<tr>_caseoption_</tr>
[128]464
[1950]465<tr>_stemoption_</tr>
[548]466
[1950]467<tr>_searchhistoryop_</tr>
[1922]468
[2299]469<!--
470Don't include this for now
[1950]471<tr>_relateddocop_</tr>
[2299]472-->
[1950]473
474<tr><td colspan=2>_textprefop_</td></tr>
475</table>
476</blockquote>
477_iconblankbar_
478<blockquote>
[876]479}
[725]480
[4763]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_ {
[4782]500<noscript><tr><td colspan=2><b>_query:textnojsformwarning_</b></td></tr></noscript>
[4763]501<tr>_formmodeoption_</tr>
502<tr>_formnumfieldoption_</tr>
503}
504
505#query options for mgpp colls with both types of search available
506_dualqueryoptions_ {
[4782]507<tr><td colspan=2><input type=radio name=qt value=0 onClick="updateqt(0);" _If_(_cgiargqt_,, checked)>_textplainsearch_</td></tr>
[4763]508<tr><td></td><td><table>_plainqueryoptions_</table></td></tr>
[4782]509<tr><td colspan=2><input type=radio name=qt value=1 onClick="updateqt(1);" _If_(_cgiargqt_,checked)>_textformsearch_</td></tr>
[4763]510<tr><td></td><td><table>_formqueryoptions_</table></td></tr>
511}
512
[876]513_collectionprefs_ {
514<h3>_textcollectionprefs_</h3>
515_collectionoption_
[1950]516</blockquote>
517_iconblankbar_
518<blockquote>
[876]519}
[725]520
[876]521_presentationprefs_ {
522<h3>_textpresentationprefs_</h3>
[1950]523<table>_htmloptions_
[876]524
[1950]525_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
[276]526
[1950]527_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
[591]528
[1950]529<tr>_formatoption_</tr></table>
530</blockquote>
531_iconblankbar_
532<blockquote>
[128]533}
[148]534
[1922]535
[1950]536#######################################################################
537# icons
538#######################################################################
539
[3775]540_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" title="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
Note: See TracBrowser for help on using the repository browser.