[Bps-public-commit] rt-extension-ajaxpreviewscrips branch, master, updated. ca88c7e4d596cfc537b340d5bc1b4136e9215e2f

? sunnavy sunnavy at bestpractical.com
Fri Jul 11 08:34:06 EDT 2014


The branch, master has been updated
       via  ca88c7e4d596cfc537b340d5bc1b4136e9215e2f (commit)
      from  6edab46e38b20e4a13b24443527ab0e7b5c0724f (commit)

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

- Log -----------------------------------------------------------------
commit ca88c7e4d596cfc537b340d5bc1b4136e9215e2f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jul 11 20:10:08 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/html/Helpers/PreviewScrips b/html/Helpers/PreviewScrips
index 458f7ae..7170e01 100644
--- a/html/Helpers/PreviewScrips
+++ b/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/html/Helpers/ShowSimplifiedRecipients b/html/Helpers/ShowSimplifiedRecipients
index 17ae3c3..a340a04 100644
--- a/html/Helpers/ShowSimplifiedRecipients
+++ b/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/html/Ticket/Elements/PreviewScrips b/html/Ticket/Elements/PreviewScrips
index 51f7652..93bbdc4 100644
--- a/html/Ticket/Elements/PreviewScrips
+++ b/html/Ticket/Elements/PreviewScrips
@@ -50,7 +50,7 @@ $TicketObj => undef
 </%args>
 <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() {
diff --git a/html/Ticket/Elements/ShowSimplifiedRecipients b/html/Ticket/Elements/ShowSimplifiedRecipients
index 74394cf..3e159b6 100644
--- a/html/Ticket/Elements/ShowSimplifiedRecipients
+++ b/html/Ticket/Elements/ShowSimplifiedRecipients
@@ -50,7 +50,7 @@ $TicketObj
 </%ARGS>
 <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() {

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


More information about the Bps-public-commit mailing list