[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-423-g057b4bf

Alex Vandiver alexmv at bestpractical.com
Mon Nov 8 20:02:24 EST 2010


The branch, 3.9-trunk has been updated
       via  057b4bff3c8554fa8e295872f31d141678b9764d (commit)
       via  4dcb76716132a3276c4281bfa2b5c8b9be6716ab (commit)
       via  0438dc9735ba0042463270336d7e63bf12d7bc18 (commit)
       via  6deb7b9da9fd9d707c9e04dcf43ea4dacb4f6160 (commit)
       via  719180253ea826a2fc393125d76fa344ac9bb60f (commit)
       via  b4054956bd8849df569a4be8c909333f9f302ff6 (commit)
       via  b587f217bc34d6a541ed8c33bb0f8eced3d12f39 (commit)
      from  9290a0240076bbe58d5555cbc1fc448e489c208e (commit)

Summary of changes:
 lib/RT/Config.pm                                   |    9 +++
 share/html/Ticket/Elements/PreviewScrips           |   19 ++++---
 .../html/Ticket/Elements/ShowSimplifiedRecipients  |   53 ++++++++++++++++++++
 share/html/Ticket/Update.html                      |   14 +++++-
 share/html/Widgets/TitleBoxStart                   |    6 ++-
 5 files changed, 89 insertions(+), 12 deletions(-)
 create mode 100644 share/html/Ticket/Elements/ShowSimplifiedRecipients

- Log -----------------------------------------------------------------
commit b587f217bc34d6a541ed8c33bb0f8eced3d12f39
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 18:05:05 2010 -0500

    Toggle all checkboxes for a given email address at once

diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 7063ac2..56c7603 100755
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -88,6 +88,12 @@
                 .addClass("action-"+ev.target.value);
         });
     });
+    jQuery(function() {
+        jQuery("input[name=TxnSendMailTo]").change(function(ev) {
+            jQuery("input[name=TxnSendMailTo][value="+ev.target.value+"]")
+                  .attr("checked",jQuery(ev.target).attr('checked'));
+        });
+    });
 </script>
 
 % $m->callback( %ARGS, CallbackName => 'AfterUpdateType' );

commit b4054956bd8849df569a4be8c909333f9f302ff6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 18:06:36 2010 -0500

    Fix HTML escaping on attribute

diff --git a/share/html/Ticket/Elements/PreviewScrips b/share/html/Ticket/Elements/PreviewScrips
index f8a6c27..8f22cd2 100755
--- a/share/html/Ticket/Elements/PreviewScrips
+++ b/share/html/Ticket/Elements/PreviewScrips
@@ -77,7 +77,7 @@ my %recips;
 %                 my $checked = 1;
 %                 $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => $addr, Type => $type, Checked => \$checked);
 %                 $recips{$addr->address}++;
-                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' %> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>" />
+                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>" />
                   <label for="TxnSendMailTo-<% $addr->address %>"><& /Elements/ShowUser, Address => $addr &></label>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
                   </li>
@@ -104,7 +104,7 @@ my %recips;
 %                 my $checked = 1;
 %                 $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type, Checked => \$checked);
 %                 $recips{$address}++;
-                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' %> value="<%$address%>" />
+                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$address%>" />
                                          <%$address%>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type);
                   </li>

commit 719180253ea826a2fc393125d76fa344ac9bb60f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 18:08:59 2010 -0500

    Ensure that ids are unique even if email addresses are repeated

diff --git a/share/html/Ticket/Elements/PreviewScrips b/share/html/Ticket/Elements/PreviewScrips
index 8f22cd2..1911b0a 100755
--- a/share/html/Ticket/Elements/PreviewScrips
+++ b/share/html/Ticket/Elements/PreviewScrips
@@ -77,8 +77,8 @@ my %recips;
 %                 my $checked = 1;
 %                 $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => $addr, Type => $type, Checked => \$checked);
 %                 $recips{$addr->address}++;
-                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>" />
-                  <label for="TxnSendMailTo-<% $addr->address %>"><& /Elements/ShowUser, Address => $addr &></label>
+                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" />
+                  <label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
                   </li>
 %             }

commit 6deb7b9da9fd9d707c9e04dcf43ea4dacb4f6160
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 18:03:49 2010 -0500

    Allow TitleBoxes to default to rolled up

