[Rt-commit] rtir branch, 2.9-trunk, updated. 2.6.1rc1-373-ge7b267a

Ruslan Zakirov ruz at bestpractical.com
Tue Aug 30 21:00:02 EDT 2011


The branch, 2.9-trunk has been updated
       via  e7b267a55514e165b1651b898af8d14fbf0abd22 (commit)
       via  ad7bcfad48010f52ff08f98c1a0b64e7b41d736f (commit)
       via  55bdc2dd32e124416156e76b3f67847d527c3819 (commit)
       via  91e432c8bb540dd446668f66360ac823ef69f901 (commit)
       via  f5cd0dea88610ae1ed77246f4b4e093df70a9234 (commit)
       via  744c91844f862dba6b878535d03a9cc2194acab5 (commit)
      from  3be42737b47dd740d5e30c64184e97710847ef41 (commit)

Summary of changes:
 TODO.porting_over_RT4                   |   15 ------
 etc/initialdata                         |   10 ++++
 html/RTIR/Create.html                   |    7 ++-
 html/RTIR/Elements/UpdateData           |    1 +
 html/RTIR/Incident/Create.html          |    4 +-
 html/RTIR/Incident/Reply.html           |    2 +-
 html/RTIR/Investigation/Elements/Create |    3 +
 t/{004-rtfm-in-rtir.t => rtfm/basics.t} |    2 +-
 t/rtfm/on-create.t                      |   70 +++++++++++++++++++++++++++++
 t/rtfm/on-update.t                      |   73 +++++++++++++++++++++++++++++++
 10 files changed, 166 insertions(+), 21 deletions(-)
 rename t/{004-rtfm-in-rtir.t => rtfm/basics.t} (90%)
 create mode 100644 t/rtfm/on-create.t
 create mode 100644 t/rtfm/on-update.t

- Log -----------------------------------------------------------------
commit 744c91844f862dba6b878535d03a9cc2194acab5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Aug 28 05:17:22 2011 +0400

    'New' link was renamed to 'Create'

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 52a42ce..348e7e8 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -72,13 +72,3 @@
 
 * add tests to make sure attachments attached to all selected Children when
   replying via Incident
-
-Test Summary Report
--------------------
-t/004-rtfm-in-rtir.t                          (Wstat: 1280 Tests: 20 Failed: 5)
-  Failed tests:  15-16, 18-20
-  Non-zero exit status: 5
-Files=38, Tests=2505, 986 wallclock secs ( 0.79 usr  0.22 sys + 413.24 cusr 27.77 csys = 442.02 CPU)
-Result: FAIL
-Failed 1/38 test programs. 5/2505 subtests failed.
-
diff --git a/t/004-rtfm-in-rtir.t b/t/004-rtfm-in-rtir.t
index 50c60a5..35f2b8d 100644
--- a/t/004-rtfm-in-rtir.t
+++ b/t/004-rtfm-in-rtir.t
@@ -17,7 +17,7 @@ $agent->title_like(qr/^Articles$/);
 
 $agent->back();
 
-$agent->follow_link_ok({text => "New", url_regex => qr/Articles/}, "followed new article link");
+$agent->follow_link_ok({text => "Create", url_regex => qr/Articles/}, "followed new article link");
 
 $agent->follow_link_ok({text => "in class Templates"}, "chose a class");
 

commit f5cd0dea88610ae1ed77246f4b4e093df70a9234
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Aug 30 02:39:26 2011 +0400

    update todo

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 348e7e8..531d8c4 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -22,9 +22,6 @@
 * Some pages with forms need new nice layouts like in RT, reply
   page comes first to mind
 
-* IR create page: "Don't send any emails to correspondents." and hints
-  are not aligned well. Look at RT's forms and adjust accordingly.
-
 * scan code for hardcoded statuses
 
 * tranasaction custom fields

