[Rt-commit] rt branch, 4.2/customfieldgrouping-extensibility, created. rt-4.2.6-37-gb1ba2c3
Kevin Falcone
falcone at bestpractical.com
Wed Aug 6 13:47:37 EDT 2014
The branch, 4.2/customfieldgrouping-extensibility has been created
at b1ba2c3d6ae2b4fa36226e65518ffaee89f62442 (commit)
- Log -----------------------------------------------------------------
commit 4abd0fa231c567fe7dca37afc528ecc52ff74265
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Wed Jul 23 13:18:44 2014 -0400
RT::CustomField provides a wrapper to get the 'type', use it
Hardcoding ref here meant that if anything extends
RT::CustomField->_GroupingClass, it'll fail to find the groupings and
dump all your CFs into the Custom Fields group. By calling back in to
GroupingClass, you get the 'magic' type and can look it up in the
groupings.
NewItem provides an empty CustomField with ContextObject set which
overriders of _GroupingClass can use for more context when
LimitoToGrouping is called on an empty object (during object creation)
RTIR uses this to provide an RTIR::Ticket grouping type so you can
separate CF groupings on RTIR tickets from those on core tickets.
Provided to allow better separation of groupings between RTIR CFs and
CFs on other Queues, especially since RTIR uses common names such as
'Customer' and 'IP' which would otherwise complicate using those CFs in
groups in other Queues. Perhaps points towards wanting per-queue CF
groupings.
diff --git a/lib/RT/CustomFields.pm b/lib/RT/CustomFields.pm
index eab9a10..14b0e8f 100644
--- a/lib/RT/CustomFields.pm
+++ b/lib/RT/CustomFields.pm
@@ -118,9 +118,11 @@ sub LimitToGrouping {
my $obj = shift;
my $grouping = shift;
+ my $grouping_class = $self->NewItem->_GroupingClass($obj);
+
my $config = RT->Config->Get('CustomFieldGroupings');
$config = {} unless ref($config) eq 'HASH';
- $config = $config->{ref($obj) || $obj} || [];
+ $config = $config->{$grouping_class} || [];
my %h = ref $config eq "ARRAY" ? @{$config} : %{$config};
if ( $grouping ) {
commit b1ba2c3d6ae2b4fa36226e65518ffaee89f62442
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Jul 24 11:53:49 2014 -0400
Allow @Groupings to be passed in
The display template (ShowCustomFieldCustomGroupings) takes Groupings as
an argument, for symmetry, also take it during editing.
This allows code to better control which groups are shown
on Create or other editing pages (in particular, RTIR and the multitude
of complex editing/creating pages in that workflow).
diff --git a/share/html/Elements/EditCustomFieldCustomGroupings b/share/html/Elements/EditCustomFieldCustomGroupings
index 6e32436..2edf572 100644
--- a/share/html/Elements/EditCustomFieldCustomGroupings
+++ b/share/html/Elements/EditCustomFieldCustomGroupings
@@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-% foreach my $group ( RT::CustomField->CustomGroupings( $Object ), '' ) {
+% foreach my $group ( @Groupings ) {
<&| /Widgets/TitleBox,
title => $group? loc($group) : loc('Custom Fields'),
class => $css_class .' '. ($group? CSSClass("$css_class-$group") : ''),
@@ -59,6 +59,7 @@
<%ARGS>
$Object
$CustomFieldGenerator => undef,
+ at Groupings => (RT::CustomField->CustomGroupings( $Object ), '')
</%ARGS>
<%INIT>
my $css_class = lc(ref($Object)||$Object);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list