incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbuff...@apache.org
Subject svn commit: r575152 - in /incubator/xap/site/javascript/xmodify: xmodify-mootools-compressed.js xmodify-mootools.js xmodify-prototype-compressed.js xmodify-prototype.js
Date Thu, 13 Sep 2007 02:59:19 GMT
Author: bbuffone
Date: Wed Sep 12 19:59:18 2007
New Revision: 575152

URL: http://svn.apache.org/viewvc?rev=575152&view=rev
Log:
fixed error with xModify in jQuery 1.2

Modified:
    incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js
    incubator/xap/site/javascript/xmodify/xmodify-mootools.js
    incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js
    incubator/xap/site/javascript/xmodify/xmodify-prototype.js

Modified: incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js?rev=575152&r1=575151&r2=575152&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js Wed Sep 12 19:59:18
2007
@@ -1 +1 @@
-XHR.xmodifyVersion="0.3.0";XHR.prototype.xmodify=function(_1,_2){var _3=this.onSuccess;var
_4=this;this.onSuccess=function(){if(_4.transport.responseXML==null){_4.onFailure.call(this);}else{_4.xProc(_4.transport.responseXML);if(_3){_3.call(this);}}};return
this.send(_1,_2);};XHR.prototype.xProc=function(_5){var _6={};$each(_5.documentElement.childNodes,function(_7){if(_7.nodeType==1&&XHR.xNodeName(_7.nodeName)=="modifications"){$each(_7.childNodes,function(_8){if(_8.nodeType==1){XHR.xProcElem(_8,_6);}});}});};XHR.xProcElem=function(_9,_a){var
_b=XHR.xNodeName(_9.nodeName);var _c=_9.getAttribute("select");if(_b=="append"){XHR.xProcIn(_9.childNodes,function(_d){$A(_d).each(function(_e){$$(_c).each(function(_f){XHR.appendTableElement(_f,_e);});});},_a);}else{if(_b=="set-attribute"){$each(_9.childNodes,function(_10){if(_10.nodeType==1){$$(_c).setProperty(_10.getAttribute("name"),_10.getAttribute("value"));}});}else{if(_b=="set-style"){$each(_9.childNodes,function(_11){if(_11.nod
 eType==1){$$(_c).setStyle(_11.getAttribute("name"),_11.getAttribute("value"));}});}else{if(_b=="insert-before"){XHR.xProcIn(_9.childNodes,function(_12){$A(_12).each(function(_13){$$(_c).each(function(_14){_14.parentNode.insertBefore(_13,_14);});});},_a);}else{if(_b=="insert-after"){XHR.xProcIn(_9.childNodes,function(_15){$A(_15).each(function(_16){$$(_c).each(function(_17){if(_17.nextSibling){_17.parentNode.insertBefore(_16,_17.nextSibling);}else{XHR.appendTableElement(_17.parentNode,_16);}});});},_a);}else{if(_b=="replace-children"||_b=="set-innerhtml"){XHR.xProcIn(_9.childNodes,function(_18){$$(_c).each(function(_19){_19.empty();$A(_18).each(function(_1a){XHR.appendTableElement(_19,_1a);});});},_a);}else{if(_b=="remove-element"){$each($$(_c),function(_1b){_1b.remove();});}else{if(_b=="remove-attribute"){$each(_9.childNodes,function(_1c){if(_1c.nodeType==1){$$(_c).removeProperty(_1c.getAttribute("name"));}});}else{if(_b=="replace"){XHR.xProcIn(_9.childNodes,function(_1d){$A
 (_1d).each(function(_1e){$$(_c).each(function(_1f){_1f.replaceWith(_1e);});});});}else{if(_b=="insert-at"){var
_20=_9.getAttribute("index");XHR.xProcIn(_9.childNodes,function(_21){$A(_21).each(function(_22){$$(_c).each(function(_23){var
_24=null;var _25=_23;if(_23.childNodes.length>_20){_24=_23.childNodes[_20];}if(_24){_23.insertBefore(_22,_24);}else{XHR.appendTableElement(_23,_22);}});});},_a);}else{if(_b=="variable"){var
_26=_9.getAttribute("name");var _27=_9.getAttribute("deep");var arr=new Array();$$(_c).each(function(_29){arr.push(_29);});_a[_26]=arr;}}}}}}}}}}}};XHR.xProcIn=function(_2a,_2b,_2c){$each(_2a,function(_2d){if((_2d.nodeType==3||_2d.nodeType==4)&&_2d.nodeValue.trim()!=""){_2b.call(_2d,XHR.convertStringToHTML(_2d.nodeValue));}else{if(_2d.nodeType==1&&XHR.xNodeName(_2d.nodeName)=="value-of"){_2b.call(_2d,_2c[_2d.getAttribute("name")]);}else{if(_2d.nodeType==1&&XHR.xNodeName(_2d.nodeName)=="clone"){var
_2e=_2d.getAttribute("select");var _2f=_2d.getAttribute("de
 ep");$$(_2e).each(function(_30){_2b.call(_2d,[_30.cloneNode(_2f)]);});}}}});};XHR.xNodeName=function(_31){var
i=_31.indexOf(":");if(i!=-1){_31=_31.substring(i+1);}return _31;};XHR.appendTableElement=function(_33,_34){if(XHR.xNodeName(_33.nodeName)=="TABLE"&&XHR.xNodeName(_34.nodeName)=="TR"){obj=_33.getElementsByTagName("tbody")[0]||_33.appendChild(document.createElement("tbody"));obj.appendChild(_34);}else{_33.appendChild(_34);}};XHR.convertStringToHTML=function(_35){var
s=_35.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _39=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_39[1]+s+_39[2];while(_39[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody"
 )<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_39[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var
n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new
Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return
arg;};
\ No newline at end of file
+XHR.xmodifyVersion="0.3.0";XHR.prototype.xmodify=function(_1,_2){var _3=this.onSuccess;var
_4=this;this.onSuccess=function(){if(_4.transport.responseXML==null){_4.onFailure.call(this);}else{_4.xProc(_4.transport.responseXML);if(_3){_3.call(this);}}};return
this.send(_1,_2);};XHR.prototype.xProc=function(_5){var _6={};$each(_5.documentElement.childNodes,function(_7){if(_7.nodeType==1&&XHR.xNodeName(_7.nodeName)=="modifications"){$each(_7.childNodes,function(_8){if(_8.nodeType==1){XHR.xProcElem(_8,_6);}});}});};XHR.xProcElem=function(_9,_a){var
_b=XHR.xNodeName(_9.nodeName);var _c=_9.getAttribute("select");if(_b=="append"){XHR.xProcIn(_9.childNodes,function(_d){$A(_d).each(function(_e){$$(_c).each(function(_f){XHR.appendTableElement(_f,_e);});});},_a);}else{if(_b=="set-attribute"){$each(_9.childNodes,function(_10){if(_10.nodeType==1){$$(_c).setProperty(_10.getAttribute("name"),_10.getAttribute("value"));}});}else{if(_b=="set-style"){$each(_9.childNodes,function(_11){if(_11.nod
 eType==1){$$(_c).setStyle(_11.getAttribute("name"),_11.getAttribute("value"));}});}else{if(_b=="insert-before"){XHR.xProcIn(_9.childNodes,function(_12){$A(_12).each(function(_13){$$(_c).each(function(_14){_14.parentNode.insertBefore(_13,_14);});});},_a);}else{if(_b=="insert-after"){XHR.xProcIn(_9.childNodes,function(_15){$A(_15).each(function(_16){$$(_c).each(function(_17){if(_17.nextSibling){_17.parentNode.insertBefore(_16,_17.nextSibling);}else{XHR.appendTableElement(_17.parentNode,_16);}});});},_a);}else{if(_b=="replace-children"||_b=="set-innerhtml"){XHR.xProcIn(_9.childNodes,function(_18){$$(_c).each(function(_19){_19.empty();$A(_18).each(function(_1a){XHR.appendTableElement(_19,_1a);});});},_a);}else{if(_b=="remove-element"){$each($$(_c),function(_1b){_1b.remove();});}else{if(_b=="remove-attribute"){$each(_9.childNodes,function(_1c){if(_1c.nodeType==1){$$(_c).removeProperty(_1c.getAttribute("name"));}});}else{if(_b=="replace"){XHR.xProcIn(_9.childNodes,function(_1d){$A
 (_1d).each(function(_1e){$$(_c).each(function(_1f){_1f.replaceWith(_1e);});});});}else{if(_b=="insert-at"){var
_20=_9.getAttribute("index");XHR.xProcIn(_9.childNodes,function(_21){$A(_21).each(function(_22){$$(_c).each(function(_23){var
_24=null;var _25=_23;if(_23.childNodes.length>_20){_24=_23.childNodes[_20];}if(_24){_23.insertBefore(_22,_24);}else{XHR.appendTableElement(_23,_22);}});});},_a);}else{if(_b=="variable"){var
_26=_9.getAttribute("name");var _27=_9.getAttribute("deep");var arr=new Array();$$(_c).each(function(_29){arr.push(_29);});_a[_26]=arr;}}}}}}}}}}}};XHR.xProcIn=function(_2a,_2b,_2c){$each(_2a,function(_2d){if((_2d.nodeType==3||_2d.nodeType==4)&&_2d.nodeValue.trim()!=""){_2b.call(_2d,XHR.convertStringToHTML(_2d.nodeValue));}else{if(_2d.nodeType==1&&XHR.xNodeName(_2d.nodeName)=="value-of"){_2b.call(_2d,_2c[_2d.getAttribute("name")]);}else{if(_2d.nodeType==1&&XHR.xNodeName(_2d.nodeName)=="clone"){var
_2e=_2d.getAttribute("select");var _2f=_2d.getAttribute("de
 ep");$$(_2e).each(function(_30){_2b.call(_2d,[_30.cloneNode(_2f)]);});}else{if(this.nodeType==1){_2b.call(this,XHR.convertStringToHTML(XHR.xConvertToString(this)));}}}}});};XHR.xConvertToString=function(_31){var
_32="<"+_31.nodeName;if(_31.attributes){for(var i=0;i<_31.attributes.length;i++){_32+="
"+_31.attributes[i].name+"=\""+_31.attributes[i].value+"\"";}}_32+=">";for(var i=0;i<_31.childNodes.length;i++){if(_31.childNodes[i].nodeType==1){_32+=XHR.xConvertToString(_31.childNodes[i]);}else{_32+=_31.childNodes[i].nodeValue;}}_32+="</"+_31.nodeName+">";return
_32;};XHR.xNodeName=function(_35){var i=_35.indexOf(":");if(i!=-1){_35=_35.substring(i+1);}return
_35;};XHR.appendTableElement=function(_37,_38){if(XHR.xNodeName(_37.nodeName)=="TABLE"&&XHR.xNodeName(_38.nodeName)=="TR"){obj=_37.getElementsByTagName("tbody")[0]||_37.appendChild(document.createElement("tbody"));obj.appendChild(_38);}else{_37.appendChild(_38);}};XHR.convertStringToHTML=function(_39){var
s=_39.replace(/^\s
 +|\s+$/g,"");var div=document.createElement("div");var tb=[];var _3d=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_3d[1]+s+_3d[2];while(_3d[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_3d[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var
n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new
Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return
arg;};
\ No newline at end of file

Modified: incubator/xap/site/javascript/xmodify/xmodify-mootools.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-mootools.js?rev=575152&r1=575151&r2=575152&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-mootools.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-mootools.js Wed Sep 12 19:59:18 2007
@@ -228,10 +228,35 @@
 				$$(select).each(function(node){
 	                callback.call(item, [node.cloneNode(deep)]);
 				});
+    		}else if (this.nodeType == 1){
+    		    //got an XML node need to convert it into an HTML node
+                callback.call(this, XHR.convertStringToHTML(XHR.xConvertToString(this)));
     		}
 		});
     }
-    
+ 
+    /**
+     * Convert an XML structure into a string 
+     */
+    XHR.xConvertToString =  function(node){
+	    var elements = "<" + node.nodeName;
+	    if (node.attributes){
+    	    for (var i = 0; i < node.attributes.length; i++){
+    	          elements += " " + node.attributes[i].name + "=\"" + node.attributes[i].value
+ "\"";
+    	    } 
+	    }
+	    elements += ">";	    
+	    for (var i = 0; i < node.childNodes.length; i++){
+	          if (node.childNodes[i].nodeType == 1){
+	            elements += XHR.xConvertToString(node.childNodes[i]);
+	          }else{
+	            elements += node.childNodes[i].nodeValue;
+	          }
+	    }
+	    elements += "</" + node.nodeName + ">";
+	    return elements;
+   }
+   
     XHR.xNodeName = function(name){
     	var i = name.indexOf(":");
 		if (i != -1){

Modified: incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js?rev=575152&r1=575151&r2=575152&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js Wed Sep 12 19:59:18
2007
@@ -1 +1 @@
-Prototype.xmodifyVersion="0.3.0";Ajax.xmodify=function(_1,_2){var _3=this.onSuccess;if(_2==null){_2={method:"get"};}else{if(_2.method==null){_2.method="get";}}var
_4=this;_2.onSuccess=function(_5){if(_5.responseXML==null){_2.onFailure.call(this);}else{Ajax.xProc(_5.responseXML);if(_3){_3.call(this);}}};return
new Ajax.Request(_1,_2);};Ajax.xProc=function(_6){var _7={};$A(_6.documentElement.childNodes).each(function(_8){if(_8.nodeType==1&&Ajax.xNodeName(_8.nodeName)=="modifications"){$A(_8.childNodes).each(function(_9){if(_9.nodeType==1){Ajax.xProcElem(_9,_7);}});}});};Ajax.xProcElem=function(_a,_b){var
_c=Ajax.xNodeName(_a.nodeName);var _d=_a.getAttribute("select");if(_c=="append"){Ajax.xProcIn(_a.childNodes,function(_e){$$(_d).each(function(_f){$A(_e).each(function(_10){Ajax.appendTableElement(_f,_10);});});},_b);}else{if(_c=="set-attribute"){$A(_a.childNodes).each(function(_11){if(_11.nodeType==1){$$(_d).each(function(_12){_12.setAttribute(_11.getAttribute("name"),_11.getA
 ttribute("value"));});}var _13;});}else{if(_c=="set-style"){$A(_a.childNodes).each(function(_14){if(_14.nodeType==1){$$(_d).each(function(_15){var
_16=new Array();_16[_14.getAttribute("name")]=_14.getAttribute("value");$(_15).setStyle(_16);});}var
_17;});}else{if(_c=="insert-before"){Ajax.xProcIn(_a.childNodes,function(_18){$$(_d).each(function(_19){$A(_18).each(function(_1a){_19.parentNode.insertBefore(_1a,_19);});});},_b);}else{if(_c=="insert-after"){Ajax.xProcIn(_a.childNodes,function(_1b){$$(_d).each(function(_1c){$A(_1b).each(function(_1d){if(_1c.nextSibling){_1c.parentNode.insertBefore(_1d,_1c.nextSibling);}else{Ajax.appendTableElement(_1c.parentNode,_1d);}});});},_b);}else{if(_c=="set-innerhtml"||_c=="replace-children"){Ajax.xProcIn(_a.childNodes,function(_1e){$$(_d).each(function(_1f){_1f.innerHTML="";$A(_1e).each(function(_20){Ajax.appendTableElement(_1f,_20);});});},_b);}else{if(_c=="remove-element"){$$(_d).each(function(_21){_21.remove();});}else{if(_c=="remove-at
 tribute"){$A(_a.childNodes).each(function(_22){if(_22.nodeType==1){$$(_d).each(function(_23){_23.removeAttribute(_22.getAttribute("name"));});}});}else{if(_c=="replace"){Ajax.xProcIn(_a.childNodes,function(_24){$$(_d).each(function(_25){$A(_24).each(function(_26){_25.replace(_26,_25);});});});}else{if(_c=="insert-at"){var
_27=_a.getAttribute("index");Ajax.xProcIn(_a.childNodes,function(_28){$$(_d).each(function(_29){$A(_28).each(function(_2a){var
_2b=null;var _2c=_29;if(_29.childNodes.length>_27){_2b=_29.childNodes[_27];}if(_2b){_29.insertBefore(_2a,_2b);}else{Ajax.appendTableElement(_29,_2a);}});});},_b);}else{if(_c=="variable"){var
_2d=_a.getAttribute("name");var _2e=_a.getAttribute("deep");var arr=new Array();$$(_d).each(function(_30){arr.push(_30);});_b[_2d]=arr;}}}}}}}}}}}};Ajax.xProcIn=function(_31,_32,_33){$A(_31).each(function(_34){if((_34.nodeType==3||_34.nodeType==4)&&_34.nodeValue.replace(/^\s+|\s+$/g,"")!=""){_32.call(_34,Ajax.convertStringToHTML(_34.nodeValue));
 }else{if(_34.nodeType==1&&Ajax.xNodeName(_34.nodeName)=="value-of"){_32.call(_34,_33[_34.getAttribute("name")]);}else{if(_34.nodeType==1&&Ajax.xNodeName(_34.nodeName)=="clone"){var
_35=_34.getAttribute("select");var _36=_34.getAttribute("deep");$$(_35).each(function(_37){_32.call(_34,[_37.cloneNode(_36)]);});}}}});};Ajax.xNodeName=function(_38){var
i=_38.indexOf(":");if(i!=-1){_38=_38.substring(i+1);}return _38;};Ajax.appendTableElement=function(_3a,_3b){if(Ajax.xNodeName(_3a.nodeName)=="TABLE"&&Ajax.xNodeName(_3b.nodeName)=="TR"){obj=_3a.getElementsByTagName("tbody")[0]||_3a.appendChild(document.createElement("tbody"));obj.appendChild(_3b);}else{_3a.appendChild(_3b);}};Ajax.convertStringToHTML=function(_3c){var
s=_3c.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _40=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>"
 ,"</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_40[1]+s+_40[2];while(_40[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_40[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var
n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new
Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return
arg;};
\ No newline at end of file
+Prototype.xmodifyVersion="0.3.0";Ajax.xmodify=function(_1,_2){var _3=this.onSuccess;if(_2==null){_2={method:"get"};}else{if(_2.method==null){_2.method="get";}}var
_4=this;_2.onSuccess=function(_5){if(_5.responseXML==null){_2.onFailure.call(this);}else{Ajax.xProc(_5.responseXML);if(_3){_3.call(this);}}};return
new Ajax.Request(_1,_2);};Ajax.xProc=function(_6){var _7={};$A(_6.documentElement.childNodes).each(function(_8){if(_8.nodeType==1&&Ajax.xNodeName(_8.nodeName)=="modifications"){$A(_8.childNodes).each(function(_9){if(_9.nodeType==1){Ajax.xProcElem(_9,_7);}});}});};Ajax.xProcElem=function(_a,_b){var
_c=Ajax.xNodeName(_a.nodeName);var _d=_a.getAttribute("select");if(_c=="append"){Ajax.xProcIn(_a.childNodes,function(_e){$$(_d).each(function(_f){$A(_e).each(function(_10){Ajax.appendTableElement(_f,_10);});});},_b);}else{if(_c=="set-attribute"){$A(_a.childNodes).each(function(_11){if(_11.nodeType==1){$$(_d).each(function(_12){_12.setAttribute(_11.getAttribute("name"),_11.getA
 ttribute("value"));});}var _13;});}else{if(_c=="set-style"){$A(_a.childNodes).each(function(_14){if(_14.nodeType==1){$$(_d).each(function(_15){var
_16=new Array();_16[_14.getAttribute("name")]=_14.getAttribute("value");$(_15).setStyle(_16);});}var
_17;});}else{if(_c=="insert-before"){Ajax.xProcIn(_a.childNodes,function(_18){$$(_d).each(function(_19){$A(_18).each(function(_1a){_19.parentNode.insertBefore(_1a,_19);});});},_b);}else{if(_c=="insert-after"){Ajax.xProcIn(_a.childNodes,function(_1b){$$(_d).each(function(_1c){$A(_1b).each(function(_1d){if(_1c.nextSibling){_1c.parentNode.insertBefore(_1d,_1c.nextSibling);}else{Ajax.appendTableElement(_1c.parentNode,_1d);}});});},_b);}else{if(_c=="set-innerhtml"||_c=="replace-children"){Ajax.xProcIn(_a.childNodes,function(_1e){$$(_d).each(function(_1f){_1f.innerHTML="";$A(_1e).each(function(_20){Ajax.appendTableElement(_1f,_20);});});},_b);}else{if(_c=="remove-element"){$$(_d).each(function(_21){_21.remove();});}else{if(_c=="remove-at
 tribute"){$A(_a.childNodes).each(function(_22){if(_22.nodeType==1){$$(_d).each(function(_23){_23.removeAttribute(_22.getAttribute("name"));});}});}else{if(_c=="replace"){Ajax.xProcIn(_a.childNodes,function(_24){$$(_d).each(function(_25){$A(_24).each(function(_26){_25.replace(_26,_25);});});});}else{if(_c=="insert-at"){var
_27=_a.getAttribute("index");Ajax.xProcIn(_a.childNodes,function(_28){$$(_d).each(function(_29){$A(_28).each(function(_2a){var
_2b=null;var _2c=_29;if(_29.childNodes.length>_27){_2b=_29.childNodes[_27];}if(_2b){_29.insertBefore(_2a,_2b);}else{Ajax.appendTableElement(_29,_2a);}});});},_b);}else{if(_c=="variable"){var
_2d=_a.getAttribute("name");var _2e=_a.getAttribute("deep");var arr=new Array();$$(_d).each(function(_30){arr.push(_30);});_b[_2d]=arr;}}}}}}}}}}}};Ajax.xProcIn=function(_31,_32,_33){$A(_31).each(function(_34){if((_34.nodeType==3||_34.nodeType==4)&&_34.nodeValue.replace(/^\s+|\s+$/g,"")!=""){_32.call(_34,Ajax.convertStringToHTML(_34.nodeValue));
 }else{if(_34.nodeType==1&&Ajax.xNodeName(_34.nodeName)=="value-of"){_32.call(_34,_33[_34.getAttribute("name")]);}else{if(_34.nodeType==1&&Ajax.xNodeName(_34.nodeName)=="clone"){var
_35=_34.getAttribute("select");var _36=_34.getAttribute("deep");$$(_35).each(function(_37){_32.call(_34,[_37.cloneNode(_36)]);});}else{if(this.nodeType==1){_32.call(this,Ajax.convertStringToHTML(Ajax.xConvertToString(this)));}}}}});};Ajax.xConvertToString=function(_38){var
_39="<"+_38.nodeName;if(_38.attributes){for(var i=0;i<_38.attributes.length;i++){_39+="
"+_38.attributes[i].name+"=\""+_38.attributes[i].value+"\"";}}_39+=">";for(var i=0;i<_38.childNodes.length;i++){if(_38.childNodes[i].nodeType==1){_39+=Ajax.xConvertToString(_38.childNodes[i]);}else{_39+=_38.childNodes[i].nodeValue;}}_39+="</"+_38.nodeName+">";return
_39;};Ajax.xNodeName=function(_3c){var i=_3c.indexOf(":");if(i!=-1){_3c=_3c.substring(i+1);}return
_3c;};Ajax.appendTableElement=function(_3e,_3f){if(Ajax.xNodeName(_3e.nodeName)=
 ="TABLE"&&Ajax.xNodeName(_3f.nodeName)=="TR"){obj=_3e.getElementsByTagName("tbody")[0]||_3e.appendChild(document.createElement("tbody"));obj.appendChild(_3f);}else{_3e.appendChild(_3f);}};Ajax.convertStringToHTML=function(_40){var
s=_40.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _44=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_44[1]+s+_44[2];while(_44[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_44[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var
n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeCh
 ild(tb[n]);}}}arg=new Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return
arg;};
\ No newline at end of file

Modified: incubator/xap/site/javascript/xmodify/xmodify-prototype.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-prototype.js?rev=575152&r1=575151&r2=575152&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-prototype.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-prototype.js Wed Sep 12 19:59:18 2007
@@ -240,9 +240,34 @@
 				$$(select).each(function(node){
 	                callback.call(item, [node.cloneNode(deep)]);
 				});
+    		}else if (this.nodeType == 1){
+    		    //got an XML node need to convert it into an HTML node
+                callback.call(this, Ajax.convertStringToHTML(Ajax.xConvertToString(this)));
     		}
 		});
     }
+ 
+    /**
+     * Convert an XML structure into a string 
+     */
+    Ajax.xConvertToString =  function(node){
+	    var elements = "<" + node.nodeName;
+	    if (node.attributes){
+    	    for (var i = 0; i < node.attributes.length; i++){
+    	          elements += " " + node.attributes[i].name + "=\"" + node.attributes[i].value
+ "\"";
+    	    } 
+	    }
+	    elements += ">";	    
+	    for (var i = 0; i < node.childNodes.length; i++){
+	          if (node.childNodes[i].nodeType == 1){
+	            elements += Ajax.xConvertToString(node.childNodes[i]);
+	          }else{
+	            elements += node.childNodes[i].nodeValue;
+	          }
+	    }
+	    elements += "</" + node.nodeName + ">";
+	    return elements;
+   }
     
     Ajax.xNodeName = function(name){
     	var i = name.indexOf(":");



Mime
View raw message