commit 91e432c8bb540dd446668f66360ac823ef69f901
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 31 03:58:03 2011 +0400

    name form
    
    name it like form in Update.html, purpose of the page is
    very similar

diff --git a/html/RTIR/Incident/Reply.html b/html/RTIR/Incident/Reply.html
index e162ae3..efa5832 100644
--- a/html/RTIR/Incident/Reply.html
+++ b/html/RTIR/Incident/Reply.html
@@ -28,7 +28,7 @@
 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $IncidentObj);
 <& /Elements/ListActions, actions => \@results &>
 
-<form action="Reply.html" method="get">
+<form action="Reply.html" name="TicketUpdate" method="get">
 <input type="hidden" name="id" value="<% $id %>" />
 <input type="hidden" name="Status" value="<% $Status %>" />
 <input type="hidden" name="All" value="<% $All %>" />

commit 55bdc2dd32e124416156e76b3f67847d527c3819
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 31 03:58:43 2011 +0400

    apply articles' class we create to RTIR's queues

diff --git a/etc/initialdata b/etc/initialdata
index b46d14d..720149d 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -726,6 +726,16 @@ for my $cf (@CustomFields) {
             HotList => 1
         );
         die $msg unless $id;
+
+        foreach my $qname ( map $_->{'Name'}, @Queues ) {
+            my $queue = RT::Queue->new( $CurrentUser );
+            $queue->Load( $qname );
+            next unless $queue->id;
+
+            my ($status, $msg) = $class->AddToObject( $queue );
+            $RT::Logger->error("Couldn't apply class to queue '$qname'")
+                unless $status;
+        }
     }
 
     require RT::Article;

commit ad7bcfad48010f52ff08f98c1a0b64e7b41d736f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 31 04:00:20 2011 +0400

    return back articles on update, test it

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 531d8c4..6368282 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -28,8 +28,6 @@
 
 === FIXES
 
-* Don't see Articles on IR's Update.html
-
 * /Incident/Reply.html needs refine query page
 
 === DOCS
diff --git a/html/RTIR/Elements/UpdateData b/html/RTIR/Elements/UpdateData
index b70bf43..08cf3a5 100644
--- a/html/RTIR/Elements/UpdateData
+++ b/html/RTIR/Elements/UpdateData
@@ -43,6 +43,7 @@
 % }
 
 <tr><td class="label" valign="top"><&|/l&>Message</&>:</td><td>
