[Rt-commit] r2313 - in rt/branches/3.4-RELEASE: .
html/Admin/CustomFields
jesse at bestpractical.com
jesse at bestpractical.com
Mon Mar 7 16:03:06 EST 2005
Author: jesse
Date: Mon Mar 7 16:03:05 2005
New Revision: 2313
Modified:
rt/branches/3.4-RELEASE/ (props changed)
rt/branches/3.4-RELEASE/html/Admin/CustomFields/Objects.html
Log:
r6568 at hualien: jesse | 2005-03-07 16:01:44 -0500
Adding support for selecting custom fields for RTFM objects
Modified: rt/branches/3.4-RELEASE/html/Admin/CustomFields/Objects.html
==============================================================================
--- rt/branches/3.4-RELEASE/html/Admin/CustomFields/Objects.html (original)
+++ rt/branches/3.4-RELEASE/html/Admin/CustomFields/Objects.html Mon Mar 7 16:03:05 2005
@@ -68,13 +68,25 @@
my $CF = RT::CustomField->new($session{'CurrentUser'});
$CF->Load($id) or Abort(loc("Could not load CustomField [_1]"), $id);
my $LookupType = $CF->LookupType;
-$LookupType =~ /^(RT::(\w+))/
- or Abort(loc("Object of type [_1] cannot take custom fields", $LookupType));
+$LookupType =~ /^(.*?)-/ ||
+ Abort(loc("Object of type [_1] cannot take custom fields", $LookupType));
-my $Type = $2;
my $Class = $1;
-my $CollectionType = $2.'s';
-my $CollectionClass = $Class.'s';
+my $CollectionClass;
+if (UNIVERSAL::can($Class.'Collection', 'new') ) {
+$CollectionClass = $Class.'Collection';
+
+} elsif (UNIVERSAL::can($Class.'es', 'new') ) {
+ $CollectionClass = $Class.'es';
+
+} elsif (UNIVERSAL::can($Class.'s', 'new') ) {
+ $CollectionClass = $Class.'s';
+
+} else {
+ Abort(loc("Can't find a collection class for '[_1]'", $Class));
+}
+
+
my $title = loc('Modify associated objects for [_1]', $CF->Name);
my $Objects = $CollectionClass->new($session{'CurrentUser'});
More information about the Rt-commit
mailing list