Remove the headblock property from the Template Asset, and merge
it into extra head tags. Style templates are not allowed to have extra head tags.
This commit is contained in:
parent
d3f8a075a7
commit
2b3b3fd458
7 changed files with 108 additions and 46 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
- fixed #4159: more menu doesn't appear for current asset on crumb trail
|
- fixed #4159: more menu doesn't appear for current asset on crumb trail
|
||||||
- fixed #9157: another typ-o in i18n
|
- fixed #9157: another typ-o in i18n
|
||||||
- fixed #9112: Thingy View Thing screen doesn't preserve newlines
|
- fixed #9112: Thingy View Thing screen doesn't preserve newlines
|
||||||
|
- fixed #9155: purpose of "headblock" duplicates "extra head tags"
|
||||||
|
|
||||||
7.6.4
|
7.6.4
|
||||||
- Survey now will show progress and time limit.
|
- Survey now will show progress and time limit.
|
||||||
|
|
@ -79,7 +80,6 @@
|
||||||
- fixed #9140: Date format error when adding tasks to PM
|
- fixed #9140: Date format error when adding tasks to PM
|
||||||
- fixed #8800: Errors in POD of Asset-related mix-in modules (Bernd Kalbfuß-Zimmermann)
|
- fixed #8800: Errors in POD of Asset-related mix-in modules (Bernd Kalbfuß-Zimmermann)
|
||||||
- fixed #9143: Yes No user profile fields problem when default == 1
|
- fixed #9143: Yes No user profile fields problem when default == 1
|
||||||
- fixed #9155: purpose of "headblock" duplicates "extra head tags"
|
|
||||||
|
|
||||||
7.5.34
|
7.5.34
|
||||||
- fixed: Regression with ProfileField->formField. Added tests to prevent future regression
|
- fixed: Regression with ProfileField->formField. Added tests to prevent future regression
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,13 @@ save you many hours of grief.
|
||||||
7.6.5
|
7.6.5
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
* The deprecated use of Graphics::Magick has been eliminated. WebGUI uses
|
* The deprecated use of Graphics::Magick has been eliminated. WebGUI uses
|
||||||
Image::Magick exclusively for all image processing functions once again.
|
Image::Magick exclusively for all image processing functions once again.
|
||||||
|
|
||||||
|
* The Head Block of Templates has been merged into the Extra Head
|
||||||
|
Tags field. Extra Head Tags are now added for all templates and
|
||||||
|
assets included on a page, except for Style templates, which do
|
||||||
|
not have Extra Head Tags. Existing Extra Head Tags for Style
|
||||||
|
templates have been removed.
|
||||||
|
|
||||||
7.6.4
|
7.6.4
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ use Getopt::Long;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Storage;
|
use WebGUI::Storage;
|
||||||
use WebGUI::Asset;
|
use WebGUI::Asset;
|
||||||
|
use WebGUI::Asset;
|
||||||
|
|
||||||
|
|
||||||
my $toVersion = "7.6.5"; # make this match what version you're going to
|
my $toVersion = "7.6.5"; # make this match what version you're going to
|
||||||
|
|
@ -27,12 +28,42 @@ my $quiet; # this line required
|
||||||
|
|
||||||
my $session = start(); # this line required
|
my $session = start(); # this line required
|
||||||
|
|
||||||
fixAccountMisspellings( $session );
|
fixAccountMisspellings( $session );
|
||||||
|
removeTemplateHeadBlock( $session );
|
||||||
|
|
||||||
# upgrade functions go here
|
# upgrade functions go here
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Describe what our function does
|
||||||
|
sub removeTemplateHeadBlock {
|
||||||
|
my $session = shift;
|
||||||
|
print "\tMerging Template head blocks into the Extra Head Tags field... " unless $quiet;
|
||||||
|
my $sth = $session->db->prepare('select assetId, revisionDate, headBlock from template');
|
||||||
|
$sth->execute();
|
||||||
|
TMPL: while (my $templateData = $sth->hashRef) {
|
||||||
|
my $template = WebGUI::Asset->new($session,
|
||||||
|
$templateData->{assetId}, 'WebGUI::Asset::Template',
|
||||||
|
$templateData->{revisionDate},
|
||||||
|
);
|
||||||
|
next TMPL unless defined $template;
|
||||||
|
if ($template->get('namespace') eq 'style') {
|
||||||
|
$template->update({
|
||||||
|
extraHeadTags => '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$template->update({
|
||||||
|
extraHeadTags => $template->getExtraHeadTags . $templateData->{headBlock},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$session->db->write('ALTER TABLE template DROP COLUMN headBlock');
|
||||||
|
# and here's our code
|
||||||
|
print "DONE!\n" unless $quiet;
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Describe what our function does
|
# Describe what our function does
|
||||||
#sub exampleFunction {
|
#sub exampleFunction {
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ sub definition {
|
||||||
uiLevel=>3,
|
uiLevel=>3,
|
||||||
fieldType=>'text',
|
fieldType=>'text',
|
||||||
defaultValue=>'',
|
defaultValue=>'',
|
||||||
filter=>'fixUrl'
|
filter=>'fixUrl',
|
||||||
},
|
},
|
||||||
isHidden=>{
|
isHidden=>{
|
||||||
tab=>"display",
|
tab=>"display",
|
||||||
|
|
@ -387,7 +387,7 @@ sub definition {
|
||||||
hoverHelp=>$i18n->get('940 description'),
|
hoverHelp=>$i18n->get('940 description'),
|
||||||
uiLevel=>9,
|
uiLevel=>9,
|
||||||
fieldType=>'yesNo',
|
fieldType=>'yesNo',
|
||||||
defaultValue=>0
|
defaultValue=>0,
|
||||||
},
|
},
|
||||||
encryptPage=>{
|
encryptPage=>{
|
||||||
fieldType => ($session->config->get("sslEnabled") ? 'yesNo' : 'hidden'),
|
fieldType => ($session->config->get("sslEnabled") ? 'yesNo' : 'hidden'),
|
||||||
|
|
@ -404,7 +404,7 @@ sub definition {
|
||||||
uiLevel=>6,
|
uiLevel=>6,
|
||||||
fieldType=>'user',
|
fieldType=>'user',
|
||||||
filter=>'fixId',
|
filter=>'fixId',
|
||||||
defaultValue=>'3'
|
defaultValue=>'3',
|
||||||
},
|
},
|
||||||
groupIdView=>{
|
groupIdView=>{
|
||||||
tab=>"security",
|
tab=>"security",
|
||||||
|
|
@ -413,7 +413,7 @@ sub definition {
|
||||||
uiLevel=>6,
|
uiLevel=>6,
|
||||||
fieldType=>'group',
|
fieldType=>'group',
|
||||||
filter=>'fixId',
|
filter=>'fixId',
|
||||||
defaultValue=>'7'
|
defaultValue=>'7',
|
||||||
},
|
},
|
||||||
groupIdEdit=>{
|
groupIdEdit=>{
|
||||||
tab=>"security",
|
tab=>"security",
|
||||||
|
|
@ -423,7 +423,7 @@ sub definition {
|
||||||
uiLevel=>6,
|
uiLevel=>6,
|
||||||
fieldType=>'group',
|
fieldType=>'group',
|
||||||
filter=>'fixId',
|
filter=>'fixId',
|
||||||
defaultValue=>'4'
|
defaultValue=>'4',
|
||||||
},
|
},
|
||||||
synopsis=>{
|
synopsis=>{
|
||||||
tab=>"meta",
|
tab=>"meta",
|
||||||
|
|
@ -431,15 +431,16 @@ sub definition {
|
||||||
hoverHelp=>$i18n->get('412 description'),
|
hoverHelp=>$i18n->get('412 description'),
|
||||||
uiLevel=>3,
|
uiLevel=>3,
|
||||||
fieldType=>'textarea',
|
fieldType=>'textarea',
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
},
|
},
|
||||||
extraHeadTags=>{
|
extraHeadTags=>{
|
||||||
tab=>"meta",
|
tab=>"meta",
|
||||||
label=>$i18n->get("extra head tags"),
|
label=>$i18n->get("extra head tags"),
|
||||||
hoverHelp=>$i18n->get('extra head tags description'),
|
hoverHelp=>$i18n->get('extra head tags description'),
|
||||||
uiLevel=>5,
|
uiLevel=>5,
|
||||||
fieldType=>'textarea',
|
fieldType=>'codearea',
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
|
customDrawMethod => 'drawExtraHeadTags',
|
||||||
},
|
},
|
||||||
isPackage=>{
|
isPackage=>{
|
||||||
label=>$i18n->get("make package"),
|
label=>$i18n->get("make package"),
|
||||||
|
|
@ -447,7 +448,7 @@ sub definition {
|
||||||
hoverHelp=>$i18n->get('make package description'),
|
hoverHelp=>$i18n->get('make package description'),
|
||||||
uiLevel=>7,
|
uiLevel=>7,
|
||||||
fieldType=>'yesNo',
|
fieldType=>'yesNo',
|
||||||
defaultValue=>0
|
defaultValue=>0,
|
||||||
},
|
},
|
||||||
isPrototype=>{
|
isPrototype=>{
|
||||||
tab=>"meta",
|
tab=>"meta",
|
||||||
|
|
@ -455,7 +456,7 @@ sub definition {
|
||||||
hoverHelp=>$i18n->get('make prototype description'),
|
hoverHelp=>$i18n->get('make prototype description'),
|
||||||
uiLevel=>9,
|
uiLevel=>9,
|
||||||
fieldType=>'yesNo',
|
fieldType=>'yesNo',
|
||||||
defaultValue=>0
|
defaultValue=>0,
|
||||||
},
|
},
|
||||||
isExportable=>{
|
isExportable=>{
|
||||||
tab=>'meta',
|
tab=>'meta',
|
||||||
|
|
@ -476,7 +477,7 @@ sub definition {
|
||||||
status=>{
|
status=>{
|
||||||
noFormPost=>1,
|
noFormPost=>1,
|
||||||
fieldType=>'hidden',
|
fieldType=>'hidden',
|
||||||
defaultValue=>'pending'
|
defaultValue=>'pending',
|
||||||
},
|
},
|
||||||
lastModified=>{
|
lastModified=>{
|
||||||
noFormPost=>1,
|
noFormPost=>1,
|
||||||
|
|
@ -486,7 +487,7 @@ sub definition {
|
||||||
assetSize=>{
|
assetSize=>{
|
||||||
noFormPost=>1,
|
noFormPost=>1,
|
||||||
fieldType=>'hidden',
|
fieldType=>'hidden',
|
||||||
defaultValue=>0
|
defaultValue=>0,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
push(@{$definition}, {
|
push(@{$definition}, {
|
||||||
|
|
@ -502,6 +503,25 @@ sub definition {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 drawExtraHeadTags ( )
|
||||||
|
|
||||||
|
Draw the Extra Head Tags. Done with a customDrawMethod because the Template
|
||||||
|
will override this.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub drawExtraHeadTags {
|
||||||
|
my ($self, $params) = @_;
|
||||||
|
return WebGUI::Form::codearea($self->session, {
|
||||||
|
name => $params->{name},
|
||||||
|
value => $self->get($params->{name}),
|
||||||
|
defaultValue => undef,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 DESTROY ( )
|
=head2 DESTROY ( )
|
||||||
|
|
@ -1958,7 +1978,7 @@ OUTPUT
|
||||||
|
|
||||||
=head2 prepareView ( )
|
=head2 prepareView ( )
|
||||||
|
|
||||||
Executes what is necessary to make the view() method work with content chunking. This includes things like processing template head tags.
|
Executes what is necessary to make the view() method work with content chunking.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
@ -1970,12 +1990,11 @@ sub prepareView {
|
||||||
my $style = $self->session->style;
|
my $style = $self->session->style;
|
||||||
my @keywords = @{WebGUI::Keyword->new($self->session)->getKeywordsForAsset({asset=>$self, asArrayRef=>1})};
|
my @keywords = @{WebGUI::Keyword->new($self->session)->getKeywordsForAsset({asset=>$self, asArrayRef=>1})};
|
||||||
if (scalar @keywords) {
|
if (scalar @keywords) {
|
||||||
$style->setMeta( {
|
$style->setMeta({
|
||||||
name => 'keywords',
|
name => 'keywords',
|
||||||
content => join(',', @keywords),
|
content => join(',', @keywords),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$style->setRawHeadTags($self->getExtraHeadTags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -2114,7 +2133,9 @@ sub processTemplate {
|
||||||
|
|
||||||
=head2 processStyle ( html )
|
=head2 processStyle ( html )
|
||||||
|
|
||||||
Returns some HTML wrappered in a style. Should be overridden by subclasses, because this one actually doesn't do anything other than return the html back to you.
|
Returns some HTML wrappered in a style. Should be overridden by subclasses, because
|
||||||
|
this one actually doesn't do anything other than return the html back to you and
|
||||||
|
adds the Asset's extraHeadTags into the raw head tags.
|
||||||
|
|
||||||
=head3 html
|
=head3 html
|
||||||
|
|
||||||
|
|
@ -2124,6 +2145,7 @@ The content to wrap up.
|
||||||
|
|
||||||
sub processStyle {
|
sub processStyle {
|
||||||
my ($self, $output) = @_;
|
my ($self, $output) = @_;
|
||||||
|
$self->session->style->setRawHeadTags($self->getExtraHeadTags);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,6 @@ sub definition {
|
||||||
fieldType => 'selectList',
|
fieldType => 'selectList',
|
||||||
defaultValue => [$session->config->get("defaultTemplateParser")],
|
defaultValue => [$session->config->get("defaultTemplateParser")],
|
||||||
},
|
},
|
||||||
headBlock => {
|
|
||||||
fieldType => "codearea",
|
|
||||||
defaultValue => undef,
|
|
||||||
},
|
|
||||||
namespace => {
|
namespace => {
|
||||||
fieldType => 'combo',
|
fieldType => 'combo',
|
||||||
defaultValue => undef,
|
defaultValue => undef,
|
||||||
|
|
@ -103,6 +99,25 @@ sub definition {
|
||||||
return $class->SUPER::definition($session,$definition);
|
return $class->SUPER::definition($session,$definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 drawExtraHeadTags ( )
|
||||||
|
|
||||||
|
Override the master drawExtraHeadTags to prevent Style template from having
|
||||||
|
Extra Head Tags.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub drawExtraHeadTags {
|
||||||
|
my ($self, $params) = @_;
|
||||||
|
if ($self->get('namespace') eq 'style') {
|
||||||
|
my $i18n = WebGUI::International->new($self->session);
|
||||||
|
return $i18n->get(881);
|
||||||
|
}
|
||||||
|
return $self->SUPER::drawExtraHeadTags($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 duplicate
|
=head2 duplicate
|
||||||
|
|
@ -125,15 +140,20 @@ sub processPropertiesFromFormPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->SUPER::processPropertiesFromFormPost;
|
$self->SUPER::processPropertiesFromFormPost;
|
||||||
# TODO: Perhaps add a way to check template syntax before it blows stuff up?
|
# TODO: Perhaps add a way to check template syntax before it blows stuff up?
|
||||||
|
my %data;
|
||||||
|
my $needsUpdate = 0;
|
||||||
if ($self->getValue("parser") ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
|
if ($self->getValue("parser") ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
|
||||||
my %data;
|
|
||||||
if (isIn($self->session->form->process("parser","className"),@{$self->session->config->get("templateParsers")})) {
|
if (isIn($self->session->form->process("parser","className"),@{$self->session->config->get("templateParsers")})) {
|
||||||
%data = ( parser => $self->session->form->process("parser","className") );
|
%data = ( parser => $self->session->form->process("parser","className") );
|
||||||
} else {
|
} else {
|
||||||
%data = ( parser => $self->session->config->get("defaultTemplateParser") );
|
%data = ( parser => $self->session->config->get("defaultTemplateParser") );
|
||||||
}
|
}
|
||||||
$self->update(\%data);
|
|
||||||
}
|
}
|
||||||
|
if ($self->session->form->process("namespace") eq 'style') {
|
||||||
|
$needsUpdate = 1;
|
||||||
|
$data{extraHeadTags} = '';
|
||||||
|
}
|
||||||
|
$self->update(\%data) if $needsUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -185,12 +205,6 @@ sub getEditForm {
|
||||||
-syntax => "html",
|
-syntax => "html",
|
||||||
-value=>$self->getValue("template")
|
-value=>$self->getValue("template")
|
||||||
);
|
);
|
||||||
$tabform->getTab("properties")->codearea(
|
|
||||||
-name=>"headBlock",
|
|
||||||
-label=>$i18n->get('head block'),
|
|
||||||
-hoverHelp=>$i18n->get('head block description'),
|
|
||||||
-value=>$self->getValue("headBlock")
|
|
||||||
);
|
|
||||||
if($self->session->config->get("templateParsers")){
|
if($self->session->config->get("templateParsers")){
|
||||||
my @temparray = @{$self->session->config->get("templateParsers")};
|
my @temparray = @{$self->session->config->get("templateParsers")};
|
||||||
tie my %parsers, 'Tie::IxHash';
|
tie my %parsers, 'Tie::IxHash';
|
||||||
|
|
@ -323,7 +337,7 @@ sub prepare {
|
||||||
my $templateHeadersSent = $self->session->stow->get("templateHeadersSent") || [];
|
my $templateHeadersSent = $self->session->stow->get("templateHeadersSent") || [];
|
||||||
my @sent = @{$templateHeadersSent};
|
my @sent = @{$templateHeadersSent};
|
||||||
unless (isIn($self->getId, @sent)) { # don't send head block if we've already sent it for this template
|
unless (isIn($self->getId, @sent)) { # don't send head block if we've already sent it for this template
|
||||||
$self->session->style->setRawHeadTags($self->getParser($self->session, $self->get('parser'))->process($self->get('headBlock'), $vars));
|
$self->session->style->setRawHeadTags($self->getParser($self->session, $self->get('parser'))->process($self->getExtraHeadTags, $vars));
|
||||||
}
|
}
|
||||||
push(@sent, $self->getId);
|
push(@sent, $self->getId);
|
||||||
$self->session->stow->set("templateHeadersSent", \@sent);
|
$self->session->stow->set("templateHeadersSent", \@sent);
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,8 @@ sub processPropertiesFromFormPost {
|
||||||
|
|
||||||
=head2 processStyle ( output )
|
=head2 processStyle ( output )
|
||||||
|
|
||||||
Returns output parsed under the current style.
|
Returns output parsed under the current style. Sets the Asset's extra head tags
|
||||||
|
into the raw head tags, too.
|
||||||
|
|
||||||
=head3 output
|
=head3 output
|
||||||
|
|
||||||
|
|
@ -381,6 +382,7 @@ An HTML blob to be parsed into the current style.
|
||||||
sub processStyle {
|
sub processStyle {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $output = shift;
|
my $output = shift;
|
||||||
|
$self->session->style->setRawHeadTags($self->getExtraHeadTags);
|
||||||
return $self->session->style->process($output,$self->get("styleTemplateId"));
|
return $self->session->style->process($output,$self->get("styleTemplateId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,6 @@ package WebGUI::i18n::English::Asset_Template;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
our $I18N = {
|
our $I18N = {
|
||||||
'head block' => {
|
|
||||||
message => q|Head Block|,
|
|
||||||
context => q|label for the get edit form where users should put things that go in the html head block|,
|
|
||||||
lastUpdated => 0,
|
|
||||||
},
|
|
||||||
|
|
||||||
'head block description' => {
|
|
||||||
message => q|Put meta tags, script tags, link tables, style sheets, and anything else here that you want to appear in the head block of the HTML document.|,
|
|
||||||
context => q|hover help for the head block field|,
|
|
||||||
lastUpdated => 0,
|
|
||||||
},
|
|
||||||
|
|
||||||
'style wizard' => {
|
'style wizard' => {
|
||||||
message => q|Style Wizard|,
|
message => q|Style Wizard|,
|
||||||
context => q|Label for link to engage the style wizard.|,
|
context => q|Label for link to engage the style wizard.|,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue