[Rt-commit] rt branch, 4.6/row-colors-by-condition, repushed
Craig Kaiser
craig at bestpractical.com
Wed Jan 2 17:21:13 EST 2019
The branch 4.6/row-colors-by-condition was deleted and repushed:
was bd0159dd8de93743c61a98805c23b270873bf539
now c05339d463752786bfab1baeece5e291540fcee2
1: 81390e43fa = 1: 81390e43fa Create ReplaceAttachments, ReplaceHeader and ReplaceContent Methods
2: 5bec6babae = 2: 5bec6babae Create rt-munge-attachments executable
3: 765817052e = 3: 765817052e Add tests for methods that munge the attachments table
4: bd0159dd8d ! 4: 165a320c04 Inital commit
@@ -82,6 +82,8 @@
+ my $color_config = RT::Config->Get('HighLightOnCondition', $user);
+ foreach my $condition (@{$color_config}) {
+ my ($attr, $value) = ( $condition->{Attribute}, $condition->{Value} );
++ next unless $attr and $value;
++
+ if ( !$self->_CoreAccessible->{$attr} ) {
+ next;
+ } else {
@@ -172,7 +174,7 @@
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="<% $Name %>">
-+ <option value="" selected="selected">(no value)</option>
++ <option value=""<% !$Default && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option>
+% foreach my $color (@Colors) {
+ <option value="<% $color %>"
+% if ($Default && $Default eq $color) {
@@ -245,12 +247,12 @@
+% my $i = 0;
+% foreach my $color (@colors) {
+ <div>
-+ <select name="Color-Arguement" class="cascade-by-optgroup">
++ <select name="Color-Argument" class="cascade-by-optgroup">
+ <optgroup label="Status">
+% if ( $ARGS{'CurrentValue'}->[$i]->{Attribute} ) {
+ <option selected="selected" value="<% $ARGS{'CurrentValue'}->[$i]->{Attribute} %>"><% $ARGS{'CurrentValue'}->[$i]->{Value} %></option>
+% }
-+ <option value=""<% !$ARGS{'CurrentValue'}->[$i]->{Value} && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option>
++ <option value="<&|/l&>(no value)</&>"<% !$ARGS{'CurrentValue'}->[$i]->{Value} && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option>
+% foreach my $status (@statuses) {
+ <option value="<% $status %>"><% $status %></option>
+% }
@@ -286,20 +288,27 @@
+</%INIT>
+
+<%METHOD Process>
-+<%ARGS>
-+</%ARGS>
+<%INIT>
+my %args = %{$ARGS{Arguments}};
+
++my @attributes = ref $args{'Color-Argument-Groups'} eq "ARRAY"
++ ? @{$args{'Color-Argument-Groups'}}
++ : ($args{'Color-Argument-Groups'});
++
++my @colors = ref $args{'Color'} eq "ARRAY" ? @{$args{'Color'}} : ($args{'Color'});
++my @color_arguments = ref $args{'Color-Argument'} eq 'ARRAY' ? @{$args{'Color-Argument'}}
++ : ($args{'Color-Argument'});
++
+my @HighLightOnCondition;
+my $i = 0;
-+foreach my $color_argument ($args{'Color-Arguement'}) {
++foreach my $color_argument (@color_arguments) {
+ my $value = $color_argument;
-+ my $attribute = $args{'Color-Arguement-Groups'}[$i];
-+ my $color = $args{'Color'}[$i];
-+
-+ next unless $value and $attribute;
++ my $attribute = $attributes[$i];
++ my $color = $colors[$i];
++
++ next unless $value and $attribute and $color;
+ push @HighLightOnCondition, { Attribute => $attribute, Value => $value, Color => $color };
++ $i++;
+}
+
+return scalar @HighLightOnCondition ? \@HighLightOnCondition : undef;
@@ -424,3 +433,4 @@
if (!name) return;
// Generate elements for cascading based on the master <select> ...
+
-: ------- > 5: c05339d463 Create tests for row colors by condition
More information about the rt-commit
mailing list