[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.1-147-g602fd00
Shawn Moore
shawn at bestpractical.com
Thu Dec 1 15:27:10 EST 2016
The branch, 4.4-trunk has been updated
via 602fd00650c4d15c1e53cde8a258e056abe342cb (commit)
via 40bd0e1e60d79fcd6a665d2c457ca28fc9b12d51 (commit)
via 523fabb14cb2c722602dae2e516a3a2c7f2be9b3 (commit)
via 06362de3b6cd3451aca2eda009b0d2137a876a05 (commit)
via 496865ab2a04eb344d69a0909a4dceb27595ee17 (commit)
via d88a99937fef4a2dc8e03c66d0f653c31efb9c7b (commit)
via a4fe91084f768a07094265af3133bdb1a1697cae (commit)
from 193312de2822d942f5ffa39dd5d30ab32a26e453 (commit)
Summary of changes:
share/html/Elements/EditCustomFields | 9 +++++++--
share/html/Elements/ShowCustomFields | 9 ++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit a4fe91084f768a07094265af3133bdb1a1697cae
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Jul 19 09:31:42 2016 -0400
Add a test for passing in a CF value to Modify in the URL
RT users sometimes provide links to the Modify page with a
custom field value populated via the link to make it easy to
click, then submit an update. Add a test to validate that this
default value is selected when the page is rendered.
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index f70486f..ce11833 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -151,6 +151,13 @@ diag "check that we can set empty value when the current is 0";
undef, 'API returns correct value';
}
+diag "check that a default value is displayed";
+{
+ my $default_ticket_id = RT::Test->create_ticket(Queue => 'General');
+ $m->get_ok("/Ticket/Modify.html?id=" . $default_ticket_id->Id . "&CustomField-$cfid=qwe");
+ $m->content_like(qr/\<option value="qwe"\s+selected="selected"/, 'Default value is selected');
+}
+
diag 'retain selected cf values when adding attachments';
{
my ( $ticket, $id );
commit d88a99937fef4a2dc8e03c66d0f653c31efb9c7b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Jul 19 10:01:16 2016 -0400
Pass %ARGS to EditCustomFields
EditCustomFields has code to pull out CF values in the form
CustomField-123 from ARGS, but ARGS was not passed from Modify.html
so any passed-in arguments were not available.
diff --git a/share/html/Ticket/Modify.html b/share/html/Ticket/Modify.html
index f57da09..937d76c 100644
--- a/share/html/Ticket/Modify.html
+++ b/share/html/Ticket/Modify.html
@@ -58,12 +58,12 @@
<&| /Widgets/TitleBox, title => loc('Modify ticket #[_1]',$TicketObj->Id), class=>'ticket-info-basics' &>
<table>
<& Elements/EditBasics, TicketObj => $TicketObj, defaults => \%ARGS, InTable => 1 &>
-<& /Elements/EditCustomFields, Object => $TicketObj, Grouping => 'Basics', InTable => 1 &>
+<& /Elements/EditCustomFields, %ARGS, Object => $TicketObj, Grouping => 'Basics', InTable => 1 &>
</table>
</&>
% $m->callback( CallbackName => 'AfterBasics', Ticket => $TicketObj );
-<& /Elements/EditCustomFieldCustomGroupings, Object => $TicketObj, AsTable => !!RT->Config->Get('EditCustomFieldsSingleColumn', $session{'CurrentUser'}) &>
+<& /Elements/EditCustomFieldCustomGroupings, %ARGS, Object => $TicketObj, AsTable => !!RT->Config->Get('EditCustomFieldsSingleColumn', $session{'CurrentUser'}) &>
<& /Elements/Submit, Name => 'SubmitTicket', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#993333" &>
</form>
commit 496865ab2a04eb344d69a0909a4dceb27595ee17
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Jul 19 10:06:03 2016 -0400
Support single default values as well as lists
806ee09e8 added support for defaults in list-type CFs
like multiple checkboxes by changing $Defaults in ARGS
to @Defaults. However, this meant values passed as $Default
were then not processed. Add support for both modes.
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 83d0458..6d3ac6b 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -112,6 +112,11 @@ if ( $RenderType eq 'Dropdown' ) {
$Rows = 0;
}
+# Process scalar values for Default
+if ( $Default and !@Default ){
+ push @Default, $Default;
+}
+
my ($checktype, $name);
if ( $MaxValues == 1 and $RenderType eq 'List' ) {
($checktype, $name) = ('radio', $Name || $NamePrefix . $CustomField->Id . '-Value');
@@ -153,6 +158,7 @@ $NamePrefix => undef
$Name => undef
$BasedOnName => undef
@Default => ()
+$Default => undef
$Values => undef
$Multiple => 0
$Rows => undef
commit 06362de3b6cd3451aca2eda009b0d2137a876a05
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'));
}
commit 523fabb14cb2c722602dae2e516a3a2c7f2be9b3
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu Sep 29 15:27:28 2016 +0000
refactor individual field row classes in Edit and ShowCustomFields
diff --git a/share/html/Elements/EditCustomFields b/share/html/Elements/EditCustomFields
index fbfb5ed..2ffda95 100644
--- a/share/html/Elements/EditCustomFields
+++ b/share/html/Elements/EditCustomFields
@@ -60,8 +60,11 @@
% }
% for my $CustomField (@CustomFields) {
% my $Type = $CustomField->Type || 'Unknown';
-
- <<% $FIELD %> class="edit-custom-field cftype-<% $Type %>">
+% my @classes = (
+% 'edit-custom-field',
+% "cftype-$Type",
+% );
+ <<% $FIELD %> class="<% join(' ', @classes) %>">
<<% $CELL %> class="cflabel">
<span class="name"><% $CustomField->Name %>:</span><br />
<span class="type"><% $CustomField->EntryHint // '' %></span>
diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index 07b828e..ee5c3f7 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -54,7 +54,12 @@
% my $Values = $Object->CustomFieldValues( $CustomField->Id );
% my $count = $Values->Count;
% next if $HideEmpty and not $count;
- <tr class="custom-field custom-field-<% $CustomField->id%><% $count ? q{} : q{ unset-field}%>" id="CF-<%$CustomField->id%>-ShowRow">
+% my @classes = (
+% 'custom-field',
+% 'custom-field-'.$CustomField->id,
+% );
+% push @classes, 'unset-field' if $count;
+ <tr class="<% join(' ', @classes) %>" id="CF-<%$CustomField->id%>-ShowRow">
<td class="label"><% $CustomField->Name %>:</td>
<td class="value<% $count ? '' : ' no-value' %>">
% unless ( $count ) {
commit 40bd0e1e60d79fcd6a665d2c457ca28fc9b12d51
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu Sep 29 15:28:02 2016 +0000
add ModifyFieldClasses callback to Edit and ShowCustomFields
this lets you have callbacks to have certain custom fields with
different classes
particularly useful for highlighting / hiding certain fields
diff --git a/share/html/Elements/EditCustomFields b/share/html/Elements/EditCustomFields
index 2ffda95..0ccea7b 100644
--- a/share/html/Elements/EditCustomFields
+++ b/share/html/Elements/EditCustomFields
@@ -64,6 +64,8 @@
% 'edit-custom-field',
% "cftype-$Type",
% );
+% $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
+% Object => $Object, Classes => \@classes, Grouping => $Grouping );
<<% $FIELD %> class="<% join(' ', @classes) %>">
<<% $CELL %> class="cflabel">
<span class="name"><% $CustomField->Name %>:</span><br />
diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index ee5c3f7..20f5aca 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -59,6 +59,8 @@
% 'custom-field-'.$CustomField->id,
% );
% push @classes, 'unset-field' if $count;
+% $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
+% Object => $Object, Classes => \@classes, Grouping => $Grouping );
<tr class="<% join(' ', @classes) %>" id="CF-<%$CustomField->id%>-ShowRow">
<td class="label"><% $CustomField->Name %>:</td>
<td class="value<% $count ? '' : ' no-value' %>">
commit 602fd00650c4d15c1e53cde8a258e056abe342cb
Merge: 193312d 40bd0e1
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu Dec 1 20:22:24 2016 +0000
Merge branch '4.4/custom-field-class-callback' into 4.4-trunk
-----------------------------------------------------------------------
More information about the rt-commit
mailing list