[Bps-public-commit] rt-extension-announce branch, master, updated. 0.06-3-g60132bc

? sunnavy sunnavy at bestpractical.com
Tue Apr 30 12:09:10 EDT 2013


The branch, master has been updated
       via  60132bc7c96e519375225de9371bbd3e9c64e561 (commit)
       via  b40892502f4249a40337ffdf4c91ea8ebe4cecbb (commit)
       via  06b1b6dd3d8d6251440eb2fe41eafad0dada44cd (commit)
      from  95c80f8a27e9d4011eccab32b3571217d261bf2e (commit)

Summary of changes:
 README                                             |  1 +
 .../Elements/PageLayout/BeforeBody                 | 17 ++++++++--
 .../Ticket/Create.html/AfterOwner                  | 38 ++++++++++++++++++++++
 html/NoAuth/css/announce.css                       |  5 +++
 lib/RT/Extension/Announce.pm                       |  2 ++
 5 files changed, 60 insertions(+), 3 deletions(-)
 create mode 100644 html/Callbacks/RT-Extension-Announce/Ticket/Create.html/AfterOwner

- Log -----------------------------------------------------------------
commit 06b1b6dd3d8d6251440eb2fe41eafad0dada44cd
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Apr 30 21:21:54 2013 +0800

    new option ShowAnnouncementsInSelfService for selfservice homepage

diff --git a/README b/README
index 4ec5897..a01db58 100644
--- a/README
+++ b/README
@@ -12,6 +12,7 @@ INSTALLATION
 
             Set(@Plugins, qw(RT::Extension::Announce));
             Set(@CustomFieldValuesSources, (qw(RT::CustomFieldValues::AnnounceGroups)));
+            Set($ShowAnnouncementsInSelfService, 1); # display for selfservice home page too
 
         or add "RT::Extension::Announce" to your existing @Plugins line.
 
diff --git a/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody b/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
index 9caa044..84984af 100644
--- a/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
+++ b/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
@@ -97,7 +97,13 @@
 </table></div>
 <%INIT>
 # Only display on Homepage
-return unless ( $m->request_comp->path =~ /^\/index.html$/ );
+if ( RT->Config->Get('ShowAnnouncementsInSelfService') ) {
+    return
+      unless ( $m->request_comp->path =~ m{^/(?:SelfService/)?index\.html$} );
+}
+else {
+    return unless ( $m->request_comp->path =~ m{^/index\.html$} );
+}
 
 my @tickets = RT::Extension::Announce::GetAnnouncements($session{CurrentUser});
 
diff --git a/lib/RT/Extension/Announce.pm b/lib/RT/Extension/Announce.pm
index 4165418..c39ddf1 100644
--- a/lib/RT/Extension/Announce.pm
+++ b/lib/RT/Extension/Announce.pm
@@ -106,6 +106,7 @@ Add these lines:
 
     Set(@Plugins, qw(RT::Extension::Announce));
     Set(@CustomFieldValuesSources, (qw(RT::CustomFieldValues::AnnounceGroups)));
+    Set($ShowAnnouncementsInSelfService, 1); # display for selfservice home page too
 
 or add C<RT::Extension::Announce> to your existing C<@Plugins> line.
 

commit b40892502f4249a40337ffdf4c91ea8ebe4cecbb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Apr 30 21:32:10 2013 +0800

    to show tickets' last update date

diff --git a/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody b/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
index 84984af..dfe14eb 100644
--- a/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
+++ b/html/Callbacks/RT-Extension-Announce/Elements/PageLayout/BeforeBody
@@ -81,12 +81,17 @@
 %if( $show_ticket_links{$ticket->Id} ){
  (<a class="announcements_detail" href="<% RT->Config->Get('WebPath') %>/Ticket/Display.html?id=<% $ticket->Id %>">more</a>)
 %}
-</td></tr>
+</td>
+<td class="date">
+<% $ticket->LastUpdatedObj->AsString %>
+</td>
+</tr>
 % if( $rows == $ShowTickets && (scalar @tickets) > $ShowTickets ){
 %   # More announcements, initially hidden.
 <tr><td colspan=2 class="toggle_announcements">
 <a href='#' class="toggle_announcements" id="toggle_announcements">More Announcements</a>
-</td></tr>
+</td>
+</tr>
 <tbody id="more_announcements">
 % }
 %$rows++;
diff --git a/html/NoAuth/css/announce.css b/html/NoAuth/css/announce.css
index eeba072..022eac9 100644
--- a/html/NoAuth/css/announce.css
+++ b/html/NoAuth/css/announce.css
@@ -77,3 +77,8 @@ ul.menu li:first-child {
 ul.menu a.announce {
   background-color: #fcc;
 }
+
+table.announce td.date {
+  font-size: smaller;
+  color: #777;
+}

commit 60132bc7c96e519375225de9371bbd3e9c64e561
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Apr 30 22:15:06 2013 +0800

    new option AnnounceDefaultGroups

diff --git a/html/Callbacks/RT-Extension-Announce/Ticket/Create.html/AfterOwner b/html/Callbacks/RT-Extension-Announce/Ticket/Create.html/AfterOwner
new file mode 100644
index 0000000..43bfb7e
--- /dev/null
+++ b/html/Callbacks/RT-Extension-Announce/Ticket/Create.html/AfterOwner
@@ -0,0 +1,38 @@
+<%init>
+my $queue = RT::Queue->new($session{CurrentUser});
+$queue->Load($ARGSRef->{Queue});
+return unless $queue->id && $queue->Name eq 'RTAnnounce';
+
+my $cf = RT::CustomField->new($session{CurrentUser});
+$cf->Load('Announcement Groups');
+return unless $cf->id;
+
+my @groups = map {
+    my $group = RT::Group->new( $session{CurrentUser} );
+    my ( $status, $msg ) = $group->LoadUserDefinedGroup($_);
+    if ( $group->id ) {
+        $group->Name;
+    }
+    else {
+        RT->Logger->warning("Failed to load group $group: $msg");
+        ();
+    }
+} grep { defined } RT->Config->Get('AnnounceDefaultGroups');
+return unless @groups;
+
+if ( @groups > 1 ) {
+    if ( $cf->Type eq 'Select' ) {
+        $ARGSRef->{ 'CustomField-' . $cf->id } = \@groups;
+    }
+    else {
+        $ARGSRef->{ 'CustomField-' . $cf->id } = join "\n", @groups;
+    }
+}
+else {
+    $ARGSRef->{ 'CustomField-' . $cf->id } = $groups[0];
+}
+</%init>
+
+<%args>
+$ARGSRef
+</%args>
diff --git a/lib/RT/Extension/Announce.pm b/lib/RT/Extension/Announce.pm
index c39ddf1..fd78541 100644
--- a/lib/RT/Extension/Announce.pm
+++ b/lib/RT/Extension/Announce.pm
@@ -107,6 +107,7 @@ Add these lines:
     Set(@Plugins, qw(RT::Extension::Announce));
     Set(@CustomFieldValuesSources, (qw(RT::CustomFieldValues::AnnounceGroups)));
     Set($ShowAnnouncementsInSelfService, 1); # display for selfservice home page too
+    Set(@AnnounceDefaultGroups, 'foo', 'bar'); # default groups on ticket creation
 
 or add C<RT::Extension::Announce> to your existing C<@Plugins> line.
 

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



More information about the Bps-public-commit mailing list