Feature: red-colored errors in the result-list for 2.0.15

Hello,

The following code is quite ugly - but the result is wonderful:
The list of results now is sorted: Errors apper first and in red,
Feedback for the expected behavior is listed later in black.

Best Regards
Andi

Andreas Warnke
3SOFT GmbH, Frauenweiherst. 14, 91058 Erlangen
Tel.: +49-9131-7701-274 mailto:Andreas.Warnke@3SOFT.de
Fax: +49-9131-7701-333 http://www.3SOFT.de

Just exchange the file webrt/Elements/ListActions with:

% if (@actions ) {
<& /Elements/TitleBoxStart, title => ‘Results’ &>

    %# ---------------------------------------- %# modified by andreas.warnke @3soft.de %# ---------------------------------------- % foreach my $action (@BadNews) {
  • <%$action%>
  • % } % foreach my $action (@Unclassified) {
  • <%$action%>
  • % } % foreach my $action (@GoodNews) {
  • <%$action%>
  • % } %# ----------------------------------------
<& /Elements/TitleBoxEnd &>
% } <%INIT> # ---------------------------------------- # added by andreas.warnke @3soft.de # ---------------------------------------- my (@GoodNews,@BadNews,@Unclassified); foreach $_ (@actions) { next unless ($_); if ( #### BAD NEWS #### m/^ACEs can only be / || m/^ACE could not be / || m/^ACE not found/ || m/^Can't/ || m/^Condition not found/ || m/^Could not/ || #TESTED m/^Couldn't / || m/^Deleting this object could/ || m/^Deleting this object would/ || m/^Either/ || m/^Email address in use/ || m/^Error in/ || m/^Error:/ || m/^Group already has member/ || #TESTED m/^Group has no / || m/^Input error/ || m/^Invalid/ || m/^Keyword could not/ || m/^Keyword not found/ || m/^Link not found/ || m/^Link already exists/ || m/^Link could not be/ || m/^Member not deleted/ || m/^Merge failed/ || #TESTED m/^Must specify/ || m/Name in use$/ || #TESTED m/^New ticket doesn't exist/ || m/^No correspondence attached/ || m/^No description for/ || m/^No group specified/ || m/^No keyword defined/ || m/^No password set/ || m/^No permission to/ || m/^No transaction type/ || m/^No user or email address specified/ || m/^Not a watcher for this/ || m/^Notification could not/ || m/^Parent must be specified/ || m/^Password: Password too short/ || #TESTED m/^Passwords did not/ || #TESTED m/^No permission to/ || m/^Permission Denied/ || #TESTED m/Permission Denied$/ || #TESTED m/^Permssion Denied/ || m/^Queue could not/ || m/^Sender's email address was not found/ || m/^System Error/ || m/^System error/ || m/^Template not found/ || m/The attachment was oversized and therefore (dropped|truncated)\.$/ || #TESTED m/^That is the same value/ || m/^That is already/ || m/^Queue: That queue does not exist/ || #TESTED m/^That user already/ || m/^That user does not/ || m/^That user is already/ || m/^That user may not/ || m/^That's not a / || m/^This transaction appears to/ || m/^This appears to be a duplicate / || #TESTED m/^Transactions are immutable/ || #m/^Trying to delete:/ || #TESTED m/^Unimplemented/ || m/^Unknown ContentEncoding/ || m/^Update type was neither/ || m/^User not found/ || m/^Watcher could not be/ || m/^You already own/ || m/^You can only/ || m/^You may not/ #### BAD NEWS #### ){ push @BadNews, $_; } elsif ( #### GOOD NEWS #### # These rules may be a bit more sloppy since the BadNews # are already tested. m/added$/ || #TESTED m/added.$/ || #TESTED m/Added$/ || m/changed from .* to / || #TESTED m/^Correspondence sent/ || #TESTED m/changed$/ || m/Changed$/ || m/created$/ || #TESTED m/Created$/ || #TESTED m/deleted$/ || m/deleted.$/ || #TESTED m/Deleted$/ || m/^Interest noted/ || #TESTED m/^Link created / || #TESTED m/^Link deleted / || #TESTED m/loaded$/ || m/Loaded$/ || m/^Merge Successful/ || #TESTED m/recorded\.$/ || #TESTED m/^Revoked/ || #TESTED m/^Granted / || #TESTED m/^Status: Ticket killed/ || #TESTED m/^Template parsed/ || m/^The comment has been recorded/ || #TESTED m/The new value has been set\.$/ || #TESTED m/^Ticket [0-9]* created / || #TESTED m/^Transaction .* purged/ || m/updated$/ || m/Updated$/ || m/^User notified/ #### GOOD NEWS #### ){ push @GoodNews, $_; } else { #### OTHER NEWS #### push @Unclassified, $_; } } # ---------------------------------------- <%ARGS> @actions => undef

Hello,

The following code is quite ugly - but the result is wonderful:
The list of results now is sorted: Errors apper first and in red,
Feedback for the expected behavior is listed later in black.

Very cute. I like it. Sadly, this won’t interact well with RT 3’s
internationalization. I’ve been pondering a way to get a similar effect,
while not breaking when the strings come up in non-English languages.
I suspect that the “right” thing might be to replace all those
error/status strings with Class::ReturnValue objects, or something
like them. That way we can fill them with metadata when we want to. :wink:

-j

Best Regards
Andi

»|« Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.