[Rt-commit] [rtir] 01/01: Added support for search by lifecycle to RTIR's query builder

Jesse Vincent jesse at bestpractical.com
Tue Mar 17 20:01:52 EDT 2015


This is an automated email from the git hooks/post-receive script.

jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.

commit 8b2ecdc6104c6d2852634a66c237d5318319639a
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Mar 17 17:01:17 2015 -0700

    Added support for search by lifecycle to RTIR's query builder
---
 .../RTIR/Search/Elements/PickBasics/Default        | 14 +++++++
 .../Default => RTIR/Elements/SelectRTIRLifecycle}  | 48 ++++++++++------------
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/html/Callbacks/RTIR/Search/Elements/PickBasics/Default b/html/Callbacks/RTIR/Search/Elements/PickBasics/Default
index c411701..5b24556 100644
--- a/html/Callbacks/RTIR/Search/Elements/PickBasics/Default
+++ b/html/Callbacks/RTIR/Search/Elements/PickBasics/Default
@@ -67,6 +67,20 @@ foreach( @$Conditions ) {
         } 
     }
 }
+
+unshift @$Conditions, {
+        Name => 'Lifecycle',
+        Field => loc('Lifecycle'),
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectBoolean',
+            Arguments => { TrueVal=> '=', FalseVal => '!=' },
+        },    
+        Value =>  {Type => 'component',
+                     Path => '/RTIR/Elements/SelectRTIRLifecycle',
+                    Arguments => { ShowNullOption => 1 }}
+
+};
 </%INIT>
 <%ARGS>
 $Conditions => [],
diff --git a/html/Callbacks/RTIR/Search/Elements/PickBasics/Default b/html/RTIR/Elements/SelectRTIRLifecycle
similarity index 64%
copy from html/Callbacks/RTIR/Search/Elements/PickBasics/Default
copy to html/RTIR/Elements/SelectRTIRLifecycle
index c411701..13a2385 100644
--- a/html/Callbacks/RTIR/Search/Elements/PickBasics/Default
+++ b/html/RTIR/Elements/SelectRTIRLifecycle
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
 %#                                          <sales at bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -45,29 +45,23 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<%INIT>
-my $path = $r->path_info;
-return unless $path =~ m{^/RTIR};
-foreach( @$Conditions ) {
-    if (($_->{'Name'}||'') eq 'Queue' ) {
-    $_->{'Value'}{'Path'} = '/RTIR/Elements/SelectRTIRQueue';
-        $_->{'Value'}{'Arguments'}{'ShowNullOption'} = 1;
-    if (defined $m->{'RTIR_ConstituencyFilter'}) {
-        $_->{'Value'}{'Arguments'}{'Constituency'} = $m->{'RTIR_ConstituencyFilter'};
-        $_->{'Value'}{'Arguments'}{'LimitToConstituency'} = 1;
-        if (defined $m->request_args->{'Lifecycle'})  {
-             $_->{'Value'}{'Arguments'}{'Lifecycle'} = $m->request_args->{'Lifecycle'};
-        }
-    }}
-    elsif (($_->{'Name'}||'') eq 'Status' ) {
-        $_->{'Value'}{'Path'} = '/Elements/SelectStatus';
-        if (!defined $_{'Value'}{'Queues'} && defined $m->request_args->{'Lifecycle'}){
-            $_->{'Value'}{'Arguments'}{'Lifecycles'} = 
-                [RT::Lifecycle->Load($m->request_args->{'Lifecycle'})]
-        } 
-    }
-}
-</%INIT>
-<%ARGS>
-$Conditions => [],
-</%ARGS>
+<select name="<%$Name%>" class="<%$Class%>">
+%     if ($ShowNullOption) {
+  <option value=""><% $DefaultLabel %></option>
+%     }
+%     for my $lifecycle (RT::IR->Lifecycles) {
+  <option value="<% $lifecycle %>"\
+% if ($lifecycle eq ($Default||'')) {
+ selected="selected"\
+% }
+><%RT::IR::FriendlyLifecycle($lifecycle) %>\
+</option>
+%     }
+</select>
+<%args>
+$ShowNullOption => 0
+$Name => undef
+$DefaultLabel => "-"
+$Default => 0
+$Class => 'select-lifecycle'
+</%args>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list