[Rt-commit] rt branch, plaintext-dashboards, created. rt-3.9.6-38-g234b138
Shawn Moore
sartak at bestpractical.com
Wed Dec 1 14:27:23 EST 2010
The branch, plaintext-dashboards has been created
at 234b138056def42653b7e1cc5fa1fd108e9431cc (commit)
- Log -----------------------------------------------------------------
commit b75d87318960dffe7895871b155c711980bed64f
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Mar 25 16:42:59 2010 -0400
Add a rough initial cut of HTML templates
diff --git a/etc/initialdata b/etc/initialdata
index 212e962..93107b9 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -486,6 +486,131 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
}
}
},
+# HTML version of the templates
+ {
+ Name => 'Correspondence in HTML', # loc
+ Description => 'HTML correspondence template', # loc
+ Content => q[RT-Attach-Message: yes
+Content-Type: text/html
+
+{$Transaction->Content( Type => 'text/html')}
+],
+ },
+
+ {
+ Queue => '0',
+ Name => 'Admin Correspondence in HTML', # loc
+ Description => 'HTML admin correspondence template', # loc
+ Content => q[RT-Attach-Message: yes
+Content-Type: text/html
+
+{ my $c = $Transaction->Content(Type => 'text/html');
+ my $url = $RT::WebURL."Ticket/Display.html?id=".$Ticket->id;
+ if (substr($c,0,500) =~ qr/\Q$url\E/) {
+ $OUT = $c;
+ } else {
+ $OUT = <<EOF;
+Ticket URL: <a href="$url">$url</a>
+<br/>
+<br/>
+<br/>
+$c
+EOF
+
+ }
+}
+],
+ },
+ {
+ Queue => '0',
+ Name => 'Admin Comment in HTML', # loc
+ Description => 'HTML admin comment template', # loc
+ Content => q[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::WebURL}?q={$Ticket->id}">ticket {$Ticket->id}</a>. It is not sent to the Requestor(s):</p>
+<br/>
+{$Transaction->Content(Type => 'text/html')}
+],
+ },
+ { Queue => '0',
+ Name => 'Status Change in HTML', # loc
+ Description => 'Ticket status changed', # loc
+ Content => q[Subject: Status Changed to: {$Transaction->NewValue}
+RT-Attach-Message: yes
+Content-Type: text/html
+
+<a href="{$RT::WebURL}?q={$Ticket->id}">{$RT::WebURL}?q={$Ticket->id}</a>
+<br/>
+<br/>
+{$Transaction->Content(Type => 'text/html')}
+],
+ },
+ {
+ Queue => '0',
+ Name => 'Resolved in HTML', # loc
+ Description => 'HTML Ticket Resolved', # loc
+ Content => q[Subject: Resolved: {$Ticket->Subject}
+Content-Type: text/html
+
+<p>According to our records, your request has been resolved.</p>
+
+<p>If you have any further questions or concerns, please respond to this message.</p>
+],
+ },
+ { 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 [{$rtname} #{$Ticket->id()}].</p>
+
+<p>Please include the string <b>[{$rtname} #{$Ticket->id}]</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 => 'Default transaction template', # loc
+ Content => q[RT-Attach-Message: yes
+Content-Type: text/html
+
+<b>{$Transaction->CreatedAsString}: {$Transaction->CreatorObj->Name} updated ticket {$Ticket->id}.</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>{$RT::WebURL}?q={$Ticket->id}</td></tr>
+</table>
+
+<br/>
+<br/>
+{$Transaction->Content( Type => 'text/html')}
+],
+ },
);
@Scrips = (
commit 1a9900c61c1f2879cff4585f1fcf783da244b436
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Mar 25 17:05:05 2010 -0400
todo list
diff --git a/etc/initialdata b/etc/initialdata
index 93107b9..532f883 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -487,6 +487,9 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
}
},
# HTML version of the templates
+# needs the approval templates to be converted
+# possibly the error templates
+# probably not the Forward templates
{
Name => 'Correspondence in HTML', # loc
Description => 'HTML correspondence template', # loc
commit ffe7f6d926d15c4b35486d01266ffe6979a79416
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Mar 25 21:04:25 2010 -0400
mark this as todos
diff --git a/etc/initialdata b/etc/initialdata
index 532f883..a04ed19 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -487,6 +487,7 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
}
},
# HTML version of the templates
+# TODO
# needs the approval templates to be converted
# possibly the error templates
# probably not the Forward templates
commit 57cb0673f20efd65e875ba4a9f283d35d718808d
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Mar 25 21:07:35 2010 -0400
More todos
diff --git a/etc/initialdata b/etc/initialdata
index a04ed19..21fdde2 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -491,6 +491,8 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
# needs the approval templates to be converted
# possibly the error templates
# probably not the Forward templates
+# needs an upgrade step
+# needs docs on how to swap your scrips to use the new templates
{
Name => 'Correspondence in HTML', # loc
Description => 'HTML correspondence template', # loc
commit 441672862c1e851f79df737d96ba263da8adc9c1
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Apr 2 14:01:55 2010 -0400
fix link in Transaction in HTML template
diff --git a/etc/initialdata b/etc/initialdata
index 21fdde2..ba77d84 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -609,7 +609,7 @@ Content-Type: text/html
<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>{$RT::WebURL}?q={$Ticket->id}</td></tr>
+<tr><td align="right"><b>Ticket URL:</b></td><td>{$RT::WebURL}Ticket/Display.html?id={$Ticket->id}</td></tr>
</table>
<br/>
commit affc7b3ca6ed2bcd40202f44160a436b20fa077b
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Apr 2 14:05:24 2010 -0400
quick test replacement using WithLinks::AndTables because it displays tables better
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 133f9e5..4d94d40 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -564,20 +564,15 @@ sub _DowngradeFromHTML {
$orig_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
$orig_entity->make_multipart('alternative', Force => 1);
- require HTML::FormatText;
- require HTML::TreeBuilder;
+ require HTML::FormatText::WithLinks::AndTables;
require Encode;
- # need to decode_utf8, see the doc of MIMEObj method
- my $tree = HTML::TreeBuilder->new_from_content(
- Encode::decode_utf8($new_entity->bodyhandle->as_string)
- );
$new_entity->bodyhandle(MIME::Body::InCore->new(
- \(scalar HTML::FormatText->new(
- leftmargin => 0,
- rightmargin => 78,
- )->format( $tree ))
+ \( HTML::FormatText::WithLinks::AndTables->convert(
+ # need to decode_utf8, see the doc of MIMEObj method
+ Encode::decode_utf8($new_entity->bodyhandle->as_string),
+ { no_rowspacing => 1 }
+ ))
));
- $tree->delete;
$orig_entity->add_part($new_entity, 0); # plain comes before html
$self->{MIMEObj} = $orig_entity;
diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index e03f133..b19c9c2 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -80,8 +80,7 @@ use RT::Attachments;
use RT::Scrips;
use RT::Ruleset;
-use HTML::FormatText;
-use HTML::TreeBuilder;
+use HTML::FormatText::WithLinks::AndTables;
=head2 Create
@@ -328,12 +327,7 @@ sub Content {
$content =~ s/<p>--\s+<br \/>.*?$//s if $args{'Quote'};
if ($args{Type} ne 'text/html') {
- my $tree = HTML::TreeBuilder->new_from_content( $content );
- $content = HTML::FormatText->new(
- leftmargin => 0,
- rightmargin => 78,
- )->format( $tree);
- $tree->delete;
+ $content = HTML::FormatText::WithLinks::AndTables->convert($content, { no_rowspacing => 1 });
}
}
else {
commit a935794ac162d809d583a0664bded7a3d56b8038
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 16 17:57:09 2010 -0500
Factor out our HTML to text conversion routine
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 92d3022..d533f40 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1839,6 +1839,29 @@ sub _RecordSendEmailFailure {
}
}
+=head2 ConvertHTMLToText HTML
+
+Takes HTML and converts it to plain text. Appropriate for generating a plain
+text part from an HTML part of an email.
+
+=cut
+
+sub ConvertHTMLToText {
+ my $html = shift;
+
+ require HTML::FormatText::WithLinks::AndTables;
+ return HTML::FormatText::WithLinks::AndTables->convert(
+ $html => {
+ leftmargin => 0,
+ rightmargin => 78,
+ no_rowspacing => 1,
+ before_link => '',
+ after_link => ' (%1)',
+ footnote => '',
+ }
+ );
+}
+
RT::Base->_ImportOverlays();
1;
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 4d94d40..74a754b 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -567,11 +567,8 @@ sub _DowngradeFromHTML {
require HTML::FormatText::WithLinks::AndTables;
require Encode;
$new_entity->bodyhandle(MIME::Body::InCore->new(
- \( HTML::FormatText::WithLinks::AndTables->convert(
- # need to decode_utf8, see the doc of MIMEObj method
- Encode::decode_utf8($new_entity->bodyhandle->as_string),
- { no_rowspacing => 1 }
- ))
+ # need to decode_utf8, see the doc of MIMEObj method
+ \(RT::Interface::Email::ConvertHTMLToText(Encode::decode_utf8($new_entity->bodyhandle->as_string)))
));
$orig_entity->add_part($new_entity, 0); # plain comes before html
diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index b19c9c2..1539705 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -327,7 +327,7 @@ sub Content {
$content =~ s/<p>--\s+<br \/>.*?$//s if $args{'Quote'};
if ($args{Type} ne 'text/html') {
- $content = HTML::FormatText::WithLinks::AndTables->convert($content, { no_rowspacing => 1 });
+ $content = RT::Interface::Email::ConvertHTMLToText($content);
}
}
else {
commit edc6d0a99a46a86d717ceed03f805864fcada7f1
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 16 18:20:03 2010 -0500
Update the HTML template links to use RT->Config and Ticket/Display.html
diff --git a/etc/initialdata b/etc/initialdata
index ba77d84..95bf4a1 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -511,7 +511,7 @@ Content-Type: text/html
Content-Type: text/html
{ my $c = $Transaction->Content(Type => 'text/html');
- my $url = $RT::WebURL."Ticket/Display.html?id=".$Ticket->id;
+ my $url = RT->Config->Get('WebURL')."Ticket/Display.html?id=".$Ticket->id;
if (substr($c,0,500) =~ qr/\Q$url\E/) {
$OUT = $c;
} else {
@@ -535,7 +535,7 @@ EOF
RT-Attach-Message: yes
Content-Type: text/html
-<p>This is a comment about <a href="{$RT::WebURL}?q={$Ticket->id}">ticket {$Ticket->id}</a>. It is not sent to the Requestor(s):</p>
+<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>
<br/>
{$Transaction->Content(Type => 'text/html')}
],
@@ -547,7 +547,7 @@ Content-Type: text/html
RT-Attach-Message: yes
Content-Type: text/html
-<a href="{$RT::WebURL}?q={$Ticket->id}">{$RT::WebURL}?q={$Ticket->id}</a>
+<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')}
@@ -609,7 +609,7 @@ Content-Type: text/html
<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>{$RT::WebURL}Ticket/Display.html?id={$Ticket->id}</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/>
commit 135a95b710a7a82e76658ddf12c36fe3a3c8d0c5
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Nov 17 16:31:40 2010 -0500
Cleanup template descriptions
diff --git a/etc/initialdata b/etc/initialdata
index 95bf4a1..4e56f4c 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -194,7 +194,7 @@
Content => '', },
{ Queue => '0',
Name => 'Autoreply', # loc
- Description => 'Default Autoresponse template', # loc
+ Description => 'Plain text Autoresponse template', # loc
Content => 'Subject: AutoReply: {$Ticket->Subject}
@@ -225,7 +225,7 @@ you may reply to this message.
{ Queue => '0',
Name => 'Transaction', # loc
- Description => 'Default transaction template', # loc
+ Description => 'Plain text transaction template', # loc
Content => 'RT-Attach-Message: yes
@@ -247,7 +247,7 @@ you may reply to this message.
Queue => '0',
Name => 'Admin Correspondence', # loc
- Description => 'Default admin correspondence template', # loc
+ Description => 'Plain text admin correspondence template', # loc
Content => 'RT-Attach-Message: yes
@@ -259,7 +259,7 @@ you may reply to this message.
{ Queue => '0',
Name => 'Correspondence', # loc
- Description => 'Default correspondence template', # loc
+ Description => 'Plain text correspondence template', # loc
Content => 'RT-Attach-Message: yes
{$Transaction->Content()}
@@ -268,7 +268,7 @@ you may reply to this message.
{ Queue => '0',
Name => 'Admin Comment', # loc
- Description => 'Default admin comment template', # loc
+ Description => 'Plain text admin comment template', # loc
Content =>
'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]\\s*//g; $s =~ s/^Re:\\s*//i; $s;}
RT-Attach-Message: yes
@@ -486,13 +486,6 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
}
}
},
-# HTML version of the templates
-# TODO
-# needs the approval templates to be converted
-# possibly the error templates
-# probably not the Forward templates
-# needs an upgrade step
-# needs docs on how to swap your scrips to use the new templates
{
Name => 'Correspondence in HTML', # loc
Description => 'HTML correspondence template', # loc
@@ -566,7 +559,7 @@ Content-Type: text/html
],
},
{ Queue => '0',
- Name => 'Autoreply in HTML', # loc
+ Name => 'Autoreply in HTML', # loc
Description => 'HTML Autoresponse template', # loc
Content => q[Subject: AutoReply: {$Ticket->Subject}
Content-Type: text/html
@@ -596,7 +589,7 @@ you may reply to this message.</p>
{
Queue => '0',
Name => 'Transaction in HTML', # loc
- Description => 'Default transaction template', # loc
+ Description => 'HTML transaction template', # loc
Content => q[RT-Attach-Message: yes
Content-Type: text/html
commit a28720b02996ba87aba1b53cd3fd067353ad3784
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Nov 18 10:34:04 2010 -0500
Interleave plain text and HTML templates for easier maintenance
In the process I've cleaned up the HTML versions and brought them up to
date with their plain text counterparts in 3.9.
diff --git a/etc/initialdata b/etc/initialdata
index 4e56f4c..922ad1e 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -222,10 +222,35 @@ you may reply to this message.
{$Transaction->Content()}
'
},
+ { 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', # loc
- Description => 'Plain text transaction template', # loc
+ Description => 'Plain text transaction template', # loc
Content => 'RT-Attach-Message: yes
@@ -242,7 +267,28 @@ you may reply to this message.
{$Transaction->Content()}
'
},
+ { 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',
@@ -256,7 +302,18 @@ you may reply to this message.
{$Transaction->Content()}
'
},
+ { 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', # loc
Description => 'Plain text correspondence template', # loc
@@ -265,7 +322,15 @@ you may reply to this message.
{$Transaction->Content()}
'
},
+ { 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', # loc
Description => 'Plain text admin comment template', # loc
@@ -280,7 +345,18 @@ This is a comment. It is not sent to the Requestor(s):
{$Transaction->Content()}
'
},
+ { 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', # loc
Description => 'Ticket status changed', # loc
@@ -292,7 +368,18 @@ This is a comment. It is not sent to the Requestor(s):
{$Transaction->Content()}
'
},
+ { Queue => '0',
+ Name => 'Status Change in HTML', # loc
+ Description => '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',
@@ -304,6 +391,15 @@ According to our records, your request has been resolved. If you have any
further questions or concerns, please respond to this message.
'
},
+ { 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", # loc
Description =>
@@ -486,130 +582,6 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
}
}
},
- {
- Name => 'Correspondence in HTML', # loc
- Description => 'HTML correspondence template', # loc
- Content => q[RT-Attach-Message: yes
-Content-Type: text/html
-
-{$Transaction->Content( Type => 'text/html')}
-],
- },
-
- {
- Queue => '0',
- Name => 'Admin Correspondence in HTML', # loc
- Description => 'HTML admin correspondence template', # loc
- Content => q[RT-Attach-Message: yes
-Content-Type: text/html
-
-{ my $c = $Transaction->Content(Type => 'text/html');
- my $url = RT->Config->Get('WebURL')."Ticket/Display.html?id=".$Ticket->id;
- if (substr($c,0,500) =~ qr/\Q$url\E/) {
- $OUT = $c;
- } else {
- $OUT = <<EOF;
-Ticket URL: <a href="$url">$url</a>
-<br/>
-<br/>
-<br/>
-$c
-EOF
-
- }
-}
-],
- },
- {
- Queue => '0',
- Name => 'Admin Comment in HTML', # loc
- Description => 'HTML admin comment template', # loc
- Content => q[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>
-<br/>
-{$Transaction->Content(Type => 'text/html')}
-],
- },
- { Queue => '0',
- Name => 'Status Change in HTML', # loc
- Description => 'Ticket status changed', # loc
- Content => q[Subject: Status Changed to: {$Transaction->NewValue}
-RT-Attach-Message: yes
-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 => q[Subject: Resolved: {$Ticket->Subject}
-Content-Type: text/html
-
-<p>According to our records, your request has been resolved.</p>
-
-<p>If you have any further questions or concerns, please respond to this message.</p>
-],
- },
- { 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 [{$rtname} #{$Ticket->id()}].</p>
-
-<p>Please include the string <b>[{$rtname} #{$Ticket->id}]</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 => q[RT-Attach-Message: yes
-Content-Type: text/html
-
-<b>{$Transaction->CreatedAsString}: {$Transaction->CreatorObj->Name} updated ticket {$Ticket->id}.</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')}
-],
- },
);
@Scrips = (
commit 897807d0dbda66bde9467cc950218629c2e6baf4
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Nov 18 11:45:23 2010 -0500
HTMLize the approvals templates
diff --git a/etc/initialdata b/etc/initialdata
index 922ad1e..7c6baf4 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -420,6 +420,25 @@ batch-process all your pending approvals.
'
},
{ 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", # loc
Description =>
"Notify Requestor of their ticket has been approved by some approver", # loc
@@ -434,6 +453,22 @@ Approver\'s notes: { $Notes }
'
},
{ 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", # loc
Description =>
"Notify Requestor of their ticket has been approved by all approvers", # loc
@@ -448,6 +483,22 @@ Approver\'s notes: { $Notes }
'
},
{ 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", # loc
Description =>
"Notify Owner of their rejected ticket", # loc
@@ -461,6 +512,21 @@ Approver\'s notes: { $Notes }
'
},
{ 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 { $Approval->OwnerObj->Name } }</b>.</p>
+
+<p>Approver\'s notes:</p>
+<blockquote>{ $Notes }</blockquote>
+'
+ },
+ { Queue => '___Approvals',
Name => "Approval Ready for Owner", # loc
Description =>
"Notify Owner of their ticket has been approved and is ready to be acted on", # loc
@@ -472,6 +538,19 @@ The ticket has been approved, you may now start to act on it.
'
},
+ { 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>
+
+'
+ },
{ Queue => 0,
Name => "Forward", # loc
Description => "Heading of a forwarded message", # loc
commit 1d00fc76ece8e5ed07671ccbaa5590ebf2581f3c
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Nov 18 11:50:28 2010 -0500
Use $Approver->Name which is actually correct
The corresponding plain text template was fixed in 3.8-trunk and that
change will be merged to 3.9-trunk in the future.
diff --git a/etc/initialdata b/etc/initialdata
index 7c6baf4..778915e 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -520,7 +520,7 @@ Content-Type: text/html
<p>Greetings,</p>
-<p>Your ticket has been rejected by <b>{ eval { $Approval->OwnerObj->Name } }</b>.</p>
+<p>Your ticket has been rejected by <b>{ eval { $Approver->Name } }</b>.</p>
<p>Approver\'s notes:</p>
<blockquote>{ $Notes }</blockquote>
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
+}
+
commit 2a2d85b5de4c36b2706d95bae969eec99df177f4
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Nov 19 16:15:36 2010 -0500
Ignore the new html templates switch
diff --git a/.gitignore b/.gitignore
index d3c9dec..1b0d1b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ etc/upgrade/3.8-branded-queues-extension
etc/upgrade/3.8-ical-extension
etc/upgrade/split-out-cf-categories
etc/upgrade/generate-rtaddressregexp
+etc/upgrade/switch-to-html-templates
lib/RT/Generated.pm
Makefile
t/data/gnupg/keyrings/random_seed
commit c3b1a9641e72471eee02167d56114c5d1b4ff72a
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Nov 22 10:41:22 2010 -0500
Make sure etc/upgrades/switch-to-html-templates is chmod'd +x
diff --git a/configure.ac b/configure.ac
index ceea142..a36d584 100755
--- a/configure.ac
+++ b/configure.ac
@@ -399,6 +399,7 @@ AC_CONFIG_FILES([
etc/upgrade/3.8-ical-extension
etc/upgrade/split-out-cf-categories
etc/upgrade/generate-rtaddressregexp
+ etc/upgrade/switch-to-html-templates
sbin/rt-attributes-viewer
sbin/rt-session-viewer
sbin/rt-dump-database
commit 7ab5afe3ce32f023d2494994bc9f242ae91af27b
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Nov 22 12:08:06 2010 -0500
Fix a typo in the HTML to text converter config
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index d533f40..1cd9d30 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1856,7 +1856,7 @@ sub ConvertHTMLToText {
rightmargin => 78,
no_rowspacing => 1,
before_link => '',
- after_link => ' (%1)',
+ after_link => ' (%l)',
footnote => '',
}
);
commit 1f09659246a5f217d6062e8c5f1a4488ab025c45
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Nov 24 10:42:08 2010 -0500
Make the HTML admin comment subject match the plain text one
This also fixes a typo where $comment was used for output rather than
$s.
diff --git a/etc/initialdata b/etc/initialdata
index 7ae4762..32073c8 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -348,7 +348,8 @@ This is a comment. It is not sent to the Requestor(s):
{ 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;}
+ Content =>
+'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]\\s*//g; $s =~ s/^Re:\\s*//i; $s;}
RT-Attach-Message: yes
Content-Type: text/html
commit 5dfee3f8fadc214dd062dad78cad0f6b1882d294
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Nov 24 12:12:41 2010 -0500
Tweak the template upgrading script to go both ways
This lets users try out the HTML templates and then decide to go back to
plain text. It also will be useful for testing both sets of templates.
diff --git a/.gitignore b/.gitignore
index 1b0d1b2..ec8c699 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,7 @@ etc/upgrade/3.8-branded-queues-extension
etc/upgrade/3.8-ical-extension
etc/upgrade/split-out-cf-categories
etc/upgrade/generate-rtaddressregexp
-etc/upgrade/switch-to-html-templates
+etc/upgrade/switch-templates-to
lib/RT/Generated.pm
Makefile
t/data/gnupg/keyrings/random_seed
diff --git a/UPGRADING b/UPGRADING
index 6e2885c..43d01a0 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -43,7 +43,12 @@ with
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
+ /opt/rt3/etc/upgrade/switch-templates-to html
+
+ To switch from HTML back to text, run:
+
+ /opt/rt3/etc/upgrade/switch-templates-to text
+
*******
diff --git a/configure.ac b/configure.ac
index a36d584..1231320 100755
--- a/configure.ac
+++ b/configure.ac
@@ -399,7 +399,7 @@ AC_CONFIG_FILES([
etc/upgrade/3.8-ical-extension
etc/upgrade/split-out-cf-categories
etc/upgrade/generate-rtaddressregexp
- etc/upgrade/switch-to-html-templates
+ etc/upgrade/switch-templates-to
sbin/rt-attributes-viewer
sbin/rt-session-viewer
sbin/rt-dump-database
diff --git a/etc/upgrade/switch-to-html-templates.in b/etc/upgrade/switch-templates-to.in
similarity index 74%
rename from etc/upgrade/switch-to-html-templates.in
rename to etc/upgrade/switch-templates-to.in
index 8098bd4..8f9eff1 100644
--- a/etc/upgrade/switch-to-html-templates.in
+++ b/etc/upgrade/switch-templates-to.in
@@ -53,8 +53,21 @@ use lib "@LOCAL_LIB_PATH@";
use lib "@RT_LIB_PATH@";
use RT;
+
+my $to = shift || '';
+my $from;
+
+if ($to =~ /html|text/i) {
+ $to = $to =~ /html/i ? 'html' : 'text';
+ $from = $to eq 'html' ? 'text' : 'html';
+} else {
+ print "Usage: $0 [html|text]\n";
+ warn "Please specify if you'd like to switch to HTML or text templates.\n";
+ exit 1;
+}
+
RT::LoadConfig();
-RT->Config->Set('LogToScreen' => 'debug');
+RT->Config->Set('LogToScreen' => 'info');
RT::Init();
$| = 1;
@@ -91,19 +104,25 @@ for (@templates) {
$scrips->Limit(
ALIAS => $templates,
FIELD => 'Name',
- VALUE => $_,
+ VALUE => ($to eq 'html' ? $_ : "$_ in HTML"),
ENTRYAGGREGATOR => 'OR'
);
}
my $switched = 0;
while ( my $s = $scrips->Next ) {
- my $html = $s->TemplateObj->Name . ' in HTML';
+ my $new = $s->TemplateObj->Name;
+
+ if ($to eq 'html') {
+ $new .= ' in HTML';
+ } else {
+ $new =~ s/ in HTML$//;
+ }
print $s->id, ": ", $s->Description, "\n";
- print " ", $s->TemplateObj->Name, " -> $html\n\n";
+ print " ", $s->TemplateObj->Name, " -> $new\n\n";
- my ($ok, $msg) = $s->SetTemplate($html);
+ my ($ok, $msg) = $s->SetTemplate($new);
if ($ok) {
$switched++;
@@ -116,14 +135,22 @@ $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.
+Switched $switched scrips to $to templates. You should now manually port any
+customizations from the old templates to the new templates.
+ EOT
+ exit 1 if $switched != $scrips->Count;
+}
+elsif ($scrips->Count) {
+ print <<" EOT";
+@{[$scrips->Count]} scrips using $from templates were found, but none were
+successfully switched to $to. See the errors above.
EOT
+ exit 1;
}
else {
print <<" EOT";
-No scrips were found using the plain text templates, so none were switched to
-the HTML templates.
+No scrips were found using the $from templates, so none were switched to
+$to templates.
EOT
}
commit 20ba42150ccb33566b2d27f797a0f6904c5baeaf
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Nov 24 14:17:13 2010 -0500
Test plain text templates by default
Tests for HTML templates will come later
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 0695da2..0b3e05e 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -176,6 +176,14 @@ sub import {
$level++;
}
+ # By default we test plain text templates for legacy's sake
+ my ($exit, $output) = $class->switch_templates_to('text');
+
+ if (my $num = $exit >> 8) {
+ warn "**** Trouble switching templates to plain text (exited $num):\n";
+ warn $output, "\n";
+ }
+
Test::More->export_to_level($level);
# blow away their diag so we can redefine it without warning
@@ -775,6 +783,24 @@ sub add_rights {
return 1;
}
+=head2 switch_templates_to TYPE
+
+This runs etc/upgrade/switch-templates-to in order to change the templates from
+HTML to text or vice versa. TYPE is the type to switch to, either C<html> or
+C<text>.
+
+=cut
+
+sub switch_templates_to {
+ my $self = shift;
+ my $type = shift;
+
+ return $self->run_and_capture(
+ command => "$RT::EtcPath/upgrade/switch-templates-to",
+ args => $type,
+ );
+}
+
sub run_mailgate {
my $self = shift;
@@ -813,10 +839,13 @@ sub run_and_capture {
$cmd .= ' --debug' if delete $args{'debug'};
+ my $args = delete $args{'args'};
+
while( my ($k,$v) = each %args ) {
next unless $v;
$cmd .= " --$k '$v'";
}
+ $cmd .= " $args" if defined $args;
$cmd .= ' 2>&1';
DBIx::SearchBuilder::Record::Cachable->FlushCache;
commit 120cf321a4368c2ac2daa3a10d771b96330fa53a
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Nov 24 14:29:42 2010 -0500
Fix this test for the new HTML -> text converter
diff --git a/t/api/txn_content.t b/t/api/txn_content.t
index 392b6a7..d44862d 100644
--- a/t/api/txn_content.t
+++ b/t/api/txn_content.t
@@ -1,7 +1,7 @@
use warnings;
use strict;
-use RT::Test tests => 3;
+use RT::Test tests => 4;
use MIME::Entity;
my $ticket = RT::Ticket->new(RT->SystemUser);
my $mime = MIME::Entity->build(
@@ -16,4 +16,8 @@ my $txns = $ticket->Transactions;
$txns->Limit( FIELD => 'Type', VALUE => 'Create' );
my $txn = $txns->First;
ok( $txn, 'got Create txn' );
-is( $txn->Content, "this is body\n", "txn's content" );
+
+# ->Content converts from text/html to plain text if we don't explicitly ask
+# for html. Our html -> text converter seems to add an extra trailing newline
+is( $txn->Content, "this is body\n\n", "txn's html content converted to plain text" );
+is( $txn->Content(Type => 'text/html'), "this is body\n", "txn's html content" );
commit 63f71d1e7767f5bced716968cb07ecd07cd897e6
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Nov 24 18:48:21 2010 -0500
Add a switch_templates_ok method to switch and test the exit code
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 0b3e05e..09af6c0 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -801,6 +801,25 @@ sub switch_templates_to {
);
}
+=head2 switch_templates_ok TYPE
+
+Calls L<switch_template_to> and tests the return values.
+
+=cut
+
+sub switch_templates_ok {
+ my $self = shift;
+ my $type = shift;
+
+ my ($exit, $output) = $self->switch_templates_to($type);
+
+ Test::More::ok(not ($exit >> 8), "Switched templates to $type cleanly");
+ diag("**** etc/upgrade/switch-templates-to exited with $num:\n$output")
+ if $exit >> 8;
+
+ return ($exit, $output);
+}
+
sub run_mailgate {
my $self = shift;
commit 234b138056def42653b7e1cc5fa1fd108e9431cc
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Nov 29 08:58:49 2010 -0500
Add our dependencies for smarter HTML to plaintext conversion
HTML::FormatText::WithLinks needs at least version 0.12 so it includes a
patch I wrote for intelligently skipping linked URLs. This prevents
duplicate links.
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 335eef3..8768a69 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -210,6 +210,8 @@ List::MoreUtils
Net::CIDR
Regexp::Common::net::CIDR
Regexp::IPv6
+HTML::FormatText::WithLinks 0.12
+HTML::FormatText::WithLinks::AndTables
.
$deps{'MASON'} = [ text_to_hash( << '.') ];
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list