[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.1-121-gcfeadd0
Shawn Moore
shawn at bestpractical.com
Wed Sep 21 11:43:05 EDT 2016
The branch, 4.4-trunk has been updated
via cfeadd0831c301a794a034f68d4d6a0ccb36c6ef (commit)
from 65a7c031dc285d80520e16fa447357a0fb7608cc (commit)
Summary of changes:
lib/RT/Interface/Web.pm | 73 +++++++++++++++++++++++++++++++++++++++
share/html/Dashboards/Render.html | 13 +++++++
share/html/Elements/QuickCreate | 2 +-
share/html/index.html | 66 ++---------------------------------
4 files changed, 89 insertions(+), 65 deletions(-)
- Log -----------------------------------------------------------------
commit cfeadd0831c301a794a034f68d4d6a0ccb36c6ef
Author: Dustin Collins <strega at bestpractical.com>
Date: Sun Sep 4 00:45:34 2016 -0400
Make QuickCreate return to Dashboard
Using QuickCreate from any dashboard takes users back to 'RT at a
glance'. In order to keep users in their current dashboard, QuickCreate
is moved to a shared location.
Fixes I#25573
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 935c62a..3ec7358 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3884,6 +3884,79 @@ sub ProcessColumnMapValue {
}
}
+sub ProcessQuickCreate {
+ my %params = @_;
+ my %ARGS = %{ $params{ARGSRef} };
+ my $path = $params{Path};
+ my @results;
+
+ if ( $ARGS{'QuickCreate'} ) {
+ my $QueueObj = RT::Queue->new($session{'CurrentUser'});
+ $QueueObj->Load($ARGS{Queue}) or Abort(loc("Queue could not be loaded."));
+
+ my $CFs = $QueueObj->TicketCustomFields;
+
+ my ($ValidCFs, @msg) = $m->comp(
+ '/Elements/ValidateCustomFields',
+ CustomFields => $CFs,
+ ARGSRef => \%ARGS,
+ ValidateUnsubmitted => 1,
+ );
+
+ my $created;
+ if ( $ValidCFs ) {
+ my ($t, $msg) = CreateTicket(
+ Queue => $ARGS{'Queue'},
+ Owner => $ARGS{'Owner'},
+ Status => $ARGS{'Status'},
+ Requestors => $ARGS{'Requestors'},
+ Content => $ARGS{'Content'},
+ Subject => $ARGS{'Subject'},
+ );
+ push @results, $msg;
+
+ if ( $t && $t->Id ) {
+ $created = 1;
+ if ( RT->Config->Get('DisplayTicketAfterQuickCreate', $session{'CurrentUser'}) ) {
+ MaybeRedirectForResults(
+ Actions => \@results,
+ Path => '/Ticket/Display.html',
+ Arguments => { id => $t->Id },
+ );
+ }
+ }
+ }
+ else {
+ push @results, loc("Can't quickly create ticket in queue [_1] because custom fields are required. Please finish by using the normal ticket creation page.", $QueueObj->Name);
+ push @results, @msg;
+
+ MaybeRedirectForResults(
+ Actions => \@results,
+ Path => "/Ticket/Create.html",
+ Arguments => {
+ (map { $_ => $ARGS{$_} } qw(Queue Owner Status Content Subject)),
+ Requestors => $ARGS{Requestors},
+ # From is set above when CFs are OK, but not here since
+ # we're not calling CreateTicket() directly. The proper
+ # place to set a default for From, if desired in the
+ # future, is in CreateTicket() itself, or at least
+ # /Ticket/Display.html (which processes
+ # /Ticket/Create.html). From is rarely used overall.
+ },
+ );
+ }
+
+ $session{QuickCreate} = \%ARGS unless $created;
+
+ MaybeRedirectForResults(
+ Actions => \@results,
+ Path => $path,
+ );
+ }
+
+ return @results;
+}
+
=head2 GetPrincipalsMap OBJECT, CATEGORIES
Returns an array suitable for passing to /Admin/Elements/EditRights with the
diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
index 0d378b2..44b0407 100644
--- a/share/html/Dashboards/Render.html
+++ b/share/html/Dashboards/Render.html
@@ -55,6 +55,8 @@
<& /Elements/Tabs &>
% }
+<& /Elements/ListActions, actions => \@results &>
+
% # honor the chosen language for just the dashboard content
% my $original_handle;
% if ($SubscriptionObj->id) {
@@ -105,13 +107,24 @@
% $session{'CurrentUser'}->{'LangHandle'} = $original_handle;
% }
<%INIT>
+my @results;
+my $skip_create = 0;
+$m->callback(ARGSRef => \%ARGS,
+ results => \@results,
+ CallbackName => 'Initial',
+ skip_create => \$skip_create);
use RT::Dashboard;
my $Dashboard = RT::Dashboard->new($session{'CurrentUser'});
my ($ok, $msg) = $Dashboard->LoadById($id);
$ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
+my $path = '/Dashboards/' . $Dashboard->id . '/' . $Dashboard->Name;
+unless ( $skip_create ) {
+ push @results, ProcessQuickCreate( Path => $path, ARGSRef => \%ARGS );
+}
+
my $SubscriptionObj = RT::Attribute->new($session{'CurrentUser'});
my $rows;
diff --git a/share/html/Elements/QuickCreate b/share/html/Elements/QuickCreate
index be25b8d..466565d 100644
--- a/share/html/Elements/QuickCreate
+++ b/share/html/Elements/QuickCreate
@@ -49,7 +49,7 @@
<&| /Widgets/TitleBox, title => loc('Quick ticket creation') &>
<form
method="post"
- action="<%RT->Config->Get('WebPath')%>/index.html"
+ action="<%RT->Config->Get('WebPath')%><% $r->path_info %>"
% $m->callback(CallbackName => 'InFormElement');
>
<input type="hidden" class="hidden" name="QuickCreate" value="1" />
diff --git a/share/html/index.html b/share/html/index.html
index bbf84c8..debfc9b 100644
--- a/share/html/index.html
+++ b/share/html/index.html
@@ -89,72 +89,10 @@ my $skip_create = 0;
$m->callback( ARGSRef => \%ARGS, results => \@results, CallbackName => 'Initial',
skip_create => \$skip_create );
-if ( $ARGS{'QuickCreate'} ) {
- my $QueueObj = RT::Queue->new($session{'CurrentUser'});
- $QueueObj->Load($ARGS{Queue}) or Abort(loc("Queue could not be loaded."));
-
- my $CFs = $QueueObj->TicketCustomFields();
-
- my ($ValidCFs, @msg) = $m->comp(
- '/Elements/ValidateCustomFields',
- CustomFields => $CFs,
- ARGSRef => \%ARGS,
- ValidateUnsubmitted => 1,
- );
-
-
- my $created;
- if ( $ValidCFs && !$skip_create ) {
- my ($t, $msg) = CreateTicket(
- Queue => $ARGS{'Queue'},
- Owner => $ARGS{'Owner'},
- Status => $ARGS{'Status'},
- # yes! it's Requestors, not Requestor
- Requestors => $ARGS{'Requestors'},
- Content => $ARGS{'Content'},
- Subject => $ARGS{'Subject'});
- push @results, $msg;
-
- if ( $t && $t->Id ) {
- $created = 1;
- if ( RT->Config->Get('DisplayTicketAfterQuickCreate', $session{'CurrentUser'}) ) {
- MaybeRedirectForResults(
- Actions => \@results,
- Path => '/Ticket/Display.html',
- Arguments => { id => $t->Id },
- );
- }
- }
- }
- elsif ( !$ValidCFs ) {
- push @results, loc("Can't quickly create ticket in queue [_1] because custom fields are required. Please finish by using the normal ticket creation page.", $QueueObj->Name);
- push @results, @msg;
-
- MaybeRedirectForResults(
- Actions => \@results,
- Path => "/Ticket/Create.html",
- Arguments => {
- (map { $_ => $ARGS{$_} } qw(Queue Owner Status Content Subject)),
- Requestors => $ARGS{Requestors},
- # From is set above when CFs are OK, but not here since we're
- # not calling CreateTicket() directly. The proper place to set
- # a default for From, if desired in the future, is in
- # CreateTicket() itself, or at least /Ticket/Display.html
- # (which processes /Ticket/Create.html). From is rarely used
- # overall.
- },
- );
- }
-
- $session{QuickCreate} = \%ARGS unless $created;
-
- MaybeRedirectForResults(
- Actions => \@results,
- Path => '/',
- );
+unless ( $skip_create ) {
+ push @results, ProcessQuickCreate( Path => '/', ARGSRef => \%ARGS );
}
-
if ( $ARGS{'q'} ) {
RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Search/Simple.html?q=".$m->interp->apply_escapes($ARGS{q}, 'u'));
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list