commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r367268 - in /jakarta/commons/proper/validator/trunk: src/javascript/org/apache/commons/validator/javascript/ xdocs/
Date Mon, 09 Jan 2006 10:54:05 GMT
Author: niallp
Date: Mon Jan  9 02:53:46 2006
New Revision: 367268

URL: http://svn.apache.org/viewcvs?rev=367268&view=rev
Log:
Prefix remaining JavaScript utility methods with "jcv_" to reduce the likelihood of clashes
with other libraries - validator still needs to be properly namespaced (as per Bug 38184).

Modified:
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
    jakarta/commons/proper/validator/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
         
-        var oByte = eval('new ' + retrieveFormName(form) + '_ByteValidations()');
+        var oByte = eval('new ' + jcv_retrieveFormName(form) + '_ByteValidations()');
 
         for (var x in oByte) {
             if (!jcv_verifyArrayElement(x, oByte[x])) {
@@ -42,7 +42,7 @@
                 }
 
                 if (value.length > 0) {
-                    if (!isDecimalDigits(value)) {
+                    if (!jcv_isDecimalDigits(value)) {
                         bValid = false;
                         if (i == 0) {
                             focusField = field;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oCreditCard = eval('new ' + retrieveFormName(form) +  '_creditCard()');
+        var oCreditCard = eval('new ' + jcv_retrieveFormName(form) +  '_creditCard()');
 
         for (var x in oCreditCard) {
             if (!jcv_verifyArrayElement(x, oCreditCard[x])) {
@@ -26,7 +26,7 @@
                  field.type == 'textarea') &&
                 (field.value.length > 0)  &&
                  field.disabled == false) {
-                if (!luhnCheck(field.value)) {
+                if (!jcv_luhnCheck(field.value)) {
                     if (i == 0) {
                         focusField = field;
                     }
@@ -46,8 +46,8 @@
      * This allows you to spot most randomly made-up or garbled credit card numbers immediately.
      * Reference: http://www.speech.cs.cmu.edu/~sburke/pub/luhn_lib.html
      */
-    function luhnCheck(cardNumber) {
-        if (isLuhnNum(cardNumber)) {
+    function jcv_luhnCheck(cardNumber) {
+        if (jcv_isLuhnNum(cardNumber)) {
             var no_digit = cardNumber.length;
             var oddoeven = no_digit & 1;
             var sum = 0;
@@ -65,7 +65,7 @@
         return false;
     }
 
-    function isLuhnNum(argvalue) {
+    function jcv_isLuhnNum(argvalue) {
         argvalue = argvalue.toString();
         if (argvalue.length == 0) {
             return false;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
        var i = 0;
        var fields = new Array();
  
-       var oDate = eval('new ' + retrieveFormName(form) +  '_DateValidations()');
+       var oDate = eval('new ' + jcv_retrieveFormName(form) +  '_DateValidations()');
 
        for (var x in oDate) {
             if (!jcv_verifyArrayElement(x, oDate[x])) {
@@ -65,7 +65,7 @@
                      }
                      var matched = dateRegexp.exec(value);
                      if(matched != null) {
-                        if (!isValidDate(matched[2], matched[1], matched[3])) {
+                        if (!jcv_isValidDate(matched[2], matched[1], matched[3])) {
                            if (i == 0) {
                                focusField = field;
                            }
@@ -103,7 +103,7 @@
                      }
                      var matched = dateRegexp.exec(value);
                      if(matched != null) {
-                         if (!isValidDate(matched[1], matched[2], matched[3])) {
+                         if (!jcv_isValidDate(matched[1], matched[2], matched[3])) {
                              if (i == 0) {
                                   focusField = field;
                              }
@@ -141,7 +141,7 @@
                      }
                      var matched = dateRegexp.exec(value);
                      if(matched != null) {
-                         if (!isValidDate(matched[3], matched[2], matched[1])) {
+                         if (!jcv_isValidDate(matched[3], matched[2], matched[1])) {
                              if (i == 0) {
                                  focusField = field;
                              }
@@ -170,7 +170,7 @@
        return bValid;
     }
     
-    function isValidDate(day, month, year) {
+    function jcv_isValidDate(day, month, year) {
 	    if (month < 1 || month > 12) {
             return false;
         }

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
 
-        var oEmail = eval('new ' + retrieveFormName(form) +  '_email()');
+        var oEmail = eval('new ' + jcv_retrieveFormName(form) +  '_email()');
 
         for (var x in oEmail) {
             if (!jcv_verifyArrayElement(x, oEmail[x])) {
@@ -27,7 +27,7 @@
                  field.type == 'textarea') &&
                 (field.value.length > 0) &&
                 field.disabled == false) {
-                if (!checkEmail(field.value)) {
+                if (!jcv_checkEmail(field.value)) {
                     if (i == 0) {
                         focusField = field;
                     }
@@ -46,7 +46,7 @@
      * Reference: Sandeep V. Tamhankar (stamhankar@hotmail.com),
      * http://javascript.internet.com
      */
-    function checkEmail(emailStr) {
+    function jcv_checkEmail(emailStr) {
         if (emailStr.length == 0) {
             return true;
         }

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oFloat = eval('new ' + retrieveFormName(form) +  '_FloatValidations()');
+        var oFloat = eval('new ' + jcv_retrieveFormName(form) +  '_FloatValidations()');
         for (var x in oFloat) {
             if (!jcv_verifyArrayElement(x, oFloat[x])) {
                 continue;
@@ -51,7 +51,7 @@
                     }
                     var noZeroString = joinedString.substring(zeroIndex,joinedString.length);
 
-                    if (!isAllDigits(noZeroString) || tempArray.length > 2) {
+                    if (!jcv_isAllDigits(noZeroString) || tempArray.length > 2) {
                         bValid = false;
                         if (i == 0) {
                             focusField = field;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
         
-        var oRange = eval('new ' + retrieveFormName(form) +  '_floatRange()');
+        var oRange = eval('new ' + jcv_retrieveFormName(form) +  '_floatRange()');
         for (var x in oRange) {
             if (!jcv_verifyArrayElement(x, oRange[x])) {
                 continue;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oRange = eval('new ' + retrieveFormName(form) +  '_intRange()');        
+        var oRange = eval('new ' + jcv_retrieveFormName(form) +  '_intRange()');        
         for (var x in oRange) {
             if (!jcv_verifyArrayElement(x, oRange[x])) {
                 continue;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oInteger = eval('new ' + retrieveFormName(form) +  '_IntegerValidations()');
+        var oInteger = eval('new ' + jcv_retrieveFormName(form) +  '_IntegerValidations()');
         for (var x in oInteger) {
             if (!jcv_verifyArrayElement(x, oInteger[x])) {
                 continue;
@@ -42,7 +42,7 @@
 
                 if (value.length > 0) {
 
-                    if (!isDecimalDigits(value)) {
+                    if (!jcv_isDecimalDigits(value)) {
                         bValid = false;
                         if (i == 0) {
                             focusField = field;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oMasked = eval('new ' + retrieveFormName(form) +  '_mask()');      
+        var oMasked = eval('new ' + jcv_retrieveFormName(form) +  '_mask()');      
         for (var x in oMasked) {
             if (!jcv_verifyArrayElement(x, oMasked[x])) {
                 continue;
@@ -29,7 +29,7 @@
                  (field.value.length > 0) &&
                  field.disabled == false) {
 
-                if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
+                if (!jcv_matchPattern(field.value, oMasked[x][2]("mask"))) {
                     if (i == 0) {
                         focusField = field;
                     }
@@ -45,6 +45,6 @@
         return isValid;
     }
 
-    function matchPattern(value, mask) {
+    function jcv_matchPattern(value, mask) {
        return mask.exec(value);
     }

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
Mon Jan  9 02:53:46 2006
@@ -15,7 +15,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oMaxLength = eval('new ' + retrieveFormName(form) +  '_maxlength()');       

+        var oMaxLength = eval('new ' + jcv_retrieveFormName(form) +  '_maxlength()');   
    
         for (var x in oMaxLength) {
             if (!jcv_verifyArrayElement(x, oMaxLength[x])) {
                 continue;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
Mon Jan  9 02:53:46 2006
@@ -15,7 +15,7 @@
         var i = 0;
         var fields = new Array();
 
-        var oMinLength = eval('new ' + retrieveFormName(form) +  '_minlength()');
+        var oMinLength = eval('new ' + jcv_retrieveFormName(form) +  '_minlength()');
 
         for (var x in oMinLength) {
             if (!jcv_verifyArrayElement(x, oMinLength[x])) {

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
Mon Jan  9 02:53:46 2006
@@ -13,7 +13,7 @@
         var i = 0;
         var fields = new Array();
 
-        var oRequired = eval('new ' + retrieveFormName(form) +  '_required()');
+        var oRequired = eval('new ' + jcv_retrieveFormName(form) +  '_required()');
 
         for (var x in oRequired) {
             if (!jcv_verifyArrayElement(x, oRequired[x])) {

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
Mon Jan  9 02:53:46 2006
@@ -12,7 +12,7 @@
         var i = 0;
         var fields = new Array();
  
-        var oShort = eval('new ' + retrieveFormName(form) +  '_ShortValidations()');
+        var oShort = eval('new ' + jcv_retrieveFormName(form) +  '_ShortValidations()');
 
         for (var x in oShort) {
             if (!jcv_verifyArrayElement(x, oShort[x])) {
@@ -42,7 +42,7 @@
                 }
 
                 if (value.length > 0) {
-                    if (!isDecimalDigits(value)) {
+                    if (!jcv_isDecimalDigits(value)) {
                         bValid = false;
                         if (i == 0) {
                             focusField = field;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
Mon Jan  9 02:53:46 2006
@@ -9,7 +9,7 @@
    * Retreive the name of the form
    * @param form The form validation is taking place on.
    */
-  function retrieveFormName(form) {
+  function jcv_retrieveFormName(form) {
 
       // Please refer to Bugs 31534, 35127, 35294, 37315 & 38159
       // for the history of the following code
@@ -93,7 +93,7 @@
    * Check a value only contains valid numeric digits
    * @param argvalue The value to check.
    */
-  function isAllDigits(argvalue) {
+  function jcv_isAllDigits(argvalue) {
       argvalue = argvalue.toString();
       var validChars = "0123456789";
       var startFrom = 0;
@@ -117,7 +117,7 @@
    * Check a value only contains valid decimal digits
    * @param argvalue The value to check.
    */
-  function isDecimalDigits(argvalue) {
+  function jcv_isDecimalDigits(argvalue) {
       argvalue = argvalue.toString();
       var validChars = "0123456789";
 

Modified: jakarta/commons/proper/validator/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/xdocs/changes.xml?rev=367268&r1=367267&r2=367268&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/validator/trunk/xdocs/changes.xml Mon Jan  9 02:53:46 2006
@@ -39,6 +39,11 @@
   <body>
 
     <release version="1.2.1 (alpha)" date="in SVN">
+      <action dev="niallp" type="fix">
+         Prefix remaining JavaScript utility methods with "jcv_" to reduce 
+         the likelihood of clashes with other libraries - validator still
+         needs to be properly namespaced (as per Bug 38184).
+      </action>
       <action dev="niallp" type="fix" issue="14471">
          Change JavaScript validators so that they don't fail when the
          field is not present on the form.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message