[Rt-commit] rtir branch, 2.9-trunk, updated. d84b7d65dedfe2d8e89659f39d6571e60437bcf8

Ruslan Zakirov ruz at bestpractical.com
Tue Mar 29 22:46:54 EDT 2011


The branch, 2.9-trunk has been updated
       via  d84b7d65dedfe2d8e89659f39d6571e60437bcf8 (commit)
       via  0e975a42de8527cd74e774aa334b41153ffc94b9 (commit)
       via  ff410b87256f93c143bfd3a0dfd959aba69cc245 (commit)
       via  8352f2995721b5ba7cdeed32106c3361292dd8fc (commit)
       via  826e5ce5addad901978c166d73777448aee8bb9f (commit)
       via  602188dece5c6cdfe06e224fc88f28bf3e18bd44 (commit)
       via  01cda6769b362b0a7afc87e5c855395df59ac638 (commit)
       via  195b9b49af316251a564585630a3146dba5da5c7 (commit)
       via  ff2dd159de5cf19c9e995c4330c6f55fe2908b71 (commit)
       via  c1f0cc1131e5b484fddd652a3843cc8f3364d663 (commit)
       via  bfe8f9619dcebb75afcd4a3eb821220a51c7de01 (commit)
       via  7ff34aef524c5c21351846f75e1dfc91f1c986ec (commit)
       via  f95a6d30148010ef353aeb39f03a03713b58dcc0 (commit)
       via  0522c14a9fc5626a0bbadb2d69d0229aed538b97 (commit)
       via  c2dc05f0f6ee22cea8ad4fc0b65282a389069a37 (commit)
       via  4b9ec44c2a8f1a54447da09b1ba9a1ff73f4bb8a (commit)
       via  123c6b023a306b295ca61ef2d53aa50e4770e43c (commit)
       via  8cb62eeada6448b96bc8556d8578c36a452a365d (commit)
       via  51eb86605fe86cde84c3c62d733a07d5a8db54ed (commit)
       via  ddced2d0b86b99682652b4511afbbb034a01fcd3 (commit)
       via  16653bcbb8052b069d719e1a5ab160f30b89c1c9 (commit)
       via  7571054368fe2d543e4cada8046c480b993e0c9e (commit)
       via  14c617cb3cbfffe105f2a16311518ae0103f1f61 (commit)
      from  37d0957751acf623f411bb79ab65419ebfa33b6c (commit)

Summary of changes:
 TODO.porting_over_RT4                              |   17 +++-
 etc/RTIR_Config.pm                                 |    8 +-
 etc/initialdata                                    |   16 ++--
 html/Callbacks/RTIR/Elements/Tabs/Privileged       |   36 +++++++
 html/RTIR/Display.html                             |    6 +-
 html/RTIR/Elements/ShowChildren                    |   29 ++++--
 html/RTIR/Incident/Children/Refine.html            |   13 +++
 .../{ShowChildren.html => Children/index.html}     |   34 ++++---
 html/RTIR/Incident/Display.html                    |  102 ++++++++++----------
 html/RTIR/Incident/Elements/ShowChildren           |    4 +-
 html/RTIR/Incident/LinkArticles.html               |    6 +-
 lib/RT/Action/RTIR_ResolveChildren.pm              |   43 +++++----
 t/001-basic-RTIR.t                                 |    2 +-
 t/002-test-reject.t                                |    2 +-
 t/003-resolve-IR-when-all-incidents-resolved.t     |    2 +-
 t/004-rtfm-in-rtir.t                               |    8 +-
 16 files changed, 206 insertions(+), 122 deletions(-)
 create mode 100644 html/RTIR/Incident/Children/Refine.html
 rename html/RTIR/Incident/{ShowChildren.html => Children/index.html} (83%)

- Log -----------------------------------------------------------------
commit 14c617cb3cbfffe105f2a16311518ae0103f1f61
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Mar 29 22:41:05 2011 +0400

    drop if(1) block

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index d312b7a..574dd08 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -232,48 +232,44 @@ unless( $TicketObj->QueueObj->Name eq 'Incidents' ) {
 }
 $ARGS{'id'} = $id = $TicketObj->Id;
 
-if( 1 ) {
+if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ )
+{   
+    my $action = $1;
+    my ($res, $msg) = $TicketObj->$action();
+    push @results, $msg;
+    # If they succeeded in taking the ticket, they should also get a lock
+    if ($res && $action =~  /^(?:Take|Steal)$/) { $ARGS{'Lock'} = 'add'; }
 
-    if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ )
-    {   
-        my $action = $1;
-        my ($res, $msg) = $TicketObj->$action();
-        push @results, $msg;
-        # If they succeeded in taking the ticket, they should also get a lock
-        if ($res && $action =~  /^(?:Take|Steal)$/) { $ARGS{'Lock'} = 'add'; }
-
-    }
+}
 
 
 
-    unless( $new_ticket ) {
-        push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
-    }
+unless( $new_ticket ) {
+    push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
+}
 
