[Rt-commit] rt branch, 4.6/row-colors-by-condition, repushed

Craig Kaiser craig at bestpractical.com
Wed Jan 2 13:27:31 EST 2019


The branch 4.6/row-colors-by-condition was deleted and repushed:
       was 5c5318fb5bfcb14f86224cd5a6daf8b60320716e
       now bd0159dd8de93743c61a98805c23b270873bf539

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: 5c5318fb5b ! 4: bd0159dd8d Inital commit
    @@ -18,9 +18,12 @@
     +You can use "__CurrentUser__" under the Value key to have the attribute checked against the current user.
     +Names of attributes should conincide with the method names for the object collection being targeted.
     +
    ++The color condition that is appears first will have the prioirty if multiple conditions are met.
    ++
     + Set(@HighLightOnCondition,
     +        { "Attribute" => "Status", "Value" => "open", "Color" => "green" },
    -+        { "Attribute" => "Owner", "Value" => "__CurrentUser__", "Color" => "red" }
    ++        { "Attribute" => "Owner", "Value" => "__CurrentUser__", "Color" => "red" },
    ++        { "Attribute" => "id", "Value" => "__CurrentUser__", "Color" => "blue" } #highlight user collections
     +  );
     +
     +=cut
    @@ -76,9 +79,7 @@
     +    my ($ret, $msg) = $user->Load($self->CurrentUser);
     +    RT::Logger->error($msg) unless $ret;
     +
    -+    my @classes;
     +    my $color_config = RT::Config->Get('HighLightOnCondition', $user);
    -+
     +    foreach my $condition (@{$color_config}) {
     +        my ($attr, $value) = ( $condition->{Attribute}, $condition->{Value} );
     +        if ( !$self->_CoreAccessible->{$attr} ) {
    @@ -87,17 +88,15 @@
     +            if ( $attr eq 'Queue' ) {
     +                my $queue = RT::Queue->new($self->CurrentUser);
     +                $queue->Load($value);
    -+                push @classes, "row-bg-color-". $condition->{Color} if $self->QueueObj->Name eq $queue->Name;
    ++                return ["row-bg-color-". $condition->{Color}] if $self->QueueObj->Name eq $queue->Name;
     +            } elsif ( $value eq '__CurrentUser__' ) {
    -+                push @classes, "row-bg-color-". $condition->{Color} if $self->$attr eq $self->CurrentUser->Id;
    ++                return ["row-bg-color-". $condition->{Color}] if $self->$attr eq $self->CurrentUser->Id;
     +            }
     +            elsif ( $self->$attr eq $value ) {
    -+                push @classes, "row-bg-color-". $condition->{Color};
    ++                return ["row-bg-color-". $condition->{Color}];
     +            }
     +        }
     +    }
    -+
    -+    return \@classes;
     +}
     +
      # implement proxy method because some RT classes



More information about the rt-commit mailing list