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

Last change on this file since 2114 was 2114, checked in by jrm21, 23 years ago

The "form query" option for mgpp is now only a valid option if the
browser is using javascript. (The option gets added in the "initialize"
function.)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 13.6 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 location.href = location.href + "&nl=1&l=" + value + getargs();
230\}
231
232function updatev () \{
233 value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
234 location.href = location.href + "&v=" + value + getargs();
235\}
236
237function updatew () \{
238 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
239 location.href = location.href + "&nl=0&nw=" + value + getargs();
240\}
241
242function updateqt () \{
243 value = document.PrefForm.qt.options[document.PrefForm.qt.selectedIndex].value;
244 location.href = location.href + "&qt=" + value + getargs();
245\}
246}
247
248
249#######################################################################
250# headers
251# these are overridden so we can put an onLoad event handler
252# in the <body> tag of this page
253#######################################################################
254
255
256_header_ {_cgihead_
257_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
258}
259
260# this declaration ends up being the same as style=restrict, never mind
261_header_[v=1] {_cgihead_
262_htmlhead_(onLoad="initialize();")_pagebanner_
263}
264
265
266#######################################################################
267# page content
268#######################################################################
269
270_pagetitle_ {_collectionname_: _textpreferences_}
271_imagethispage_ {_iconthispage_}
272
273_htmloptions_ {}
274
275_htmloptionson_ {
276<p>
277<tr><td colspan=2>_fcoption_</td></tr>
278<p>
279<tr><td colspan=2>_hloption_</td></tr>
280<p>
281<tr>_extlinkoption_</tr>
282_If_(_PreferenceDocsFromWeb_,<p>
283<tr>_intlinkoption_</tr>)
284}
285
286_fcoption_ {
287<input type=checkbox name=fc onClick="updatefc();"_If_("_cgiargfc_" eq "1", checked)>
288_textfcoption_
289}
290
291_hloption_ {
292<input type=checkbox name=hl onClick="updatehl();"_If_("_cgiarghl_" eq "1", checked)>
293_texthloption_
294}
295
296#search pref options
297_boxsizeoption_{
298<td valign=baseline>_textqueryboxsize_</td>
299<td><input type=radio name=qb value=0 onClick="updateqb(0);"
300 _If_(_cgiargqb_,, checked)>_textregbox_<br>
301<input type=radio name=qb value=1 onClick="updateqb(1);"
302 _If_(_cgiargqb_, checked)>_textbigbox_</td>
303}
304
305_caseoption_ {
306<td valign=baseline>_textcasediffs_</td>
307<td><input type=radio name=k value=1 onClick="updatek(1);"
308 _If_(_cgiargk_, checked)>_textignorecase_<br>
309<input type=radio name=k value=0 onClick="updatek(0);"
310 _If_(_cgiargk_,, checked)>_textmatchcase_</td>
311}
312
313_caseoption_ [l=ar] {}
314_caseoption_ [l=zh] {}
315
316_stemoption_ {
317<td valign=baseline>_textwordends_</td>
318<td><input type=radio name=s value=1 onClick="updates(1);"
319 _If_(_cgiargs_, checked)>_textstem_<br>
320<input type=radio name=s value=0 onClick="updates(0);"
321 _If_(_cgiargs_,, checked)>_textnostem_</td>
322}
323
324_stemoption_ [l=zh] {}
325
326
327_modeoption_ {
328<td valign=baseline>_textquerymode_</td>
329<td><input type=radio name=b value=0 onClick="updateb(0);"
330 _If_(_cgiargb_,, checked)>_textsimplemode_<br>
331<input type=radio name=b value=1 onClick="updateb(1);"
332 _If_(_cgiargb_, checked)>_textadvancedmode_</td>
333}
334
335
336_searchhistoryop_ {
337<td valign=baseline>_textsearchhistory_</td>
338<td><input type=radio name="hd" value=0 onClick="updatehd();"
339 _If_("_cgiarghd_" eq "0", checked)>_textnohistorydisplay_<br>
340<input type=radio name="hd" value=1 onClick="updatehd();"
341 _If_("_cgiarghd_" eq "0",, checked)>_texthistorydisplay_</td>
342}
343
344_relateddocop_ {
345<td colspan=2><nobr><input type=checkbox name="rd" value=1 onClick="updaterd();" _If_("_cgiargrd_" eq "1", checked)>
346Display related documents</nobr></td>
347}
348
349_historynumrecords_{<select name="hdn" onChange="updatehd();">
350 <option value="5"_If_("_cgiarghd_" eq "5", selected)>5
351 <option value="10"_If_("_cgiarghd_" eq "10", selected)>10
352 <option value="15"_If_("_cgiarghd_" eq "15", selected)>15
353 <option value="20"_If_("_cgiarghd_" eq "20", selected)>20
354</select>}
355
356_maxdocoption_ {
357<select name="m" onChange="updatem();">
358 <option value="50"_If_("_cgiargm_" eq "50", selected)>50
359 <option value="100"_If_("_cgiargm_" eq "100", selected)>100
360 <option value="200"_If_("_cgiargm_" eq "200", selected)>200
361</select>
362}
363
364_hitsperpageoption_ {
365<select name="o" onChange="updateo();">
366 <option value="10"_If_("_cgiargo_" eq "10", selected)>10
367 <option value="20"_If_("_cgiargo_" eq "20", selected)>20
368 <option value="50"_If_("_cgiargo_" eq "50", selected)>50
369 <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
370</select>
371}
372
373_extlinkoption_ {
374<td>_textextlink_</td>
375<td><select name="el" onChange="updateel();">
376 <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
377 _textlinkinterm_
378 <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
379 _textlinkdirect_
380</select></td>
381}
382
383_intlinkoption_ {
384<td>_textintlink_</td>
385<td><select name="il" onChange="updateil();">
386 <option value="l"_If_("_cgiargil_" eq "l", selected)>
387 _textdigitlib_
388 <option value="w"_If_("_cgiargil_" eq "w", selected)>
389 _textweb_
390</select></td>
391}
392
393# set from within pageaction
394_languageoption_ {}
395_encodingoption_ {}
396
397_formatoption_ {
398<td>_textformat_</td>
399<td><select name="v" onChange="updatev();">
400 <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
401 <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
402</select></td>
403}
404
405_content_ {
406<center>
407_navigationbar_
408</center>
409
410<blockquote>
411
412<form name=PrefForm method=get action="_gwcgi_">
413
414<input type="hidden" name="e" value="_decodedcompressedoptions_">
415
416_If_(_collectionoption_,_collectionprefs_)
417_presentationprefs_
418_If_("_cgiargct_" eq "1",_mgppsearchprefs_,_mgsearchprefs_)
419
420</blockquote>
421</form>
422}
423
424#search prefs for mg collections
425_mgsearchprefs_ {
426<h3>_textsearchprefs_</h3>
427<table>
428<tr>_boxsizeoption_</tr>
429
430<tr>_caseoption_</tr>
431
432<tr>_stemoption_</tr>
433
434<tr>_modeoption_</tr>
435
436<tr>_searchhistoryop_</tr>
437
438<tr>_relateddocop_</tr>
439
440<tr><td colspan=2>_textprefop_</td></tr>
441</table>
442<input type=submit value="Update settings"><!--non-javascript users only-->
443</blockquote>
444_iconblankbar_
445<blockquote>
446}
447
448_collectionprefs_ {
449<h3>_textcollectionprefs_</h3>
450_collectionoption_
451</blockquote>
452_iconblankbar_
453<blockquote>
454}
455
456_presentationprefs_ {
457<h3>_textpresentationprefs_</h3>
458<table>_htmloptions_
459
460_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
461
462_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
463
464<tr>_formatoption_</tr></table>
465</blockquote>
466_iconblankbar_
467<blockquote>
468}
469
470#######################################################
471## new stuff for prefs for form vs text search - for mgpp collections
472_mgppsearchprefs_ {
473<h3>_textsearchprefs_</h3>
474<table>
475<tr>_searchtypeop_</tr>
476
477_If_(_cgiargqt_,_formsearchoptions_,_textsearchoptions_)
478
479<tr>_caseoption_</tr>
480
481<tr>_stemoption_</tr>
482
483<tr>_searchhistoryop_</tr>
484
485<tr><td colspan=2>_textprefop_</td></tr></table>
486<input type=submit value="Update settings"><!--non-javascript users only-->
487</blockquote>
488_iconblankbar_
489<blockquote>
490}
491
492
493_searchtypeop_ {
494<td>_texttypesearch_</td>
495<td><select name="qt" onChange="updateqt();">
496 <option value="0"_If_("_cgiargqt_" eq "0", selected)>_texttextsearch_
497<!-- textformsearch option done in initialize function -->
498</select></td>
499}
500
501_formsearchoptions_ {
502<tr>_formmodeoption_</tr>
503}
504
505_textsearchoptions_ {
506<tr>_boxsizeoption_</tr>
507<tr>_modeoption_</tr>
508}
509
510_formmodeoption_{
511<td valign=baseline>_textformtype_</td>
512<td><input type=radio name=b value=0 onClick="updateb(0);"
513 _If_(_cgiargb_,, checked)>_textsimple_<br>
514<input type=radio name=b value=1 onClick="updateb(1);"
515 _If_(_cgiargb_, checked)>_textadvanced_<br>
516_formnumoption_</td>
517}
518
519_formnumoption_ {_textwith_
520<select name="fqn" onChange="updatefqn();">
521 <option value="2"_If_("_cgiargfqn_" eq "2", selected)>2
522 <option value="4"_If_("_cgiargfqn_" eq "4", selected)>4
523 <option value="6"_If_("_cgiargfqn_" eq "6", selected)>6
524 <option value="8"_If_("_cgiargfqn_" eq "8", selected)>8
525</select>_textfields_</td>
526}
527
528
529#######################################################################
530# icons
531#######################################################################
532
533_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
Note: See TracBrowser for help on using the repository browser.