[Rt-commit] rtir branch, 2.9-trunk, updated. 2.6.1rc1-400-gd4c33c4

Ruslan Zakirov ruz at bestpractical.com
Tue Sep 27 14:49:23 EDT 2011


The branch, 2.9-trunk has been updated
       via  d4c33c4b0620d76d151b0358d1baed16b665b939 (commit)
       via  2a5df6b2e52f6c7dbad168f9b0ab841901a942cf (commit)
       via  38afef0e0bd0e80d947f315962c5613884da4cb6 (commit)
       via  8b3f3857583681d775b17a5f4340305828553a6d (commit)
       via  2419efbf914f1a09e426b32b3cd54bc40f571664 (commit)
       via  f8765515d29b5d2761b5007ed281f26366e53024 (commit)
      from  97ee90aa635f18933115914c54d581642a740143 (commit)

Summary of changes:
 html/Callbacks/RTIR/Elements/Tabs/Privileged |   54 +++++++++++++++--
 html/RTIR/Incident/BulkAbandon.html          |   16 ++---
 html/RTIR/Link/FromIncident/index.html       |    1 -
 html/RTIR/Link/ToIncident/index.html         |    1 -
 html/RTIR/Report/BulkReject.html             |   16 ++---
 html/RTIR/Search/Elements/ShowResults        |   82 ++++----------------------
 6 files changed, 73 insertions(+), 97 deletions(-)

- Log -----------------------------------------------------------------
commit f8765515d29b5d2761b5007ed281f26366e53024
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 27 15:36:24 2011 +0400

    move additional search links into page's menu

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 9ebef33..ca4ebbe 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -82,7 +82,7 @@ my $re_rtir_types = '(?:'. join( '|', map "\Q$_\E", RT::IR->Types ) .')';
 
 my $search_arguments = sub {
     my %res = ();
-    my @query_fields = qw(Query Format RowPerPage Page OrderBy Order);
+    my @query_fields = qw(Query Format RowsPerPage Page OrderBy Order);
     if ( my $refined = $m->notes('RefinedSearch') ) {
         @res{ @query_fields } = @{ $refined->{'query'} }{ @query_fields };
     } else {
@@ -379,6 +379,8 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         path => "/RTIR/Display.html?id=$id",
     );
 } elsif ( $request_path =~ m{^/RTIR/(Search/|Incident/BulkAbandon\.html$|Report/BulkReject\.html$)} ) {
+    my %args = $search_arguments->();
+
     my $queue = $args->{'Queue'} || '';
     unless ( $queue ) {
         if ( $request_path =~ /Incident/ ) {
@@ -389,15 +391,12 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         }
     }
     unless ( $queue ) {
-        my (undef, @queues) = RT::IR->OurQuery( $args->{'Query'} );
+        my (undef, @queues) = RT::IR->OurQuery( $args{'Query'} );
         $queue = $queues[0] if @queues == 1;
     }
     my $type = RT::IR::TicketType( Queue => $queue ) || '';
 
-    my %args = (
-        $search_arguments->(),
-        Queue => $queue,
-    );
+    $args{'Queue'} = $queue if $queue;
 
     PageMenu()->child(
         link => title => loc('Show Results'),
@@ -432,6 +431,49 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
             path => "/RTIR/Report/BulkReject.html?". $query_string->( %args ),
         );
     }
