[Bps-public-commit] rt-extension-notificationmatrix branch, master, updated. f335d91beeec4063b8d580984a2e1c5489879093

Chia-liang Kao clkao at bestpractical.com
Tue Jul 13 07:39:05 EDT 2010


The branch, master has been updated
       via  f335d91beeec4063b8d580984a2e1c5489879093 (commit)
       via  d7ac2fafae9126b7ac99fcc1d06956829c4545ee (commit)
      from  b131fc07b5e1105ab2e99e20faa954d121d252dd (commit)

Summary of changes:
 html/Admin/Queues/NotificationMatrix.html          |   32 ++++++++++++--------
 lib/RT/Extension/NotificationMatrix/Rule.pm        |    2 +-
 .../NotificationMatrix/Rule/QueueChanged.pm        |    1 +
 .../NotificationMatrix/Rule/TicketCommented.pm     |    1 +
 .../NotificationMatrix/Rule/TicketCreated.pm       |    2 +
 .../NotificationMatrix/Rule/TicketResolved.pm      |    1 +
 .../NotificationMatrix/Rule/TicketTaken.pm         |    1 +
 .../Rule/TicketUpdatedExternally.pm                |    1 +
 8 files changed, 27 insertions(+), 14 deletions(-)

- Log -----------------------------------------------------------------
commit d7ac2fafae9126b7ac99fcc1d06956829c4545ee
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Tue Jul 13 12:51:58 2010 +0800

    more verbose description.

