[Rt-commit] r11919 - in rt/branches/3.8-TESTING: . etc lib/RT/Action

alexmv at bestpractical.com alexmv at bestpractical.com
Mon Apr 28 15:01:39 EDT 2008


Author: alexmv
Date: Mon Apr 28 15:01:39 2008
New Revision: 11919

Added:
   rt/branches/3.8-TESTING/lib/RT/Action/ExtractSubjectTag.pm
Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/etc/RT_Config.pm.in
   rt/branches/3.8-TESTING/etc/initialdata
   rt/branches/3.8-TESTING/html/NoAuth/css/web2/background-gradient.png
   rt/branches/3.8-TESTING/html/NoAuth/css/web2/forms.css
   rt/branches/3.8-TESTING/html/NoAuth/css/web2/layout.css

Log:
 r31004 at kohr-ah:  chmrr | 2008-04-28 15:01:29 -0400
  * Make web2 background slightly less BLUE
  * Integrate ExtractSubjectTag extension


Modified: rt/branches/3.8-TESTING/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.8-TESTING/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.8-TESTING/etc/RT_Config.pm.in	Mon Apr 28 15:01:39 2008
@@ -185,6 +185,14 @@
 # resolve arbitrary tickets!
 
 
+# The default "extract remote tracking tags" scrip settings; these
+# detect when your RT is talking to another RT, and adjusts the
+# subject accordingly.
+Set($ExtractSubjectTagMatch, qr/\[.+? #\d+\]/);
+Set($ExtractSubjectTagNoMatch, ( ${RT::EmailSubjectTagRegex}
+       ? qr/\[(?:${RT::EmailSubjectTagRegex}) #\d+\]/
+       : qr/\[\Q$RT::rtname\E #\d+\]/));
+
 # }}}
 
 # {{{ Outgoing mail configuration
@@ -199,6 +207,8 @@
 
 Set($MailCommand , 'sendmailpipe');
 
+# }}}
+
 # {{{ Sendmail Configuration
 # These options only take effect if $MailCommand is 'sendmail' or
 # 'sendmailpipe'
@@ -709,8 +719,6 @@
 
 # }}}
 
-
-
 # {{{ Development Mode
 #
 # RT comes with a "Development mode" setting. 

Modified: rt/branches/3.8-TESTING/etc/initialdata
==============================================================================
--- rt/branches/3.8-TESTING/etc/initialdata	(original)
+++ rt/branches/3.8-TESTING/etc/initialdata	Mon Apr 28 15:01:39 2008
@@ -94,6 +94,9 @@
     { Name        => 'Open Tickets',                                      # loc
       Description => 'Open tickets on correspondence',                    # loc
       ExecModule  => 'AutoOpen' },
+    { Name        => 'Extract Subject Tag',                               # loc
+      Description => 'Extract tags from a Transaction\'s subject and add them to the Ticket\'s subject.', # loc
+      ExecModule  => 'ExtractSubjectTag' },
 );
 
 @ScripConditions = (
@@ -459,6 +462,10 @@
        ScripCondition => 'On Resolve',
        ScripAction    => 'Notify Requestors',
        Template       => 'Resolved' },
+    {  Description    => "On transaction, add any tags in the transaction's subject to the ticket's subject",
+       ScripCondition => 'On Transaction',
+       ScripAction    => 'Extract Subject Tag',
+       Template       => 'Blank' },
     {  Description => "When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval",    # loc
        Queue          => '___Approvals',
        ScripCondition => 'User Defined',

Modified: rt/branches/3.8-TESTING/html/NoAuth/css/web2/background-gradient.png
==============================================================================
Binary files. No diff available.

Modified: rt/branches/3.8-TESTING/html/NoAuth/css/web2/forms.css
==============================================================================
--- rt/branches/3.8-TESTING/html/NoAuth/css/web2/forms.css	(original)
+++ rt/branches/3.8-TESTING/html/NoAuth/css/web2/forms.css	Mon Apr 28 15:01:39 2008
@@ -80,7 +80,7 @@
 
 input[type=reset], input[type=submit], input[class=button] {
    color: #fff;
-   background: #003EBA;
+   background: #183b83;
    padding: 0.25em;
    padding-left: 0.5em;
    padding-right: 0.5em;

Modified: rt/branches/3.8-TESTING/html/NoAuth/css/web2/layout.css
==============================================================================
--- rt/branches/3.8-TESTING/html/NoAuth/css/web2/layout.css	(original)
+++ rt/branches/3.8-TESTING/html/NoAuth/css/web2/layout.css	Mon Apr 28 15:01:39 2008
@@ -53,8 +53,8 @@
     padding:0;
     margin:0;
 
-    background-color: #003EBA;
-    background: #003eba url(background-gradient.png) top left repeat-x ;
+    background-color: #183b83;
+    background: #183b83 url(<%RT->Config->Get('WebPath')%>/NoAuth/css/web2/background-gradient.png) top left repeat-x ;
     font-family: helvetica, arial, sans-serif;
 
 }
@@ -135,7 +135,7 @@
 
 div#footer #bpscredits {
  text-align: right;
- background: url(/NoAuth/images/bplogo.gif) no-repeat top right;
+ background: url(<%RT->Config->Get('WebImagesURL')%>/bplogo.gif) no-repeat top right;
  padding-top: 4em;
 } 
 

Added: rt/branches/3.8-TESTING/lib/RT/Action/ExtractSubjectTag.pm
==============================================================================
--- (empty file)
+++ rt/branches/3.8-TESTING/lib/RT/Action/ExtractSubjectTag.pm	Mon Apr 28 15:01:39 2008
@@ -0,0 +1,91 @@
+# BEGIN BPS TAGGED BLOCK {{{
+# 
+# COPYRIGHT:
+#  
+# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC 
+#                                          <jesse at bestpractical.com>
+# 
+# (Except where explicitly superseded by other copyright notices)
+# 
+# 
+# LICENSE:
+# 
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+# 
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+# 
+# 
+# CONTRIBUTION SUBMISSION POLICY:
+# 
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+# 
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+# 
+# END BPS TAGGED BLOCK }}}
+
+package RT::Action::ExtractSubjectTag;
+require RT::Action::Generic;
+
+use strict;
+use vars qw/@ISA/;
+ at ISA = qw(RT::Action::Generic);
+
+sub Describe {
+    my $self = shift;
+    return ( ref $self );
+}
+
+sub Prepare {
+    return (1);
+}
+
+sub Commit {
+    my $self            = shift;
+    my $Transaction     = $self->TransactionObj;
+    my $FirstAttachment = $Transaction->Attachments->First;
+    return 1 unless ($FirstAttachment);
+
+    my $Ticket = $self->TicketObj;
+
+    my $TicketSubject      = $self->TicketObj->Subject;
+    my $origTicketSubject  = $TicketSubject;
+    my $TransactionSubject = $FirstAttachment->Subject;
+
+    my $match   = RT->Config->Get('ExtractSubjectTagMatch');
+    my $nomatch = RT->Config->Get('ExtractSubjectTagNoMatch');
+    while ( $TransactionSubject =~ /($match)/g ) {
+        my $tag = $1;
+        next if $tag =~ /$nomatch/;
+        $TicketSubject .= " $tag" unless ( $TicketSubject =~ /\Q$tag\E/ );
+    }
+
+    $self->TicketObj->SetSubject($TicketSubject)
+        if ( $TicketSubject ne $origTicketSubject );
+
+    return (1);
+}
+
+1;


More information about the Rt-commit mailing list