Skip to content

Commit

Permalink
Revert "Rename template variables in the Account and Admin Toggle tem…
Browse files Browse the repository at this point in the history
…plates to not use underscores."

This reverts commit 0b4e8d5.
  • Loading branch information
perlDreamer committed Sep 21, 2010
1 parent a961214 commit f0476bd
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 89 deletions.
8 changes: 0 additions & 8 deletions docs/gotcha.txt
Expand Up @@ -11,14 +11,6 @@ save you many hours of grief.
--------------------------------------------------------------------
* WebGUI now depends on PerlIO::eol, for doing line ending translation.

* As part of the migration to Template::Toolkit, we will be changing template
variables from using dots to underscores. All templates using that namespace were
automatically upgraded to use the new variables.

In this version, these templates were updated:
Account Macro template
Admin Toggle Macro template

7.10.0
--------------------------------------------------------------------
* Due to a bug in the 7.8.24-7.9.11 upgrade, the ordering of template
Expand Down
8 changes: 0 additions & 8 deletions docs/templates.txt
Expand Up @@ -3,14 +3,6 @@ templates, you will need to apply these changes manually to your copies.

7.10.1

* Account Macro template variables renamed:
account.url => account_url
account.text => account_text

* AdminToggle Macro template variables renamed:
toggle.url => toggle_url
toggle.text => toggle_text

* Asset Report Template - asset-report/asset-report-default-template
Remove the empty template attachment

Expand Down
48 changes: 3 additions & 45 deletions docs/upgrades/upgrade_7.10.0-7.10.1.pl
Expand Up @@ -107,7 +107,7 @@ sub repackTemplates {
template => $asset->get('template'),
});
}
print "\t... DONE!\n" unless $quiet;
print "DONE!\n" unless $quiet;

print "\tRepacking head tags in all assets, this may take a while..." unless $quiet;
$sth = $session->db->read( "SELECT assetId, revisionDate FROM assetData where usePackedHeadTags=1" );
Expand All @@ -118,7 +118,7 @@ sub repackTemplates {
extraHeadTags => $asset->get('extraHeadTags'),
});
}
print "\t... DONE!\n" unless $quiet;
print "DONE!\n" unless $quiet;

print "\tRepacking all snippets, this may take a while..." unless $quiet;
$sth = $session->db->read( "SELECT assetId, revisionDate FROM snippet" );
Expand All @@ -130,49 +130,9 @@ sub repackTemplates {
});
}

print "\t... DONE!\n" unless $quiet;
}


#----------------------------------------------------------------------------
# Rename template variables
sub renameAccountMacroTemplateVariables {
my $session = shift;

print "\tRename Account Macro template variables..." unless $quiet;
my $sth = $session->db->read( q|SELECT assetId, revisionDate FROM template where namespace="Macro/a_account"| );
while ( my ($assetId, $revisionDate) = $sth->array ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId, $revisionDate );
next unless $asset;
my $template = $asset->get('template');
$template =~ s/account\.url/account_url/msg;
$template =~ s/account\.text/account_text/msg;
$asset->update({
template => $template,
});
}
print "\t... DONE!\n" unless $quiet;
print "DONE!\n" unless $quiet;
}

#----------------------------------------------------------------------------
# Rename template variables
sub renameAdminToggleMacroTemplateVariables {
my $session = shift;

print "\tRename Admin Toggle Macro template variables..." unless $quiet;
my $sth = $session->db->read( q|SELECT assetId, revisionDate FROM template where namespace="Macro/AdminToggle"| );
while ( my ($assetId, $revisionDate) = $sth->array ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId, $revisionDate );
next unless $asset;
my $template = $asset->get('template');
$template =~ s/toggle\.url/toggle_url/msg;
$template =~ s/toggle\.text/toggle_text/msg;
$asset->update({
template => $template,
});
}
print "\t... DONE!\n" unless $quiet;
}

