[Rt-commit] rt branch, master, updated. rt-4.0.8-548-gf3b4248

Alex Vandiver alexmv at bestpractical.com
Tue Nov 20 13:39:08 EST 2012


The branch, master has been updated
       via  f3b42484833af4a46c5ebed1741e2a69044cb8a6 (commit)
       via  349625e7309e15777b23f5de4665ed152b507770 (commit)
       via  e084acbb1a129e441984abe07a1b1b7a4778a5c3 (commit)
       via  70b05fc2ef1e56b3c8a5e9321df365939cc8cd97 (commit)
       via  c2eb541ab89b138235951ca74c73ee1cd623323e (commit)
       via  b1cc4054c4e5a76c43e23d3bfad6a7c8b8562027 (commit)
       via  ff5687eee313a66f87394c4a72404b6853b09156 (commit)
       via  a73772e0090f9085d659eb9a4903c546d1d6359a (commit)
       via  581d05e450d94728ccbb359a62d64fe953518f45 (commit)
       via  f19d36c0a18df993b5cc7f34c81397db3bcd5bab (commit)
       via  32a75a6f5721a8ee85a2cb9de9169098a3316fc9 (commit)
       via  8d87f2ce8a2ac882127983c5aa1fbcb3d4742b3f (commit)
       via  b4ca13dbb9849296f28a0b2798801643ca54715e (commit)
       via  69a7133fdc42ee2b37c0c835bb0adbfe02558b26 (commit)
       via  0ee492afd186ac589af31b4a722ab1e3fe065ec0 (commit)
       via  6402b7cb025d4e84773f3586c34541fd4a7fcf79 (commit)
       via  a79755e1acccc79e7732048bf92d5b0532d3016c (commit)
       via  f6e146fb79532dd0e9a6f7ec11bf4b3e0c8e044e (commit)
       via  f8e7ad49c1f478fa8c6290cdce8437e99a0845d1 (commit)
       via  a491d555fb9fe5c74c737078b1c5328a332ef367 (commit)
       via  90c1a308d6cb7b8f0eda4c7454cfe9c6806762d1 (commit)
       via  1f41abd89aea5a0d9082f34008b2507e8fdc7ed2 (commit)
       via  ce7dbd542785021aea360f2d119483de56ff8360 (commit)
       via  d2a79aac0fbcbe3d8c1aa76433af82bd93ee2fa9 (commit)
       via  a47ef9133bfdb190a94e98521f6c4242f03570cc (commit)
       via  d77618cbb06e9a14440fe5d70b7678ae71952e60 (commit)
       via  8ef95236d66fd68962e333932f739a24bb3db208 (commit)
       via  21fe63650e6df9d265fa83d19f711b98be95a280 (commit)
       via  038c4b52bad0285a4436ad9dd0b4059bca56aff1 (commit)
       via  7ebac86a041922ff3c868fdb4b73cba420c7db6a (commit)
       via  5083f796d4b616d1bd9c2bbf46567a4cad43a91c (commit)
       via  2b29c4765829219e148488b8d4ad63d3f44fec34 (commit)
       via  1364022818f362f6736b90bcc5ddc761c543416e (commit)
       via  47f6b6df4d4939ce873db596d5d32a66d5165595 (commit)
       via  43f152d1950de42268649c10391dfd6000152ce5 (commit)
       via  66ef0b01c623307832c3f7b914ab5ef7e53ece33 (commit)
       via  c0333c2cb31e00bdb564868548112dbeb8ae61fa (commit)
       via  31eb53e1072794e7b8f8e4e62496d985c19f68ce (commit)
       via  354a9ee3b2929cd1ef13ec9f46df39b2e82ed5eb (commit)
       via  db1846bc8d9bc3c27bd8fcbfb519fc92540fbe73 (commit)
       via  9ddb3dbb570be241517d3fa09ac3dc6e075c66b5 (commit)
       via  d3637ac058173e88667fbf35de4eca28f499d6da (commit)
       via  23c9d675a7f8a65a02995668b4efd68b9484ff28 (commit)
       via  8917f7942209fcec20c898c2ea80e2eaa138b3cf (commit)
       via  68aade51a53c05145ad80541ac37420594f58e07 (commit)
       via  17a3afd20d79cc277b7676407a1083ed3cfc2ad2 (commit)
       via  0902cde5926aad53415cf4e0db862cd86e8e501f (commit)
       via  6614b3985294f1fb1d75e14b4b847e6144933f8b (commit)
       via  c2802d83fb9037f58b5c49c71b04d90022f41e7f (commit)
       via  ec3c23af337709ce46498f6b0f54a25f0f0ae266 (commit)
       via  f3c3903da9d1ec9e0875f51584ffaa571d2ff983 (commit)
       via  bc253693e97b026ce73d7f3205478dae3638399c (commit)
       via  efb26763bed7aa807e811b75c50df2b99596f97c (commit)
      from  03217dd7ee8641f4f0f59385c361cc69a1406701 (commit)

