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

Last change on this file since 1212 was 1212, checked in by sjboddie, 24 years ago

Added French and Spanish language selection options to the preferences
page. I really don't like how this is currently implemented (i.e. you
have to recompile the library to do something so simple), it might have
to wait until the new configuration file stuff is done before it's fixed
though.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 10.2 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
14#######################################################################
15# java images/scripts
16#######################################################################
17
18# the _javalinks_ macros are the flashy image links at the top right of
19# the page. this is overridden here as we don't want a 'preferences'
20# link on this page
21
22_javalinks_ {_imagehome__imagehelp_}
23_javalinks_ [v=1] {
24_imagehome_<br>
25_imagehelp_<br>
26}
27
28
29#######################################################################
30# scripts
31# note that changing either the "m" or the "o" argument
32# from the preferences page necessitates reseting the "r"
33# argument to 1
34#######################################################################
35
36_ccsfunctions_ {argcc = "";
37savedccs = new Object();
38
39function initialize () \{
40 for (i = 0; i < document.links.length; i++)
41 savedhrefs[i] = document.links[i].href;
42
43 s = "_cgiargcc_";
44 a = s.split (",");
45 for (i = 0; i < a.length ;i++) \{
46 for (j = 0; j < document.PrefForm.cc.length; j++) \{
47 if (a[i] == document.PrefForm.elements["cc"][j].value) \{
48 document.PrefForm.elements["cc"][j].checked = true;
49 savedccs[a[i]] = 1;
50 argcc = argcc + "&cc=" + a[i];
51 break;
52 \} else \{
53 savedccs[a[i]] = 0;
54 \}
55 \}
56 \}
57 updatehrefs();
58\}
59
60function updatecc (collection) \{
61 if (savedccs[collection] == 1) savedccs[collection] = 0;
62 else savedccs[collection] = 1;
63
64 var i;
65 argcc = "";
66 for (i in savedccs)
67 if (savedccs[i] == 1) argcc += "&cc=" + i;
68 updatehrefs();
69\}
70}
71
72_standardfunctions_ {
73function initialize () \{
74 for (i = 0; i < document.links.length; i++)
75 savedhrefs[i] = document.links[i].href;
76\}
77}
78
79_getargsfunction_ {
80function getargs () \{
81 return argk + args + argm + argo + arghd + argb_If_(_collectionoption_,_ccsargs_)_If_(_htmloptions_,_htmlargs_);
82\}
83}
84
85_ccsargs_ {+ argcc}
86_htmlargs_ {+ argel + argil + argfc + arghl}
87
88_htmlfunctions_ {argel = "";
89argil = "";
90argfc = "";
91arghl = "";
92
93function updateel () \{
94 value = document.PrefForm.el.options[document.PrefForm.el.selectedIndex].value;
95 if (value != "_cgiargel_") argel = "&el=" + value;
96 else argel = "";
97 updatehrefs();
98\}
99
100function updateil () \{
101 value = document.PrefForm.il.options[document.PrefForm.il.selectedIndex].value;
102 if (value != "_cgiargil_") argil = "&il=" + value;
103 else argil = "";
104 updatehrefs();
105\}
106
107function updatefc () \{
108 if (document.PrefForm.fc.checked)
109 _If_("_cgiargfc_" eq "1",_argfcblank_,_argfcon_)
110 else
111 _If_("_cgiargfc_" ne "1",_argfcblank_,_argfcoff_)
112 updatehrefs();
113\}
114
115function updatehl () \{
116 if (document.PrefForm.hl.checked)
117 _If_("_cgiarghl_" eq "1",_arghlblank_,_arghlon_)
118 else
119 _If_("_cgiarghl_" ne "1",_arghlblank_,_arghloff_)
120 updatehrefs();
121\}
122}
123
124_argfcblank_ {argfc = "";}
125_argfcon_ {argfc = "&fc=1&f=1";}
126_argfcoff_ {argfc = "&fc=0&f=0";}
127
128_arghlblank_ {arghl = "";}
129_arghlon_ {arghl = "&hl=1";}
130_arghloff_ {arghl = "&hl=0";}
131
132_arghdblank_ {arghd = "";}
133_arghdon_ {arghd = "&hd=1";}
134_arghdoff_{arghd = "&hd=0";}
135
136_pagescriptextra_ {
137// preferences scripts generated from \_preferences:pagescriptextra\_
138
139savedhrefs = new Object();
140
141argk = "";
142args = "";
143argm = "";
144argo = "";
145argb = "";
146arghd = "";
147_If_(_collectionoption_,_ccsfunctions_,_standardfunctions_)
148_If_(_htmloptions_,_htmlfunctions_)
149_getargsfunction_
150function updatehrefs () \{
151 for (i = 0; i < document.links.length; i++)
152 document.links[i].href = savedhrefs[i] + getargs();
153\}
154
155function updatek (value) \{
156 if (value != _cgiargk_) argk = "&k=" + value;
157 else argk = "";
158 updatehrefs();
159\}
160
161function updates (value) \{
162 if (value != _cgiargs_) args = "&s=" + value;
163 else args = "";
164 updatehrefs();
165\}
166
167function updatem () \{
168 value = document.PrefForm.m.options[document.PrefForm.m.selectedIndex].value;
169 if (value != _cgiargm_) argm = "&r=1&m=" + value;
170 else argm = "";
171 updatehrefs();
172\}
173
174function updateo () \{
175 value = document.PrefForm.o.options[document.PrefForm.o.selectedIndex].value;
176 if (value != _cgiargo_) argo = "&r=1&o=" + value;
177 else argo = "";
178 updatehrefs();
179\}
180
181function updateb (value) \{
182 if (value != _cgiargb_) argb = "&b=" + value;
183 else argb = "";
184 updatehrefs();
185\}
186
187function updatehd () \{
188 if (document.PrefForm.hd.checked)
189 _If_("_cgiarghd_" eq "1",_arghdblank_,_arghdon_)
190 else
191 _If_("_cgiarghd_" ne "1",_arghdblank_,_arghdoff_)
192 updatehrefs();
193\}
194
195function updatel () \{
196 value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
197 location.href = location.href + "&l=" + value + getargs();
198\}
199
200function updatev () \{
201 value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
202 location.href = location.href + "&v=" + value + getargs();
203\}
204
205function updatew () \{
206 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
207 location.href = location.href + "&nw=" + value + getargs();
208\}
209}
210
211#######################################################################
212# headers
213# these are overridden so we can put an onLoad event handler
214# in the <body> tag of this page
215#######################################################################
216
217
218_header_ {_cgihead_
219_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
220}
221
222# this declaration ends up being the same as style=restrict, never mind
223_header_[v=1] {_cgihead_
224_htmlhead_(onLoad="initialize();")_pagebanner_
225}
226
227
228#######################################################################
229# page content
230#######################################################################
231
232_pagetitle_ {_collectionname_: _textpreferences_}
233_imagethispage_ {_iconthispage_}
234
235_htmloptions_ {}
236
237_htmloptionson_ {
238<p>
239_fcoption_
240<p>
241_hloption_
242<p>
243_extlinkoption_
244_If_(_PreferenceDocsFromWeb_,<p>
245_intlinkoption_)
246}
247
248_caseoption_ {
249<input type=radio name=k value=1 onClick="updatek(1);"
250 _If_(_cgiargk_, checked)>_textignorecase_<br>
251<input type=radio name=k value=0 onClick="updatek(0);"
252 _If_(_cgiargk_,, checked)>_textmatchcase_
253}
254
255_caseoption_ [l=ar] {}
256
257_fcoption_ {
258<input type=checkbox name=fc onClick="updatefc();"_If_("_cgiargfc_" eq "1", checked)>
259_textfcoption_
260}
261
262_hloption_ {
263<input type=checkbox name=hl onClick="updatehl();"_If_("_cgiarghl_" eq "1", checked)>
264_texthloption_
265}
266
267_caseoption_ [l=zh] {}
268
269_stemoption_ {
270<input type=radio name=s value=1 onClick="updates(1);"
271 _If_(_cgiargs_, checked)>_textstem_<br>
272<input type=radio name=s value=0 onClick="updates(0);"
273 _If_(_cgiargs_,, checked)>_textnostem_
274}
275
276_stemoption_ [l=zh] {}
277
278_maxdocoption_ {
279<select name="m" onChange="updatem();">
280 <option value="50"_If_("_cgiargm_" eq "50", selected)>50
281 <option value="100"_If_("_cgiargm_" eq "100", selected)>100
282 <option value="200"_If_("_cgiargm_" eq "200", selected)>200
283</select>
284}
285
286_hitsperpageoption_ {
287<select name="o" onChange="updateo();">
288 <option value="10"_If_("_cgiargo_" eq "10", selected)>10
289 <option value="20"_If_("_cgiargo_" eq "20", selected)>20
290 <option value="50"_If_("_cgiargo_" eq "50", selected)>50
291 <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
292</select>
293}
294
295_modeoption_ {
296<input type=radio name=b value=0 onClick="updateb(0);"
297 _If_(_cgiargb_,, checked)>_textsimplemode_<br>
298<input type=radio name=b value=1 onClick="updateb(1);"
299 _If_(_cgiargb_, checked)>_textadvancedmode_
300}
301
302_searchhistoryop_ {
303<input type=checkbox name="hd" onClick="updatehd();"
304 _If_("_cgiarghd_" eq "1", checked)>_texthistorydisplay_
305}
306
307_extlinkoption_ {
308_textextlink_
309<select name="el" onChange="updateel();">
310 <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
311 _textlinkinterm_
312 <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
313 _textlinkdirect_
314</select>
315}
316
317_intlinkoption_ {
318_textintlink_
319<select name="il" onChange="updateil();">
320 <option value="l"_If_("_cgiargil_" eq "l", selected)>
321 _textdigitlib_
322 <option value="w"_If_("_cgiargil_" eq "w", selected)>
323 _textweb_
324</select>
325}
326
327_languageoption_ {}
328
329_enlanguageoption_ {<option value="en"_If_("_cgiargl_",, selected)_If_("_cgiargl_" eq "en", selected)>_textlangeng_}
330_delanguageoption_ {<option value="de"_If_("_cgiargl_" eq "de", selected)>_textlanggerman_}
331_frlanguageoption_ {<option value="fr"_If_("_cgiargl_" eq "fr", selected)>_textlangfrench_}
332_eslanguageoption_ {<option value="es"_If_("_cgiargl_" eq "es", selected)>_textlangspanish_}
333_milanguageoption_ {<option value="mi"_If_("_cgiargl_" eq "mi", selected)>_textlangmaori_}
334_zhlanguageoption_ {<option value="zh"_If_("_cgiargl_" eq "zh", selected)>_textlangchinese_}
335
336_encodingoption_ {
337_textencoding_
338<select name="w" onChange="updatew();">
339 <option value="w" _If_("_cgiargw_" eq "w",selected)>Western (ISO-8859-1)
340 <option value="u" _If_("_cgiargw_" eq "u",selected)>UTF-8
341 <option value="g" _If_("_cgiargw_" eq "g",selected)>GBK
342</select>
343}
344
345_formatoption_ {
346_textformat_
347<select name="v" onChange="updatev();">
348 <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
349 <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
350</select>
351}
352
353_content_ {
354<center>
355_navigationbar_
356</center>
357<blockquote>
358
359<form name=PrefForm method=get action="_gwcgi_">
360
361<input type="hidden" name="e" value="_decodedcompressedoptions_">
362
363_If_(_collectionoption_,_collectionprefs_)
364_presentationprefs_
365_searchprefs_
366
367</blockquote>
368</form>
369}
370
371_searchprefs_ {
372<h3>_textsearchprefs_</h3>
373<p>
374_caseoption_
375
376<p>
377_stemoption_
378
379<p>
380_modeoption_
381
382<p>
383_searchhistoryop_
384
385<p>
386_textprefop_
387<br>_iconblankbar_
388}
389
390_collectionprefs_ {
391<h3>_textcollectionprefs_</h3>
392_collectionoption_
393<br>_iconblankbar_
394}
395
396_presentationprefs_ {
397<h3>_textpresentationprefs_</h3>
398_htmloptions_
399
400<p>
401_languageoption_
402
403<p>
404_encodingoption_
405
406<p>
407_formatoption_
408<br>_iconblankbar_
409}
410
411#######################################################################
412# icons
413#######################################################################
414
415_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
416
417
418
419
420
421
422
423
Note: See TracBrowser for help on using the repository browser.