[Rt-commit] rt branch, html-templates, updated. rt-3.9.4-491-g54bf2e5

Thomas Sibley trs at bestpractical.com
Fri Nov 19 16:09:41 EST 2010


The branch, html-templates has been updated
       via  54bf2e51a6a947a4336a3dc6fdd7c453b3b7434d (commit)
       via  ee3bd083ffcfd6d2864eea00411ba9c0f94bdca0 (commit)
       via  564316b5564789ffa415f48cafddea83e1ce4228 (commit)
       via  2d5417f929ef48f825870a20e64e61ba9ac97377 (commit)
      from  1d00fc76ece8e5ed07671ccbaa5590ebf2581f3c (commit)

Summary of changes:
 UPGRADING                                          |    8 +
 etc/initialdata                                    |   20 +-
 etc/upgrade/3.9.7/content                          |  186 ++++++++++++++++++++
 ...ddressregexp.in => switch-to-html-templates.in} |   82 +++++++--
 4 files changed, 266 insertions(+), 30 deletions(-)
 mode change 100755 => 100644 etc/initialdata
 create mode 100755 etc/upgrade/3.9.7/content
 copy etc/upgrade/{generate-rtaddressregexp.in => switch-to-html-templates.in} (60%)

- Log -----------------------------------------------------------------
commit 2d5417f929ef48f825870a20e64e61ba9ac97377
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Nov 19 13:15:49 2010 -0500

    Switch the default scrip templates to the HTML versions

diff --git a/etc/initialdata b/etc/initialdata
index 778915e..289b2c5 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -671,39 +671,39 @@ Hour:         { $SubscriptionObj->SubValue('Hour') }
     {  Description    => 'On Owner Change Notify Owner',
        ScripCondition => 'On Owner Change',
        ScripAction    => 'Notify Owner',
-       Template       => 'Transaction' },
+       Template       => 'Transaction in HTML' },
     {  Description    => 'On Create Autoreply To Requestors',
        ScripCondition => 'On Create',
        ScripAction    => 'AutoReply To Requestors',
-       Template       => 'AutoReply' },
+       Template       => 'AutoReply in HTML' },
     {  Description    => 'On Create Notify AdminCcs',
        ScripCondition => 'On Create',
        ScripAction    => 'Notify AdminCcs',
-       Template       => 'Transaction' },
+       Template       => 'Transaction in HTML' },
     {  Description    => 'On Correspond Notify AdminCcs',
        ScripCondition => 'On Correspond',
        ScripAction    => 'Notify AdminCcs',
-       Template       => 'Admin Correspondence' },
+       Template       => 'Admin Correspondence in HTML' },
     {  Description    => 'On Correspond Notify Requestors and Ccs',
        ScripCondition => 'On Correspond',
        ScripAction    => 'Notify Requestors And Ccs',
-       Template       => 'Correspondence' },
+       Template       => 'Correspondence in HTML' },
     {  Description    => 'On Correspond Notify Other Recipients',
        ScripCondition => 'On Correspond',
        ScripAction    => 'Notify Other Recipients',
-       Template       => 'Correspondence' },
+       Template       => 'Correspondence in HTML' },
     {  Description    => 'On Comment Notify AdminCcs as Comment',
        ScripCondition => 'On Comment',
        ScripAction    => 'Notify AdminCcs As Comment',
-       Template       => 'Admin Comment' },
+       Template       => 'Admin Comment in HTML' },
     {  Description    => 'On Comment Notify Other Recipients as Comment',
        ScripCondition => 'On Comment',
        ScripAction    => 'Notify Other Recipients As Comment',
-       Template       => 'Correspondence' },
+       Template       => 'Correspondence in HTML' },
     {  Description    => 'On Resolve Notify Requestors',
        ScripCondition => 'On Resolve',
        ScripAction    => 'Notify Requestors',
-       Template       => 'Resolved' },
+       Template       => 'Resolved in HTML' },
     {  Description    => "On transaction, add any tags in the transaction's subject to the ticket's subject",
        ScripCondition => 'On Transaction',
        ScripAction    => 'Extract Subject Tag',

commit 564316b5564789ffa415f48cafddea83e1ce4228
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Nov 19 15:58:18 2010 -0500

    Fix the Ticket Status change template name

diff --git a/etc/initialdata b/etc/initialdata
old mode 100755
new mode 100644
index 289b2c5..7ae4762
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -370,7 +370,7 @@ Content-Type: text/html
     },
     {  Queue       => '0',
        Name        => 'Status Change in HTML',              # loc
-       Description => 'Ticket status changed',              # loc
+       Description => 'HTML Ticket status changed',              # loc
        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
 Content-Type: text/html
 

commit ee3bd083ffcfd6d2864eea00411ba9c0f94bdca0
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Nov 19 16:00:44 2010 -0500

    Blow in the new HTML templates when doing an upgrade

diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
new file mode 100755
index 0000000..28032f3
--- /dev/null
+++ b/etc/upgrade/3.9.7/content
@@ -0,0 +1,186 @@
+# New HTML templates
+
+ at Templates = (
+    {  Queue       => '0',
+       Name        => 'Autoreply in HTML',                              # loc
+       Description => 'HTML Autoresponse template',                     # loc
+       Content     => q[Subject: AutoReply: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>Greetings,</p>
+
+<p>This message has been automatically generated in response to the
+creation of a trouble ticket regarding <b>{$Ticket->Subject()}</b>,
+a summary of which appears below.</p>
+
+<p>There is no need to reply to this message right now.  Your ticket has been
+assigned an ID of <b>{$Ticket->SubjectTag}</b>.</p>
+
+<p>Please include the string <b>{$Ticket->SubjectTag}</b>
+in the subject line of all future correspondence about this issue. To do so,
+you may reply to this message.</p>
+
+<p>Thank you,<br/>
+{$Ticket->QueueObj->CorrespondAddress()}</p>
+
+<hr/>
+{$Transaction->Content(Type => 'text/html')}
+],
+    },
+    {  Queue       => '0',
+       Name        => 'Transaction in HTML',          # loc
+       Description => 'HTML transaction template',    # loc
+       Content     => 'RT-Attach-Message: yes
+Content-Type: text/html
+
+<b>{$Transaction->CreatedAsString}: {$Transaction->CreatorObj->Name} updated ticket <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{$Ticket->id}</a>.</b>
+<br>
+<table border="0">
+<tr><td align="right"><b>Transaction:</b></td><td>{$Transaction->Description}</td></tr>
+<tr><td align="right"><b>Queue:</b></td><td>{$Ticket->QueueObj->Name}</td></tr>
+<tr><td align="right"><b>Subject:</b></td><td>{$Transaction->Subject || $Ticket->Subject || "(No subject given)"} </td></tr>
+<tr><td align="right"><b>Owner:</b></td><td>{$Ticket->OwnerObj->Name}</td></tr>
+<tr><td align="right"><b>Requestors:</b></td><td>{$Ticket->RequestorAddresses}</td></tr>
+<tr><td align="right"><b>Status:</b></td><td>{$Ticket->Status}</td></tr>
+<tr><td align="right"><b>Ticket URL:</b></td><td><a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}</a></td></tr>
+</table>
+<br/>
+<br/>
+{$Transaction->Content( Type => "text/html")}
+'
+    },
+    {  Queue       => '0',
+       Name        => 'Admin Correspondence in HTML',                     # loc
+       Description => 'HTML admin correspondence template',    # loc
+       Content     => 'RT-Attach-Message: yes
+Content-Type: text/html
+
+Ticket URL: <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}</a>
+<br />
+<br />
+{$Transaction->Content(Type => "text/html");}
+'
+    },
+    {  Queue       => '0',
+       Name        => 'Correspondence in HTML',                 # loc
+       Description => 'HTML correspondence template',           # loc
+       Content     => 'RT-Attach-Message: yes
+Content-Type: text/html
+
+{$Transaction->Content( Type => "text/html")}
+'
+    },
+    {  Queue       => '0',
+       Name        => 'Admin Comment in HTML',                  # loc
+       Description => 'HTML admin comment template',            # loc
+       Content     => 'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\[Comment\]//g; $comment =~ s/^Re//i; $s;}
+RT-Attach-Message: yes
+Content-Type: text/html
+
+<p>This is a comment about <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">ticket {$Ticket->id}</a>. It is not sent to the Requestor(s):</p>
+
+{$Transaction->Content(Type => "text/html")}
+'
+    },
+    {  Queue       => '0',
+       Name        => 'Status Change in HTML',              # loc
+       Description => 'HTML Ticket status changed',              # loc
+       Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
+Content-Type: text/html
+
+<a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}</a>
+<br/>
+<br/>
+{$Transaction->Content(Type => "text/html")}
+'
+    },
+    {  Queue       => '0',
+       Name        => 'Resolved in HTML',               # loc
+       Description => 'HTML Ticket Resolved',           # loc
+       Content     => 'Subject: Resolved: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>According to our records, your request has been resolved.  If you have any further questions or concerns, please respond to this message.</p>
+'
+    },
+    {  Queue       => '___Approvals',
+       Name        => "New Pending Approval in HTML",                                   # loc
+       Description => "Notify Owners and AdminCcs of new items pending their approval", # loc
+       Content     => 'Subject: New Pending Approval: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>Greetings,</p>
+
+<p>There is a new item pending your approval: <b>{$Ticket->Subject()}</b>,
+a summary of which appears below.</p>
+
+<p>Please <a href="{RT->Config->Get(\'WebURL\')}Approvals/Display.html?id={$Ticket->id}">approve
+or reject this ticket</a>, or visit the <a href="{RT->Config->Get(\'WebURL\')}Approvals/">approvals
+overview</a> to batch-process all your pending approvals.</p>
+
+<hr />
+{$Transaction->Content()}
+'
+    },
+    {  Queue       => '___Approvals',
+       Name        => "Approval Passed in HTML",    # loc
+       Description =>
+         "Notify Requestor of their ticket has been approved by some approver", # loc
+       Content => 'Subject: Ticket Approved: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>Greetings,</p>
+
+<p>Your ticket has been approved by <b>{ eval { $Approver->Name } }</b>.
+Other approvals may be pending.</p>
+
+<p>Approver\'s notes:</p>
+<blockquote>{ $Notes }</blockquote>
+'
+    },
+    {  Queue       => '___Approvals',
+       Name        => "All Approvals Passed in HTML",    # loc
+       Description =>
+         "Notify Requestor of their ticket has been approved by all approvers", # loc
+       Content => 'Subject: Ticket Approved: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>Greetings,</p>
+
+<p>Your ticket has been approved by <b>{ eval { $Approver->Name } }</b>.
+Its Owner may now start to act on it.</p>
+
+<p>Approver\'s notes:</p>
+<blockquote>{ $Notes }</blockquote>
+'
+    },
+    {  Queue       => '___Approvals',
+       Name        => "Approval Rejected in HTML",    # loc
+       Description =>
+         "Notify Owner of their rejected ticket", # loc
+       Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>Greetings,</p>
+
+<p>Your ticket has been rejected by <b>{ eval { $Approver->Name } }</b>.</p>
+
+<p>Approver\'s notes:</p>
+<blockquote>{ $Notes }</blockquote>
+'
+    },
+    {  Queue       => '___Approvals',
+       Name        => "Approval Ready for Owner in HTML",    # loc
+       Description =>
+         "Notify Owner of their ticket has been approved and is ready to be acted on", # loc
+       Content => 'Subject: Ticket Approved: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>Greetings,</p>
+
+<p>The ticket has been approved, you may now start to act on it.</p>
+
+'
+    },
+);
+

