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

Last change on this file since 2299 was 2299, checked in by sjboddie, 23 years ago

Removed a bunch of _width_ macros from language macro files as they're
no longer used.

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