From: senator Date: Mon, 18 Apr 2011 15:15:20 +0000 (-0400) Subject: make the "Your Expression" preview more accurate by X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fe0c574d0fd474cf1145786ed959ceb4df840874;p=contrib%2FConifer.git make the "Your Expression" preview more accurate by showing "NOT (a OR b OR c)" instead of "(a NOR b NOR c)". This really only matters in the case of a single clause inside the negated expression: Now such a thing shows up as "NOT (a)" versus "(a)" --- diff --git a/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js b/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js index 2212dcdfe5..0c5852838d 100644 --- a/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js +++ b/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js @@ -231,9 +231,12 @@ function NodeEditor() { } function render_vmsp_label(point, minimal) { - /* quick and dirty */ + /* "minimal" mode has two implications: + * 1) for svf, only show the code, not the longer label. + * 2) for bool ops, completely ingore negation + */ if (point.bool_op()) { - return (openils.Util.isTrue(point.negate()) ? "N" : "") + + return (!minimal && openils.Util.isTrue(point.negate()) ? "N" : "") + point.bool_op(); } else if (point.svf()) { return (openils.Util.isTrue(point.negate()) ? "NOT " : "") + ( @@ -361,8 +364,9 @@ function redraw_expression_preview() { function render_expression_preview(r) { if (r.children().length) { - return "(" + r.children().map(render_expression_preview).join( - " " + render_vmsp_label(r) + " " + return (openils.Util.isTrue(r.negate()) ? "NOT " : "") + + "(" + r.children().map(render_expression_preview).join( + " " + render_vmsp_label(r, true /* minimal */) + " " ) + ")"; } else if (!r.bool_op()) { return render_vmsp_label(r, true /* minimal */);