Summary of changes:
 etc/RT_Config.pm.in                                |  33 +++
 lib/RT/Config.pm                                   |  28 +++
 lib/RT/CustomField.pm                              | 100 +++++++-
 lib/RT/CustomFields.pm                             |  54 ++++
 lib/RT/Interface/Web.pm                            |  48 +++-
 lib/RT/Test/Web.pm                                 |  10 +-
 sbin/rt-test-dependencies.in                       |   1 +
 share/html/Admin/Groups/Modify.html                |   4 +-
 share/html/Admin/Queues/Modify.html                |   6 +-
 share/html/Admin/Users/Modify.html                 |  44 ++--
 .../Articles/Article/Elements/EditCustomFields     |  10 +-
 share/html/Elements/EditCustomField                |  28 ++-
 ...{Quicksearch => EditCustomFieldCustomGroupings} |  32 +--
 share/html/{Ticket => }/Elements/EditCustomFields  |  35 ++-
 share/html/Elements/EditLinks                      |   1 +
 ...tomFieldDate => ShowCustomFieldCustomGroupings} |  26 +-
 share/html/Elements/ShowCustomFields               |   3 +
 share/html/Elements/ShowLinks                      |   1 +
 share/html/Elements/ValidateCustomFields           |  51 ++--
 share/html/NoAuth/js/late.js                       |  36 +++
 share/html/Search/Bulk.html                        |  92 +++----
 share/html/SelfService/Create.html                 |  35 +--
 share/html/SelfService/Update.html                 |   2 +-
 share/html/Ticket/Create.html                      |  42 +++-
 share/html/Ticket/Elements/EditCustomFields        |  62 +----
 share/html/Ticket/Elements/EditDates               |   1 +
 share/html/Ticket/Elements/EditPeople              |  26 +-
 .../Ticket/Elements/EditTransactionCustomFields    |   7 +-
 share/html/Ticket/Elements/ShowBasics              |   1 +
 share/html/Ticket/Elements/ShowCustomFields        |   2 +-
 share/html/Ticket/Elements/ShowDates               |   1 +
 share/html/Ticket/Elements/ShowPeople              |   1 +
 share/html/Ticket/Elements/ShowSummary             |  14 +-
 share/html/Ticket/Modify.html                      |   4 +-
 share/html/Ticket/ModifyAll.html                   |   5 +-
 share/html/Ticket/ModifyDates.html                 |   2 +-
 share/html/Ticket/ModifyLinks.html                 |   1 +
 share/html/Ticket/ModifyPeople.html                |   4 +-
 share/html/Ticket/Update.html                      |  16 +-
 share/html/m/ticket/create                         |  36 +--
 t/web/cf_groupings.t                               | 275 +++++++++++++++++++++
 t/web/cf_groupings_user.t                          | 110 +++++++++
 42 files changed, 976 insertions(+), 314 deletions(-)
 copy share/html/Elements/{Quicksearch => EditCustomFieldCustomGroupings} (77%)
 copy share/html/{Ticket => }/Elements/EditCustomFields (80%)
 copy share/html/Elements/{ShowCustomFieldDate => ShowCustomFieldCustomGroupings} (78%)
 create mode 100644 t/web/cf_groupings.t
 create mode 100644 t/web/cf_groupings_user.t

