<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>controllers/js_validate_controller.php</filename>
    </added>
    <added>
      <filename>js_validate_app_controller.php</filename>
    </added>
    <added>
      <filename>js_validate_app_model.php</filename>
    </added>
    <added>
      <filename>models/js_validate.php</filename>
    </added>
    <added>
      <filename>tests/cases/models/js_validate.test.php</filename>
    </added>
    <added>
      <filename>vendors/js/unit_tests.js</filename>
    </added>
    <added>
      <filename>views/js_validate/test.ctp</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -42,7 +42,7 @@
               return true;
             }
             
-            if (!$.fn.validate.validateRule(field, val, this['rule'], this['negate'])) {
+            if (!$.fn.validate.validateRule(val, this['rule'], this['negate'])) {
               errors.push(this['message']);
               
               $.fn.validate.setError(field, this['message']);
@@ -65,33 +65,34 @@
     });
   };
   
-  $.fn.validate.validateRule = function(field, val, rule, negate) {
+  $.fn.validate.validateRule = function(val, rule, negate) {
+    if(negate == undefined) {
+      negate = false;
+    }
+        
     //handle custom functions
-    if(typeof rule == 'object' &amp;&amp; $.fn.validate[rule.rule] != undefined) {
-      return $.fn.validate[rule.rule](val, rule.params);
+    if(typeof rule == 'object') {
+      if($.fn.validate[rule.rule] != undefined) {
+        return $.fn.validate[rule.rule](val, rule.params);
+      } else {
+        return true;
+      }
     }
-    
+
     //handle regex rules
     if (negate &amp;&amp; val.match(eval(rule))) {
       return false;
-    } else if (!val.match(eval(rule))) {
-      return false;
-    }
-    
-    return true;
-  };
-
-  $.fn.validate.range = function(val, params) {
-    if (val &lt; parseInt(params[0])) {
-      return false;
-    }
-    if (val &gt; parseInt(params[1])) {
+    } else if (!negate &amp;&amp; !val.match(eval(rule))) {
       return false;
     }
     
     return true;
   };
   
+  $.fn.validate.boolean = function(val) {
+    return $.fn.validate.inList(val, [0, 1, '0', '1', true, false]);
+  }
+    
   $.fn.validate.comparison = function(val, params) {
     if(val == &quot;&quot;) {
       return false;
@@ -109,6 +110,27 @@
     return false;
   };
   
+  $.fn.validate.inList = function(val, params) {
+    if(params != null) {
+      if($.inArray(val, params) == -1) {
+        return false;
+      }
+    }
+    
+    return true;
+  }
+  
+  $.fn.validate.range = function(val, params) {
+    if (val &lt; parseInt(params[0])) {
+      return false;
+    }
+    if (val &gt; parseInt(params[1])) {
+      return false;
+    }
+    
+    return true;
+  };
+  
   $.fn.validate.multiple = function(val, params) {
     if(typeof val != &quot;object&quot; || val == null) {
       return false;</diff>
      <filename>vendors/js/jquery.validation.js</filename>
    </modified>
    <modified>
      <diff>@@ -20,11 +20,6 @@ if (!defined('VALID_IP_JS')) {
   define('VALID_IP_JS', '/^[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}$/');
 }
 
-//list taken from /cake/libs/validation.php line 497
-if (!defined('DEFAULT_VALIDATION_EXTENSIONS')) {
-  define('DEFAULT_VALIDATION_EXTENSIONS', 'gif,jpeg,png,jpg');
-}
-
 class ValidationHelper extends Helper {
   var $helpers = array('Javascript');
 
@@ -41,16 +36,11 @@ class ValidationHelper extends Helper {
     //load the whitelist
     $this-&gt;whitelist = Configure::read('javascriptValidationWhitelist');
 
-    //catch the form submit
-    if ($options['form']) {
-      $js[] = sprintf('$(function() { $(&quot;%s&quot;).validate() });', $options['form']);
-    }
-
     $validation = array();
     if (!is_array($modelNames)) {
       $modelNames = array($modelNames);
     }
-    
+
     //filter the rules to those that can be handled with JavaScript
     foreach($modelNames as $modelName) {
       $model = classRegistry::init($modelName);
@@ -59,7 +49,7 @@ class ValidationHelper extends Helper {
         if (array_intersect(array('rule', 'allowEmpty', 'on', 'message', 'last'), array_keys($validators))) {
           $validators = array($validators);
         }
-        
+
         foreach($validators as $key =&gt; $validator) {
           $rule = null;
 
@@ -88,9 +78,9 @@ class ValidationHelper extends Helper {
                           'message' =&gt; __($validator['message'], true)
                          );
 
-						if (isset($validator['last']) &amp;&amp; $validator['last'] === true) {
-						    $temp['last'] = true;
-						} 
+            if (isset($validator['last']) &amp;&amp; $validator['last'] === true) {
+              $temp['last'] = true;
+            }
 
             if (isset($validator['allowEmpty']) &amp;&amp; $validator['allowEmpty'] === true) {
               $temp['allowEmpty'] = true;
@@ -108,10 +98,14 @@ class ValidationHelper extends Helper {
       }
     }
 
-    $js = sprintf('$(function() { $(&quot;%s&quot;).validate(%s, %s) });',
-                  $options['form'],
-                  $this-&gt;Javascript-&gt;object($validation),
-                  $this-&gt;Javascript-&gt;object($pluginOptions));
+    if ($options['form']) {
+      $js = sprintf('$(function() { $(&quot;%s&quot;).validate(%s, %s) });',
+                    $options['form'],
+                    $this-&gt;Javascript-&gt;object($validation),
+                    $this-&gt;Javascript-&gt;object($pluginOptions));
+    } else {
+      return $this-&gt;Javascript-&gt;object($validation);
+    }
 
     if ($options['inline']) {
       return sprintf($this-&gt;Javascript-&gt;tags['javascriptblock'], $js);
@@ -139,6 +133,30 @@ class ValidationHelper extends Helper {
       $rule = $rule[0];
     }
 
+    if ($rule == 'comparison') {
+      $params[0] = str_replace(array(' ', &quot;\t&quot;, &quot;\n&quot;, &quot;\r&quot;, &quot;\0&quot;, &quot;\x0B&quot;), '', strtolower($params[0]));
+      switch ($params[0]) {
+        case 'isgreater':
+          $params[0] = '&gt;';
+          break;
+        case 'isless':
+          $params[0] = '&lt;';
+          break;
+        case 'greaterorequal':
+          $params[0] = '&gt;=';
+          break;
+        case 'lessorequal':
+          $params[0] = '&lt;=';
+          break;
+        case 'equalto':
+          $params[0] = '==';
+          break;
+        case 'notequal':
+          $params[0] = '!=';
+          break;
+      }
+    }
+
     //Certain Cake built-in validations can be handled with regular expressions,
     //but aren't on the Cake side.
     switch ($rule) {
@@ -146,15 +164,29 @@ class ValidationHelper extends Helper {
         return '/^[0-9A-Za-z]+$/';
       case 'between':
         return sprintf('/^.{%d,%d}$/', $params[0], $params[1]);
+      case 'boolean':
+        return array('rule' =&gt; 'boolean');
       case 'date':
         //Some of Cake's date regexs aren't JavaScript compatible. Skip for now
-        return false;
+        if (!empty($params[0])) {
+          $params = $params[0];
+        } else {
+          $params = 'ymd';
+        }
+        return array('rule' =&gt; 'date', 'params' =&gt; $params);
       case 'email':
         return VALID_EMAIL_JS;
       case 'equalTo':
         return sprintf('/^%s$/', $params[0]);
       case 'extension':
-        return sprintf('/\.(%s)$/', implode('|', explode(',', DEFAULT_VALIDATION_EXTENSIONS)));
+        if (empty($params[0])) {
+          $params = array('gif', 'jpeg', 'png', 'jpg');
+        } else {
+          $params = $params[0];
+        }
+        return sprintf('/\.(%s)$/', implode('|', $params));
+      case 'inList':
+        return array('rule' =&gt; 'inList', 'params' =&gt; $params[0]);
       case 'ip':
         return VALID_IP_JS;
       case 'minLength':
@@ -163,7 +195,11 @@ class ValidationHelper extends Helper {
         return sprintf('/^.{0,%d}$/', $params[0]);
       case 'money':
         //The Cake regex for money was giving me issues, even within PHP.  Skip for now
-        return false;
+        return array('rule' =&gt; 'money');
+      case 'multiple':
+        $defaults = array('in' =&gt; null, 'max' =&gt; null, 'min' =&gt; null);
+        $params = array_merge($defaults, $params[0]);
+        return array('rule' =&gt; 'multiple', 'params' =&gt; $params);
       case 'numeric':
         //Cake uses PHP's is_numeric function, which actually accepts a varied input
         //(both +0123.45e6 and 0xFF are valid) then what is allowed in this regular expression.
@@ -175,10 +211,6 @@ class ValidationHelper extends Helper {
         //Don't think there is a way to do this with a regular expressions,
         //so we'll handle this with plain old javascript
         return array('rule' =&gt; $rule, 'params' =&gt; array($params[0], $params[1]));
-      case 'multiple':
-        $defaults = array('in' =&gt; null, 'max' =&gt; null, 'min' =&gt; null);
-        $params = array_merge($defaults, $params[0]);
-        return array('rule' =&gt; 'multiple', 'params' =&gt; $params);
     }
 
     //try to lookup the regular expression from
@@ -193,7 +225,7 @@ class ValidationHelper extends Helper {
       }
     }
 
-    if($regex) {
+    if ($regex) {
       //special handling
       switch ($rule) {
         case 'postal':
@@ -205,7 +237,7 @@ class ValidationHelper extends Helper {
       }
       return $regex;
     }
-    
+
     return array('rule' =&gt; $rule, 'params' =&gt; $params);
   }
 }</diff>
      <filename>views/helpers/validation.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9cda6e02e740154ae85681027e9f065ddb4e970b</id>
    </parent>
  </parents>
  <author>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </author>
  <url>http://github.com/javierm/js_validate/commit/722cb7a2b3c51d09835f7c16bcd038556dac5e46</url>
  <id>722cb7a2b3c51d09835f7c16bcd038556dac5e46</id>
  <committed-date>2009-05-01T18:53:30-07:00</committed-date>
  <authored-date>2009-05-01T18:53:30-07:00</authored-date>
  <message>added a ton of unit test</message>
  <tree>0d82a419ed4e3cdb520e1e9026b7fc0a7c841c61</tree>
  <committer>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </committer>
</commit>
