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

Last change on this file since 4542 was 4199, checked in by kjdon, 21 years ago

added form search option to cross coll search prefs

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 14.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# 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 // only add form search option if mgpp (ct arg) and javascript
47_If_("_cgiargct_" eq "1",var opt=new Option\("_textformsearch_"\, "1"\); document.PrefForm.qt.options[1]=opt;,//)_If_("_cgiargqt_" eq "1",opt.selected=1;)
48
49 s = "_cgiargcc_";
50 a = s.split (",");
51 for (i = 0; i < a.length ;i++) \{
52 for (j = 0; j < document.PrefForm.cc.length; j++) \{
53 if (a[i] == document.PrefForm.elements["cc"][j].value) \{
54 document.PrefForm.elements["cc"][j].checked = true;
55 savedccs[a[i]] = 1;
56 argcc = argcc + "&cc=" + a[i];
57 break;
58 \} else \{
59 savedccs[a[i]] = 0;
60 \}
61 \}
62 \}
63 updatehrefs();
64\}
65
66function updatecc (collection) \{
67 if (savedccs[collection] == 1) savedccs[collection] = 0;
68 else savedccs[collection] = 1;
69
70 var i;
71 argcc = "";
72 var changed = 0;
73 for (i in savedccs)
74 if (savedccs[i] == 1) \{
75 argcc += "&cc=" + i;
76 changed = 1;
77 \}
78 if (changed == 1) argcc += "&r=1";
79 updatehrefs();
80\}
81}
82
83_standardfunctions_ {
84function initialize () \{
85 for (i = 0; i < document.links.length; i++)
86 savedhrefs[i] = document.links[i].href;
87 // only add form search option if mgpp (ct arg) and javascript
88_If_("_cgiargct_" eq "1",var opt=new Option\("_textformsearch_"\, "1"\); document.PrefForm.qt.options[1]=opt;,//)_If_("_cgiargqt_" eq "1",opt.selected=1;)
89\}
90}
91
92_getargsfunction_ {
93function getargs () \{
94 return argk + args + argm + argo + argrd + arghd + argb + argqb + argfqn_If_(_collectionoption_,_ccsargs_)_If_(_htmloptions_,_htmlargs_);
95\}
96}
97
98_ccsargs_ {+ argcc}
99_htmlargs_ {+ argel + argil + argfc + arghl}
100
101_htmlfunctions_ {argel = "";
102argil = "";
103argfc = "";
104arghl = "";
105
106function updateel () \{
107 value = document.PrefForm.el.options[document.PrefForm.el.selectedIndex].value;
108 if (value != "_cgiargel_") argel = "&el=" + value;
109 else argel = "";
110 updatehrefs();
111\}
112
113function updateil () \{
114 value = document.PrefForm.il.options[document.PrefForm.il.selectedIndex].value;
115 if (value != "_cgiargil_") argil = "&il=" + value;
116 else argil = "";
117 updatehrefs();
118\}
119
120function updatefc(value) \{
121 if (value != _cgiargfc_) argfc = "&fc=" + value + "&f=" + value;
122 else argfc = "";
123 updatehrefs();
124\}
125
126function updatehl(value) \{
127 if (value != _cgiarghl_) arghl = "&hl=" + value;
128 else arghl = "";
129 updatehrefs();
130\}
131}
132
133_pagescriptextra_ {
134// preferences scripts generated from \_preferences:pagescriptextra\_
135
136savedhrefs = new Object();
137
138argk = "";
139args = "";
140argm = "";
141argrd = "";
142argo = "";
143argb = "";
144arghd = "";
145argqb = "";
146argfqn = "";
147
148_If_(_collectionoption_,_ccsfunctions_,_standardfunctions_)
149_If_(_htmloptions_,_htmlfunctions_)
150_getargsfunction_
151function updatehrefs () \{
152 for (i = 0; i < document.links.length; i++)
153 document.links[i].href = savedhrefs[i] + getargs();
154\}
155
156function updatek (value) \{
157 if (value != _cgiargk_) argk = "&k=" + value;
158 else argk = "";
159 updatehrefs();
160\}
161
162function updates (value) \{
163 if (value != _cgiargs_) args = "&s=" + value;
164 else args = "";
165 updatehrefs();
166\}
167
168function updatem () \{
169 value = document.PrefForm.m.options[document.PrefForm.m.selectedIndex].value;
170 if (value != _cgiargm_) argm = "&r=1&m=" + value;
171 else argm = "";
172 updatehrefs();
173\}
174
175function updaterd () \{
176 if (document.PrefForm.rd.checked)
177 _If_("_cgiargrd_" eq "1",argrd="";,argrd="&rd=1";)
178 else
179 _If_("_cgiargrd_" ne "1",argrd="";,argrd="&rd=0";)
180 updatehrefs();
181\}
182
183function updateo () \{
184 value = document.PrefForm.o.options[document.PrefForm.o.selectedIndex].value;
185 if (value != _cgiargo_) argo = "&r=1&o=" + value;
186 else argo = "";
187 updatehrefs();
188\}
189
190function updatefqn () \{
191 value = document.PrefForm.fqn.options[document.PrefForm.fqn.selectedIndex].value;
192 if (value != _cgiargfqn_) argfqn = "&fqn=" + value;
193 else argfqn = "";
194 updatehrefs();
195\}
196
197function updateb (value) \{
198 if (value != _cgiargb_) argb = "&b=" + value;
199 else argb = "";
200 updatehrefs();
201\}
202
203function updatehd() \{
204 arghd="";
205 if (document.PrefForm.hd[0].checked) \{
206 if ("_cgiarghd_" != "0") arghd = "&hd=0";
207 \}
208 else \{
209 value = document.PrefForm.hdn[document.PrefForm.hdn.selectedIndex].value;
210 if (_cgiarghd_ != value) arghd = "&hd="+value;
211 \}
212 updatehrefs();
213\}
214
215function updateqb(value) \{
216 if (value != _cgiargqb_) argqb = "&qb=" + value;
217 else argqb = "";
218 updatehrefs();
219\}
220
221function updatel () \{
222 value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
223 href = location.href;
224 if (href.match(/&l=\\w\\w/)) href = href.replace(/&l=\\w\\w/, "&l=" + value);
225 else href += "&l=" + value;
226 if (!location.href.match(/&nl=1$/)) href += "&nl=1";
227 location.href = href + getargs();
228\}
229
230function updatev () \{
231 value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
232 href = location.href;
233 if (href.match(/&v=\\d/)) href = href.replace(/&v=\\d/, "&v=" + value);
234 else href += "&v=" + value;
235 location.href = href + getargs();
236\}
237
238function updatew () \{
239 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
240 href = location.href;
241 if (href.match(/&nw=[^&]+/)) href = href.replace(/&nw=[^&]+/, "&nw=" + value);
242 else href += "&nw=" + value;
243 if (!location.href.match(/&nl=0$/)) href += "&nl=0";
244 location.href = href + getargs();
245\}
246
247function updateqt () \{
248 value = document.PrefForm.qt.options[document.PrefForm.qt.selectedIndex].value;
249 location.href = location.href + "&qt=" + value + getargs();
250\}
251}
252
253
254#######################################################################
255# headers
256# these are overridden so we can put an onLoad event handler
257# in the <body> tag of this page
258#######################################################################
259
260
261_header_ {_cgihead_
262_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
263}
264
265# this declaration ends up being the same as style=restrict, never mind
266_header_[v=1] {_cgihead_
267_htmlhead_(onLoad="initialize();")_pagebanner_
268}
269
270
271#######################################################################
272# page content
273#######################################################################
274
275_pagetitle_ {_collectionname_: _textpreferences_}
276_imagethispage_ {_iconthispage_}
277
278_htmloptions_ {}
279
280_htmloptionson_ {
281<p>
282<tr>_fcoption_</tr>
283<p>
284<tr>_hloption_</tr>
285<p>
286<tr>_extlinkoption_</tr>
287_If_(_PreferenceDocsFromWeb_,<p>
288<tr>_intlinkoption_</tr>)
289}
290
291_fcoption_ {
292<td valign=baseline>Document page layout</td>
293<td><input type=radio name=fc value=1 onClick="updatefc(1);"
294 _If_(_cgiargfc_, checked)>navigation bar at top<br>
295<input type=radio name=fc value=0 onClick="updatefc(0);"
296 _If_(_cgiargfc_,, checked)>no navigation bar</td>
297}
298
299_hloption_ {
300<td valign=baseline>Search term highlighting</td>
301<td><input type=radio name=hl value=1 onClick="updatehl(1);"
302 _If_(_cgiarghl_, checked)>highlight search terms<br>
303<input type=radio name=hl value=0 onClick="updatehl(0);"
304 _If_(_cgiarghl_,, checked)>don't highlight search terms</td>
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_If_(_prefschanged_,<p>_prefschanged_<br><center>_iconblankbar_</center>)
421
422<blockquote>
423
424<form name=PrefForm method=get action="_gwcgi_">
425
426<input type="hidden" name="e" value="_decodedcompressedoptions_">
427
428_If_(_collectionoption_,_collectionprefs_)
429_presentationprefs_
430_If_("_cgiargct_" eq "1",_mgppsearchprefs_,_mgsearchprefs_)
431
432</blockquote>
433</form>
434}
435
436#search prefs for mg collections
437_mgsearchprefs_ {
438<center><table border=0 cellpadding=0 cellspacing=0 width=_pagewidth_><tr>
439<td><h3>_textsearchprefs_</h3></td>
440<td align=right><input type=submit name="bp" value="_textsetprefs_"></td>
441</tr></table></center>
442
443<table>
444<tr>_boxsizeoption_</tr>
445
446<tr>_caseoption_</tr>
447
448<tr>_stemoption_</tr>
449
450<tr>_modeoption_</tr>
451
452<tr>_searchhistoryop_</tr>
453
454<!--
455Don't include this for now
456<tr>_relateddocop_</tr>
457-->
458
459<tr><td colspan=2>_textprefop_</td></tr>
460</table>
461</blockquote>
462_iconblankbar_
463<blockquote>
464}
465
466_collectionprefs_ {
467<h3>_textcollectionprefs_</h3>
468_collectionoption_
469</blockquote>
470_iconblankbar_
471<blockquote>
472}
473
474_presentationprefs_ {
475<h3>_textpresentationprefs_</h3>
476<table>_htmloptions_
477
478_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
479
480_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
481
482<tr>_formatoption_</tr></table>
483</blockquote>
484_iconblankbar_
485<blockquote>
486}
487
488#######################################################
489## new stuff for prefs for form vs text search - for mgpp collections
490_mgppsearchprefs_ {
491<h3>_textsearchprefs_</h3>
492<table>
493<tr>_searchtypeop_</tr>
494
495_If_(_cgiargqt_,_formsearchoptions_,_textsearchoptions_)
496
497<tr>_caseoption_</tr>
498
499<tr>_stemoption_</tr>
500
501<tr>_searchhistoryop_</tr>
502
503<tr><td colspan=2>_textprefop_</td></tr></table>
504<input type=submit value="Update settings"><!--non-javascript users only-->
505</blockquote>
506_iconblankbar_
507<blockquote>
508}
509
510
511_searchtypeop_ {
512<td>_texttypesearch_</td>
513<td><select name="qt" onChange="updateqt();">
514 <option value="0"_If_("_cgiargqt_" eq "0", selected)>_texttextsearch_
515<!-- textformsearch option done in initialize function -->
516</select></td>
517}
518
519_formsearchoptions_ {
520<tr>_formmodeoption_</tr>
521}
522
523_textsearchoptions_ {
524<tr>_boxsizeoption_</tr>
525<tr>_modeoption_</tr>
526}
527
528_formmodeoption_{
529<td valign=baseline>_textformtype_</td>
530<td><input type=radio name=b value=0 onClick="updateb(0);"
531 _If_(_cgiargb_,, checked)>_textsimple_<br>
532<input type=radio name=b value=1 onClick="updateb(1);"
533 _If_(_cgiargb_, checked)>_textadvanced_<br>
534_formnumoption_</td>
535}
536
537_formnumoption_ {_textwith_
538<select name="fqn" onChange="updatefqn();">
539 <option value="2"_If_("_cgiargfqn_" eq "2", selected)>2
540 <option value="4"_If_("_cgiargfqn_" eq "4", selected)>4
541 <option value="6"_If_("_cgiargfqn_" eq "6", selected)>6
542 <option value="8"_If_("_cgiargfqn_" eq "8", selected)>8
543</select>_textfields_</td>
544}
545
546
547#######################################################################
548# icons
549#######################################################################
550
551_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" title="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
Note: See TracBrowser for help on using the repository browser.