[Rt-commit] r9526 - in rt/branches/3.6-EXPERIMENTAL-CATEGORIES: .
lib/RT lib/RT/Interface
falcone at bestpractical.com
falcone at bestpractical.com
Wed Oct 31 22:23:49 EDT 2007
Author: falcone
Date: Wed Oct 31 22:23:49 2007
New Revision: 9526
Modified:
rt/branches/3.6-EXPERIMENTAL-CATEGORIES/ (props changed)
rt/branches/3.6-EXPERIMENTAL-CATEGORIES/html/Elements/EditCustomFieldSelect
rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/Interface/Web.pm
rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/ObjectCustomFieldValues_Overlay.pm
Log:
r26020 at ketch: falcone | 2007-10-31 13:08:05 -0400
* correctly re-select the values in the dropdown box when using categories
and some of the CFVs are identical
Modified: rt/branches/3.6-EXPERIMENTAL-CATEGORIES/html/Elements/EditCustomFieldSelect
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-CATEGORIES/html/Elements/EditCustomFieldSelect (original)
+++ rt/branches/3.6-EXPERIMENTAL-CATEGORIES/html/Elements/EditCustomFieldSelect Wed Oct 31 22:23:49 2007
@@ -106,11 +106,12 @@
% push @levels, $level;
% }
% }
-% # use <<>> as a bizarre joiner and we'll disallow it in category names
+% # use >>|<< as a bizarre joiner and we'll disallow it in category names
% my $optionname = join(">>|<<",("Category", $category, $value->Name));
<option value="<%$optionname%>"
% if ($Values) {
- <% ($Values->HasEntry($value->Name)||'') && ($$SelectedRef = 1) && 'SELECTED' %>
+ <% ($Values->HasEntry(Value => $value->Name, Category => ($value->Category||'')) ||'')
+ && ($$SelectedRef = 1) && 'SELECTED' %>
% } elsif ($Default) {
<% (ref $Default ? (grep {$_ eq $value->Name} @{$Default}) : ($Default eq $value->Name))
&& ($$SelectedRef = 1) && 'SELECTED' %>
Modified: rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/Interface/Web.pm Wed Oct 31 22:23:49 2007
@@ -1325,6 +1325,8 @@
my %values_hash;
foreach my $value ( @values ) {
my $category;
+ # trying to encode values in a string led to the ugly
+ # >>|<< seperator
if ($value =~ /Category>>\|<<(.*?)>>\|<<(.*)/) {
$category = $1;
$value = $2;
Modified: rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/ObjectCustomFieldValues_Overlay.pm
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/ObjectCustomFieldValues_Overlay.pm (original)
+++ rt/branches/3.6-EXPERIMENTAL-CATEGORIES/lib/RT/ObjectCustomFieldValues_Overlay.pm Wed Oct 31 22:23:49 2007
@@ -117,11 +117,26 @@
sub HasEntry {
my $self = shift;
- my $value = shift;
+ my $value;
+ my $category;
+ if (@_ == 1) {
+ $value = shift;
+ } elsif (@_ > 1) {
+ my %args = @_;
+ $value = $args{Value};
+ $category = $args{Category};
+ } else {
+ $RT::Logger->warning("Invalid argument list passed to RT::ObjectCustomFieldValues::HasEntry [@_]");
+ return undef;
+ }
#TODO: this could cache and optimize a fair bit.
foreach my $item (@{$self->ItemsArrayRef}) {
- return(1) if ($item->Content eq $value);
+ if ($item->Content eq $value) {
+ # not all selects use categories
+ next if ($category && $item->Category ne $category);
+ return(1)
+ }
}
return undef;
More information about the Rt-commit
mailing list