-    if ( $ARGS{'BulkLink'} || $Child ) {
-        my @link;
-        push @link, @SelectedTickets if $ARGS{'BulkLink'};
-        push @link, $Child if $Child;
-        foreach my $id ( grep $_, @link ) {
-            my $child = RT::Ticket->new( $session{'CurrentUser'} );
-            $child->Load( $id );
-            unless( $child->id ) {
-                push @results, loc("Couldn't load ticket #[_1] for linking.", $id);
-                next;
-            }
-            push @results, $DoLinks->( $child, $TicketObj );
+if ( $ARGS{'BulkLink'} || $Child ) {
+    my @link;
+    push @link, @SelectedTickets if $ARGS{'BulkLink'};
+    push @link, $Child if $Child;
+    foreach my $id ( grep $_, @link ) {
+        my $child = RT::Ticket->new( $session{'CurrentUser'} );
+        $child->Load( $id );
+        unless( $child->id ) {
+            push @results, loc("Couldn't load ticket #[_1] for linking.", $id);
+            next;
         }
+        push @results, $DoLinks->( $child, $TicketObj );
     }
-    if ( $ARGS{'BulkArticles'} && @SelectedTickets ) {
-        my $ref = join " ", map "a:$_", @SelectedTickets;
-        push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => {$TicketObj->Id."-RefersTo" => $ref} );
-    }
-
-    unless( $new_ticket ) {
-        $ARGS{UpdateAttachments} = delete $session{'Attachments'};
-        push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj );
-    }
+}
+if ( $ARGS{'BulkArticles'} && @SelectedTickets ) {
+    my $ref = join " ", map "a:$_", @SelectedTickets;
+    push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => {$TicketObj->Id."-RefersTo" => $ref} );
+}
 
+unless( $new_ticket ) {
+    $ARGS{UpdateAttachments} = delete $session{'Attachments'};
+    push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj );
 }
 
 # XXX: need the way to show @results when aborting

commit 7571054368fe2d543e4cada8046c480b993e0c9e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Mar 29 22:49:58 2011 +0400

    move check a little bit earlier

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 574dd08..5d81a14 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -262,6 +262,20 @@ if ( $ARGS{'BulkLink'} || $Child ) {
         push @results, $DoLinks->( $child, $TicketObj );
     }
 }
+
+# If we deleted any links, check if what we deleted from still has children
+if ( $deleted_links ) {
+    # XXX: Can we ever get here?
+    my $children = new RT::Tickets( $session{'CurrentUser'} );
+    $children->LimitQueue( VALUE => 'Incident Reports' );
+    $children->LimitQueue( VALUE => 'Investigations' );
+    $children->LimitQueue( VALUE => 'Blocks' );
+    $children->LimitMemberOf( $id );
+    unless ( $children->Count ) {
+        push @results, loc("WARNING: Incident [_1] has no children.", $id);
+    }
+}
+
 if ( $ARGS{'BulkArticles'} && @SelectedTickets ) {
     my $ref = join " ", map "a:$_", @SelectedTickets;
     push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => {$TicketObj->Id."-RefersTo" => $ref} );
@@ -282,19 +296,6 @@ if ( $TicketObj->TimeLeft > 0 ) {
     $TimeWorked .= '/'. $TicketObj->TimeLeft;
 }
 
-# If we deleted any links, check if what we deleted from still has children
-if ( $deleted_links ) {
-    # XXX: Can we ever get here?
-    my $children = new RT::Tickets( $session{'CurrentUser'} );
-    $children->LimitQueue( VALUE => 'Incident Reports' );
-    $children->LimitQueue( VALUE => 'Investigations' );
-    $children->LimitQueue( VALUE => 'Blocks' );
-    $children->LimitMemberOf( $id );
-    unless ( $children->Count ) {
-        push @results, loc("WARNING: Incident [_1] has no children.", $id);
-    }
-}
-
 my $attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $TicketObj);
 
 </%INIT>

commit 16653bcbb8052b069d719e1a5ab160f30b89c1c9
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Mar 29 22:50:28 2011 +0400

    use "may be redirect"
    
    * no resubmits
    * get proper id in args on create for tabs

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 5d81a14..c921c73 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -278,7 +278,10 @@ if ( $deleted_links ) {
 
 if ( $ARGS{'BulkArticles'} && @SelectedTickets ) {
     my $ref = join " ", map "a:$_", @SelectedTickets;
-    push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => {$TicketObj->Id."-RefersTo" => $ref} );
+    push @results, ProcessTicketLinks(
+        TicketObj => $TicketObj,
+        ARGSRef => {$TicketObj->Id."-RefersTo" => $ref}
+    );
 }
 
 unless( $new_ticket ) {
@@ -286,6 +289,12 @@ unless( $new_ticket ) {
     push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj );
 }
 