+    PageMenu()->child(
+        chart => title => loc('Chart'),
+        path => "/Search/Chart.html?". $query_string->( %args ),
+    );
+
+    my $more = PageMenu->child( more => title => loc('Feeds') );
+    $more->child(
+        spreadsheet => title => loc('Spreadsheet'),
+        path => "/Search/Results.tsv?". $query_string->( %args ),
+    );
+
+    my $RSSPath = join '/', map $m->interp->apply_escapes( $_, 'u' ),
+        $session{'CurrentUser'}->UserObj->Name,
+        $session{'CurrentUser'}->UserObj->GenerateAuthString(
+            join '', map $args{$_}, qw(Query Order OrderBy)
+        )
+    ;
+    $more->child(
+        rss => title => loc('RSS'),
+        path => "/NoAuth/rss/$RSSPath/?". $query_string->(
+            Query => $args{Query}, Order => $args{Order}, OrderBy => $args{OrderBy}
+        ),
+    );
+
+    my $ical_path = join '/', map $m->interp->apply_escapes($_, 'u'),
+        $session{'CurrentUser'}->UserObj->Name,
+        $session{'CurrentUser'}->UserObj->GenerateAuthString( $args{Query} ),
+        $args{Query}
+    ;
+    $more->child( ical => title => loc('iCal') => path => '/NoAuth/iCal/'.$ical_path);
+
+    if ( $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System ) ) {
+        my $shred_args = $query_string->(
+            search          => 1,
+            plugin          => 'Tickets',
+            'Tickets:query' => $args{'Query'},
+            'Tickets:limit' => $args{'RowsPerPage'},
+        );
+        $more->child(
+            shredder => title => loc('Shredder'),
+            path => '/Admin/Tools/Shredder/?' . $shred_args
+        );
+    }
 } elsif ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?Split\.html$} ) {
     my $id = $args->{'Split'};
 
diff --git a/html/RTIR/Search/Elements/ShowResults b/html/RTIR/Search/Elements/ShowResults
index f7d783a..da50beb 100644
--- a/html/RTIR/Search/Elements/ShowResults
+++ b/html/RTIR/Search/Elements/ShowResults
@@ -1,70 +1,4 @@
 <% $result |n %>
-
-% if ( $ShowListActions ) {
-<div align="right">
-<%PERL>
-# this would do well as a Callback
-my $QueryString = $m->comp('/Elements/QueryString',
-                            Queue     => $Queue,
-                            Query     => $Query,
-                            Format    => $Format,
-                            Rows      => $Rows,
-                            OrderBy   => $OrderBy,
-                            Order     => $Order,
-                            Page      => $Page,
-                          );
-my $ShortQueryString = $m->comp('/Elements/QueryString',
-                            Queue     => $Queue,
-                            Query     => $Query,
-                            Rows      => $Rows,
-                            Page      => $Page,
-                            OrderBy   => $OrderBy,
-                            Order     => $Order,
-                          );
-</%PERL>
-
-%# XXX: this code is duplicated in html/Search/Elements/ResultViews (RT)
-
-% if ( $Queue eq 'Incident Reports' ) {
-%   if ( $ShowNavigation ) {
-<a href="<% RT->Config->Get('WebPath') %>/RTIR/Report/BulkReject.html?<% $ShortQueryString %>"><&|/l&>Bulk Reject</&></a> |
-%   } else {
-<a href="<% RT->Config->Get('WebPath') %>/RTIR/Report/BulkReject.html?<% $m->comp('/Elements/QueryString',
-    Queue     => $Queue,
-    Query     => $Query,
-    OrderBy   => $OrderBy,
-    Order     => $Order,
-) %>"><&|/l&>Bulk Reject</&></a> |
-%   }
-% }
-
-<a href="<% RT->Config->Get('WebPath') %>/Search/Results.tsv?<% $ShortQueryString %>"><&|/l&>spreadsheet</&></a> |
-<a href="<% RT->Config->Get('WebPath') %>/Search/Results.rdf?<% $ShortQueryString %>"><&|/l&>RSS</&></a> |
-
-<%PERL>
-if ( $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => $RT::System ) ) {
-    my $query_string = $m->comp('/Elements/QueryString',
-        Search => 1,
-        Plugin => 'Tickets',
-        'Tickets:query' => $Query,
-        'Tickets:limit' => $Rows || '',
-    );
-</%PERL>
-<a href="<% RT->Config->Get('WebPath') %>/Admin/Tools/Shredder/?<% $query_string |n %>"><&|/l&>Shredder...</&></a>
-% }
-
-<form method="get" action="<% RT->Config->Get('WebPath') %>/Search/Chart.html"><&|/l&>chart</&>
-% my %hiddens = (Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order);
-% foreach my $key ( keys %hiddens ) {
-<input type="hidden" class="hidden" name="<% $key %>" value="<% defined $hiddens{$key}? $hiddens{$key}: '' %>" />
-% }
-<&|/l, $m->scomp('/Search/Elements/SelectGroupBy', Name => 'PrimaryGroupBy') &>grouped by [_1]</&>
-<&|/l, $m->scomp('/Search/Elements/SelectChartType', Name => 'ChartStyle') &>style: [_1]</&>
-<input type="submit" class="button" value="<% loc('Go') %>" />
-</form>
-
-</div>
-% }
 <%INIT>
 
 $Query = join ' AND ', map "( $_ )", grep $_, $BaseQuery, $Query;