diff --git a/share/html/Widgets/TitleBoxStart b/share/html/Widgets/TitleBoxStart
index 62663db..03b9e1c 100755
--- a/share/html/Widgets/TitleBoxStart
+++ b/share/html/Widgets/TitleBoxStart
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<div class="titlebox<% $class ? " $class " : '' %>" id="<% $id %>">
+<div class="titlebox<% $class ? " $class " : '' %><% $rolledup ? " rolled-up" : ""%>" id="<% $id %>">
   <div class="titlebox-title<% $title_class ? " $title_class" : ''%>">
 % if ($hideable) {
     <span class="widget"><a href="#" onclick="return rollup('<%$tid%>');" title="Toggle visibility"></a></span>
@@ -58,7 +58,7 @@
 	<% $titleright  %><% $titleright_raw |n%><% $titleright_href ? "</a>" : '' |n%>\
     </span>
   </div>
-  <div class="titlebox-content <% $bodyclass %>" id="<% $tid %>">
+  <div class="titlebox-content <% $bodyclass %><% $rolledup ? " hidden" : ""%>" id="<% $tid %>">
 <%ARGS>
 $class => ''
 $bodyclass => ''
@@ -71,9 +71,11 @@ $titleright => ''
 $titleright_raw => ''
 $id => ''
 $hideable => 1
+$rolledup => 0
 </%ARGS>
 
 <%init>
+$hideable = 1 if $rolledup;
 #
 # This should be pretty bulletproof
 #

commit 0438dc9735ba0042463270336d7e63bf12d7bc18
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 18:15:44 2010 -0500

    Add an ID and label to Rules-generated addresses, too

diff --git a/share/html/Ticket/Elements/PreviewScrips b/share/html/Ticket/Elements/PreviewScrips
index 1911b0a..2abe9d4 100755
--- a/share/html/Ticket/Elements/PreviewScrips
+++ b/share/html/Ticket/Elements/PreviewScrips
@@ -104,8 +104,8 @@ my %recips;
 %                 my $checked = 1;
 %                 $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type, Checked => \$checked);
 %                 $recips{$address}++;
-                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$address%>" />
-                                         <%$address%>
+                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$address%>" id="TxnSendMailTo-<% $address %>-<% $recips{$address} %>" />
+                  <label for="TxnSendMailTo-<% $address %>-<% $recips{$address} %>"><%$address%></label>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type);
                   </li>
 %             }

commit 4dcb76716132a3276c4281bfa2b5c8b9be6716ab
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 18:20:15 2010 -0500

    Add a preference for showing a simplified recipient list
    
    Rather than relying on the "Scrips and Recipients" widget, this option
    unique-ifies the recipient list, and displays it above the message.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 19ebcf2..0f08772 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -394,6 +394,15 @@ our %META = (
             },
         },
     },
