source: main/tags/2.35/gsdl/macros/pref.dm@ 27368

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

altered preferences page slightly

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