commit 2419efbf914f1a09e426b32b3cd54bc40f571664
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 27 15:42:45 2011 +0400

    drop ShowListActions argument we don't use

diff --git a/html/RTIR/Incident/BulkAbandon.html b/html/RTIR/Incident/BulkAbandon.html
index 3f1a7b2..2f774a2 100644
--- a/html/RTIR/Incident/BulkAbandon.html
+++ b/html/RTIR/Incident/BulkAbandon.html
@@ -47,7 +47,6 @@ my $result_set = $m->scomp('/RTIR/Search/Elements/ShowResults',
     Order         => $Order,
     Page          => $Page,
     ShowNavigation  => 1,
-    ShowListActions => 0
 );
 </%PERL>
 
diff --git a/html/RTIR/Link/FromIncident/index.html b/html/RTIR/Link/FromIncident/index.html
index c756a5c..beeca79 100644
--- a/html/RTIR/Link/FromIncident/index.html
+++ b/html/RTIR/Link/FromIncident/index.html
@@ -41,7 +41,6 @@
     Order         => $Order,
     BaseURL       => $base_url,
     ShowNavigation  => 1,
-    ShowListActions => 0,
 &>
 
 <& /Elements/Submit, Name => "SubmitTicket", Caption => $title, Label => loc("Link") &>
diff --git a/html/RTIR/Link/ToIncident/index.html b/html/RTIR/Link/ToIncident/index.html
index 891d4c8..6800e5f 100644
--- a/html/RTIR/Link/ToIncident/index.html
+++ b/html/RTIR/Link/ToIncident/index.html
@@ -45,7 +45,6 @@
     Order         => $Order,
     BaseURL       => "RTIR/Link/ToIncident/?id=$id&Queue=Incidents",
     ShowNavigation  => 1,
-    ShowListActions => 0,
 &>
 
 <& /Elements/Submit,
diff --git a/html/RTIR/Report/BulkReject.html b/html/RTIR/Report/BulkReject.html
index b43ebec..012cec2 100644
--- a/html/RTIR/Report/BulkReject.html
+++ b/html/RTIR/Report/BulkReject.html
@@ -48,7 +48,6 @@
     OrderBy         => $OrderBy,
     Order           => $Order,
     ShowNavigation  => 1,