#----------------------------------------------------------------------------
# Describe what our function does
Expand Down Expand Up @@ -237,8 +197,6 @@ sub finish {
my $session = shift;
updateTemplates($session);
repackTemplates( $session );
renameAccountMacroTemplateVariables( $session );
renameAdminToggleMacroTemplateVariables( $session );
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
Expand Down
11 changes: 1 addition & 10 deletions lib/WebGUI/Help/Macro_AdminToggle.pm
Expand Up @@ -6,16 +6,7 @@ our $HELP = {
'admin toggle' => {
title => 'admin toggle title',
body => '',
variables => [
{
name => 'toggle_url',
description => 'toggle.url',
},
{
name => 'toggle_text',
description => 'toggle.text',
},
],
variables => [ { 'name' => 'toggle.url' }, { 'name' => 'toggle.text' } ],
fields => [],
related => []
},
Expand Down
11 changes: 1 addition & 10 deletions lib/WebGUI/Help/Macro_a_account.pm
Expand Up @@ -7,16 +7,7 @@ our $HELP = {
title => 'account title',
body => '',
fields => [],
variables => [
{
name => 'account_url',
description => 'account.url',
},
{
name => 'account_text',
description => 'account.text',
}
],
variables => [ { 'name' => 'account.url' }, { 'name' => 'account.text' } ],
related => []
},

Expand Down
8 changes: 4 additions & 4 deletions lib/WebGUI/Macro/AdminToggle.pm
Expand Up @@ -52,12 +52,12 @@ sub process {
my $i18n = WebGUI::International->new($session,'Macro_AdminToggle');
my %var;
if ($session->var->isAdminOn) {
$var{'toggle_url'} = $session->url->page('op=switchOffAdmin');
$var{'toggle_text'} = $turnOff || $i18n->get(517);
$var{'toggle.url'} = $session->url->page('op=switchOffAdmin');
$var{'toggle.text'} = $turnOff || $i18n->get(517);
}
else {
$var{'toggle_url'} = $session->url->page('op=switchOnAdmin');
$var{'toggle_text'} = $turnOn || $i18n->get(516);
$var{'toggle.url'} = $session->url->page('op=switchOnAdmin');
$var{'toggle.text'} = $turnOn || $i18n->get(516);
}
my $template = $templateName ? WebGUI::Asset::Template->newByUrl($session, $templateName)
: WebGUI::Asset::Template->new($session, "PBtmpl0000000000000036");
Expand Down
4 changes: 2 additions & 2 deletions lib/WebGUI/Macro/a_account.pm
Expand Up @@ -44,8 +44,8 @@ sub process {
my @param = @_;
return $session->url->page("op=auth;method=init") if ($param[0] eq "linkonly");
my $i18n = WebGUI::International->new($session,'Macro_a_account');
$var{'account_url'} = $session->url->page('op=auth;method=init');
$var{'account_text'} = $param[0] || $i18n->get(46);
$var{'account.url'} = $session->url->page('op=auth;method=init');
$var{'account.text'} = $param[0] || $i18n->get(46);
if ($param[1]) {
return WebGUI::Asset::Template->newByUrl($session,$param[1])->process(\%var);
} else {
Expand Down
2 changes: 1 addition & 1 deletion t/Macro/AdminToggle.t
Expand Up @@ -145,7 +145,7 @@ sub addTemplate {
className => 'WebGUI::Asset::Template',
url => 'admintoggle-test',
namespace => 'Macro/AdminToggle',
template => "HREF=<tmpl_var toggle_url>\nLABEL=<tmpl_var toggle_text>",
template => "HREF=<tmpl_var toggle.url>\nLABEL=<tmpl_var toggle.text>",
id => 'AdminToggleTemplate--Z',
usePacked => 0,
};
Expand Down
2 changes: 1 addition & 1 deletion t/Macro/a_account.t
Expand Up @@ -92,7 +92,7 @@ sub addTemplate {
className => 'WebGUI::Asset::Template',
url => 'a_account-test',
namespace => 'Macro/a_account',
template => "HREF=<tmpl_var account_url>\nLABEL=<tmpl_var account_text>",
template => "HREF=<tmpl_var account.url>\nLABEL=<tmpl_var account.text>",
id => 'testTemplatea_account1',
usePacked => 1,
};
Expand Down

0 comments on commit f0476bd

Please sign in to comment.