- Log -----------------------------------------------------------------
commit f3b42484833af4a46c5ebed1741e2a69044cb8a6
Merge: 03217dd 349625e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Nov 20 12:58:08 2012 -0500

    Merge branch '4.2/custom-field-groupings'
    
    Conflicts:
    	lib/RT/CustomField.pm

diff --cc lib/RT/CustomField.pm
index 158ca7e,a036534..28e4855
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@@ -1240,10 -1244,103 +1246,102 @@@ sub CollectionClassFromLookupType 
      return $collection_class;
  }
  
+ =head2 Groupings
+ 
+ Returns a (sorted and lowercased) list of the groupings in which this custom
+ field appears.
+ 
+ If called on a loaded object, the returned list is limited to groupings which
+ apply to the record class this CF applies to (L</RecordClassFromLookupType>).
+ 
+ If passed a loaded object or a class name, the returned list is limited to
+ groupings which apply to the class of the object or the specified class.
+ 
+ If called on an unloaded object, all potential groupings are returned.
+ 
+ =cut
+ 
+ sub Groupings {
+     my $self = shift;
+     my $record_class = $self->_GroupingClass(shift);
+ 
+     my $config = RT->Config->Get('CustomFieldGroupings');
+        $config = {} unless ref($config) eq 'HASH';
+ 
+     my @groups;
+     if ( $record_class ) {
+         push @groups, keys %{ $config->{$record_class} || {} };
+         push @groups, keys %{ $BUILTIN_GROUPINGS{$record_class} || {} };
+     } else {
+         push @groups, map { keys %$_ } values %$config;
+         push @groups, map { keys %$_ } values %BUILTIN_GROUPINGS;
+     }
+ 
+     my %seen;
+     return
+         sort { lc($a) cmp lc($b) }
+         grep defined && length && !$seen{lc $_}++,
+         @groups;
+ }
+ 
+ =head2 CustomGroupings
+ 
+ Identical to L</Groupings> but filters out built-in groupings from the the
+ returned list.
+ 
+ =cut
+ 
+ sub CustomGroupings {
+     my $self = shift;
+     my $record_class = $self->_GroupingClass(shift);
+     return grep !$BUILTIN_GROUPINGS{$record_class}{$_}, $self->Groupings( $record_class );
+ }
+ 
+ sub _GroupingClass {
+     my $self    = shift;
+     my $record  = shift;
+ 
+     my $record_class = ref($record) || $record || '';
+     $record_class = $self->RecordClassFromLookupType
+         if !$record_class and blessed($self) and $self->id;
+ 
+     return $record_class;
+ }
+ 
+ =head2 RegisterBuiltInGroupings
+ 
+ Registers groupings to be considered a fundamental part of RT, either via use
+ in core RT or via an extension.  These groupings must be rendered explicitly in
+ Mason by specific calls to F</Elements/ShowCustomFields> and
+ F</Elements/EditCustomFields>.  They will not show up automatically on normal
+ display pages like configured custom groupings.
+ 
+ Takes a set of key-value pairs of class names (valid L<RT::Record> subclasses)
+ and array refs of grouping names to consider built-in.
+ 
+ If a class already contains built-in groupings (such as L<RT::Ticket> and
+ L<RT::User>), new groupings are appended.
+ 
+ =cut
+ 
+ sub RegisterBuiltInGroupings {
+     my $self = shift;
+     my %new  = @_;
+ 
+     while (my ($k,$v) = each %new) {
+         $v = [$v] unless ref($v) eq 'ARRAY';
+         $BUILTIN_GROUPINGS{$k} = {
+             %{$BUILTIN_GROUPINGS{$k} || {}},
+             map { $_ => 1 } @$v
+         };
+     }
+     $BUILTIN_GROUPINGS{''} = { map { %$_ } values %BUILTIN_GROUPINGS  };
+ }
+ 
 -=head1 ApplyGlobally
 +=head1 IsOnlyGlobal
  
 -Certain custom fields (users, groups) should only be applied globally
 -but rather than regexing in code for LookupType =~ RT::Queue, we'll codify
 -the rules here.
 +Certain custom fields (users, groups) should only be added globally;
 +codify that set here for reference.
  
  =cut
  

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


More information about the Rt-commit mailing list