root/trunk/gsdl/macros/pref.dm @ 901

Revision 901, 9.8 KB (checked in by sjboddie, 20 years ago)

bug in collectionoption stuff

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
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  for (i in savedccs)
67    if (savedccs[i] == 1) argcc += "&cc=" + i;
68  updatehrefs();
69\}
70}
71
72_standardfunctions_ {
73function initialize () \{
74  for (i = 0; i < document.links.length; i++)
75    savedhrefs[i] = document.links[i].href;
76\}
77}
78
79_getargsfunction_ {
80function getargs () \{
81  return argk + args + argm + argo + argb_If_(_collectionoption_,_ccsargs_)_If_(_htmloptions_,_htmlargs_);
82\}
83}
84
85_ccsargs_ {+ argcc}
86_htmlargs_ {+ argel + argil + argfc + arghl}
87
88_htmlfunctions_ {argel = "";
89argil = "";
90argfc = "";
91arghl = "";
92
93function updateel () \{
94  value = document.PrefForm.el.options[document.PrefForm.el.selectedIndex].value;
95  if (value != "_cgiargel_") argel = "&el=" + value;
96  else argel = "";
97  updatehrefs();
98\}
99
100function updateil () \{
101  value = document.PrefForm.il.options[document.PrefForm.il.selectedIndex].value;
102  if (value != "_cgiargil_") argil = "&il=" + value;
103  else argil = "";
104  updatehrefs();
105\}
106
107function updatefc () \{
108  if (document.PrefForm.fc.checked)
109    _If_("_cgiargfc_" eq "1",_argfcblank_,_argfcon_)
110  else
111    _If_("_cgiargfc_" ne "1",_argfcblank_,_argfcoff_)
112  updatehrefs();
113\}
114
115function updatehl () \{
116  if (document.PrefForm.hl.checked)
117    _If_("_cgiarghl_" eq "1",_arghlblank_,_arghlon_)
118  else
119    _If_("_cgiarghl_" ne "1",_arghlblank_,_arghloff_)
120  updatehrefs();
121\}
122}
123
124_argfcblank_ {argfc = "";}
125_argfcon_ {argfc = "&fc=1&f=1";}
126_argfcoff_ {argfc = "&fc=0&f=0";}
127
128_arghlblank_ {arghl = "";}
129_arghlon_ {arghl = "&hl=1";}
130_arghloff_ {arghl = "&hl=0";}
131
132_pagescriptextra_ {
133// preferences scripts generated from \_preferences:pagescriptextra\_
134
135savedhrefs = new Object();
136
137argk = "";
138args = "";     
139argm = "";
140argo = "";
141argb = "";
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 updateo () \{
170  value = document.PrefForm.o.options[document.PrefForm.o.selectedIndex].value;
171  if (value != _cgiargo_) argo = "&r=1&o=" + value;
172  else argo = "";
173  updatehrefs();
174\}
175
176function updateb (value) \{
177  if (value != _cgiargb_) argb = "&b=" + value;
178  else argb = "";
179  updatehrefs();
180\}
181
182function updatel () \{
183  value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
184  location.href = location.href + "&l=" + value + getargs();
185\}
186
187function updatev () \{
188  value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
189  location.href = location.href + "&v=" + value + getargs();
190\}
191
192function updatew () \{
193  value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
194  location.href = location.href + "&nw=" + value + getargs();
195\}
196}
197
198#######################################################################
199# headers
200# these are overridden so we can put an onLoad event handler
201# in the <body> tag of this page
202#######################################################################
203
204
205_header_ {_cgihead_
206_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
207}
208
209# this declaration ends up being the same as style=restrict, never mind
210_header_[v=1] {_cgihead_
211_htmlhead_(onLoad="initialize();")_pagebanner_
212}
213
214
215#######################################################################
216# page content
217#######################################################################
218
219_pagetitle_ {_collectionname_: _textpreferences_}
220_imagethispage_ {_iconthispage_}
221
222_htmloptions_ {}
223
224_htmloptionson_ {
225<p>
226_fcoption_
227<p>
228_hloption_
229<p>
230_extlinkoption_
231_If_(_PreferenceDocsFromWeb_,<p>
232_intlinkoption_)
233}
234
235_caseoption_ {
236<input type=radio name=k value=1 onClick="updatek(1);"
237        _If_(_cgiargk_, checked)>_textignorecase_<br>
238<input type=radio name=k value=0 onClick="updatek(0);"
239        _If_(_cgiargk_,, checked)>_textmatchcase_
240}
241
242_fcoption_ {
243<input type=checkbox name=fc onClick="updatefc();"_If_("_cgiargfc_" eq "1", checked)> 
244_textfcoption_
245}
246
247_hloption_ {
248<input type=checkbox name=hl onClick="updatehl();"_If_("_cgiarghl_" eq "1", checked)> 
249_texthloption_
250}
251
252_caseoption_ [l=zh] {}
253
254_stemoption_ {
255<input type=radio name=s value=1 onClick="updates(1);"
256  _If_(_cgiargs_, checked)>_textstem_<br>
257<input type=radio name=s value=0 onClick="updates(0);"
258  _If_(_cgiargs_,, checked)>_textnostem_
259}
260
261_stemoption_ [l=zh] {}
262
263_maxdocoption_ {
264<select name="m" onChange="updatem();">
265  <option value="50"_If_("_cgiargm_" eq "50", selected)>50
266  <option value="100"_If_("_cgiargm_" eq "100", selected)>100
267  <option value="200"_If_("_cgiargm_" eq "200", selected)>200
268</select>
269}
270
271_hitsperpageoption_ {
272<select name="o" onChange="updateo();">
273  <option value="10"_If_("_cgiargo_" eq "10", selected)>10 
274  <option value="20"_If_("_cgiargo_" eq "20", selected)>20
275  <option value="50"_If_("_cgiargo_" eq "50", selected)>50
276  <option value="100")_If_("_cgiargo_" eq "100", selected)>_textall_
277</select>
278}
279
280_modeoption_ {
281<input type=radio name=b value=0 onClick="updateb(0);"
282        _If_(_cgiargb_,, checked)>_textsimplemode_<br>
283<input type=radio name=b value=1 onClick="updateb(1);"
284        _If_(_cgiargb_, checked)>_textadvancedmode_
285}
286
287_extlinkoption_ {
288_textextlink_
289<select name="el" onChange="updateel();">
290  <option value="prompt"_If_("_cgiargel_" eq "prompt", selected)>
291     _textlinkinterm_
292  <option value="direct"_If_("_cgiargel_" eq "direct", selected)>
293     _textlinkdirect_
294</select>
295}
296
297_intlinkoption_ {
298_textintlink_
299<select name="il" onChange="updateil();">
300  <option value="l"_If_("_cgiargil_" eq "l", selected)>
301     _textdigitlib_
302  <option value="w"_If_("_cgiargil_" eq "w", selected)>
303     _textweb_
304</select>
305}
306
307_languageoption_ {}
308
309_enlanguageoption_ {<option value="en"_If_("_cgiargl_",, selected)_If_("_cgiargl_" eq "en", selected)>_textlangeng_}
310_milanguageoption_ {<option value="mi"_If_("_cgiargl_" eq "mi", selected)>_textlangmaori_}
311_zhlanguageoption_ {<option value="zh"_If_("_cgiargl_" eq "zh", selected)>_textlangchinese_}
312
313_encodingoption_ {
314_textencoding_
315<select name="w" onChange="updatew();">
316  <option value="w" _If_("_cgiargw_" eq "w",selected)>Western (ISO-8859-1)
317  <option value="u" _If_("_cgiargw_" eq "u",selected)>UTF-8
318  <option value="g" _If_("_cgiargw_" eq "g",selected)>GBK
319</select>
320}
321
322_formatoption_ {
323_textformat_
324<select name="v" onChange="updatev();">
325  <option value="0"_If_("_cgiargv_" eq "0", selected)>_textgraphical_
326  <option value="1"_If_("_cgiargv_" eq "1", selected)>_texttextual_
327</select>
328}
329
330_content_ {
331<center>
332_navigationbar_
333</center>
334<blockquote>
335
336<form name=PrefForm method=get action="_gwcgi_">
337
338<input type="hidden" name="e" value="_decodedcompressedoptions_">
339
340_If_(_collectionoption_,_collectionprefs_)
341_presentationprefs_
342_searchprefs_
343
344</blockquote>
345</form>
346}
347
348_searchprefs_ {
349<h3>_textsearchprefs_</h3>
350<p>
351_caseoption_
352
353<p>
354_stemoption_
355
356<p>
357_modeoption_
358
359<p>
360_textprefop_
361<br>_iconblankbar_
362}
363
364_collectionprefs_ {
365<h3>_textcollectionprefs_</h3>
366_collectionoption_
367<br>_iconblankbar_
368}
369
370_presentationprefs_ {
371<h3>_textpresentationprefs_</h3>
372_htmloptions_
373
374<p>
375_languageoption_
376
377<p>
378_encodingoption_
379
380<p>
381_formatoption_
382<br>_iconblankbar_
383}
384
385#######################################################################
386# https
387#######################################################################
388
389_httpiconhpref_ {_httpimg_/h\_pref.gif}
390_httpiconhpref_ [l=mi] {_httpimg_/mh\_pref.gif}
391_widthhpref_ {200}
392_widthhpref_ [l=mi] {220}
393_heighthpref_ {57}
394
395
396#######################################################################
397# icons
398#######################################################################
399
400_iconthispage_ {<img src="_httpiconhpref_" alt="_textpreferences_" width="_widthhpref_" height="_heighthpref_">}
401_iconthispage_ [l=mi] {<img src="_httpimg_/mh\_pref.gif" alt="" width="220" height="57">}
402
403
404
405
406
407
408
409
Note: See TracBrowser for help on using the browser.