svn commit r9343 - in trunk/esb/java/modules/distribution/src/main/www/extensions/core/js: . mediators

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit r9343 - in trunk/esb/java/modules/distribution/src/main/www/extensions/core/js: . mediators

svn-9
Author: indika
Date: Wed Oct 31 05:26:12 2007
New Revision: 9343

Modified:
   trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js
   trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/xquery_mediator.js
Log:
fixed ESB_JAVA 292 - there is an issue with createesbelment method


Modified: trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js (original)
+++ trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js Wed Oct 31 05:26:12 2007
@@ -23,7 +23,7 @@
 
 function namevalidate(namestring) {
 
-    if(namestring.indexOf("'") == -1 && namestring.indexOf(" ") == -1 && namestring.indexOf("&") == -1 && namestring.indexOf('"') == -1) {
+    if (namestring.indexOf("'") == -1 && namestring.indexOf(" ") == -1 && namestring.indexOf("&") == -1 && namestring.indexOf('"') == -1) {
         return true;
     } else {
         return false;
@@ -86,8 +86,30 @@
     // ******************************************************
 
     var namewithnsprefix = filteredstring.split(" ", 1)[0];
-    if (namewithnsprefix.indexOf("<") != -1) namewithnsprefix = namewithnsprefix.substring(1, namewithnsprefix.length);
-    if (namewithnsprefix.indexOf("/>") != -1) namewithnsprefix = namewithnsprefix.substring(0, namewithnsprefix.length - 2);
+
+    //this return complete  element string if the element does not contain any " " char ..ex: <a>a</a>
+    if (namewithnsprefix != undefined && namewithnsprefix != null && namewithnsprefix.indexOf("<") != -1) {
+        if (namewithnsprefix.indexOf(">") == -1) {
+            // for element name like <a
+            namewithnsprefix = namewithnsprefix.substring(namewithnsprefix.indexOf("<") + 1, namewithnsprefix.length);
+        } else {
+            if (namewithnsprefix.indexOf("/>") != -1) {
+
+                if (namewithnsprefix.indexOf("/>") == (namewithnsprefix.indexOf(">") - 1)) {
+                    // for element name like <a/>
+                    namewithnsprefix = namewithnsprefix.substring(namewithnsprefix.indexOf("<") + 1, namewithnsprefix.indexOf("/>"));
+                } else {
+                    //for elemnt name like <a>a<b/></a>
+                    namewithnsprefix = namewithnsprefix.substring(namewithnsprefix.indexOf("<") + 1, namewithnsprefix.indexOf(">"));
+                }
+
+            } else {
+                // for element name like <a>a</a>
+                namewithnsprefix = namewithnsprefix.substring(namewithnsprefix.indexOf("<") + 1, namewithnsprefix.indexOf(">"));
+            }
+            // to track in case of element that has not contained " " char
+        }
+    }
     if (window.ActiveXObject) {
         var doc = new ActiveXObject("Microsoft.XMLDOM");
         doc.async = "false";
@@ -115,33 +137,33 @@
 function yuieditorpanel(paneltitle, panelbody, statusbartext, panelId, width) {
 
     var divcontrol;
-    if(panelId == "panelSequence") {
+    if (panelId == "panelSequence") {
         divcontrol = document.getElementById("sequencePanel");
     } else {
         divcontrol = document.getElementById("registryPanel");
     }
-//    var divcontrol = document.getElementById("divOverPanel");
+    //    var divcontrol = document.getElementById("divOverPanel");
     divcontrol.innerHTML = "";
     var id = "myPanel";
     var panelcontrol = document.createElement("div");
     if (panelId != null && panelId != undefined) {
         id = panelId;
     }
-    panelcontrol.setAttribute("id",id) ;
+    panelcontrol.setAttribute("id", id);
     panelcontrol.innerHTML = "<div class='hd'><div class='tl'></div>"
-            + "<span>" + paneltitle + "</span><div class='tr'></div></div>"
-            + "<div class='bd'>" + panelbody + "</div>"
-            + "<div id='statusbar' class='ft'>" + statusbartext + "</div>";
+        + "<span>" + paneltitle + "</span><div class='tr'></div></div>"
+        + "<div class='bd'>" + panelbody + "</div>"
+        + "<div id='statusbar' class='ft'>" + statusbartext + "</div>";
 
     divcontrol.appendChild(panelcontrol);
-//    panelcontrol.style.zIndex = 3;
+    //    panelcontrol.style.zIndex = 3;
     var esbpanel1 = new YAHOO.widget.Panel(id, {
         width:width, fixedcenter:true, visible:false, constraintoviewport:true });
     esbpanel1.render();
-//    initoverlaymanager();
-//    paneloverlaymanager.register(esbpanel1);
+    //    initoverlaymanager();
+    //    paneloverlaymanager.register(esbpanel1);
     divcontrol.style.display = "inline";
-//    paneloverlaymanager.showAll();
+    //    paneloverlaymanager.showAll();
     esbpanel1.show();
 }
 function transformXMLToString(xmlDoc, xslDocURL, objDiv) {
@@ -187,18 +209,18 @@
 }
 
 function ltrim(str) {
- for (var k=0; k<str.length && str.charAt(k)<=" " ; k++) ;
- return str.substring(k,str.length);
+    for (var k = 0; k < str.length && str.charAt(k) <= " "; k++) ;
+    return str.substring(k, str.length);
 }
 function rtrim(str) {
- for (var j=str.length-1; j>=0 && str.charAt(j)<=" " ; j--) ;
- return str.substring(0,j+1);
+    for (var j = str.length - 1; j >= 0 && str.charAt(j) <= " "; j--) ;
+    return str.substring(0, j + 1);
 }
 
 //This function accepts a String and trims the string in both sides of the string ignoring space characters
-function trim(stringValue){
-//   var trimedString = stringValue.replace( /^\s+/g, "" );
-//   return trimedString.replace( /\s+$/g, "" );
+function trim(stringValue) {
+    //   var trimedString = stringValue.replace( /^\s+/g, "" );
+    //   return trimedString.replace( /\s+$/g, "" );
     return ltrim(rtrim(stringValue));
 }
 
@@ -209,7 +231,7 @@
     };
 
     var warning = null;
-    switch(type) {
+    switch (type) {
         case TYPE_INFO:
             warning = new YAHOO.widget.SimpleDialog("esbwarning", {width:"350px", fixedcenter:true, visible:false, draggable:true, close:true, text:message, icon:YAHOO.widget.SimpleDialog.ICON_INFO, constraintoviewport: true, buttons:[ { text:"OK", handler:handleOK, isDefault:true }]});
             break;

Modified: trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/xquery_mediator.js
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/xquery_mediator.js (original)
+++ trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/xquery_mediator.js Wed Oct 31 05:26:12 2007
@@ -291,17 +291,11 @@
 function addvariable(position, propcount) {
     addvariableIndex(propcount);
     var qi = variablesindexs.length - 1 ;
-    //    var variable_parm = new Object();
-    //    variable_parm.qi = qi;
-    //    variable_parm.isinitpar = "false";
-    //    allvariables[allvariables.length] = variable_parm;
     var addth = false;
-    //    if (parseInt(propcount) == 0) {
     if (needthforprop) {
         addth = true;
         needthforprop = false;
     }
-    //    }
     var propertys = document.getElementById("variables");
     if (propertys != undefined && propertys != null) {
         var ths = propertys.getElementsByTagName("th");

_______________________________________________
Esb-java-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev