[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-225-ge53a1cf
Shawn Moore
sartak at bestpractical.com
Tue Jul 27 22:35:34 EDT 2010
The branch, new-style-templates has been updated
via e53a1cf26358d74e2147c1479a3fb35a7fc22074 (commit)
from b6b1c7b32579fd572271856aeec351094bd91039 (commit)
Summary of changes:
etc/upgrade/3.9.1/content | 2 +-
lib/RT/Template_Overlay.pm | 28 ++++++++++++++--------------
share/html/Admin/Elements/ModifyTemplate | 6 +++---
t/api/template-simple.t | 28 ++++++++++++++--------------
t/web/template.t | 10 +++++-----
5 files changed, 37 insertions(+), 37 deletions(-)
- Log -----------------------------------------------------------------
commit e53a1cf26358d74e2147c1479a3fb35a7fc22074
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Jul 27 22:37:21 2010 -0400
Change the template Type from Full to Perl
diff --git a/etc/upgrade/3.9.1/content b/etc/upgrade/3.9.1/content
index 558a35a..1412c82 100644
--- a/etc/upgrade/3.9.1/content
+++ b/etc/upgrade/3.9.1/content
@@ -16,7 +16,7 @@
$templates->UnLimit();
while (my $template = $templates->Next) {
- my ($status, $msg) = $template->SetType('Full');
+ my ($status, $msg) = $template->SetType('Perl');
unless ( $status ) {
die "Couldn't change Type of Template #" . $template->Id . ": $msg";
}
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index bb4eabd..f1cb9f1 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -82,7 +82,7 @@ sub _Accessible {
id => 'read',
Name => 'read/write',
Description => 'read/write',
- Type => 'read/write', #Type is one of Full or Simple
+ Type => 'read/write', #Type is one of Perl or Simple
Content => 'read/write',
Queue => 'read/write',
Creator => 'read/auto',
@@ -206,7 +206,7 @@ sub Create {
Content => undef,
Queue => 0,
Description => '[no description]',
- Type => 'Full',
+ Type => 'Perl',
Name => undef,
@_
);
@@ -215,7 +215,7 @@ sub Create {
unless ( $self->CurrentUser->HasRight(Right =>'ModifyTemplate', Object => $RT::System) ) {
return ( undef, $self->loc('Permission Denied') );
}
- if ( $args{Type} eq 'Full' && !$self->CurrentUser->HasRight(Right => 'ModifyPerlTemplates', Object => $RT::System) ) {
+ if ( $args{Type} eq 'Perl' && !$self->CurrentUser->HasRight(Right => 'ModifyPerlTemplates', Object => $RT::System) ) {
return ( undef, $self->loc('Permission Denied') );
}
$args{'Queue'} = 0;
@@ -227,7 +227,7 @@ sub Create {
unless ( $QueueObj->CurrentUserHasRight('ModifyTemplate') ) {
return ( undef, $self->loc('Permission Denied') );
}
- if ( $args{Type} eq 'Full' && !$QueueObj->CurrentUserHasRight('ModifyPerlTemplates') ) {
+ if ( $args{Type} eq 'Perl' && !$QueueObj->CurrentUserHasRight('ModifyPerlTemplates') ) {
return ( undef, $self->loc('Permission Denied') );
}
$args{'Queue'} = $QueueObj->Id;
@@ -408,8 +408,8 @@ sub _ParseContent {
$args{'loc'} = sub { $self->loc(@_) };
}
- if ($self->Type eq 'Full') {
- return $self->_ParseContentFull(
+ if ($self->Type eq 'Perl') {
+ return $self->_ParseContentPerl(
Content => $content,
TemplateArgs => \%args,
);
@@ -422,8 +422,8 @@ sub _ParseContent {
}
}
-# uses Text::Template for Full templates
-sub _ParseContentFull {
+# uses Text::Template for Perl templates
+sub _ParseContentPerl {
my $self = shift;
my %args = (
Content => undef,
@@ -597,7 +597,7 @@ sub CurrentUserHasQueueRight {
=head2 SetType
-If setting Type to Full, require the ModifyPerlTemplates right on the queue.
+If setting Type to Perl, require the ModifyPerlTemplates right on the queue.
=cut
@@ -605,7 +605,7 @@ sub SetType {
my $self = shift;
my $NewType = shift;
- if ($NewType eq 'Full' && !$self->CurrentUserHasQueueRight('ModifyPerlTemplates')) {
+ if ($NewType eq 'Perl' && !$self->CurrentUserHasQueueRight('ModifyPerlTemplates')) {
return ( undef, $self->loc('Permission Denied') );
}
@@ -615,7 +615,7 @@ sub SetType {
=head2 SetQueue
When changing the queue, make sure the current user has ModifyPerlTemplates on the
-new queue if the type is Full.
+new queue if the type is Perl.
Templates can't change Queue in the UI (yet?).
@@ -628,7 +628,7 @@ sub SetQueue {
my $NewQueueObj = RT::Queue->new( $self->CurrentUser );
$NewQueueObj->Load($NewQueue);
- if ( $self->Type eq 'Full' && !$NewQueueObj->CurrentUserHasRight('ModifyPerlTemplates') ) {
+ if ( $self->Type eq 'Perl' && !$NewQueueObj->CurrentUserHasRight('ModifyPerlTemplates') ) {
return ( undef, $self->loc('Permission Denied. You do not have ModifyPerlTemplates on the new queue.') );
}
@@ -637,7 +637,7 @@ sub SetQueue {
=head2 CompileCheck
-If the template's Type is Full, then compile check all the codeblocks to see if
+If the template's Type is Perl, then compile check all the codeblocks to see if
they are syntactically valid. We eval them in a codeblock to avoid actually
executing the code.
@@ -649,7 +649,7 @@ sub CompileCheck {
my $self = shift;
return (1, $self->loc("Template does not include Perl code"))
- unless $self->Type eq 'Full';
+ unless $self->Type eq 'Perl';
my $content = $self->Content;
$content = '' if !defined($content);
diff --git a/share/html/Admin/Elements/ModifyTemplate b/share/html/Admin/Elements/ModifyTemplate
index 3faea47..8ef9128 100755
--- a/share/html/Admin/Elements/ModifyTemplate
+++ b/share/html/Admin/Elements/ModifyTemplate
@@ -67,7 +67,7 @@
<&|/l&>Type</&>:
</td>
<td>
-<input type="radio" name="Type" value="Full" <% $Type eq "Full" ? 'checked="checked"' : "" |n %>><&|/l&>Full</&></input><br />
+<input type="radio" name="Type" value="Perl" <% $Type eq "Perl" ? 'checked="checked"' : "" |n %>><&|/l&>Perl</&></input><br />
<input type="radio" name="Type" value="Simple" <% $Type eq "Simple" ? 'checked="checked"' : "" |n %>><&|/l&>Simple</&></input><br />
</td>
</tr>
@@ -84,7 +84,7 @@
<%INIT>
-$Type = 'Full' if !$Type;
+$Type = 'Perl' if !$Type;
</%INIT>
@@ -92,5 +92,5 @@ $Type = 'Full' if !$Type;
$Name => ''
$Description => ''
$Content => ''
-$Type => 'Full'
+$Type => 'Perl'
</%ARGS>
diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index 4697e1c..7d885a3 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -39,25 +39,25 @@ $ticket->AddCustomFieldValue(
TemplateTest(
Content => "\ntest",
- FullOutput => "test",
+ PerlOutput => "test",
SimpleOutput => "test",
);
TemplateTest(
Content => "\ntest { 5 * 5 }",
- FullOutput => "test 25",
+ PerlOutput => "test 25",
SimpleOutput => "test { 5 * 5 }",
);
TemplateTest(
Content => "\ntest { \$Requestor }",
- FullOutput => "test dom\@example.com",
+ PerlOutput => "test dom\@example.com",
SimpleOutput => "test dom\@example.com",
);
TemplateTest(
Content => "\ntest { \$TicketSubject }",
- FullOutput => "test ",
+ PerlOutput => "test ",
SimpleOutput => "test template testing",
);
@@ -128,25 +128,25 @@ SimpleTemplateTest(
TemplateTest(
Content => "\ntest { \$Ticket->Nonexistent }",
- FullOutput => undef,
+ PerlOutput => undef,
SimpleOutput => "test { \$Ticket->Nonexistent }",
);
TemplateTest(
Content => "\ntest { \$Nonexistent->Nonexistent }",
- FullOutput => undef,
+ PerlOutput => undef,
SimpleOutput => "test { \$Nonexistent->Nonexistent }",
);
TemplateTest(
Content => "\ntest { \$Ticket->OwnerObj->Name }",
- FullOutput => "test root",
+ PerlOutput => "test root",
SimpleOutput => "test { \$Ticket->OwnerObj->Name }",
);
TemplateTest(
Content => "\ntest { *!( }",
- FullOutput => undef,
+ PerlOutput => undef,
SimpleOutput => "test { *!( }",
);
@@ -161,12 +161,12 @@ is($ticket->Status, 'new', "simple templates can't call ->Resolve");
my $template = RT::Template->new($RT::SystemUser);
$template->Create(
Name => "type chameleon",
- Type => "Full",
+ Type => "Perl",
Content => "\ntest { 10 * 7 }",
);
ok($id = $template->id, "Created template");
$template->Parse;
-is($template->MIMEObj->stringify_body, "test 70", "Full output");
+is($template->MIMEObj->stringify_body, "test 70", "Perl output");
$template = RT::Template->new($RT::SystemUser);
$template->Load($id);
@@ -180,9 +180,9 @@ $template = RT::Template->new($RT::SystemUser);
$template->Load($id);
is($template->Name, "type chameleon");
-$template->SetType('Full');
+$template->SetType('Perl');
$template->Parse;
-is($template->MIMEObj->stringify_body, "test 70", "Full output");
+is($template->MIMEObj->stringify_body, "test 70", "Perl output");
my $counter = 0;
sub IndividualTemplateTest {
@@ -190,7 +190,7 @@ sub IndividualTemplateTest {
my %args = (
Name => "Test-" . ++$counter,
- Type => "Full",
+ Type => "Perl",
@_,
);
@@ -223,7 +223,7 @@ sub TemplateTest {
local $Test::Builder::Level = $Test::Builder::Level + 1;
my %args = @_;
- for my $type ('Full', 'Simple') {
+ for my $type ('Perl', 'Simple') {
next if $args{"Skip$type"};
IndividualTemplateTest(
diff --git a/t/web/template.t b/t/web/template.t
index 90b6eab..c153c37 100644
--- a/t/web/template.t
+++ b/t/web/template.t
@@ -33,7 +33,7 @@ $m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
# now try changing Type back and forth
$m->form_name('ModifyTemplate');
-is($m->value('Type'), 'Full');
+is($m->value('Type'), 'Perl');
$m->field(Type => 'Simple');
$m->submit;
@@ -42,22 +42,22 @@ $m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
$m->form_name('ModifyTemplate');
is($m->value('Type'), 'Simple', 'updated type to simple');
-$m->field(Type => 'Full');
+$m->field(Type => 'Perl');
$m->submit;
$m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
$m->form_name('ModifyTemplate');
-is($m->value('Type'), 'Simple', 'need the ModifyPerlTemplates right to update Type to Full');
+is($m->value('Type'), 'Simple', 'need the ModifyPerlTemplates right to update Type to Perl');
$m->content_contains('Permission Denied');
ok( RT::Test->add_rights(
{ Principal => $user_a, Right => [qw(ModifyPerlTemplates)] },
), 'add ModifyPerlTemplates rights');
-$m->field(Type => 'Full');
+$m->field(Type => 'Perl');
$m->submit;
$m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
$m->form_name('ModifyTemplate');
-is($m->value('Type'), 'Full', 'now that we have ModifyPerlTemplates we can update Type to Full');
+is($m->value('Type'), 'Perl', 'now that we have ModifyPerlTemplates we can update Type to Perl');
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list