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

Last change on this file since 1922 was 1922, checked in by kjm18, 23 years ago

added javascript functions and macros for mgpp form search prefs. Prefs page
has been revamped.

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