commit 54bf2e51a6a947a4336a3dc6fdd7c453b3b7434d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Nov 19 16:09:13 2010 -0500

    Add the script and a note for switching to HTML templates when upgrading

diff --git a/UPGRADING b/UPGRADING
index 5ddf803..6e2885c 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -37,6 +37,14 @@ with
 
     { $Ticket->SubjectTag }
 
+* There are now HTML versions of the standard plain text templates.  Running
+  make upgrade as described in the README will insert the new templates into
+  existing installs.  While new installs use the HTML templates by default,
+  upgrades from older versions don't automatically switch to the HTML versions.
+  To switch existing scrips, run:
+
+    /opt/rt3/etc/upgrade/switch-to-html-templates
+
 
 *******
 UPGRADING FROM 3.8.8 and earlier - Changes:
diff --git a/etc/upgrade/switch-to-html-templates.in b/etc/upgrade/switch-to-html-templates.in
new file mode 100644
index 0000000..8098bd4
--- /dev/null
+++ b/etc/upgrade/switch-to-html-templates.in
@@ -0,0 +1,129 @@
+#!@PERL@
+# 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 }}}
+use strict;
+use warnings;
+
+use lib "@LOCAL_LIB_PATH@";
+use lib "@RT_LIB_PATH@";
+
+use RT;
+RT::LoadConfig();
+RT->Config->Set('LogToScreen' => 'debug');
+RT::Init();
+
+$| = 1;
+
+my @templates = (
+    "Autoreply",
+    "Transaction",
+    "Admin Correspondence",
+    "Correspondence",
+    "Admin Comment",
+    "Status Change",
+    "Resolved",
+    "New Pending Approval",
+    "Approval Passed",
+    "All Approvals Passed",
+    "Approval Rejected",
+    "Approval Ready for Owner",
+);
+
+$RT::Handle->BeginTransaction();
+
+use RT::Scrips;
+my $scrips = RT::Scrips->new( RT->SystemUser );
+$scrips->UnLimit;
+
+my $templates = $scrips->Join(
+    ALIAS1 => 'main',
+    FIELD1 => 'Template',
+    TABLE2 => 'Templates',
+    FIELD2 => 'id'
+);
+
+for (@templates) {
+    $scrips->Limit(
+        ALIAS => $templates,
+        FIELD => 'Name',
+        VALUE => $_,
+        ENTRYAGGREGATOR => 'OR'
+    );
+}
+
+my $switched = 0;
+while ( my $s = $scrips->Next ) {
+    my $html = $s->TemplateObj->Name . ' in HTML';
+
+    print $s->id, ": ", $s->Description, "\n";
+    print "    ", $s->TemplateObj->Name, " -> $html\n\n";
+
+    my ($ok, $msg) = $s->SetTemplate($html);
+
+    if ($ok) {
+        $switched++;
+    } else {
+        warn "    Couldn't switch templates: $msg\n";
+    }
+}
+
+$RT::Handle->Commit;
+
+if ($switched) {
+    print <<"    EOT";
+Switched $switched scrips to HTML templates.  You should now manually port your
+customizations from the old templates to the new HTML templates.
+    EOT
+}
+else {
+    print <<"    EOT";
+No scrips were found using the plain text templates, so none were switched to
+the HTML templates.
+    EOT
+}
+

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


More information about the Rt-commit mailing list