+    SimplifiedRecipients => {
+        Section         => 'Ticket display',                       #loc
+        Overridable     => 1,
+        SortOrder       => 7,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => q|Show simplified recipient list on ticket update|,                #loc
+        },
+    },
 
     # User overridable locale options
     DateTimeFormat => {
diff --git a/share/html/Ticket/Elements/PreviewScrips b/share/html/Ticket/Elements/PreviewScrips
index 2abe9d4..4b82495 100755
--- a/share/html/Ticket/Elements/PreviewScrips
+++ b/share/html/Ticket/Elements/PreviewScrips
@@ -49,15 +49,16 @@
 $TicketObj => undef
 </%args>
 <%init>
-my $Object = $TicketObj->DryRun(%ARGS);
-my %recips;
+my $Object = $m->notes("DryRun-".$TicketObj->Id) || $TicketObj->DryRun(%ARGS);
+my %recips = %{ $m->notes("DryRun-Recipients-".$TicketObj->Id) || {} };
+return unless $Object;
 </%init>
 <p>
 <&|/l, RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$TicketObj->Id,
 &>Uncheck boxes to disable notifications to the listed recipients <b>for this transaction only</b>; persistent squelching is managed on the <a href="[_1]">People page</a>.</&>
 </p>
 
-% if ( $Object and $Object->Scrips ) {
+% if ( $Object->Scrips ) {
 %     # Sort scrips with recipients before those without
 %     my @scrips = map { $_->[0] }
 %                  sort { ($b->[1]?1:0) <=> ($a->[1]?1:0) }
@@ -91,7 +92,7 @@ my %recips;
 %     }
 % }
 
-% if ( $Object and $Object->Rules ) {
+% if ( $Object->Rules ) {
 %     for my $rule (@{$Object->Rules}) {
 %         next unless $rule->{hints} && $rule->{hints}{class} eq 'SendEmail';
           <b><% $rule->Describe %></b>
@@ -115,4 +116,4 @@ my %recips;
 %     }
 % }
 
-<input type="hidden" name="TxnRecipients" value="<% join ",",keys %recips %>" />
+% $m->notes("DryRun-Recipients-".$TicketObj->Id, \%recips);
diff --git a/share/html/Ticket/Elements/ShowSimplifiedRecipients b/share/html/Ticket/Elements/ShowSimplifiedRecipients
new file mode 100644
index 0000000..feb4cdd
--- /dev/null
+++ b/share/html/Ticket/Elements/ShowSimplifiedRecipients
@@ -0,0 +1,53 @@
+<%args>
+$TicketObj
+</%args>
+<%init>
+return unless RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'});
+
+my $Object = $m->notes("DryRun-".$TicketObj->Id) || $TicketObj->DryRun(%ARGS);
+$m->notes("DryRun-".$TicketObj->Id, $Object);
+return unless $Object;
+
+my %headers = (To => {}, Cc => {}, Bcc => {});
+if ($Object->Scrips) {
+    for my $scrip (grep $_->ActionObj->Action->isa('RT::Action::SendEmail'), @{$Object->Scrips->Prepared}) {
+        for my $type qw(To Cc Bcc) {
+            $headers{$type}{$_->address} = $_
+                for $scrip->ActionObj->Action->$type();
+        }
+    }
+}
+if ($Object->Rules) {
+    for my $rule (grep {$_->{hints} and $_->{hints}{class} eq "SendEmail"} @{$Object->Rules}) {
+        for my $type qw(To Cc Bcc) {
+            $headers{$type}{$_} ||= @{[Email::Address->parse($_)]}[0] # Hate list context
+                for @{$rule->{hints}{recipients}{$type}};
+        }
+    }
+}
+my %recips;
+</%init>
+<&|/Widgets/TitleBox, title => loc('Recipients'), id => 'recipients' &>
+<table>
+<tr>
+% for my $type qw(To Cc Bcc) {
+%     next unless keys %{$headers{$type}};
+<td valign="top"><% $type %>:</td>
+<td valign="top">
+%     for my $addr (sort {$a->address cmp $b->address} values %{$headers{$type}}) {
+%         my $checked = 1;
+%         $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => $addr, Type => $type, Checked => \$checked);
+%         $recips{$addr->address}++;
+<input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" />
+<label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
+%         $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
+<br />
+%     }
+</td></tr>
+% }
+</table>
+<i>(Uncheck boxes to disable notifications to the listed
+recipients. Does <b>not</b> change who will receive future
+updates.)</i>
+</&>
+% $m->notes("DryRun-Recipients-".$TicketObj->Id, \%recips);
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 56c7603..ba04934 100755
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -143,6 +143,8 @@
 </div>
 
 <div id="ticket-update-message">
+  <& /Ticket/Elements/ShowSimplifiedRecipients, TicketObj => $TicketObj, %ARGS &>
+
   <&|/Widgets/TitleBox, title => loc('Message'), class => 'messagedetails' &>
   <table width="100%" border="0">
 <& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $TicketObj &>
@@ -184,12 +186,16 @@
   <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket', id => 'SubmitTicket' &>
 
 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
-  <&|/Widgets/TitleBox, title => loc('Scrips and Recipients'), id => 'previewscrips' &>
+  <&|/Widgets/TitleBox, title => loc('Scrips and Recipients'), id => 'previewscrips', rolledup => RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'}) &>
     <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
   </&>
 % }
 </div>
 
+% if (my $recips = $m->notes("DryRun-Recipients-".$TicketObj->Id)) {
+<input type="hidden" name="TxnRecipients" value="<% join ",",sort keys %{$recips} %>" />
+% }
+
 </form>
 <hr class="clear" />
 <%INIT>

commit 057b4bff3c8554fa8e295872f31d141678b9764d
Merge: 6deb7b9 4dcb767
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 8 20:02:10 2010 -0500

    Merge branch 'show-simplified-recipients' into 3.9-trunk


-----------------------------------------------------------------------


More information about the Rt-commit mailing list