[Rt-commit] rt branch, 4.4/squelching-all, created. rt-4.2.5-194-g4f875d7
Wallace Reis
wreis at bestpractical.com
Fri Aug 8 15:40:11 EDT 2014
The branch, 4.4/squelching-all has been created
at 4f875d712bfeea4a9a97de911228ad35085d76ff (commit)
- Log -----------------------------------------------------------------
commit c167921e56e08b30f6d19a81f39373f7599d24f1
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jul 14 17:11:32 2014 -0300
Add squelched recipients as preference
User preference to start with squelch checkboxes unchecked/checked on
ticket reply page. This should respect the semi-permanently squelched
address when applying its logic. If set to true, then the page shows
the checkboxes unchecked - which means the email addresses are *not*
getting any kind of mail.
Additionally, it adds a new config option called $SquelchedRecipients
which allows to set it broadly for all users.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 38dfc52..dbcd8e3 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1583,6 +1583,17 @@ detailed breakdown by scrip.
Set($SimplifiedRecipients, 0);
+=item C<$SquelchedRecipients>
+
+If C<$SquelchedRecipients> is set, the checkbox list of who will receive
+B<any> kind of mail on the ticket reply page are displayed initially as
+B<un>checked - which means nobody in that list would get any mail. It
+does not affect correspondence done via email yet.
+
+=cut
+
+Set($SquelchedRecipients, 0);
+
=item C<$HideResolveActionsWithDependencies>
If set to 1, this option will skip ticket menu actions which can't be
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 6126aad..6317db6 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -459,10 +459,19 @@ our %META;
Description => "Show simplified recipient list on ticket update", #loc
},
},
+ SquelchedRecipients => {
+ Section => 'Ticket display', #loc
+ Overridable => 1,
+ SortOrder => 8,
+ Widget => '/Widgets/Form/Boolean',
+ WidgetArguments => {
+ Description => "Default to squelching all outgoing email notifications (from web interface) on ticket update", #loc
+ },
+ },
DisplayTicketAfterQuickCreate => {
Section => 'Ticket display',
Overridable => 1,
- SortOrder => 8,
+ SortOrder => 9,
Widget => '/Widgets/Form/Boolean',
WidgetArguments => {
Description => 'Display ticket after "Quick Create"', #loc
@@ -471,7 +480,7 @@ our %META;
QuoteFolding => {
Section => 'Ticket display',
Overridable => 1,
- SortOrder => 9,
+ SortOrder => 10,
Widget => '/Widgets/Form/Boolean',
WidgetArguments => {
Description => 'Enable quote folding?' # loc
diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index a27c8f7..f5575c4 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -76,6 +76,10 @@ my %recips;
$m->abort unless @dryrun;
my %squelched = ProcessTransactionSquelching( \%ARGS );
+my $squelched_config = !( RT->Config->Get('SquelchedRecipients', $session{'CurrentUser'}) );
+if ($ARGS{TxnRecipients}) {
+ $squelched_config = undef;
+}
</%init>
<p>
<&|/l, RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$TicketObj->Id,
@@ -96,7 +100,7 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
<ul>
% for my $addr (@addresses) {
<li>
-% my $checked = not $squelched{$addr->address};
+% my $checked = $squelched_config // not $squelched{$addr->address};
% $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => $addr, Type => $type, Checked => \$checked);
% $recips{$addr->address}++;
<b><%loc($type)%></b>:
diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index 4c6b60c..49e27db 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -94,6 +94,10 @@ if (@scrips) {
}
my %recips;
my %squelched = ProcessTransactionSquelching( \%ARGS );
+my $squelched_config = !( RT->Config->Get('SquelchedRecipients', $session{'CurrentUser'}) );
+if ($ARGS{TxnRecipients}) {
+ $squelched_config = undef;
+}
</%init>
<table>
% for my $type (qw(To Cc Bcc)) {
@@ -102,7 +106,7 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
<td valign="top"><% $type %>:</td>
<td valign="top">
% for my $addr (sort {$a->address cmp $b->address} values %{$headers{$type}}) {
-% my $checked = not $squelched{$addr->address};
+% my $checked = $squelched_config // not $squelched{$addr->address};
% $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} %>" />
commit 0afa3528ce45b6881fa631fc95a520f43cff9904
Author: Wallace Reis <wreis at bestpractical.com>
Date: Tue Jul 15 18:48:09 2014 -0300
'Select All' checkbox for scrips correspondences/comments
At ticket reply page, we have the option to select/deselect who in the
list of people should receive a copy of the reply/comment. This aims to
add an 'all' checkbox which can select/deselect all of them at once.
diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index f5575c4..f49dbd2 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -77,8 +77,10 @@ $m->abort unless @dryrun;
my %squelched = ProcessTransactionSquelching( \%ARGS );
my $squelched_config = !( RT->Config->Get('SquelchedRecipients', $session{'CurrentUser'}) );
+my $all_checkbox = $squelched_config ? 'checked="checked"' : "";
if ($ARGS{TxnRecipients}) {
$squelched_config = undef;
+ $all_checkbox = scalar(grep {$_} values %squelched) ? "" : 'checked="checked"';
}
</%init>
<p>
@@ -89,6 +91,14 @@ if ($ARGS{TxnRecipients}) {
% my @scrips = grep {$_->ActionObj->Action->isa('RT::Action::SendEmail')}
% map {@{$_->Scrips->Prepared}} @dryrun;
% if (@scrips) {
+% if ( grep {
+% my $s = $_;
+% my $action = $s->ActionObj->Action;
+% scalar(map { $action->$_ } qw(To Cc Bcc))
+% } @scrips ) {
+<input type="checkbox" class="checkbox" name="TxnSendMailToAll" value="1" <% $all_checkbox | n %> onclick="setCheckbox(this,'TxnSendMailTo')">
+<label for="TxnSendMailToAll"><b><% loc('All recipients') %></b></label><br />
+% }
% for my $scrip (@scrips) {
<b><% $scrip->Description || loc('Scrip #[_1]',$scrip->id) %></b><br />
<&|/l, loc($scrip->ConditionObj->Name), loc($scrip->ActionObj->Name), loc($scrip->Template)&>[_1] [_2] with template [_3]</&>
diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index 49e27db..e49be9c 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -95,11 +95,22 @@ if (@scrips) {
my %recips;
my %squelched = ProcessTransactionSquelching( \%ARGS );
my $squelched_config = !( RT->Config->Get('SquelchedRecipients', $session{'CurrentUser'}) );
+my $all_checkbox = $squelched_config ? 'checked="checked"' : "";
if ($ARGS{TxnRecipients}) {
$squelched_config = undef;
+ $all_checkbox = scalar(grep {$_} values %squelched) ? "" : 'checked="checked"';
}
</%init>
<table>
+% if ( scalar(map { keys %{$headers{$_}} } qw(To Cc Bcc)) ) {
+<tr>
+<td> </td>
+<td>
+<input type="checkbox" class="checkbox" name="TxnSendMailToAll" value="1" <% $all_checkbox | n %> onclick="setCheckbox(this,'TxnSendMailTo')">
+<label for="TxnSendMailToAll"><b><% loc('All recipients') %></b></label>
+</td>
+</tr>
+% }
% for my $type (qw(To Cc Bcc)) {
% next unless keys %{$headers{$type}} or keys %{$no_squelch{$type}};
<tr>
diff --git a/share/static/js/util.js b/share/static/js/util.js
index b665c0e..1636cbf 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -82,6 +82,8 @@ function set_rollup_state(e,e2,state) {
function setCheckbox(input, name, val) {
if (val == null) val = input.checked;
+ var allfield = jQuery('input[name=' + input.name + ']');
+ allfield.prop('checked', val);
// Find inputs within the current form or collection list, whichever is closest.
var container = jQuery(input).closest("form, table.collection-as-table").get(0);
commit d4d4993497b5bfe20ed203f0b3a632f1df2f92a7
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jul 21 10:01:11 2014 -0300
Make 'select all' check/uncheck bi-directional
If I uncheck "All $thing", and then I re-check all of the items by hand,
then "All $thing" pops back to being checked as soon as I re-checked
the last item.
diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index f49dbd2..4e4195d 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -120,9 +120,8 @@ if ($ARGS{TxnRecipients}) {
% }
% if ( $show_checkbox ) {
- <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" />
+ <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" onclick="checkboxSetEvent(this)" />
% }
-
<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 ) {
diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index e49be9c..9cc9bf8 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -120,7 +120,7 @@ if ($ARGS{TxnRecipients}) {
% my $checked = $squelched_config // not $squelched{$addr->address};
% $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} %>" />
+<input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" onclick="checkboxSetEvent(this)" />
<label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
% $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
<br />
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 1636cbf..9f93721 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -80,14 +80,18 @@ function set_rollup_state(e,e2,state) {
/* other utils */
+function getClosestInputElements(input) {
+ // Find inputs within the current form or collection list, whichever is closest.
+ var container = jQuery(input).closest("form, table.collection-as-table").get(0);
+ return container.getElementsByTagName('input');
+}
+
function setCheckbox(input, name, val) {
if (val == null) val = input.checked;
var allfield = jQuery('input[name=' + input.name + ']');
allfield.prop('checked', val);
- // Find inputs within the current form or collection list, whichever is closest.
- var container = jQuery(input).closest("form, table.collection-as-table").get(0);
- var myfield = container.getElementsByTagName('input');
+ var myfield = getClosestInputElements(input);
for ( var i = 0; i < myfield.length; i++ ) {
if ( myfield[i].type != 'checkbox' ) continue;
if ( name ) {
@@ -104,6 +108,38 @@ function setCheckbox(input, name, val) {
}
}
+function checkboxSetEvent(input) {
+ var name = input.name;
+ var myfield = getClosestInputElements(input);
+ var checked_count = 0;
+ var field_count = 0;
+ for ( var i = 0; i < myfield.length; i++ ) {
+ if ( myfield[i].type != 'checkbox' ) continue;
+ if ( name ) {
+ if ( name instanceof RegExp ) {
+ if ( ! myfield[i].name.match( name ) ) continue;
+ }
+ else {
+ if ( myfield[i].name != name ) continue;
+ }
+
+ }
+
+ field_count++;
+ if ( myfield[i].checked ) {
+ checked_count++;
+ }
+ }
+
+ var allfield = jQuery('input[name=' + name + 'All' + ']');
+ if (field_count == checked_count) {
+ allfield.prop('checked', true);
+ }
+ else {
+ allfield.prop('checked', false);
+ }
+}
+
/* apply callback to nodes or elements */
function walkChildNodes(parent, callback)
commit 4f875d712bfeea4a9a97de911228ad35085d76ff
Author: Wallace Reis <wreis at bestpractical.com>
Date: Fri Aug 8 16:33:02 2014 -0300
Merge checkbox click event handlers
Merge "setCheckbox" and "checkboxSetEvent" handlers into single one
function which sets up everything bi-directionally (on both the "All"
checkbox, as well as the individual ones).
diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index 4e4195d..668efcb 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -120,7 +120,7 @@ if ($ARGS{TxnRecipients}) {
% }
% if ( $show_checkbox ) {
- <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" onclick="checkboxSetEvent(this)" />
+ <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" onclick="setCheckbox(this)" />
% }
<label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
% $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index 9cc9bf8..8f695eb 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -120,7 +120,7 @@ if ($ARGS{TxnRecipients}) {
% my $checked = $squelched_config // not $squelched{$addr->address};
% $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} %>" onclick="checkboxSetEvent(this)" />
+<input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" onclick="setCheckbox(this)" />
<label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
% $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
<br />
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 9f93721..8416853 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -88,31 +88,20 @@ function getClosestInputElements(input) {
function setCheckbox(input, name, val) {
if (val == null) val = input.checked;
- var allfield = jQuery('input[name=' + input.name + ']');
- allfield.prop('checked', val);
- var myfield = getClosestInputElements(input);
- for ( var i = 0; i < myfield.length; i++ ) {
- if ( myfield[i].type != 'checkbox' ) continue;
- if ( name ) {
- if ( name instanceof RegExp ) {
- if ( ! myfield[i].name.match( name ) ) continue;
- }
- else {
- if ( myfield[i].name != name ) continue;
- }
-
- }
-
- myfield[i].checked = val;
+ var is_set_event = false;
+ if ( !name ) {
+ name = input.name;
+ is_set_event = true;
+ }
+ else {
+ var allfield = jQuery('input[name=' + input.name + ']');
+ allfield.prop('checked', val);
}
-}
-function checkboxSetEvent(input) {
- var name = input.name;
- var myfield = getClosestInputElements(input);
var checked_count = 0;
var field_count = 0;
+ var myfield = getClosestInputElements(input);
for ( var i = 0; i < myfield.length; i++ ) {
if ( myfield[i].type != 'checkbox' ) continue;
if ( name ) {
@@ -125,18 +114,25 @@ function checkboxSetEvent(input) {
}
- field_count++;
- if ( myfield[i].checked ) {
- checked_count++;
+ if ( is_set_event ) {
+ field_count++;
+ if ( myfield[i].checked ) {
+ checked_count++;
+ }
+ }
+ else {
+ myfield[i].checked = val;
}
}
- var allfield = jQuery('input[name=' + name + 'All' + ']');
- if (field_count == checked_count) {
- allfield.prop('checked', true);
- }
- else {
- allfield.prop('checked', false);
+ if ( is_set_event ) {
+ var allfield = jQuery('input[name=' + name + 'All' + ']');
+ if (field_count == checked_count) {
+ allfield.prop('checked', true);
+ }
+ else {
+ allfield.prop('checked', false);
+ }
}
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list