From: Michael M Slusarz Date: Thu, 10 Dec 2009 01:06:24 +0000 (-0700) Subject: Add equal/notequal search criteria to ViewPort X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3b5bb908fb77f72d2a864d273ebee0f8dcd9f4a5;p=horde.git Add equal/notequal search criteria to ViewPort --- diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index 9ffbf3ee9..9f1dc290b 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -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; } diff --git a/imp/js/ViewPort.js b/imp/js/ViewPort.js index 849277420..b0985ae7e 100644 --- a/imp/js/ViewPort.js +++ b/imp/js/ViewPort.js @@ -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); }