+MaybeRedirectForResults(
+    Actions   => \@results,
+    Path      => "/RTIR/Display.html",
+    Arguments => { id => $TicketObj->id },
+);
+
 # XXX: need the way to show @results when aborting
 unless ( $TicketObj->CurrentUserHasRight('ShowTicket') ) {
     Abort("No permission to view ticket #$id.");

commit ddced2d0b86b99682652b4511afbbb034a01fcd3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Mar 29 22:52:53 2011 +0400

    don't print in initialdata, upsets tests

diff --git a/etc/initialdata b/etc/initialdata
index ab1cfef..639474d 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -729,14 +729,13 @@ for my $cf (@CustomFields) {
     my $class = RT::FM::Class->new($CurrentUser);
     $class->Load('Templates');
     unless ($class->Id) {
-        print "  Creating 'Templates' RTFM class..";
+        $RT::Logger->info("Creating 'Templates' RTFM class.");
         my ($id, $msg) = $class->Create(
             Name => 'Templates',
             Description => 'Response templates',
             HotList => 1
         );
         die $msg unless $id;
-        print "Done\n";
     }
 
     my $response = RT::CustomField->new($CurrentUser);
@@ -751,7 +750,6 @@ for my $cf (@CustomFields) {
             LookupType => RT::FM::Article->CustomFieldLookupType,
         );
         die $msg unless $id;
-        print "Done\n";
     }
 
     $response->AddToObject($class);
@@ -766,6 +764,5 @@ for my $cf (@CustomFields) {
     $group->PrincipalObj->GrantRight( Right => $_, Object => $class )
       for qw/AdminClass AdminTopics CreateArticle ModifyArticle ModifyArticleTopics SeeClass ShowArticle ShowArticleHistory DeleteArticle/;
 
-    print "Done.\n";
 } );
 

commit 51eb86605fe86cde84c3c62d733a07d5a8db54ed
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Mar 29 22:53:23 2011 +0400

    RTFM is in core

