Index: trunk/gsdl/macros/pref.dm
===================================================================
--- trunk/gsdl/macros/pref.dm	(revision 180)
+++ trunk/gsdl/macros/pref.dm	(revision 276)
@@ -1,3 +1,90 @@
 package preferences
+
+
+#######################################################################
+# scripts
+# note that changing either the "m" or the "o" argument
+# from the preferences page necessitates reseting the "r"
+# argument to 1
+#######################################################################
+
+_pagescriptextra_ {
+// preferences scripts generated from \_preferences:pagescriptextra\_
+
+	savedhrefs = new Object();
+
+	k\_arg = "";
+	s\_arg = "";		
+	m\_arg = "";
+	o\_arg = "";
+
+	function initialize () \{
+		for (i = 0; i < document.links.length; i++)
+			savedhrefs[i] = document.links[i].href;
+	\}
+
+	function update\_hrefs () \{
+		for (i = 0; i < document.links.length; i++)
+			document.links[i].href = savedhrefs[i] + k\_arg + s\_arg + m\_arg + o\_arg;
+	\}
+
+	function k\_update (value) \{
+		if (value != _cgiargk_) k\_arg = "&k=" + value;
+		else k\_arg = "";
+		update\_hrefs();
+	\}
+
+	function s\_update (value) \{
+		if (value != _cgiargs_) s\_arg = "&s=" + value;
+		else s\_arg = "";
+		update\_hrefs();
+	\}
+
+	function m\_update () \{
+		value = document.PrefForm.m.options[document.PrefForm.m.selectedIndex].value;
+		if (value != _cgiargm_) m\_arg = "&r=1&m=" + value;
+		else m\_arg = "";
+		update\_hrefs();
+	\}
+
+	function o\_update () \{
+		value = document.PrefForm.o.options[document.PrefForm.o.selectedIndex].value;
+		if (value != _cgiargo_) o\_arg = "&r=1&o=" + value;
+		else o\_arg = "";
+		update\_hrefs();
+	\}
+
+	function l\_update () \{
+		value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
+		location.href = location.href + k\_arg + s\_arg + m\_arg + o\_arg + "&l=" + value;
+	\}
+
+	function v\_update () \{
+		value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
+		location.href = location.href + k\_arg + s\_arg + m\_arg + o\_arg + "&v=" + value;
+	\}
+}
+
+#######################################################################
+# headers
+# these are overridden so we can put an onLoad event handler
+# in the <body> tag of this page
+#######################################################################
+
+
+_header_ {_cgihead_
+_htmlhead_(background="_httpiconchalk_" onLoad="initialize();")_startspacer__pagebanner_
+}
+
+# this declaration ends up being the same as style=restrict, never mind
+_header_[version=text] {_cgihead_
+_htmlhead_(onLoad="initialize();")_pagebanner_
+}
+
+# style=restrict lacks the sidestripe, version links and 
+# language links
+_header_[style=restrict] {_cgihead_
+_htmlhead_(onLoad="initialize();")_pagebanner_
+}
 
 
@@ -10,19 +97,19 @@
 
 _caseoption_ {
-<input type=radio name=k value=1
+<input type=radio name=k value=1 onClick="k\_update(1);"
 		_If_(_cgiargk_, checked)>_textignorecase_<br>
-<input type=radio name=k value=0
+<input type=radio name=k value=0 onClick="k\_update(0);"
 		_If_(_cgiargk_,, checked)>_textmatchcase_
 }
 
 _stemoption_ {
-<input type=radio name=s value=1 
+<input type=radio name=s value=1 onClick="s\_update(1);"
 		_If_(_cgiargs_, checked)>_textstem_<br>
-<input type=radio name=s value=0
+<input type=radio name=s value=0 onClick="s\_update(0);"
 		_If_(_cgiargs_,, checked)>_textnostem_
 }
 
 _maxdocoption_ {
-<select name="m">
+<select name="m" onChange="m\_update();">
   <option value="50"_If_("_cgiargm_" eq "50", selected)>50
   <option value="100"_If_("_cgiargm_" eq "100", selected)>100
@@ -33,5 +120,5 @@
 
 _hitsperpageoption_ {
-<select name="o">
+<select name="o" onChange="o\_update();">
   <option value="10"_If_("_cgiargo_" eq "10", selected)>10  
   <option value="20"_If_("_cgiargo_" eq "20", selected)>20
@@ -42,14 +129,29 @@
 }
 
+_languageoption_ {
+_textlanguage_
+<select name="l" onChange="l\_update();">
+  <option value="en"_If_("_cgiargl_",, selected)_If_("_cgiargl_" eq "en", selected)>English
+  <option value="mi"_If_("_cgiargl_" eq "mi", selected)>Maori
+</select>
+}
+
+_formatoption_ {
+_textformat_
+<select name="v" onChange="v\_update();">
+  <option value="0"_If_("_cgiargv_" eq "0", selected)>Graphical
+  <option value="1"_If_("_cgiargv_" eq "1", selected)>Textual
+</select>
+}
+
 _content_ {
+<center>
+_navigationbar_
+</center>
 <blockquote>
 
 <form name=PrefForm method=get action="_gwcgi_">
-<_font_>
 
 <input type="hidden" name="e" value="_compressedoptions_">
-<input type="hidden" name="q" value="_querystring_">
-<input type="hidden" name="a" value="q">
-<input type="hidden" name="r" value="1">
 
 <p>_caseoption_
@@ -60,10 +162,11 @@
 _textprefop_
 
-<table width="100%">
-<tr><td>
-<input type="submit" value="_textsetprefs_">
-</td></tr></table>
+<p>
+_languageoption_
+
+<p>
+_formatoption_
+
 </blockquote>
-</font>
 </form>
 }
@@ -99,5 +202,6 @@
 _textnostem_ { whole word must match}
 _textprefop_ {Return up to _maxdocoption_ hits with _hitsperpageoption_ hits per page.}
-_textsetprefs_ {Set these preferences}
+_textlanguage_ {Interface language: }
+_textformat_ {Interface format: }
 
 #######################################################################
@@ -111,8 +215,8 @@
 _textnostem_ [language=mi] { me tika te k&uuml;muri}
 _textprefop_ [language=mi] {Whakahokia mai te _maxdocoption_ kupu, &auml;, kia _hitsperpageoption_ kupu ki ia wh&auml;rangi.}
-_textsetprefs_ [language=mi] {Whakamaua}
-
-
-
-
-
+
+
+
+
+
+