-    ShowListActions => 0,
 &>
 
 % if ( $session{'tickets'}->Count ) {
diff --git a/html/RTIR/Search/Elements/ShowResults b/html/RTIR/Search/Elements/ShowResults
index da50beb..2683881 100644
--- a/html/RTIR/Search/Elements/ShowResults
+++ b/html/RTIR/Search/Elements/ShowResults
@@ -47,6 +47,5 @@ $BaseURL         => "RTIR/Search/Results.html?"
 
 $ShowEmpty       => 0
 $ShowNavigation  => 0
-$ShowListActions => $ShowNavigation
 $AllowSorting    => 1
 </%ARGS>

commit 8b3f3857583681d775b17a5f4340305828553a6d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 27 16:09:05 2011 +0400

    return ~number of records we found from ShowResults
    
    it's not exact number, just indication that we found
    something

diff --git a/html/RTIR/Search/Elements/ShowResults b/html/RTIR/Search/Elements/ShowResults
index 2683881..42a1598 100644
--- a/html/RTIR/Search/Elements/ShowResults
+++ b/html/RTIR/Search/Elements/ShowResults
@@ -1,4 +1,3 @@
-<% $result |n %>
 <%INIT>
 
 $Query = join ' AND ', map "( $_ )", grep $_, $BaseQuery, $Query;
@@ -8,9 +7,11 @@ $BaseURL .= ( $BaseURL =~ /\?/ )? '&': '?' unless $BaseURL =~ m{[&?]$};
 
 my $collection = $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
 $collection->FromSQL( $Query );
+
 my $result = $m->scomp( '/Elements/TicketList',
     %ARGS,
     Collection     => $collection,
+    Query          => $Query,
     OrderBy        => $OrderBy,
     Order          => $Order,
     Rows           => $Rows,
@@ -29,8 +30,15 @@ $session{'CurrentSearchHash'} = {
     RowsPerPage => $Rows
 };
 
-return '' if !$ShowEmpty && !$result;
-
+my $found = $collection->Count;
+if ( $found || $ShowEmpty ) {
+    $m->out( $result );
+}
+else {
+    $m->out( $m->interp->apply_escapes($EmptyLabel, 'h') )
+        if $EmptyLabel;
+}
+return $found;
 </%INIT>
 <%ARGS>
 $Queue           => ''
@@ -46,6 +54,7 @@ $Order           => 'ASC'
 $BaseURL         => "RTIR/Search/Results.html?"
 
 $ShowEmpty       => 0
+$EmptyLabel      => ''
 $ShowNavigation  => 0
 $AllowSorting    => 1
 </%ARGS>

commit 38afef0e0bd0e80d947f315962c5613884da4cb6
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 27 16:10:21 2011 +0400

    use new ShowResults behavior
    
    stop using $session{'tickets'} or scomp

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 05f28e7..4bfde25 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -29,6 +29,8 @@
 * html/RTIR/Search/Results.html has results argument
   that is passed into ListActions, get rid of it
 
+* for bulk reject and abandon base query should be active and query empty
+
 === CLEANUP && REFACTORING
 
 * re-use CSS squishing
diff --git a/html/RTIR/Incident/BulkAbandon.html b/html/RTIR/Incident/BulkAbandon.html
index 2f774a2..97569e6 100644
--- a/html/RTIR/Incident/BulkAbandon.html
+++ b/html/RTIR/Incident/BulkAbandon.html
@@ -34,8 +34,7 @@
 % }
 
 <%PERL>
-# XXX: cache result set to check if get empty results
-my $result_set = $m->scomp('/RTIR/Search/Elements/ShowResults',
+my $found = $m->comp('/RTIR/Search/Elements/ShowResults',
     Queue         => 'Incidents',
     BaseURL       => 'RTIR/Incident/BulkAbandon.html',
     BaseQuery     => RT::IR->Query( Queue => 'Incidents' ),
@@ -46,13 +45,12 @@ my $result_set = $m->scomp('/RTIR/Search/Elements/ShowResults',
     OrderBy       => $OrderBy,
     Order         => $Order,
     Page          => $Page,
+    EmptyLabel    => loc("no incidents"),
     ShowNavigation  => 1,
 );
 </%PERL>
 
-% if( $session{'tickets'}->Count ) {
-% $m->out( $result_set );
-
+% if ( $found ) {
 <&| /Widgets/TitleBox, title => loc("Select recipients") &>
 % foreach my $box( @CheckBox ) {
 % my $checked = (scalar grep $_ && $box->{'Value'}, @ReplyToAll )? ' checked' : '';
@@ -71,9 +69,8 @@ my $result_set = $m->scomp('/RTIR/Search/Elements/ShowResults',
     CheckAll => 1, ClearAll => 1,
     CheckboxName => 'SelectedTickets',
 &>
-% } else {
-<i><% loc("no incidents") %></i>
 % }
+
 </form>
 
 <%INIT>
diff --git a/html/RTIR/Report/BulkReject.html b/html/RTIR/Report/BulkReject.html
index 012cec2..1609f28 100644
--- a/html/RTIR/Report/BulkReject.html
+++ b/html/RTIR/Report/BulkReject.html
@@ -36,7 +36,8 @@
 <input type="hidden" name="OrderBy" value="<% $OrderBy %>" />
 <input type="hidden" name="Order"   value="<% $Order %>" />
 
-<& /RTIR/Search/Elements/ShowResults,
+<%PERL>
+my $found = $m->comp( '/RTIR/Search/Elements/ShowResults',
     Queue           => $Queue,
     BaseURL         => $BaseURL,
     BaseQuery       => $BaseQuery,
@@ -48,9 +49,10 @@
     OrderBy         => $OrderBy,
     Order           => $Order,
     ShowNavigation  => 1,
-&>
+);
+</%PERL>
 
-% if ( $session{'tickets'}->Count ) {
+% if ( $found ) {
 <& /Elements/Submit,
     Name => "BulkReject",
     Caption => loc("Reject selected incident reports"),

commit 2a5df6b2e52f6c7dbad168f9b0ab841901a942cf
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 27 16:12:35 2011 +0400

    we have redirect, no need in redoing search

diff --git a/html/RTIR/Report/BulkReject.html b/html/RTIR/Report/BulkReject.html
index 1609f28..8113c65 100644
--- a/html/RTIR/Report/BulkReject.html
+++ b/html/RTIR/Report/BulkReject.html
@@ -119,8 +119,6 @@ if ( $BulkReject ) {
     }
     push @results, map { ref($_)? loc( "Ticket [_1]: [_2]", $_->[0], $_->[1] ): $_ }
                    @tempresults;
-    # force redo search if we changed state
-    $session{'tickets'}->RedoSearch if $session{'tickets'};
 
     if ( $BulkRejectAndReturn ) {
         MaybeRedirectForResults(

commit d4c33c4b0620d76d151b0358d1baed16b665b939
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 27 22:45:45 2011 +0400

    use active as base for bulk reject and abandon
    
    User shouldn't be able to change base base query
    and we should present only active tickets for
    reject and abandon.

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 4bfde25..05f28e7 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -29,8 +29,6 @@
 * html/RTIR/Search/Results.html has results argument
   that is passed into ListActions, get rid of it
 
-* for bulk reject and abandon base query should be active and query empty
-
 === CLEANUP && REFACTORING
 
 * re-use CSS squishing
diff --git a/html/RTIR/Incident/BulkAbandon.html b/html/RTIR/Incident/BulkAbandon.html
index 97569e6..4d231ad 100644
--- a/html/RTIR/Incident/BulkAbandon.html
+++ b/html/RTIR/Incident/BulkAbandon.html
@@ -37,7 +37,7 @@
 my $found = $m->comp('/RTIR/Search/Elements/ShowResults',
     Queue         => 'Incidents',
     BaseURL       => 'RTIR/Incident/BulkAbandon.html',
-    BaseQuery     => RT::IR->Query( Queue => 'Incidents' ),
+    BaseQuery     => RT::IR->ActiveQuery( Queue => 'Incidents' ),
     Query         => $Query,
     DisplayFormat => "__CheckBox__, $Format",
     Format        => $Format,
@@ -157,7 +157,7 @@ if ( $ARGS{'BulkAbandon'} ) {
 
 </%INIT>
 <%ARGS>
-$Query           => RT::IR->ActiveQuery( Queue => 'Incidents' )
+$Query           => ''
 $Format          => RT->Config->Get('RTIRSearchResultFormats')->{'AbandonIncidents'}
 $Rows            => 50
 $Page            => 1
diff --git a/html/RTIR/Report/BulkReject.html b/html/RTIR/Report/BulkReject.html
index 8113c65..c37186f 100644
--- a/html/RTIR/Report/BulkReject.html
+++ b/html/RTIR/Report/BulkReject.html
@@ -40,7 +40,7 @@
 my $found = $m->comp( '/RTIR/Search/Elements/ShowResults',
     Queue           => $Queue,
     BaseURL         => $BaseURL,
-    BaseQuery       => $BaseQuery,
+    BaseQuery       => RT::IR->ActiveQuery( Queue => $Queue ),
     Query           => $Query,
     DisplayFormat   => "__CheckBox__, $Format",
     Format          => $Format,
@@ -146,8 +146,7 @@ my $BaseURL = "RTIR/Report/BulkReject.html?"
 $Status              => 'rejected'
 $Queue               => 'Incident Reports'
 
-$BaseQuery           => RT::IR->Query( Queue => $Queue )
-$Query               => RT::IR->ActiveQuery( Queue => $Queue )
+$Query               => ''
 $Format              => RT->Config->Get('RTIRSearchResultFormats')->{'RejectReports'}
 $Rows                => 50
 $Page                => 1

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


More information about the Rt-commit mailing list