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

Last change on this file since 12764 was 12764, checked in by kjdon, 18 years ago

changed preferences page, in particular search type and query box and num fields stuff

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 13.7 KB
Line 
1# this file must be UTF-8 encoded
2
3package preferences
4
5# set within server
6
7# collectionoption is only set when cross-collection searching is turned on
8_collectionoption_ {}
9
10# this macro will be set to "1" when the "source docs retrived from dl/web
11# button is required - i.e. whenever PreferenceDocsFromWeb isn't set to false
12# in collect.cfg
13_PreferenceDocsFromWeb_ {}
14
15# this macro will be set to _textprefschanged_ when the "set preferences"
16# button has been pressed
17_prefschanged_ {}
18
19#######################################################################
20# global navigation links
21#######################################################################
22
23# this is overridden here as we don't want a 'preferences' link on this page
24
25_globallinks_ {_homelink_ _helplink_}
26
27#######################################################################
28# scripts
29# note that changing either the "m" or the "o" argument
30# from the preferences page necessitates reseting the "r"
31# argument to 1
32#######################################################################
33
34_ccsfunctions_ {argcc = "";
35savedccs = new Object();
36
37function initialize () \{
38 for (i = 0; i < document.links.length; i++)
39 savedhrefs[i] = document.links[i].href;
40
41 s = "_cgiargcc_";
42 a = s.split (",");
43 for (i = 0; i < a.length ;i++) \{
44 for (j = 0; j < document.PrefForm.cc.length; j++) \{
45 if (a[i] == document.PrefForm.elements["cc"][j].value) \{
46 document.PrefForm.elements["cc"][j].checked = true;
47 savedccs[a[i]] = 1;
48 argcc = argcc + "&cc=" + a[i];
49 break;
50 \} else \{
51 savedccs[a[i]] = 0;
52 \}
53 \}
54 \}
55 updatehrefs();
56\}
57
58function updatecc (collection) \{
59 if (savedccs[collection] == 1) savedccs[collection] = 0;
60 else savedccs[collection] = 1;
61
62 var i;
63 argcc = "";
64 var changed = 0;
65 for (i in savedccs)
66 if (savedccs[i] == 1) \{
67 argcc += "&cc=" + i;
68 changed = 1;
69 \}
70 if (changed == 1) argcc += "&r=1";
71 updatehrefs();
72\}
73}
74
75_standardfunctions_ {
76function initialize () \{
77 for (i = 0; i < document.links.length; i++)
78 savedhrefs[i] = document.links[i].href;
79
80\}
81
82}
83
84_getargsfunction_ {
85function getargs () \{
86 return argk + args + argm + argo + argrd + arghd + argb + argqf + argqb + argfqn + argqt_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(value) \{
113 if (value != _cgiargfc_) argfc = "&fc=" + value + "&f=" + value;
114 else argfc = "";
115 updatehrefs();
116\}
117
118function updatehl(value) \{
119 if (value != _cgiarghl_) arghl = "&hl=" + value;
120 else arghl = "";
121 updatehrefs();
122\}
123}
124
125_pagescriptextra_ {
126// preferences scripts generated from \_preferences:pagescriptextra\_
127
128savedhrefs = new Object();
129
130argk = "";
131args = "";
132argm = "";
133argrd = "";
134argo = "";
135argb = "";
136argqf = "";
137arghd = "";
138argqb = "";
139argfqn = "";
140argqt= "";
141
142_If_(_collectionoption_,_ccsfunctions_,_standardfunctions_)
143_If_(_htmloptions_,_htmlfunctions_)
144_getargsfunction_
145function updatehrefs () \{
146 for (i = 0; i < document.links.length; i++)
147 document.links[i].href = savedhrefs[i] + getargs();
148\}
149
150function updatek (value) \{
151 if (value != _cgiargk_) argk = "&k=" + value;
152 else argk = "";
153 updatehrefs();
154\}
155
156function updates (value) \{
157 if (value != _cgiargs_) args = "&s=" + value;
158 else args = "";
159 updatehrefs();
160\}
161
162function updatem () \{
163 value = document.PrefForm.m.options[document.PrefForm.m.selectedIndex].value;
164 if (value != _cgiargm_) argm = "&r=1&m=" + value;
165 else argm = "";
166 updatehrefs();
167\}
168
169function updaterd () \{
170 if (document.PrefForm.rd.checked)
171 _If_("_cgiargrd_" eq "1",argrd="";,argrd="&rd=1";)
172 else
173 _If_("_cgiargrd_" ne "1",argrd="";,argrd="&rd=0";)
174 updatehrefs();
175\}
176
177function updateo () \{
178 value = document.PrefForm.o.options[document.PrefForm.o.selectedIndex].value;
179 if (value != _cgiargo_) argo = "&r=1&o=" + value;
180 else argo = "";
181 updatehrefs();
182\}
183
184function updateqt (value) \{
185 alert ("updateqt");
186 if (value != _cgiargqt_) argqt = "&qt=" + value;
187 else argqt = "";
188 alert ("argqt = "+argqt);
189 updatehrefs();
190\}
191
192function updatefqn () \{
193 value = document.PrefForm.fqn.options[document.PrefForm.fqn.selectedIndex].value;
194 if (value != _cgiargfqn_) argfqn = "&fqn=" + value;
195 else argfqn = "";
196 updatehrefs();
197\}
198
199function updateb (value) \{
200 if (value != _cgiargb_) argb = "&b=" + value;
201 else argb = "";
202 updatehrefs();
203\}
204
205function updatehd() \{
206 arghd="";
207 if (document.PrefForm.hd[0].checked) \{
208 if ("_cgiarghd_" != "0") arghd = "&hd=0";
209 \}
210 else \{
211 value = document.PrefForm.hdn[document.PrefForm.hdn.selectedIndex].value;
212 if (_cgiarghd_ != value) arghd = "&hd="+value;
213 \}
214 updatehrefs();
215\}
216
217
218function updateqb() \{
219
220 value = document.PrefForm.qb.options[document.PrefForm.qb.selectedIndex].value;
221 if (value != _cgiargqb_) argqb = "&qb=" + value;
222 else argqb = "";
223 updatehrefs();
224\}
225
226function updatel () \{
227 value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
228 href = location.href;
229 if (href.match(/&l=[\\w\\-]+/)) href = href.replace(/&l=[\\w\\-]+/, "&l=" + value);
230 else href += "&l=" + value;
231 if (!location.href.match(/&nl=1$/)) href += "&nl=1";
232 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
233 location.href = href + getargs();
234\}
235
236function updatev () \{
237 value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
238 href = location.href;
239 if (href.match(/&v=\\d/)) href = href.replace(/&v=\\d/, "&v=" + value);
240 else href += "&v=" + value;
241 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
242 location.href = href + getargs();
243\}
244
245function updatew () \{
246 value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
247 href = location.href;
248 if (href.match(/&nw=[^&]+/)) href = href.replace(/&nw=[^&]+/, "&nw=" + value);
249 else href += "&nw=" + value;
250 if (!location.href.match(/&nl=0$/)) href += "&nl=0";
251 while (href.match(/&cc=[\\w]+/)) href = href.replace(/&cc=[\\w]+/, "");
252 location.href = href + getargs();
253\}
254
255}
256
257
258#######################################################################
259# headers
260# these are overridden so we can put an onLoad event handler
261# in the <body> tag of this page
262#######################################################################
263
264
265_header_ {_cgihead_
266_htmlhead_(class="bgimage" onLoad="initialize();")_startspacer__pagebanner_
267}
268
269# this declaration ends up being the same as style=restrict, never mind
270_header_[v=1] {_cgihead_
271_htmlhead_(onLoad="initialize();")_pagebanner_
272}
273
274
275#######################################################################
276# page content
277#######################################################################
278
279_pagetitle_ {_collectionname_: _textpreferences_}
280_imagethispage_ {_textpreferences_}
281
282_htmloptions_ {}
283
284_htmloptionson_ {
285<p>
286<tr>_fcoption_</tr>
287<p>
288<tr>_hloption_</tr>
289<p>
290<tr>_extlinkoption_</tr>
291_If_(_PreferenceDocsFromWeb_,<p>
292<tr>_intlinkoption_</tr>)
293}
294
295_fcoption_ {
296<td valign=baseline>Document page layout</td>
297<td><input type=radio name=fc value=1 onClick="updatefc(1);"
298 _If_(_cgiargfc_, checked)>navigation bar at top<br>
299<input type=radio name=fc value=0 onClick="updatefc(0);"
300 _If_(_cgiargfc_,, checked)>no navigation bar</td>
301}
302
303_hloption_ {
304<td valign=baseline>Search term highlighting</td>
305<td><input type=radio name=hl value=1 onClick="updatehl(1);"
306 _If_(_cgiarghl_, checked)>highlight search terms<br>
307<input type=radio name=hl value=0 onClick="updatehl(0);"
308 _If_(_cgiarghl_,, checked)>don't highlight search terms</td>
309}
310
311#search pref options
312
313
314# search type option
315_searchtypeoptionplain_ {
316<td valign=baseline>_textsearchtype_</td>
317<td>_textplainsearchtype_</td>
318}
319_searchtypeoptionform_ {
320<td valign=baseline>_textsearchtype_</td>
321<td>_textformsearchtype_</td>
322}
323_searchtypeoptionboth_ {
324<td valign=baseline>_textsearchtype_</td>
325<td><input type=radio name=qt value=0 onClick="updateqt(0);"
326 _If_(_cgiargqt_,, checked)>_textplainsearchtype_<br>
327<input type=radio name=qt value=1 onClick="updateqt(1);"
328 _If_(_cgiargqt_, checked)>_textformsearchtype_</td>
329}
330
331_boxsizeoption_{
332<select name="qb" onChange="updateqb();">
333 <option value="0"_If_("_cgiargqb_" eq "0", selected)>_textregularbox_
334 <option value="1"_If_("_cgiargqb_" eq "1", selected)>_textlargebox_
335</select>
336}
337
338_formnumfieldoption_ {
339<select name="fqn" onChange="updatefqn();">
340 <option value="2"_If_("_cgiargfqn_" eq "2", selected)>2
341 <option value="4"_If_("_cgiargfqn_" eq "4", selected)>4
342 <option value="6"_If_("_cgiargfqn_" eq "6", selected)>6
343 <option value="8"_If_("_cgiargfqn_" eq "8", selected)>8
344</select>
345}
346
347_modeoption_ {
348<td valign=baseline>_textquerymode_</td>
349<td><input type=radio name=b value=0 onClick="updateb(0);"
350 _If_(_cgiargb_,, checked)>_textsimplemode_<br>
351<input type=radio name=b value=1 onClick="updateb(1);"
352 _If_(_cgiargb_, checked)>_textadvancedmode_</td>
353}
354
355_caseoption_ {
356<td valign=baseline>_textcasediffs_</td>
357<td><input type=radio name=k value=1 onClick="updatek(1);"
358 _If_(_cgiargk_, checked)>_textignorecase_<br>
359<input type=radio name=k value=0 onClick="updatek(0);"
360 _If_(_cgiargk_,, checked)>_textmatchcase_</td>
361}
362
363_caseoption_ [l=ar] {}
364_caseoption_ [l=zh] {}
365
366_stemoption_ {
367<td valign=baseline>_textwordends_</td>
368<td><input type=radio name=s value=1 onClick="updates(1);"
369 _If_(_cgiargs_, checked)>_textstem_<br>
370<input type=radio name=s value=0 onClick="updates(0);"
371 _If_(_cgiargs_,, checked)>_textnostem_</td>
372}
373
374_stemoption_ [l=zh] {}
375
376
377_searchhistoryop_ {
378<td valign=baseline>_textsearchhistory_</td>
379<td><input type=radio name="hd" value=0 onClick="updatehd();"
380 _If_("_cgiarghd_" eq "0", checked)>_textnohistorydisplay_<br>
381<input type=radio name="hd" value=1 onClick="updatehd();"
382 _If_("_cgiarghd_" eq "0",, checked)>_texthistorydisplay_</td>
383}
384
385_relateddocop_ {
386<td colspan=2><nobr><input type=checkbox name="rd" value=1 onClick="updaterd();" _If_("_cgiargrd_" eq "1", checked)>
387Display related documents</nobr></td>
388}
389
390_historynumrecords_{<select name="hdn" onChange="updatehd();">
391 <option value="5"_If_("_cgiarghd_" eq "5", selected)>5
392 <option value="10"_If_("_cgiarghd_" eq "10", selected)>10
393 <option value="15"_If_("_cgiarghd_" eq "15", selected)>15
394 <option value="20"_If_("_cgiarghd_" eq "20", selected)>20
395</select>}
396
397_maxdocoption_ {
398<select name="m" onChange="updatem();">
399 <option value="50"_If_("_cgiargm_" eq "50", selected)>50
400 <option value="100"_If_("_cgiargm_" eq "100", selected)>100
401 <option value="200"_If_("_cgiargm_" eq "200", selected)>200
402</select>
403}
404
405_hitsperpageoption_ {
406<select name="o" onChange="updateo();">
407 <option value="10"_If_("_cgiargo_" eq "10", selected)>10
408 <option value="20"_If_("_cgiargo_" eq "20", selected)>20
409 <option value="50"_If_("_cgiargo_" eq "50", selected)>50
410 <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
411</select>
412}
413
414_extlinkoption_ {
415<td>_textextlink_</td>
416<td><select name="el" onChange="updateel();">
417 <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
418 _textlinkinterm_
419 <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
420 _textlinkdirect_
421</select></td>
422}
423
424_intlinkoption_ {
425<td>_textintlink_</td>
426<td><select name="il" onChange="updateil();">
427 <option value="l"_If_("_cgiargil_" eq "l", selected)>
428 _textdigitlib_
429 <option value="w"_If_("_cgiargil_" eq "w", selected)>
430 _textweb_
431</select></td>
432}
433
434# set from within pageaction
435_languageoption_ {}
436_encodingoption_ {}
437
438_formatoption_ {
439<td>_textformat_</td>
440<td><select name="v" onChange="updatev();">
441 <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
442 <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
443</select></td>
444}
445
446_content_ {
447_optnavigationbar_
448
449_If_(_prefschanged_,<p>_prefschanged_<br><div class="divbar">&nbsp;</div>)
450
451<blockquote>
452
453<form name=PrefForm method=get action="_gwcgi_">
454<input type="hidden" name="e" value="_compressedoptions_">
455_If_(_collectionoption_,_collectionprefs_)
456_presentationprefs_
457_searchprefs_
458</blockquote>
459</form>
460}
461
462#search prefs
463_searchprefs_ {
464<table border=0 cellpadding=0 cellspacing=0 width=_pagewidth_><tr>
465<td><h3>_textsearchprefs_</h3></td>
466<td align=right><input type=submit name="bp" value="_textsetprefs_"></td>
467</tr></table>
468
469<table>
470<tr>_querytypedependantoptions_</tr>
471
472<tr>_modeoption_</tr>
473
474<tr>_caseoption_</tr>
475
476<tr>_stemoption_</tr>
477
478<tr>_searchhistoryop_</tr>
479
480<!--
481Don't include this for now
482<tr>_relateddocop_</tr>
483-->
484
485<tr><td colspan=2>_textprefop_</td></tr>
486</table>
487</blockquote>
488<div class="divbar">&nbsp;</div>
489<blockquote>
490}
491
492_querytypedependantoptions_ {
493_If_("_cgiargct_" eq "0",_searchtypeoptionplain_,_mgppqueryoptions_)
494}
495_mgppqueryoptions_ {
496_If_("_cgiargqto_" eq "1", _searchtypeoptionplain_)
497_If_("_cgiargqto_" eq "2", _searchtypeoptionform_)
498_If_("_cgiargqto_" eq "3", _searchtypeoptionboth_)
499}
500
501# should this go somewhere??
502#<noscript><tr><td colspan=2><b>_query:textnojsformwarning_</b></td></tr></noscript>
503
504_collectionprefs_ {
505<h3>_textcollectionprefs_</h3>
506_collectionoption_
507</blockquote>
508<div class="divbar">&nbsp;</div>
509<blockquote>
510}
511
512_presentationprefs_ {
513<h3>_textpresentationprefs_</h3>
514<table>_htmloptions_
515
516_If_(_languageoption_,<tr><td>_textlanguage_</td><td>_languageoption_</td></tr>)
517
518_If_(_encodingoption_,<tr><td>_textencoding_</td><td>_encodingoption_</td></tr>)
519
520<tr>_formatoption_</tr></table>
521</blockquote>
522<div class="divbar">&nbsp;</div>
523<blockquote>
524}
525
Note: See TracBrowser for help on using the repository browser.