+<& /Articles/Elements/BeforeMessageBox, %ARGS &>
 % $m->callback( %ARGS, CallbackPage => '/Ticket/Update.html', CallbackName => 'BeforeMessageBox' );
 % if ( exists $ARGS{'UpdateContent'} ) {
 % delete $ARGS{'QuoteTransaction'};
diff --git a/t/004-rtfm-in-rtir.t b/t/rtfm/basics.t
similarity index 100%
rename from t/004-rtfm-in-rtir.t
rename to t/rtfm/basics.t
diff --git a/t/rtfm/on-update.t b/t/rtfm/on-update.t
new file mode 100644
index 0000000..ab5ec75
--- /dev/null
+++ b/t/rtfm/on-update.t
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 69;
+
+RT::Test->started_ok;
+my $agent = default_agent();
+
+my $article_id = 1;
+my $article_name = 'some article';
+
+diag "create an article" if $ENV{'TEST_VERBOSE'};
+{
+    $agent->get_ok('/', "followed 'Articles' overview link");
+    $agent->follow_link_ok({text => "Articles"}, "followed 'Articles' overview link");
+    $agent->follow_link_ok({text => "New Article" }, "followed new article link");
+    $agent->follow_link_ok({text => "in class Templates"}, "chose a class");
+
+    my $cf = RT::CustomField->new( RT->SystemUser );
+    $cf->Load('Response');
+    ok($cf->id, 'found respone custom field');
+
+    $agent->form_name("EditArticle");
+    $agent->field(Name => $article_name);
+    $agent->field(Summary => "this is a summary");
+    $agent->field( 'Object-RT::Article--CustomField-'. $cf->id .'-Values' => 'this is a content' );
+    $agent->submit;
+
+    is($agent->status, 200, "attempt to create succeeded");
+}
+
+my $incident_id;
+foreach my $queue ( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
+    my $id = $agent->create_rtir_ticket_ok(
+        $queue,
+        {
+            Subject => "test",
+            ( $queue eq 'Blocks' ? ( Incident => $incident_id ) : () ),
+        },
+    );
+    $incident_id = $id if $queue eq 'Incidents';
+
+    my $reply_text = $queue eq 'Incidents'? 'Reply to Reporters' : 'Reply';
+
+    $agent->follow_link_ok({text => "$reply_text"}, "followed '$reply_text' link");
+    $agent->form_name('TicketUpdate');
+    is( $agent->field('UpdateContent'), '' );
+    $agent->field('Articles-Include-Article-Named' => $article_name);
+    $agent->click('Go');
+    $agent->form_name('TicketUpdate');
+    like( $agent->field('UpdateContent'), qr/this is a content/ );
+
+    $agent->follow_link_ok({text => "$reply_text"}, "followed '$reply_text' link");
+    $agent->form_name('TicketUpdate');
+    is( $agent->field('UpdateContent'), '' );
+    $agent->select('Articles-Include-Article-Named-Hotlist' => $article_id);
+    $agent->click('Go');
+    $agent->form_name('TicketUpdate');
+    like( $agent->field('UpdateContent'), qr/this is a content/ );
+
+    $agent->follow_link_ok({text => "$reply_text"}, "followed '$reply_text' link");
+    $agent->form_name('TicketUpdate');
+    is( $agent->field('UpdateContent'), '' );
+    $agent->field('Articles_Content' => $article_name);
+    $agent->click('Go');
+    $agent->form_name('TicketUpdate');
+    is( $agent->field('UpdateContent'), '' );
+    $agent->click('Articles-Include-Article-'. $article_id);
+    $agent->form_name('TicketUpdate');
+    like( $agent->field('UpdateContent'), qr/this is a content/ );
+}

commit e7b267a55514e165b1651b898af8d14fbf0abd22
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 31 04:30:02 2011 +0400

    return back articles on create

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 720a84d..eb4ba58 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -37,9 +37,9 @@
 % }
 
 % unless ( $Split ) {
-<form action="<% RT->Config->Get('WebPath') %>/RTIR/Create.html" method="post" enctype="multipart/form-data">
+<form action="<% RT->Config->Get('WebPath') %>/RTIR/Create.html" method="post" enctype="multipart/form-data" name="TicketCreate">
 % } else {
-<form action="<% RT->Config->Get('WebPath') %>/RTIR/Split.html" method="post" enctype="multipart/form-data">
+<form action="<% RT->Config->Get('WebPath') %>/RTIR/Split.html" method="post" enctype="multipart/form-data" name="TicketCreate">
 % }
 <input type="hidden" name="id" value="new" />
 <input type="hidden" name="Queue" value="<% $Queue %>" />
@@ -231,6 +231,9 @@
 % } else {
 %   $include_signature = 0;
 % }