diff --git a/html/Admin/Queues/NotificationMatrix.html b/html/Admin/Queues/NotificationMatrix.html
index 6b50f12..42a3799 100644
--- a/html/Admin/Queues/NotificationMatrix.html
+++ b/html/Admin/Queues/NotificationMatrix.html
@@ -66,7 +66,7 @@ Find User defined groups:
 </tr>
 % for my $action (@actions) {
 <tr>
-<th class="action"><% $action %></th>
+<th class="action"><% ("RT::Extension::NotificationMatrix::Rule::".$action)->Description %></th>
 %   for my $Group (@groups, @user_groups) {
 <td><input type="checkbox" name="NM-<% $action %>-<% $Group->Id %>" <% $matrix_hash->{$action}{$Group->Id} ? 'checked' : '' %> />
 </td>
@@ -96,7 +96,6 @@ $Groups->LimitToRolesForQueue($QueueObj->Id);
 my @groups = @{ $Groups->ItemsArrayRef };
 my @user_groups;
 my @actions = qw(TicketCreated TicketCommented TicketTaken TicketResolved TicketUpdatedExternally QueueChanged);
-
 my $matrix;
 my $UserGroups;
 if ($GroupString) {
diff --git a/lib/RT/Extension/NotificationMatrix/Rule.pm b/lib/RT/Extension/NotificationMatrix/Rule.pm
index e8c6bbb..2cdf5f6 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule.pm
@@ -65,7 +65,7 @@ sub LoadTemplate {
 
 sub Description {
     my $self = shift;
-    my $name = ref($self);
+    my $name = ref($self) || $self;
     $name =~ s/^RT::Extension::NotificationMatrix::Rule::// or die "unknown rule: $name";
     return "Notification for $name";
 }
diff --git a/lib/RT/Extension/NotificationMatrix/Rule/QueueChanged.pm b/lib/RT/Extension/NotificationMatrix/Rule/QueueChanged.pm
index af843bb..c0c4fcd 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/QueueChanged.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/QueueChanged.pm
@@ -4,6 +4,7 @@ use warnings;
 use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'QueueChanged';
+use constant Description => 'When queue of ticket is changed';
 
 sub ConditionMatched {
     my $self = shift;
diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketCommented.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketCommented.pm
index b9fe241..60cda43 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketCommented.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketCommented.pm
@@ -5,6 +5,7 @@ use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'TicketCommented';
 use constant DefaultTemplate => 'Admin Comment';
+use constant Description => 'When ticket is commented';
 
 sub ConditionMatched {
     my $self = shift;
diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketCreated.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketCreated.pm
index 9612b9f..342c041 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketCreated.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketCreated.pm
@@ -5,6 +5,8 @@ use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'TicketCreated';
 
+use constant Description => 'When ticket is created';
+
 sub ConditionMatched {
     my $self = shift;
     $self->ScripConditionMatched("On Create");
diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketResolved.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketResolved.pm
index cb07d20..412971a 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketResolved.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketResolved.pm
@@ -5,6 +5,7 @@ use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'TicketResolved';
 use constant DefaultTemplate => 'Resolved';
+use constant Description => 'When ticket is resolved';
 
 sub ConditionMatched {
     my $self = shift;
diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
index f029e1d..994f141 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketTaken.pm
@@ -4,6 +4,7 @@ use warnings;
 use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'TicketTaken';
+use constant Description => 'When ticket is taken';
 
 sub ConditionMatched {
     my $self = shift;
diff --git a/lib/RT/Extension/NotificationMatrix/Rule/TicketUpdatedExternally.pm b/lib/RT/Extension/NotificationMatrix/Rule/TicketUpdatedExternally.pm
index b0001ef..33d7b51 100644
--- a/lib/RT/Extension/NotificationMatrix/Rule/TicketUpdatedExternally.pm
+++ b/lib/RT/Extension/NotificationMatrix/Rule/TicketUpdatedExternally.pm
@@ -5,6 +5,7 @@ use base 'RT::Extension::NotificationMatrix::Rule';
 
 use constant NM_Entry => 'TicketUpdatedExternally';
 use constant DefaultTemplate => 'Admin Correspondence';
+use constant Description => 'When ticket is updated externally';
 
 sub ConditionMatched {
     my $self = shift;

commit f335d91beeec4063b8d580984a2e1c5489879093
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Tue Jul 13 19:40:19 2010 +0800

    minor ui tweaks.

diff --git a/html/Admin/Queues/NotificationMatrix.html b/html/Admin/Queues/NotificationMatrix.html
index 42a3799..7f4a4d8 100644
--- a/html/Admin/Queues/NotificationMatrix.html
+++ b/html/Admin/Queues/NotificationMatrix.html
@@ -30,8 +30,9 @@ table.notification-matrix td {
 
 <form method="post">
 Find User defined groups:
-<input name="GroupString" value="<% $GroupString %>">
-<& /Elements/Submit, Name => "Save", Label => loc('Search') &>
+<input name="GroupString" value="<% $ARGS{GroupString} %>">
+<& /Elements/Submit, Name => "Search", Label => loc('Search') &>
+<& /Elements/Submit, Name => "ListAll", Label => loc('List All') &>
 
 </form>
 
@@ -42,8 +43,12 @@ Find User defined groups:
 % while (my $Group = $UserGroups->Next()) {
   <input type="checkbox" name="SelectUserGroup-<% $Group->Id %>"><% $Group->SelfDescription %><br>
 % }
-<& /Elements/Submit, Name => "Save", Label => loc('Subscribe to Queue notification') &>
-
+% if ($UserGroups->Count) {
+<& /Elements/Submit, Name => "Save", Label => loc('Subscribe selected queue for notification') &>
+% }
+% else {
+<h2>No groups matching '<% $ARGS{'GroupString'} %>' found</h2>
+% }
 </form>
 % }
 
@@ -53,9 +58,9 @@ Find User defined groups:
 <table class="notification-matrix">
 <tr class="group-type">
 <th></th>
-<th colspan="<% scalar @groups %>">Ticket Roles</th>
+<th colspan="<% scalar @groups %>"><&|/l&>Ticket Roles</&></th>
 % if (@user_groups) {
-<th colspan="<% scalar @user_groups %>">User Defined Groups</th>
+<th colspan="<% scalar @user_groups %>"><&|/l&>User Defined Groups</&></th>
 % }
 </tr>
 <tr class="sep">
@@ -98,12 +103,15 @@ my @user_groups;
 my @actions = qw(TicketCreated TicketCommented TicketTaken TicketResolved TicketUpdatedExternally QueueChanged);
 my $matrix;
 my $UserGroups;
-if ($GroupString) {
+if (exists $ARGS{'GroupString'}) {
     $UserGroups = RT::Groups->new($session{'CurrentUser'});
     $UserGroups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined');
-    $UserGroups->Limit(FIELD => 'Name',
-                       VALUE => $GroupString,
-                       OPERATOR => 'LIKE');
+    if (!$ARGS{'ListAll'}) {
+        $UserGroups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined');
+        $UserGroups->Limit(FIELD => 'Name',
+                           VALUE => $ARGS{'GroupString'},
+                           OPERATOR => 'LIKE');
+    }
 }
 
 if ($ARGS{SelectUserGroup}) {
@@ -141,5 +149,4 @@ for (uniq map { @{$matrix->{$_}} } keys %$matrix) {
 </%init>
 <%args>
 $id => 1         #some identifier that a Queue could 
-$GroupString => ''
 </%args>

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



More information about the Bps-public-commit mailing list