[Rt-commit] rt branch, 4.4/ajax-preview-scrips, updated. rt-4.2.3-205-g23513bd

? sunnavy sunnavy at bestpractical.com
Fri Jul 11 08:35:18 EDT 2014


The branch, 4.4/ajax-preview-scrips has been updated
       via  23513bdba66aeb0e9b4696d39368efd146012c16 (commit)
      from  355ed02acf0b12fc8813e14b0b3fc1b9ec81a1d2 (commit)

Summary of changes:
 share/html/Helpers/PreviewScrips            | 24 ++++++++++++++++++++++--
 share/html/Helpers/ShowSimplifiedRecipients | 18 +++++++++++++++++-
 share/html/Ticket/Update.html               |  4 ++--
 3 files changed, 41 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 23513bdba66aeb0e9b4696d39368efd146012c16
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jul 11 20:00:24 2014 +0800

    respect one-time Cc/Bcc too
    
    they couldn't been squelched, so checkbox is misleading there, radio is better
    instead. the reason to add a radio rather than simply removing checkbox is for
    vertical alignment.

diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index 458f7ae..7170e01 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -83,7 +83,8 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
           <&|/l, loc($scrip->ConditionObj->Name), loc($scrip->ActionObj->Name), loc($scrip->Template)&>[_1] [_2] with template [_3]</&>
           <br />
 %         for my $type (qw(To Cc Bcc)) {
-%             my @addresses =  $scrip->ActionObj->Action->$type();
+%             my $action = $scrip->ActionObj->Action;
+%             my @addresses =  $action->$type();
 %             next unless @addresses;
               <ul>
 %             for my $addr (@addresses) {
@@ -91,9 +92,28 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 %                 my $checked = not $squelched{$addr->address};
 %                 $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 %>-<% $recips{$addr->address} %>" />
+                  <b><%loc($type)%></b>:
+%                 my $show_checkbox = 1;
+%                 if ( grep {$_ eq $addr} @{$action->{NoSquelch}{$type}} ) {
+%                     $show_checkbox = 0;
+%                 }
+
+%                 if ( $show_checkbox ) {
+                      <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" />
+%                 }
+%                 else {
+                      <input type="radio" readonly="readonly" disabled="disabled" checked="checked" />
+%                 }
                   <label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
+%                 unless ( $show_checkbox ) {
+%                     if ( $type eq 'Cc' ) {
+                          (<&|/l&>explicit one-time Cc</&>)
+%                     }
+%                     else {
+                          (<&|/l&>explicit one-time Bcc</&>)
+%                     }
+%                 }
                   </li>
 %             }
               </ul>
diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index 17ae3c3..a340a04 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -65,11 +65,16 @@ my $Object = $TicketObj->DryRun(%ARGS);
 return unless $Object;
 
 my %headers = (To => {}, Cc => {}, Bcc => {});
+my %no_squelch;
 if ($Object->Scrips) {
     for my $scrip (grep $_->ActionObj->Action->isa('RT::Action::SendEmail'), @{$Object->Scrips->Prepared}) {
+        my $action = $scrip->ActionObj->Action;
         for my $type (qw(To Cc Bcc)) {
             $headers{$type}{$_->address} = $_
-                for $scrip->ActionObj->Action->$type();
+                for $action->$type();
+        }
+        for my $type ( keys %{$action->{NoSquelch}} ) {
+            $no_squelch{$type}{$_} ||= 1 for @{$action->{NoSquelch}{$type}};
         }
     }
 }
@@ -98,6 +103,17 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 <label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
 %         $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
 <br />
+%         if ( $no_squelch{$type}{$addr} ) {
+<input type="radio" readonly="readonly" disabled="disabled" checked="checked" />
+<label><& /Elements/ShowUser, Address => $addr &></label>
+%             if ( $type eq 'Cc' ) {
+(<&|/l&>explicit one-time Cc</&>)
+%             }
+%             else {
+(<&|/l&>explicit one-time Bcc</&>)
+%             }
+<br />
+%         }
 %     }
 </td></tr>
 % }
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index faec518..e9f3cc4 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -139,7 +139,7 @@
 % if ( RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'}) ) {
 <script type="text/javascript">
 jQuery( function() {
-   jQuery("#ticket-update-metadata :input").change( function() {
+   jQuery("#ticket-update-metadata :input, input[name^=UpdateCc], input[name^=UpdateBcc]").change( function() {
        jQuery('#recipients div.titlebox-content').load( '<% RT->Config->Get('WebPath')%>/Helpers/ShowSimplifiedRecipients',
            jQuery('form[name=TicketUpdate]').serialize(),
            function() {
@@ -209,7 +209,7 @@ jQuery( function() {
 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
 <script type="text/javascript">
 jQuery( function() {
-   jQuery("#ticket-update-metadata :input").change( function() {
+   jQuery("#ticket-update-metadata :input, input[name^=UpdateCc], input[name^=UpdateBcc]").change( function() {
        jQuery('#previewscrips div.titlebox-content').load( '<% RT->Config->Get('WebPath')%>/Helpers/PreviewScrips',
            jQuery('form[name=TicketUpdate]').serialize(),
            function() {

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


More information about the rt-commit mailing list