Add equal/notequal search criteria to ViewPort
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 10 Dec 2009 01:06:24 +0000 (18:06 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 15 Dec 2009 00:49:20 +0000 (17:49 -0700)
imp/js/DimpBase.js
imp/js/ViewPort.js

index 9ffbf3e..9f1dc29 100644 (file)
@@ -2499,7 +2499,7 @@ var DimpBase = {
         // Make sure that any given row is not deleted more than once. Need to
         // explicitly mark here because message may already be flagged deleted
         // when we load page (i.e. switching to using trash folder).
-        vs = vs.search({ isdel: { not: [ true ] } });
+        vs = vs.search({ isdel: { notequal: [ true ] } });
         if (!vs.size()) {
             return;
         }
index 8492774..b0985ae 100644 (file)
@@ -1596,7 +1596,9 @@ ViewPort_Selection = Class.create({
     // params = (Object) Key is search key, value is object -> key of object
     // must be the following:
     //   equal - Matches any value contained in the query array.
-    //   not - Matches any value not contained in the query array.
+    //   include - Matches if this value is contained within the array.
+    //   notequal - Matches any value not contained in the query array.
+    //   notinclude - Matches if this value is not contained within the array.
     //   regex - Matches the RegExp contained in the query.
     search: function(params)
     {
@@ -1608,10 +1610,15 @@ ViewPort_Selection = Class.create({
                     // s.key = search type; s.value = search query
                     switch (s.key) {
                     case 'equal':
-                    case 'not':
+                    case 'notequal':
                         var r = i[k.key] && s.value.include(i[k.key]);
                         return (s.key == 'equal') ? r : !r;
 
+                    case 'include':
+                    case 'notinclude':
+                        var r = i[k.key] && Object.isArray(i[k.key]) && i[k.key].include(s.value);
+                        return (s.key == 'include') ? r : !r;
+
                     case 'regex':
                         return i[k.key].match(s.value);
                     }