add messageboard to test_content and fix revealed problems
This commit is contained in:
parent
bdb803915e
commit
be33a59e90
2 changed files with 121 additions and 11 deletions
|
|
@ -50,8 +50,8 @@ See WebGUI::Asset::prepareView() for details.
|
|||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
my $template = WebGUI::Asset::Template->newById($self->session, $self->templateId);
|
||||
if (!$template) {
|
||||
my $template = eval{ WebGUI::Asset::Template->newById($self->session, $self->templateId) };
|
||||
if ($@ or !$template) {
|
||||
WebGUI::Error::ObjectNotFound::Template->throw(
|
||||
error => qq{Template not found},
|
||||
templateId => $self->templateId,
|
||||
|
|
@ -111,8 +111,11 @@ sub view {
|
|||
$first = $child;
|
||||
}
|
||||
my %lastPostVars;
|
||||
my $lastPost = WebGUI::Asset::Wobject::MessageBoard->newById($self->session, $child->lastPostId);
|
||||
if (defined $lastPost) {
|
||||
if ( $child->lastPostId ) {
|
||||
my $lastPost = eval { WebGUI::Asset->newById($self->session, $child->lastPostId) };
|
||||
if ( $@ ) {
|
||||
$self->session->log->error( "Could not instance " . $child->lastPostId . ": " . $@ );
|
||||
}
|
||||
%lastPostVars = (
|
||||
'forum.lastPost.url' => $lastPost->getUrl,
|
||||
'forum.lastPost.date' => $self->session->datetime->epochToHuman($lastPost->creationDate,"%z"),
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ sub buildAsset {
|
|||
my $files = $rawprops->{_files} || [];
|
||||
my $children = $rawprops->{_children} || [];
|
||||
my $props = { map { $_ => $rawprops->{$_} } grep { !/^_/ } keys %$rawprops };
|
||||
$props->{ styleTemplateId } ||= $page->can( 'styleTemplateId' ) ? $page->styleTemplateId : '';
|
||||
|
||||
my $asset = $page->addChild({
|
||||
className => $class,
|
||||
|
|
@ -461,12 +462,12 @@ my $DT_NOW = DateTime->now;
|
|||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'wg.png' ),
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'wg.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -626,7 +627,113 @@ my $DT_NOW = DateTime->now;
|
|||
}
|
||||
],
|
||||
'WebGUI::Asset::Wobject::MessageBoard' => [
|
||||
|
||||
{
|
||||
title => 'Message Board',
|
||||
isHidden => 1,
|
||||
_children => [
|
||||
{
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
title => 'Logos',
|
||||
isHidden => 1,
|
||||
postFormTemplateId => 'PBtmpl0000000000000029',
|
||||
threadTemplateId => 'PBtmpl0000000000000032',
|
||||
collaborationTemplateId => 'PBtmpl0000000000000026',
|
||||
_children => [
|
||||
{
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => 'Thread',
|
||||
content => lorem(0,1,2),
|
||||
synopsis => lorem(0),
|
||||
_children => [
|
||||
{
|
||||
className => 'WebGUI::Asset::Post',
|
||||
title => "Post",
|
||||
content => lorem(3,4,5),
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'plainblack.gif' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'wg.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title => 'Icons',
|
||||
_children => [
|
||||
{
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => 'Clock',
|
||||
content => lorem(0,1,2),
|
||||
synopsis => lorem(0),
|
||||
_children => [
|
||||
{
|
||||
className => 'WebGUI::Asset::Post',
|
||||
title => "Camera",
|
||||
content => lorem(3,4,5),
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'icon', 'camera.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'icon', 'clock.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => 'Brick',
|
||||
content => lorem(0,1,2),
|
||||
synopsis => lorem(0),
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'icon', 'brick.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => 'Cog',
|
||||
content => lorem(0,1,2),
|
||||
synopsis => lorem(0),
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'icon', 'cog.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => 'Bug',
|
||||
content => lorem(0,1,2),
|
||||
synopsis => lorem(0),
|
||||
_files => [
|
||||
{
|
||||
property => 'storageId',
|
||||
file => catfile( WebGUI::Paths->extras, 'icon', 'bug.png' ),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'WebGUI::Asset::Wobject::Collaboration::Newsletter' => [
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue