[Rt-commit] rt branch, queue-like-search, updated. rt-4.2.9-2-ga3c0a96

Dave Goehrig dave at bestpractical.com
Thu Dec 15 13:37:03 EST 2016


The branch, queue-like-search has been updated
       via  a3c0a968e4746664e8e5c2056228798d6b555bf8 (commit)
      from  4016c4c40fe70dd8010aa7e3efced4f51b89fd0d (commit)

Summary of changes:
 lib/RT/Tickets.pm                     |  5 ++---
 share/html/Search/Elements/PickBasics | 37 +++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit a3c0a968e4746664e8e5c2056228798d6b555bf8
Author: Dave Goehrig <dave at bestpractical.com>
Date:   Thu Dec 15 13:36:49 2016 -0500

    search for rt & rtir w/ js

diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index fda767b..bc0ef72 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -730,8 +730,7 @@ sub _QueueLimit {
     my $alias;
 
     if ($op eq 'LIKE' || $op eq 'NOT LIKE') {
-        $alias = $sb->Join(
-            TYPE   => 'RIGHT',
+        $alias = $sb->{_sql_aliases}{queues} ||= $sb->Join(
             ALIAS1 => 'main',
             FIELD1 => 'Queue',
             TABLE2 => 'Queues',
@@ -739,7 +738,7 @@ sub _QueueLimit {
         );
 
         return $sb->Limit(
-           LEFTJOIN      => $alias,
+           ALIAS         => $alias,
            FIELD         => 'Name',
            OPERATOR      => $op,
            VALUE         => $value,
diff --git a/share/html/Search/Elements/PickBasics b/share/html/Search/Elements/PickBasics
index 006422d..5174ed4 100644
--- a/share/html/Search/Elements/PickBasics
+++ b/share/html/Search/Elements/PickBasics
@@ -226,6 +226,43 @@ my @lines = (
 $m->callback( Conditions => \@lines );
 
 </%INIT>
+
+<script type="text/javascript">
+    jQuery(function() {
+
+    // move the actual value to a hidden value, and shadow the others
+    var hidden = jQuery('<input>').attr('type','hidden').attr('name','ValueOfQueue')
+
+    // change the selector's name, but preserve the values, we'll set value via js
+    var selector = jQuery("[name='ValueOfQueue']");
+
+    // rename the selector so we don't get an extra term in the query
+    selector[0].name = "";
+    selector.bind('change',function() {
+        hidden[0].value = selector[0].value;
+    });
+
+    // create a text input box and hide it for use with matches / doesn't match
+    // NB: if you give text a name it will add an additional term to the query!
+    var text = jQuery('<input>').attr('type','text');
+    text.hide();
+    text.bind('change',function() {
+        hidden[0].value = text[0].value;
+    });
+
+    // hook the op field so that we can swap between the two input types
+    var op = jQuery("[name='QueueOp']");
+    op.bind('change',function() {
+        text.toggle()
+        selector.toggle()
+    })
+    op[0].value = "=";	// select "is" by default rather than "match"
+
+    // add the fields to the DOM
+    selector.before(hidden);
+    selector.after(text);
+    });
+</script>
 <%ARGS>
 %queues => ()
 </%ARGS>

-----------------------------------------------------------------------


More information about the rt-commit mailing list