diff --git a/etc/initialdata b/etc/initialdata
index 639474d..d0c6b00 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -725,8 +725,8 @@ for my $cf (@CustomFields) {
     my $CurrentUser = RT::CurrentUser->new();
     $CurrentUser->LoadByName('RT_System');
 
-    require RT::FM::Class;
-    my $class = RT::FM::Class->new($CurrentUser);
+    require RT::Class;
+    my $class = RT::Class->new($CurrentUser);
     $class->Load('Templates');
     unless ($class->Id) {
         $RT::Logger->info("Creating 'Templates' RTFM class.");
@@ -738,16 +738,17 @@ for my $cf (@CustomFields) {
         die $msg unless $id;
     }
 
+    require RT::Article;
     my $response = RT::CustomField->new($CurrentUser);
     $response->Load('Response');
-    unless ($response->Id and $response->LookupType eq RT::FM::Article->CustomFieldLookupType) {
-        print "  Creating 'Response' RTFM custom field..";
+    unless ($response->Id and $response->LookupType eq RT::Article->CustomFieldLookupType) {
+        $RT::Logger->info("Creating 'Response' RTFM custom field.");
         my ($id, $msg) = $response->Create(
             Name => 'Response',
             Type => 'Text',
             MaxValues => 1,
             Description => 'Response to be inserted into the ticket',
-            LookupType => RT::FM::Article->CustomFieldLookupType,
+            LookupType => RT::Article->CustomFieldLookupType,
         );
         die $msg unless $id;
     }

commit 8cb62eeada6448b96bc8556d8578c36a452a365d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Mar 29 22:58:00 2011 +0400

    fix number of tests

diff --git a/t/001-basic-RTIR.t b/t/001-basic-RTIR.t
index 00f4b1f..e43e5cd 100644
--- a/t/001-basic-RTIR.t
+++ b/t/001-basic-RTIR.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 28;
+use RT::IR::Test tests => 25;
 
 RT::Test->started_ok;
 my $agent = default_agent();

commit 123c6b023a306b295ca61ef2d53aa50e4770e43c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 00:13:17 2011 +0400

    rename component, as we need refine page

diff --git a/html/RTIR/Incident/ShowChildren.html b/html/RTIR/Incident/Children/index.html
similarity index 100%
rename from html/RTIR/Incident/ShowChildren.html
rename to html/RTIR/Incident/Children/index.html

commit 4b9ec44c2a8f1a54447da09b1ba9a1ff73f4bb8a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:27:54 2011 +0400

    use main tabs for menu

diff --git a/html/RTIR/Incident/Children/index.html b/html/RTIR/Incident/Children/index.html
index 2b1f98b..bcb8fba 100644
--- a/html/RTIR/Incident/Children/index.html
+++ b/html/RTIR/Incident/Children/index.html
@@ -23,12 +23,7 @@
 %# 
 %# END LICENSE BLOCK
 <& /RTIR/Elements/Header, Title => $Title &>
-<& /RTIR/Search/Elements/RefineTabs, 
-    Title             => $Title,
-    Ticket            => $Incident,
-    Queue             => $Queue,
-    current_tab       => $current_tab,
-&>
+<& /Elements/Tabs &>
 
 <& /Elements/ListActions, actions => \@results &>
 

commit c2dc05f0f6ee22cea8ad4fc0b65282a389069a37
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:28:56 2011 +0400

    we moved component, change links

diff --git a/html/RTIR/Incident/Children/index.html b/html/RTIR/Incident/Children/index.html
index bcb8fba..151516d 100644
--- a/html/RTIR/Incident/Children/index.html
+++ b/html/RTIR/Incident/Children/index.html
@@ -33,7 +33,7 @@
 <h2><% loc('Total [_1]: [_2]([_3])', $Queue, $children->CountAll, $all_children->CountAll) %></h2>
 % }
 
-<form action="ShowChildren.html" method="post">
+<form action="index.html" method="post">
 <input type="hidden" name="id" value="<% $id %>" />
 <input type="hidden" name="Queue" value="<% $Queue %>" />
 
@@ -41,7 +41,7 @@
     Ticket             => $Incident,
     Queue              => $Queue,
     States             => [@States],
-    FullList           => RT->Config->Get('WebPath')."/RTIR/Incident/ShowChildren.html?Queue=$Queue&id=$id",
+    FullList           => RT->Config->Get('WebPath')."/RTIR/Incident/Children/?Queue=$Queue&id=$id",
     Delete             => $delete,
     ShowHeader         => 1,
     ShowStatesSelector => 1,
@@ -86,8 +86,6 @@ $all_children->FromSQL( RT::IR->ChildrenQuery(
     Ticket => $Incident,
     States => [@possible_states],
 ) );
-my $current_tab = 'RTIR/Incident/ShowChildren.html?'
-    . $m->comp( '/Elements/QueryString', id => $id, Queue => $Queue );
 </%INIT>
 <%ARGS>
 $id              => undef
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
index 68261b5..e634518 100644
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ b/html/RTIR/Incident/Elements/ShowChildren
@@ -1,9 +1,9 @@
 <&| /Widgets/TitleBox, 
     title       => loc( $Queue ),
-    title_href  => RT->Config->Get('WebPath') ."/RTIR/Incident/ShowChildren.html?Queue=". $EscapedQueue ."&id=".$id,
+    title_href  => RT->Config->Get('WebPath') ."/RTIR/Incident/Children/?Queue=". $EscapedQueue ."&id=".$id,
     ( $total_count > $Rows
         ? ( titleright    => loc("More... ([_1] total)", $total_count),
-            titleright_href => RT->Config->Get('WebPath') ."/RTIR/Incident/ShowChildren.html?Queue=". $EscapedQueue ."&id=".$id )
+            titleright_href => RT->Config->Get('WebPath') ."/RTIR/Incident/Children/?Queue=". $EscapedQueue ."&id=".$id )
         : (),
     ),
     class => 'tickets-list-'. lc(RT::IR::TicketType( Queue => $Queue )),

commit 0522c14a9fc5626a0bbadb2d69d0229aed538b97
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:29:44 2011 +0400

    use lifecycles when we list incident's children

diff --git a/html/RTIR/Elements/ShowChildren b/html/RTIR/Elements/ShowChildren
index 3796a72..7b5617e 100644
--- a/html/RTIR/Elements/ShowChildren
+++ b/html/RTIR/Elements/ShowChildren
@@ -24,7 +24,7 @@
 %# END LICENSE BLOCK
 
 % if( $ShowStatesSelector ) {
-%   foreach my $s( RT::IR::States( Queue => $Queue, Inactive => 1 ) ) {
+%   foreach my $s ( $QueueObj->Lifecycle->Valid ) {
 %       my $checked = (grep { $_ eq $s } @States)? 'checked': '';
 <input type="checkbox" name="States" value="<% $s %>" <% $checked %> />&nbsp;<% $s %>
 %   }
@@ -59,9 +59,16 @@
 % }
 
 <%INIT>
-unless( @States ) {
-    @States = ( RT::IR::States( Queue => $Queue ), 'resolved', 'removed' );
+
+my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
+$QueueObj->Load( $Queue );
+unless ( $QueueObj->id ) {
+    $RT::Logger->error("Couldn't load queue '$Queue'");
+    return;
 }
+
+ at States = $QueueObj->Lifecycle->Valid('initial', 'active') unless @States;
+
 my $Type = RT::IR::TicketType( Queue => $Queue );
 
 $Format ||= RT->Config->Get('RTIRSearchResultFormats')->{'Child' . $Type};
@@ -82,10 +89,13 @@ $Queue => undef
 $Ticket => undef
 $OrderBy => 'Due'
 $Rows => 0
+
 $Delete => 0
 $FullList => undef
 $NoTicketsCaption => undef,
+
 @States => ()
+
 $ShowHeader => 0
 $ShowStatesSelector => 0
 </%ARGS>
diff --git a/html/RTIR/Incident/Children/index.html b/html/RTIR/Incident/Children/index.html
index 151516d..991ed4b 100644
--- a/html/RTIR/Incident/Children/index.html
+++ b/html/RTIR/Incident/Children/index.html
@@ -51,10 +51,10 @@
 </form>
 
 <%INIT>
-my @results;
 my $Incident = LoadTicket($id);
 $id = $ARGS{'id'} = $Incident->Id;
 
+my @results;
 if( $ARGS{'Unlink'} ) {
     # translate the checkbox args to what ProcessTicketLinks expects
     $ARGS{'DeleteLink-'. $_ .'-MemberOf-'} = 1 for @SelectedTickets;
@@ -68,6 +68,15 @@ unless ( $Incident->CurrentUserHasRight('ShowTicket') ) {
     Abort("No permission to view ticket");
 }
 
+my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
+$QueueObj->Load( $Queue );
+unless ( $QueueObj->id ) {
+    Abort("Couldn't load queue '$Queue'");
+}
+
+ at States = $QueueObj->Lifecycle->Valid('initial', 'active')
+    unless @States;
+
 my $Title = loc("$Queue for Incident #[_1]: [_2]", $id, $Incident->Subject);
 
 my $delete = $Incident->CurrentUserHasRight('ModifyTicket') ? 1: 0;
@@ -79,12 +88,11 @@ $children->FromSQL( RT::IR->ChildrenQuery(
     States => [@States],
 ) );
 
-my @possible_states = RT::IR::States( Queue => $Queue, Inactive => 1 );
 my $all_children = RT::Tickets->new( $session{'CurrentUser'} );
 $all_children->FromSQL( RT::IR->ChildrenQuery(
     Queue  => $Queue,
     Ticket => $Incident,
-    States => [@possible_states],
+    States => [ $QueueObj->Lifecycle->Valid ],
 ) );
 </%INIT>
 <%ARGS>
@@ -92,5 +100,5 @@ $id              => undef
 $Queue           => 'Incident Reports'
 
 @SelectedTickets => ()
- at States          => RT::IR::States( Queue => $Queue )
+ at States          => ()
 </%ARGS>

commit f95a6d30148010ef353aeb39f03a03713b58dcc0
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:30:34 2011 +0400

    use Status instead of State CF in default format strings

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 2a4c787..9bf2794 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -135,7 +135,7 @@ Set($RTIRSearchResultFormats, {
         q{'<b><a HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
           __QueueName__,
-          '__CustomField.{State}__',
+          __Status__,
           __LastUpdatedRelative__,
           __CreatedRelative__,
           __NEWLINE__,
@@ -219,19 +219,19 @@ Set($RTIRSearchResultFormats, {
     ChildReport =>
         q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
-          '__CustomField.{State}__',
+          __Status__,
           __DueRelative__},
 
     ChildInvestigation =>
         q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
-          '__CustomField.{State}__',
+          __Status__,
           __DueRelative__},
 
     ChildBlock =>
         q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
-          '__CustomField.{State}__',
+          __Status__,
            __DueRelative__},
 
 } );

commit 7ff34aef524c5c21351846f75e1dfc91f1c986ec
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:32:40 2011 +0400

    show delete hint only if table is not empty

diff --git a/html/RTIR/Elements/ShowChildren b/html/RTIR/Elements/ShowChildren
index 7b5617e..6cdb6e0 100644
--- a/html/RTIR/Elements/ShowChildren
+++ b/html/RTIR/Elements/ShowChildren
@@ -31,7 +31,7 @@
 <& /Elements/Submit, Name => 'RefineStatus', Label => loc('Filter status') &>
 % }
 
-% if ($Delete) {
+% if ( $Delete && $children->Count ) {
 <i><% loc("Check box to unlink") %></i><br />
 % }
 <& /Elements/TicketList, 

commit bfe8f9619dcebb75afcd4a3eb821220a51c7de01
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:47:44 2011 +0400

    Refine page for Incident's children list

diff --git a/html/RTIR/Incident/Children/Refine.html b/html/RTIR/Incident/Children/Refine.html
new file mode 100644
index 0000000..f87fbbd
--- /dev/null
+++ b/html/RTIR/Incident/Children/Refine.html
@@ -0,0 +1,13 @@
+<%INIT>
+return $m->comp(
+    '/RTIR/Search/Elements/RefinePage',
+    %ARGS,
+    ResultPage => 'RTIR/Incident/Children/?'. $m->comp('/Elements/QueryString',
+        id => $ARGS{'id'}, Queue => $ARGS{'Queue'},
+    ),
+    BaseQuery => RT::IR->BaseQuery(
+        Queue    => $ARGS{'Queue'},
+        MemberOf => $ARGS{'id'},
+    ),
+);
+</%INIT>

commit c1f0cc1131e5b484fddd652a3843cc8f3364d663
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 01:48:12 2011 +0400

    tabs for incident's children list

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 3efff13..bf65c83 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -283,6 +283,42 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         back => title => loc('Back to ticket #[_1]', $id),
         path => "/RTIR/Display.html?id=$id",
     );
+} elsif ( $request_path =~ m{^/RTIR/Incident/Children/} ) {
+    my $queue = $args->{'Queue'} || 'Incident Reports';
+    my $type = RT::IR::TicketType( Queue => $queue );
+
+    my $ticket = RT::Ticket->new( $session{'CurrentUser'} );
+    $ticket->Load( $args->{'id'} );
+    my $id = $ticket->id;
+
+    my %args = (
+        $search_arguments->(),
+        id => $id,
+        Queue => $queue,
+    );
+
+    PageMenu()->child(
+        link => title => loc('Show Results'),
+        path => "/RTIR/Incident/Children/?". $query_string->( %args ),
+    );
+    PageMenu()->child(
+        edit_search => title => loc('Edit Search'),
+        path => "/RTIR/Incident/Children/Refine.html?". $query_string->( %args ),
+    );
+    PageMenu()->child(
+        new_search => title => loc('New Search'),
+        path => "/RTIR/Incident/Children/Refine.html?". $query_string->(
+            NewQuery => 1, id => $id, Queue => $queue,
+        ),
+    );
+    PageMenu()->child(
+        new => title => loc("New $type"),
+        path => "/RTIR/Create.html?". $query_string->( Incident => $id, Queue => $queue ),
+    );
+    PageMenu()->child(
+        back => title => loc('Back to ticket #[_1]', $id),
+        path => "/RTIR/Display.html?id=$id",
+    );
 } elsif ( $request_path =~ m{^/RTIR/(Search/|Incident/BulkAbandon\.html$)} ) {
     my $queue = $args->{'Queue'} || '';
     my $type = RT::IR::TicketType( Queue => $queue );

commit ff2dd159de5cf19c9e995c4330c6f55fe2908b71
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 02:27:56 2011 +0400

    get rid of last ChildrenQuery component call

diff --git a/html/RTIR/Elements/ShowChildren b/html/RTIR/Elements/ShowChildren
index 6cdb6e0..4f6ea2f 100644
--- a/html/RTIR/Elements/ShowChildren
+++ b/html/RTIR/Elements/ShowChildren
@@ -74,12 +74,11 @@ my $Type = RT::IR::TicketType( Queue => $Queue );
 $Format ||= RT->Config->Get('RTIRSearchResultFormats')->{'Child' . $Type};
 
 my $children = RT::Tickets->new( $session{'CurrentUser'} );
-$children->FromSQL( $m->comp( '/RTIR/Elements/ChildrenQuery',
-                              Queue  => $Queue,
-                              Ticket => $Ticket,
-                              States => [@States],
-                            )
-                  );
+$children->FromSQL( RT::IR->ChildrenQuery(
+    Queue  => $Queue,
+    Ticket => $Ticket,
+    States => [@States],
+));
 
 </%INIT>
 

commit 195b9b49af316251a564585630a3146dba5da5c7
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 03:19:49 2011 +0400

    redirect after taking actions

diff --git a/html/RTIR/Incident/Children/index.html b/html/RTIR/Incident/Children/index.html
index 991ed4b..312781f 100644
--- a/html/RTIR/Incident/Children/index.html
+++ b/html/RTIR/Incident/Children/index.html
@@ -64,6 +64,11 @@ if( $ARGS{'Unlink'} ) {
     RT->Config->Set( StrictLinkACL => $strict_acl );
 }
 
+MaybeRedirectForResults(
+    Actions   => \@results,
+    Arguments => { id => $id, Queue => $Queue },
+);
+
 unless ( $Incident->CurrentUserHasRight('ShowTicket') ) {
     Abort("No permission to view ticket");
 }

commit 01cda6769b362b0a7afc87e5c855395df59ac638
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 03:21:08 2011 +0400

    another test file pass, adjust number of tests

diff --git a/t/002-test-reject.t b/t/002-test-reject.t
index bf6a066..8106940 100644
--- a/t/002-test-reject.t
+++ b/t/002-test-reject.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 118;
+use RT::IR::Test tests => 107;
 
 RT::Test->started_ok;
 my $agent = default_agent();

commit 602188dece5c6cdfe06e224fc88f28bf3e18bd44
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 03:47:46 2011 +0400

    no more $ticket->Resolve method
    
    use new DefaultStatus(on_incident_resolve) or first inactive

diff --git a/lib/RT/Action/RTIR_ResolveChildren.pm b/lib/RT/Action/RTIR_ResolveChildren.pm
index 1533666..1561d46 100644
--- a/lib/RT/Action/RTIR_ResolveChildren.pm
+++ b/lib/RT/Action/RTIR_ResolveChildren.pm
@@ -78,29 +78,36 @@ sub Commit {
     my $self = shift;
     my $id = $self->TicketObj->Id;
 
-    my $query =  "(Queue = 'Incident Reports'"
-                ." OR Queue = 'Investigations'"
-                ." OR Queue = 'Blocks'"
-                .") AND MemberOf = " . $id
-                ." AND ("
-                # TODO: move to per queue statuses lists
-                . join(" AND ", map "Status != '$_'",
-                        RT::Queue->InactiveStatusArray )
-                .")";
-
-    my $members = new RT::Tickets( $self->TransactionObj->CurrentUser );
-    $members->FromSQL( $query );
-    while ( my $member = $members->Next ) {
-        if ( RT::IR::Ticket::IsLinkedToActiveIncidents( $member, $self->TicketObj ) ) {
-            $member->Comment(Content => <<END);
+    foreach my $qname ( 'Incident Reports', 'Investigations', 'Blocks' ) {
+        next if $qname eq 'Blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
+
+        my $queue = RT::Queue->new( $self->CurrentUser );
+        $queue->Load( $qname );
+        unless ( $queue->id ) {
+            $RT::Logger->error("Couldn't load '$qname' queue");
+            next;
+        }
+
+        my $cycle = $queue->Lifecycle;
+        my $query = "MemberOf = $id AND Queue = '$qname' AND "
+            . join ' AND ', map "Status != '$_'", $cycle->Inactive;
+
+        my $members = RT::Tickets->new( $self->CurrentUser );
+        $members->FromSQL( $query );
+        while ( my $member = $members->Next ) {
+            if ( RT::IR::Ticket::IsLinkedToActiveIncidents( $member, $self->TicketObj ) ) {
+                $member->Comment(Content => <<END);
 
 Linked Incident \#$id was resolved, but ticket still has unresolved linked Incidents.
 
 END
-            next;
+                next;
+            }
+            my ($res, $msg) = $member->SetStatus(
+                $cycle->DefaultStatus('on_incident_resolve') || ($cycle->Inactive)[0]
+            );
+            $RT::Logger->info( "Couldn't resolve ticket: $msg" ) unless $res;
         }
-        my ($res, $msg) = $member->Resolve;
-        $RT::Logger->info( "Couldn't resolve ticket: $msg" ) unless $res;
     }
     return 1;
 }

commit 826e5ce5addad901978c166d73777448aee8bb9f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 03:49:01 2011 +0400

    another test file pass, adjust number of tests

diff --git a/t/003-resolve-IR-when-all-incidents-resolved.t b/t/003-resolve-IR-when-all-incidents-resolved.t
index 59e5195..6b1294e 100644
--- a/t/003-resolve-IR-when-all-incidents-resolved.t
+++ b/t/003-resolve-IR-when-all-incidents-resolved.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 36;
+use RT::IR::Test tests => 34;
 
 RT::Test->started_ok;
 my $agent = default_agent();

commit 8352f2995721b5ba7cdeed32106c3361292dd8fc
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 03:54:03 2011 +0400

    update todo

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 20d6bb5..99f3ffa 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -1,9 +1,19 @@
-* redirect from /Ticket/Diplay.html to /RTIR/Display.html doesn't work
-
 * BulkAbandon needs a lot of love. see TODO comments
 
 * BulkAbandon misses Query arguments when updated
 
 * upgrade script that setups lifecycle column on the queues
 
+* upgrade script that unapplies State custom field
+
+* upgrade script that deletes all Status changes from 
+  transactions for RTIR's queues and turns changes of
+  the State CFs into Status changes
+
 * /Incident/Reply.html needs refine query page
+
+* on_incident_resolve - document it
+
+* /Incident/Children/ and friends use "State" all over the place,
+  anyway we break backwards compatibility, let's be consistent
+  and ditch the word

commit ff410b87256f93c143bfd3a0dfd959aba69cc245
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 04:29:03 2011 +0400

    return back RT::FM integration

diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index a920eec..5b5773e 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -61,7 +61,6 @@
 
 </&>
 
-% if ($RT::FM::VERSION) {
 <&| /Widgets/TitleBox,
     title => loc("Articles"),
     title_href => RT->Config->Get('WebPath') ."/RTIR/Advanced.html?id=".$id, 
@@ -71,20 +70,19 @@
 % if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
 % my $qs = $m->comp("/Elements/QueryString", "RefersTo-new" => "t:$id", next => RT->Config->Get('WebPath')."/RTIR/Display.html?id=$id");
     <table width="100%"><tr><td align="right"><font size="-1">
-        | <a href="<%RT->Config->Get('WebPath')%>/RTFM/Article/PreCreate.html?<% $qs |n%>"><%loc('New')%></a> 
+        | <a href="<%RT->Config->Get('WebPath')%>/Articles/Article/PreCreate.html?<% $qs |n%>"><%loc('New')%></a> 
         | <a href="<%RT->Config->Get('WebPath')%>/RTIR/Incident/LinkArticles.html?id=<%$id%>"><%loc("Link")%></a> |
     </font></td></tr></table>
 % }
 
 <ul>
 % while (my $Link = $Ticket->RefersTo->Next) {
-% next unless UNIVERSAL::isa($Link->TargetURI->Object, "RT::FM::Article");
+% next unless UNIVERSAL::isa($Link->TargetURI->Object, "RT::Article");
 <li><a href="<%$Link->TargetURI->Resolver->HREF%>"><% $Link->TargetURI->Object->Name %></a></li>
 % }
 </ul>
 
 </&>
-% }
 </td> <td class="boxcontainer" valign="top">
 % $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'RightColumnStart' );
 
diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index c921c73..a1f752b 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -104,7 +104,6 @@
 
 </td><td class="boxcontainer" valign="top">
 
-% if ($RT::FM::VERSION) {
 <&| /Widgets/TitleBox,
     title => loc("Articles"),
     title_href => RT->Config->Get('WebPath') ."/RTIR/Advanced.html?id=".$id, 
@@ -114,20 +113,19 @@
 % if ($TicketObj->CurrentUserHasRight('ModifyTicket')) {
 % my $qs = $m->comp("/Elements/QueryString", "RefersTo-new" => "t:$id", next => RT->Config->Get('WebPath')."/RTIR/Display.html?id=$id");
     <table width="100%"><tr><td align="right"><font size="-1">
-        | <a href="<%RT->Config->Get('WebPath')%>/RTFM/Article/PreCreate.html?<% $qs |n%>"><%loc('New')%></a> 
+        | <a href="<%RT->Config->Get('WebPath')%>/Articles/Article/PreCreate.html?<% $qs |n%>"><%loc('New')%></a> 
         | <a href="<%RT->Config->Get('WebPath')%>/RTIR/Incident/LinkArticles.html?id=<%$id%>"><%loc("Link")%></a> |
     </font></td></tr></table>
 % }
 
 <ul>
 % while (my $Link = $TicketObj->RefersTo->Next) {
-% next unless UNIVERSAL::isa($Link->TargetURI->Object, "RT::FM::Article");
+% next unless UNIVERSAL::isa($Link->TargetURI->Object, "RT::Article");
 <li><a href="<%$Link->TargetURI->Resolver->HREF%>"><% $Link->TargetURI->Object->Name %></a></li>
 % }
 </ul>
 
 </&>
-% }
 </td></tr></table>
 
 <& /Ticket/Elements/ShowHistory,
diff --git a/html/RTIR/Incident/LinkArticles.html b/html/RTIR/Incident/LinkArticles.html
index 701db02..02b3d77 100644
--- a/html/RTIR/Incident/LinkArticles.html
+++ b/html/RTIR/Incident/LinkArticles.html
@@ -45,7 +45,7 @@ Search: <input type="text" name="search" value="<% $search %>" />
 <ul>
 % while (my $article = $articles->Next) {
 <li><input type="checkbox" name="SelectedTickets" value="<% $article->id %>" /> 
-<a href="/RTFM/Article/Display.html?id=<% $article->id %>"><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></a>
+<a href="/Articles/Article/Display.html?id=<% $article->id %>"><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></a>
 </li>
 % }
 </ul>
@@ -59,8 +59,8 @@ my $IncidentObj = LoadTicket($id);
 $ARGS{'id'} = $id = $IncidentObj->id;
 my $title = loc("Link selected articles to Incident #[_1]", $id);
 
-use RT::FM::ArticleCollection;
-my $articles = RT::FM::ArticleCollection->new( $session{'CurrentUser'} );
+use RT::Articles;
+my $articles = RT::Articles->new( $session{'CurrentUser'} );
 if ( $search ) {
     $articles->LimitCustomField( VALUE => $search,
                                  ENTRYAGGREGATOR => 'OR',

commit 0e975a42de8527cd74e774aa334b41153ffc94b9
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 04:32:57 2011 +0400

    another test file pass, adjust number of tests

diff --git a/t/004-rtfm-in-rtir.t b/t/004-rtfm-in-rtir.t
index 77b50c5..50c60a5 100644
--- a/t/004-rtfm-in-rtir.t
+++ b/t/004-rtfm-in-rtir.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 22;
+use RT::IR::Test tests => 20;
 
 RT::Test->started_ok;
 my $agent = default_agent();
@@ -12,12 +12,12 @@ my $ir_id  = $agent->create_ir( {Subject => "looking for rtfm"});
 
 $agent->display_ticket( $ir_id);
 
-$agent->follow_link_ok({text => "RTFM"}, "followed 'RTFM' overview link");
-$agent->title_like(qr/Overview/);
+$agent->follow_link_ok({text => "Articles"}, "followed 'Articles' overview link");
+$agent->title_like(qr/^Articles$/);
 
 $agent->back();
 
-$agent->follow_link_ok({text => "New", url_regex => qr/RTFM/}, "followed new RTFM article link");
+$agent->follow_link_ok({text => "New", url_regex => qr/Articles/}, "followed new article link");
 
 $agent->follow_link_ok({text => "in class Templates"}, "chose a class");
 

commit d84b7d65dedfe2d8e89659f39d6571e60437bcf8
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 30 04:36:22 2011 +0400

    update pre 3.0 TODO

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 99f3ffa..ed83865 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -17,3 +17,6 @@
 * /Incident/Children/ and friends use "State" all over the place,
   anyway we break backwards compatibility, let's be consistent
   and ditch the word
+
+* Some pages with forms need new nice layouts like in RT, reply
+  page comes first to mind

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


More information about the Rt-commit mailing list