myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r380695 - /myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/statechangednotifier/resource/stateChangedNotifier.js
Date Fri, 24 Feb 2006 15:56:58 GMT
Author: werpu
Date: Fri Feb 24 07:56:56 2006
New Revision: 380695

URL: http://svn.apache.org/viewcvs?rev=380695&view=rev
Log:
fixed a bug... the links were rendered invalid in a non state changed condition

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/statechangednotifier/resource/stateChangedNotifier.js

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/statechangednotifier/resource/stateChangedNotifier.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/statechangednotifier/resource/stateChangedNotifier.js?rev=380695&r1=380694&r2=380695&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/statechangednotifier/resource/stateChangedNotifier.js
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/statechangednotifier/resource/stateChangedNotifier.js
Fri Feb 24 07:56:56 2006
@@ -16,11 +16,10 @@
  */
 dojo.require("dojo.debug");
 dojo.require("dojo.html");
-/*global exclusion list singleton which keeps track of all exclusions over all entire forms.
-		we cannot allow that some predefined exclusions
-		are rendered invalid by another tag
-*/
-var myfaces_stateChange_globalExclusionList = new Array();
+var  myfaces_stateChange_globalExclusionList = new Array();
+
+
+
 /**
 * central function definition for the state change notifier
 */
@@ -33,7 +32,14 @@
     this.arrCommandIds = new Array();
     this.objectsToConfirmList = new Array();
     this.objectsToConfirmBeforeExclusion = new Array();
+    /*global exclusion list singleton which keeps track of all exclusions over all entire
forms.
+		we cannot allow that some predefined exclusions
+		are rendered invalid by another tag
+	*/
 }
+
+
+
 /**
 * prepares the notifier entry fields
 * and trigger filters
@@ -57,10 +63,10 @@
             myfaces_stateChange_globalExclusionList.push(newIds[cnt - globalExclLen]);
             this.arrCommandIds.push(newIds[cnt - globalExclLen]);
         }
-        this.addObjectsToConfirmList("a", null);
-        this.addObjectsToConfirmList("input", "button");
-        this.addObjectsToConfirmList("input", "submit");
-        this.addObjectsToConfirmList("button", null);
+        this.addObjectsToConfirmList("a",null);
+        this.addObjectsToConfirmList("input","button");
+        this.addObjectsToConfirmList("input","submit");
+        this.addObjectsToConfirmList("button",null);
         this.putConfirmExcludingElements();
     }
 };
@@ -79,11 +85,12 @@
     for (var i = 0; i < arrElements.length; i += 1) {
         var elementId = arrElements[i].id;
         var onclick = arrElements[i].onclick;
-        if (tagType === null || (tagType !== null && arrElements[i].type === tagType))
{
-            if (elementId !== null && onclick !== null && elementId !== "")
{
-                this.objectsToConfirmBeforeExclusion.push(elementId);
-            }
-        }
+     
+        if(tagType === null || (tagType !== null && arrElements[i].type === tagType))
{
+	        if (elementId !== null && onclick !== null && elementId !== "")
{
+	            this.objectsToConfirmBeforeExclusion.push(elementId);
+	        }
+	    }
     }
 };
 org_apache_myfaces_StateChangedNotifier.prototype.putConfirmExcludingElements = function
() {
@@ -92,7 +99,7 @@
         if (!this.isElementExcluded(elementId)) {
             this.objectsToConfirmList.push(elementId);
         } else {
-            this.removeConfirmInElement(elementId); //remove old includes from the list if
we get one 
+        	this.removeConfirmInElement(elementId); //remove old includes from the list if we
get one 
         }
     }
     for (var cnt2 = 0; cnt2 < this.objectsToConfirmList.length; cnt2 += 1) {
@@ -127,15 +134,16 @@
             //if (!confirm(message)) return false;
         return confirm(this.message);
     }
-    return false;
+    return true;
 };
 org_apache_myfaces_StateChangedNotifier.prototype.removeConfirmInElement = function (commandId)
{
     var command = dojo.byId(commandId);
-    var oldOnClick = command.getAttribute("old_onclick");
-    if (oldOnClick !== null) {
-        command.setAttribute("onclick", oldOnClick);
-    }
-};
+	var oldOnClick = command.getAttribute("old_onclick");
+	
+	if(oldOnClick !== null) {
+		command.setAttribute("onclick",oldOnClick);
+	}	
+}
 org_apache_myfaces_StateChangedNotifier.prototype.putConfirmInElement = function (commandId)
{
     var command = dojo.byId(commandId);
     if (command !== null) {
@@ -146,6 +154,7 @@
             onclickstr = onclickstr.replace(/function anonymous\(\)/, "");
             onclickstr = "if (" + this.notifierName + ".showMessage()) { " + onclickstr +
" }";
             command.setAttribute("onclick", new Function("", onclickstr));
+            
         } else {
             command.setAttribute("onclick", "if (" + this.notifierName + ".showMessage())
{ " + onclick + " }");
         }



Mime
View raw message