+% if ( RT->Config->Get('ArticleOnTicketCreate')) {
+<& /Articles/Elements/BeforeMessageBox, %ARGS &>
+% }
 % $m->callback( %ARGS, CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' );
 % if ( $ARGS{Content} ) {
 <& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => $include_signature &>
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index a8d304e..12331b8 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -43,9 +43,9 @@ if ( $ChildObj && !$ChildObj->CurrentUserHasRight('ModifyTicket') ) {
 </%PERL>
 
 % if ( $Split ) {
-<form action="Split.html" method="post" enctype="multipart/form-data">
+<form action="Split.html" method="post" enctype="multipart/form-data" name="TicketCreate">
 % } else {
-<form action="Create.html" method="post" enctype="multipart/form-data">
+<form action="Create.html" method="post" enctype="multipart/form-data" name="TicketCreate">
 % }
 
 <input type="hidden" name="id"           value="new" />
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 11bd1e2..2f1d342 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -120,6 +120,9 @@ email addresses. These people <b>will</b> receive future updates.)</&></font></i
 % unless ( $SkipField{'Content'} || $HideField{'Content'} ) {
 <tr><td class="labeltop"><&|/l&>Message</&>:</td>
 <td>
+% if ( RT->Config->Get('ArticleOnTicketCreate')) {
+<& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj, MessageBoxName => $NamePrefix .'Content' &>
+% }
 % $m->callback( %ARGS, MessageBoxName => $NamePrefix .'Content',
 %    CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' );
 % my $content = $value_cb->('Content');
diff --git a/t/rtfm/on-create.t b/t/rtfm/on-create.t
new file mode 100644
index 0000000..0c6ced0
--- /dev/null
+++ b/t/rtfm/on-create.t
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 53;
+
+RT->Config->Set( ArticleOnTicketCreate => 1 );
+
+RT::Test->started_ok;
+my $agent = default_agent();
+
+my $article_id = 1;
+my $article_name = 'some article';
+
+diag "create an article" if $ENV{'TEST_VERBOSE'};
+{
+    $agent->get_ok('/', "followed 'Articles' overview link");
+    $agent->follow_link_ok({text => "Articles"}, "followed 'Articles' overview link");
+    $agent->follow_link_ok({text => "New Article" }, "followed new article link");
+    $agent->follow_link_ok({text => "in class Templates"}, "chose a class");
+
+    my $cf = RT::CustomField->new( RT->SystemUser );
+    $cf->Load('Response');
+    ok($cf->id, 'found respone custom field');
+
+    $agent->form_name("EditArticle");
+    $agent->field(Name => $article_name);
+    $agent->field(Summary => "this is a summary");
+    $agent->field( 'Object-RT::Article--CustomField-'. $cf->id .'-Values' => 'this is a content' );
+    $agent->submit;
+
+    is($agent->status, 200, "attempt to create succeeded");
+}
+
+foreach ( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
+    my $queue = RT::Queue->new(RT->SystemUser);
+    $queue->Load( $_ );
+    ok $agent->goto_create_ticket( $queue ), "UI -> create ticket";
+
+    my $content_name = $queue->Name eq 'Incidents'? 'InvestigationContent': 'Content';
+    my $prefix = $queue->Name eq 'Incidents'? 'InvestigationContent-': '';
+
+    $agent->form_name('TicketCreate');
+    is( $agent->field( $content_name ), '' );
+    $agent->field($prefix.'Articles-Include-Article-Named' => $article_name);
+    $agent->click('Go');
+    $agent->form_name('TicketCreate');
+    like( $agent->field( $content_name ), qr/this is a content/ );
+
+    ok $agent->goto_create_ticket( $queue ), "UI -> create ticket";
+    $agent->form_name('TicketCreate');
+    is( $agent->field( $content_name ), '' );
+    $agent->select($prefix .'Articles-Include-Article-Named-Hotlist' => $article_id);
+    $agent->click('Go');
+    $agent->form_name('TicketCreate');
+    like( $agent->field( $content_name ), qr/this is a content/ );
+
+    ok $agent->goto_create_ticket( $queue ), "UI -> create ticket";
+    $agent->form_name('TicketCreate');
+    is( $agent->field( $content_name ), '' );
+    $agent->field($prefix .'Articles_Content' => $article_name);
+    $agent->click('Go');
+    $agent->form_name('TicketCreate');
+    is( $agent->field( $content_name ), '' );
+    $agent->click($prefix .'Articles-Include-Article-'. $article_id);
+    $agent->form_name('TicketCreate');
+    like( $agent->field( $content_name ), qr/this is a content/ );
+}
+

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


More information about the Rt-commit mailing list