[Rt-commit] r8986 - rt/branches/3.7-EXPERIMENTAL/html/Ticket

ruz at bestpractical.com ruz at bestpractical.com
Mon Sep 10 17:13:05 EDT 2007


Author: ruz
Date: Mon Sep 10 17:13:04 2007
New Revision: 8986

Modified:
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html

Log:
* more on selecting keys

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html	Mon Sep 10 17:13:04 2007
@@ -59,6 +59,26 @@
 <input type="hidden" class="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction}||'' %>" />
 <input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
 <input type="hidden" class="hidden" name="Action" value="<% $ARGS{Action}||'' %>" />
+
+% if ( @gnupg_keys_issues ) {
+<&| /Widgets/TitleBox, title => loc('GnuPG issues') &>
+<% loc("You are going to encrypt outgoing email messages, but there is a problem(s) with recipients' public keys. You have to figure out problems with keys, disable sending a message to some recipients or disable encryption.") %>
+
+<ul>
+% foreach my $issue ( @gnupg_keys_issues ) {
+<li>
+% if ( $issue->{'User'} ) {
+User <a href="<% RT->Config->Get('WebPath') %>/Admin/Users/Modify.html?id=<% $issue->{'User'}->id %>"><&/Elements/ShowUser, User => $issue->{'User'} &></a> has a problem.
+% } else {
+There is a problem with key(s) for address <% $issue->{'EmailAddress'} %>, but there is no user in the DB for this address.
+% }
+<% $issue->{'Message'} %>
+</li>
+% }
+</ul>
+</&>
+% }
+
 <table border="0">
 
 <tr><td align="right"><&|/l&>Status</&>:</td>
@@ -241,6 +261,8 @@
 }
 # }}}
 
+# XXX: we must apply squelshing here, to get real recipients below
+
 my @results;
 my @gnupg_keys_issues;
 if ( $ARGS{'SubmitTicket'} && $ARGS{'Encrypt'} ) {
@@ -266,30 +288,30 @@
 
         my $prefered_key;
         $prefered_key = $user->PreferredKey if $user;
+
         #XXX: prefered key is not yet implemented...
 
+        # classify errors
+        $checks_failure = 1;
+        my %issue = (
+            EmailAddress => $address,
+            $user? (User => $user) : (),
+            Keys => undef,
+        );
+
         unless ( $res{'info'} && @{ $res{'info'} } ) {
-            # no keys
-            push @gnupg_messages, loc("There is no key suitable to encrypt messages to [_1]", $address);
+            # no key
+            $issue{'Message'} = loc("There is no key suitable for encryption.");
         }
-        elsif ( @{ $res{'info'} } == 1 ) {
+        elsif ( @{ $res{'info'} } == 1 && !$res{'info'}[0]{'TrustLevel'} ) {
             # trust is not set
-            push @gnupg_messages, loc("There is one key for address [_1], but trust is not set", $address);
+            $issue{'Message'} = loc("There is one suitable key, but trust level is not set.");
         }
         else {
             # multiple keys
-            push @gnupg_messages, loc("There are several keys suitable to encrypt messages to [_1]", $address);
+            $issue{'Message'} = loc("There are several keys suitable for encryption.");
         }
-        $checks_failure = 1;
-        push @gnupg_keys_issues, {
-            EmailAddress => $address,
-            $user? (User => $user) : (),
-            Keys => undef,
-        };
-    }
-    if ( @gnupg_messages ) {
-        push @results, loc("You are going to encrypt outgoing email messages, but there is a problem(s) with recipients' public keys. You have to figured out problems with keys, disable sending a message to particular recipient or disable encryption.");
-        push @results, @gnupg_messages;
+        push @gnupg_keys_issues, \%issue;
     }
 }
 


More information about the Rt-commit mailing list