r4338 considerGivenConstraint: ability to check context tags
authorAlexey Andriyanov <alan@al-an.info>
Tue, 15 Mar 2011 11:55:30 +0000 (11:55 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Tue, 15 Mar 2011 11:55:30 +0000 (11:55 +0000)
wwwroot/inc/functions.php

index 20940414e6af6912185a135990ea8acb085f1096..38ca7b511cde65c728a7821e2b8d34665f182f6c 100644 (file)
@@ -2610,6 +2610,7 @@ function considerConfiguredConstraint ($cell, $varname)
 
 // Tell, if the given arbitrary RackCode text addresses the given record
 // (an empty text matches any record).
+// An undefined $cell means current context.
 function considerGivenConstraint ($cell, $filtertext)
 {
        if ($filtertext == '')
@@ -2617,7 +2618,10 @@ function considerGivenConstraint ($cell, $filtertext)
        $parse = spotPayload ($filtertext, 'SYNT_EXPR');
        if ($parse['result'] != 'ACK')
                throw new InvalidRequestArgException ('filtertext', $filtertext, 'RackCode parsing error');
-       return judgeCell ($cell, $parse['load']);
+       if (isset ($cell))
+               return judgeCell ($cell, $parse['load']);
+       else
+               return judgeContext ($parse['load']);
 }
 
 // Return list of records in the given realm, which conform to