Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/Extended.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/Extended.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/Extended.html 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/Extended.html 4 Jun 2006 00:45:49 -0000 1.3 @@ -15,15 +15,56 @@ return r; }; -function comboSelectValue(c, val) { - var ops = c.getElementsByTagName("option"); - for (var i = ops.length; --i >= 0;) { - var op = ops[i]; - op.selected = (op.value == val); - } - c.value = val; -}; +function getSelectedValue(el) { + if(!el) + return ""; + return el[el.selectedIndex].value; +} +function setSelectedValue(el, val) { + if(!el) + return ""; + var ops = el.getElementsByTagName("option"); + for (var i = ops.length; --i >= 0;) { + var op = ops[i]; + op.selected = (op.value == val); + } + el.value = val; +} + +function getCheckedValue(el) { + if(!el) + return ""; + var radioLength = el.length; + if(radioLength == undefined) + if(el.checked) + return el.value; + else + return "false"; + for(var i = 0; i < radioLength; i++) { + if(el[i].checked) { + return el[i].value; + } + } + return ""; +} + +function setCheckedValue(el, val) { + if(!el) + return; + var radioLength = el.length; + if(radioLength == undefined) { + el.checked = (el.value == val.toString()); + return; + } + for(var i = 0; i < radioLength; i++) { + el[i].checked = false; + if(el[i].value == val.toString()) { + el[i].checked = true; + } + } +} + function __dlg_onclose() { opener.Dialog._return(null); }; @@ -84,50 +125,77 @@ document.body.onkeypress = __dlg_close_on_esc; }; +function placeFocus() { +var bFound = false; + // for each form + for (f=0; f < document.forms.length; f++) { + // for each element in each form + for(i=0; i < document.forms[f].length; i++) { + // if it's not a hidden element + if (document.forms[f][i].type != "hidden") { + // and it's not disabled + if (document.forms[f][i].disabled != true) { + // set the focus to it + document.forms[f][i].focus(); + var bFound = true; + } + } + // if found in this element, stop looking + if (bFound == true) + break; + } + // if found in this form, stop looking + if (bFound == true) + break; + } +} + function Init() { __dlg_init(); var param = window.dialogArguments; - if (param) { - document.getElementById("width").value = param["width"]; - document.getElementById("height").value = param["height"]; - document.getElementById("sizeIncludesBars").checked = (param["sizeIncludesBars"] == 'true'); - document.getElementById("statusBar").checked = (param["statusBar"] == 'true'); - document.getElementById("mozParaHandler").value = param["mozParaHandler"]; - document.getElementById("undoSteps").value = param["undoSteps"]; - document.getElementById("baseHref").value = param["baseHref"]; - document.getElementById("stripBaseHref").checked = (param["stripBaseHref"] == 'true'); - document.getElementById("stripSelfNamedAnchors").checked = (param["stripSelfNamedAnchors"] == 'true'); - document.getElementById("only7BitPrintablesInURLs").checked = (param["only7BitPrintablesInURLs"] == 'true'); - document.getElementById("sevenBitClean").checked = (param["sevenBitClean"] == 'true'); - document.getElementById("killWordOnPaste").checked = (param["killWordOnPaste"] == 'true'); - document.getElementById("flowToolbars").checked = (param["flowToolbars"] == 'true'); - document.getElementById("CharacterMapMode").value = param["CharacterMapMode"]; - document.getElementById("ListTypeMode").value = param["ListTypeMode"]; - + if(param) { + var el; + for (var field in param) { + //alert(field + '="' + param[field] + '"'); + el = document.getElementById(field); + if (el.tagName.toLowerCase()=="input"){ + if ((el.type.toLowerCase()=="radio") || (el.type.toLowerCase()=="checkbox")){ + setCheckedValue(el, param[field]); + } else { + el.value = param[field]; + } + } else if (el.tagName.toLowerCase()=="select"){ + setSelectedValue(el, param[field]); + } else if (el.tagName.toLowerCase()=="textarea"){ + el.value = param[field]; + } + } } - document.getElementById("width").focus(); - window.resizeTo(420, 500); + placeFocus(); }; +// pass data back to the calling window function onOK() { - // pass data back to the calling window - var param = { width: document.getElementById("width").value, - height: document.getElementById("height").value, - sizeIncludesBars: (document.getElementById("sizeIncludesBars").checked?true:""), - statusBar: (document.getElementById("statusBar").checked?true:""), - mozParaHandler: document.getElementById("mozParaHandler").value, - undoSteps: document.getElementById("undoSteps").value, - baseHref: document.getElementById("baseHref").value, - stripBaseHref: (document.getElementById("stripBaseHref").checked?true:""), - stripSelfNamedAnchors: (document.getElementById("stripSelfNamedAnchors").checked?true:""), - only7BitPrintablesInURLs: (document.getElementById("only7BitPrintablesInURLs").checked?true:""), - sevenBitClean: (document.getElementById("sevenBitClean").checked?true:""), - killWordOnPaste: (document.getElementById("killWordOnPaste").checked?true:""), - flowToolbars: (document.getElementById("flowToolbars").checked?true:""), - CharacterMapMode: document.getElementById("CharacterMapMode").value, - ListTypeOptions: document.getElementById("ListTypeMode").value - }; - __dlg_close(param); + var param = new Object(); + var el = document.getElementsByTagName('input'); + for (var i=0; i - +
Settings
Editor width:
@@ -154,10 +222,10 @@

Size includes bars
- +

Status Bar
- +

Mozilla Parameter Handler:

Strip base href
- +

Strip self named anchors
- +

only 7bit printables in URLs
- +

7bit Clean
- +

kill Word on paste
- +

flow toolbars
- +

+

show loading
+ +


-
CharacterMap mode :
- -
+

-
+
ListType mode :
-
-

- +

+ +

+
+
CharCounter (showChar) :

+
CharCounter (showWord) :

+
CharCounter (showHtml) :
+
+

+

- \ No newline at end of file +