[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-556-gb571cb5
? sunnavy
sunnavy at bestpractical.com
Tue Nov 23 05:49:13 EST 2010
The branch, 3.9-trunk has been updated
via b571cb5d62746601e967b9ffd78cde85e1ba339c (commit)
via b79a783d5ec15409895be11cb75e3551dc60fd45 (commit)
from 8abfe0f3fe01caff7fa6dec2b41a40a680684afc (commit)
Summary of changes:
etc/RT_Config.pm.in | 11 +++++++++++
lib/RT/Config.pm | 9 +++++++++
share/html/index.html | 10 ++++++++++
t/web/quickcreate.t | 36 ++++++++++++++++++++++++++++++++++++
4 files changed, 66 insertions(+), 0 deletions(-)
create mode 100644 t/web/quickcreate.t
- Log -----------------------------------------------------------------
commit b79a783d5ec15409895be11cb75e3551dc60fd45
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Nov 23 17:27:55 2010 +0800
new config DisplayTicketAfterQuickCreate thanks to Ivan Kohler
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 793eabd..17a1acd 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1697,6 +1697,17 @@ Default: C<< Set( $AllowUserAutocompleteForUnprivileged, 0 ) >>
Set( $AllowUserAutocompleteForUnprivileged, 0 );
+=item C<$DisplayTicketAfterQuickCreate>
+
+Enable this to redirect to the created ticket display page automatically
+when using QuickCreate.
+
+Default: C<< Set( $DisplayTicketAfterQuickCreate, 0 ) >>
+
+=cut
+
+Set( $DisplayTicketAfterQuickCreate, 0 );
+
=back
=head1 UTF-8 Configuration
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 3188eb4..7faf3a4 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -403,6 +403,15 @@ our %META = (
Description => q|Show simplified recipient list on ticket update|, #loc
},
},
+ DisplayTicketAfterQuickCreate => {
+ Section => 'Ticket display',
+ Overridable => 1,
+ SortOrder => 8,
+ Widget => '/Widgets/Form/Boolean',
+ WidgetArguments => {
+ Description => q{Display ticket after "Quick Create"}, #loc
+ },
+ },
# User overridable locale options
DateTimeFormat => {
diff --git a/share/html/index.html b/share/html/index.html
index f0bd103..be06330 100755
--- a/share/html/index.html
+++ b/share/html/index.html
@@ -115,6 +115,16 @@ if ( $ARGS{'QuickCreate'} ) {
Content => $ARGS{'Content'},
Subject => $ARGS{'Subject'});
push @results, $msg;
+
+ if ( $t && $t->Id && RT->Config->Get('DisplayTicketAfterQuickCreate', $session{'CurrentUser'}) ) {
+ $m->comp(
+ '/Elements/MaybeRedirectForResults',
+ 'Actions' => \@results,
+ 'Path' => 'Ticket/Display.html',
+ 'id' => $t->Id,
+ );
+ }
+
}
elsif ( !$ValidCFs ) {
push @results, "can't quickly create ticket in queue " .
commit b571cb5d62746601e967b9ffd78cde85e1ba339c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Nov 23 18:10:00 2010 +0800
test config DisplayTicketAfterQuickCreate
diff --git a/t/web/quickcreate.t b/t/web/quickcreate.t
new file mode 100644
index 0000000..3da0ccb
--- /dev/null
+++ b/t/web/quickcreate.t
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use RT::Test tests => 8;
+
+RT->Config->Set('DisplayTicketAfterQuickCreate' => 0);
+
+my ($baseurl, $m) = RT::Test->started_ok;
+
+ok($m->login, 'logged in');
+
+$m->form_with_fields('Subject', 'Content');
+$m->field(Subject => 'from quick create');
+$m->submit;
+
+$m->content_like(qr/Ticket \d+ created in queue/, 'created ticket');
+is( $m->uri, $baseurl . '/index.html', 'still in homepage' );
+
+$m->get_ok($baseurl . '/Prefs/Other.html');
+$m->submit_form(
+ form_name => 'ModifyPreferences',
+ fields => { 'DisplayTicketAfterQuickCreate' => 1, },
+ button => 'Update',
+);
+
+$m->content_contains( 'Preferences saved',
+ 'enabled DisplayTicketAfterQuickCreate' );
+$m->get($baseurl);
+
+$m->form_with_fields('Subject', 'Content');
+$m->field(Subject => 'from quick create');
+$m->submit;
+
+$m->content_like(qr/Ticket \d+ created in queue/, 'created ticket');
+like( $m->uri, qr!/Ticket/Display.html!, 'still in homepage' );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list