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

Last change on this file since 3775 was 3775, checked in by sjboddie, 21 years ago

Added "title" attributes to img tags so that modern browsers display
tooltips as intended (previously we relied on the "alt" attribute which
doesn't display tooltips for netscape6/mozilla etc.).

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