[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-196-g482fbd2
Thomas Sibley
trs at bestpractical.com
Fri Jul 30 15:05:16 EDT 2010
The branch, 3.9-trunk has been updated
via 482fbd258ab4a601ab59d8c9975354331c4399da (commit)
from 972d9a4377cbcf496105bd34d6e2846e366219e5 (commit)
Summary of changes:
lib/RT/CustomField_Overlay.pm | 10 ++++++++++
share/html/Admin/CustomFields/Modify.html | 6 ++++--
.../Admin/Elements/SelectCustomFieldRenderType | 11 ++++++++++-
3 files changed, 24 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 482fbd258ab4a601ab59d8c9975354331c4399da
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Jul 30 15:06:14 2010 -0400
We don't yet support cascaded selects when rendering as a List
Let the user know and act appropriately. This commit should be reverted
as soon as we do support cascaded lists.
diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index 1a1bac1..31e2c5b 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -905,6 +905,11 @@ sub SetRenderType {
$self->FriendlyType));
}
+ # XXX: Remove this restriction once we support lists and cascaded selects
+ if ( $self->BasedOnObj->id and $type =~ /List/ ) {
+ return (0, $self->loc("We can't currently render as a List when basing categories on another custom field. Please use another render type."));
+ }
+
return $self->SetAttribute( Name => 'RenderType', Content => $type );
}
@@ -1522,6 +1527,11 @@ sub SetBasedOn {
return (0, "Permission denied")
unless $cf->Id && $cf->CurrentUserHasRight('SeeCustomField');
+ # XXX: Remove this restriction once we support lists and cascaded selects
+ if ( $self->RenderType =~ /List/ ) {
+ return (0, $self->loc("We can't currently render as a List when basing categories on another custom field. Please use another render type."));
+ }
+
return $self->AddAttribute(
Name => "BasedOn",
Description => "Custom field whose CF we depend on",
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index dc25567..7d24e3b 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -77,7 +77,8 @@
<& /Admin/Elements/SelectCustomFieldRenderType,
Name => "RenderType",
TypeComposite => $CustomFieldObj->TypeComposite,
- Default => $CustomFieldObj->RenderType, &>
+ Default => $CustomFieldObj->RenderType,
+ BasedOn => $CustomFieldObj->BasedOnObj->id, &>
</td>
</tr>
% }
@@ -219,7 +220,8 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
$CustomFieldObj->SetRenderType( undef );
}
- $CustomFieldObj->SetBasedOn( $BasedOn );
+ my ($good, $msg) = $CustomFieldObj->SetBasedOn( $BasedOn );
+ push @results, $msg;
my $paramtag = "CustomField-". $CustomFieldObj->Id ."-Value";
# Delete any fields that want to be deleted
diff --git a/share/html/Admin/Elements/SelectCustomFieldRenderType b/share/html/Admin/Elements/SelectCustomFieldRenderType
index ac8f5fd..1d7c246 100755
--- a/share/html/Admin/Elements/SelectCustomFieldRenderType
+++ b/share/html/Admin/Elements/SelectCustomFieldRenderType
@@ -46,16 +46,25 @@
%#
%# END BPS TAGGED BLOCK }}}
<select name="<%$Name%>">
-%for my $option ($cf->RenderTypes($TypeComposite)) {
+%for my $option (@types) {
<option value="<%$option%>"<%$option eq $Default && qq[ selected="selected"] |n%>><% $option %></option>
%}
</select>
<%INIT>
my $cf = RT::CustomField->new($session{'CurrentUser'});
$Default ||= $cf->DefaultRenderType($TypeComposite);
+
+my @types = $cf->RenderTypes($TypeComposite);
+
+# XXX: We currently don't support cascaded select CFs when
+# rendering as a list, so don't offer it for now.
+if ( $BasedOn ) {
+ @types = grep { not /List/ } @types;
+}
</%INIT>
<%ARGS>
$Default => undef
$TypeComposite => 'Select-0'
$Name => 'RenderType'
+$BasedOn => 0
</%ARGS>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list