fixed a couple bugs in mb migration
This commit is contained in:
parent
3aaac188f8
commit
95a1c05143
2 changed files with 22 additions and 23 deletions
|
|
@ -1597,6 +1597,7 @@ Any properties to set besides defaults.
|
||||||
sub newByDynamicClass {
|
sub newByDynamicClass {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $assetId = shift;
|
my $assetId = shift;
|
||||||
|
return undef unless defined $assetId;
|
||||||
my $className = shift;
|
my $className = shift;
|
||||||
my $overrideProperties = shift;
|
my $overrideProperties = shift;
|
||||||
unless (defined $className) {
|
unless (defined $className) {
|
||||||
|
|
|
||||||
|
|
@ -60,16 +60,15 @@ sub getName {
|
||||||
sub view {
|
sub view {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my %var;
|
my %var;
|
||||||
my $count = 1;
|
my $count;
|
||||||
|
my $first;
|
||||||
my @forum_loop;
|
my @forum_loop;
|
||||||
my $children = $self->getLineage(["children"],{includeOnlyClasses=>["WebGUI::Asset::Wobject::Collaboration"]});
|
my $children = $self->getLineage(["children"],{includeOnlyClasses=>["WebGUI::Asset::Wobject::Collaboration"],returnObjects=>1});
|
||||||
foreach my $child (@{$children}) {
|
foreach my $child (@{$children}) {
|
||||||
|
$count++;
|
||||||
next unless ($child->canView);
|
next unless ($child->canView);
|
||||||
if ($count == 1) {
|
if ($count == 1) {
|
||||||
$var{'default.listing'} = $child->view;
|
$first = $child;
|
||||||
$var{'default.description'} = $child->get("description");
|
|
||||||
$var{'default.title'} = $child->get("title");
|
|
||||||
$var{'default.controls'} = $child->getToolbar;
|
|
||||||
}
|
}
|
||||||
my %lastPostVars;
|
my %lastPostVars;
|
||||||
my $lastPost = WebGUI::Asset::Wobject::MessageBoard->newByDynamicClass($child->get("lastPostId"));
|
my $lastPost = WebGUI::Asset::Wobject::MessageBoard->newByDynamicClass($child->get("lastPostId"));
|
||||||
|
|
@ -87,23 +86,22 @@ sub view {
|
||||||
'forum.lastPost.user.isVisitor' => ($lastPost->get("ownerUserId") eq '1')
|
'forum.lastPost.user.isVisitor' => ($lastPost->get("ownerUserId") eq '1')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
push(@forum_loop, {
|
push(@forum_loop, {
|
||||||
%lastPostVars,
|
%lastPostVars,
|
||||||
'forum.controls' => $child->getToolbar,
|
'forum.controls' => $child->getToolbar,
|
||||||
'forum.count' => $count,
|
'forum.count' => $count,
|
||||||
'forum.title' => $child->get('title'),
|
'forum.title' => $child->get('title'),
|
||||||
'forum.description' => $child->get("description"),
|
'forum.description' => $child->get("description"),
|
||||||
'forum.replies' => $child->get("replies"),
|
'forum.replies' => $child->get("replies"),
|
||||||
'forum.rating' => $child->get("rating"),
|
'forum.rating' => $child->get("rating"),
|
||||||
'forum.views' => $child->get("views"),
|
'forum.views' => $child->get("views"),
|
||||||
'forum.threads' => $child->get("threads"),
|
'forum.threads' => $child->get("threads"),
|
||||||
'forum.url' => $child->getUrl,
|
'forum.url' => $child->getUrl,
|
||||||
'forum.user.canView' => $child->canView,
|
'forum.user.canView' => $child->canView,
|
||||||
'forum.user.canPost' => $child->canPost
|
'forum.user.canPost' => $child->canPost
|
||||||
});
|
});
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$var{'default.listing'} = $first->view if ($count == 1 && defined $first);
|
||||||
$var{'forum.add.url'} = $self->getUrl("func=add&class=WebGUI::Asset::Wobject::Collaboration");
|
$var{'forum.add.url'} = $self->getUrl("func=add&class=WebGUI::Asset::Wobject::Collaboration");
|
||||||
$var{'forum.add.label'} = WebGUI::International::get(75,"MessageBoard");
|
$var{'forum.add.label'} = WebGUI::International::get(75,"MessageBoard");
|
||||||
$var{'title.label'} = WebGUI::International::get(99);
|
$var{'title.label'} = WebGUI::International::get(99);
|
||||||
|
|
@ -112,7 +110,7 @@ sub view {
|
||||||
$var{'threads.label'} = WebGUI::International::get(1036);
|
$var{'threads.label'} = WebGUI::International::get(1036);
|
||||||
$var{'replies.label'} = WebGUI::International::get(1016);
|
$var{'replies.label'} = WebGUI::International::get(1016);
|
||||||
$var{'lastpost.label'} = WebGUI::International::get(1017);
|
$var{'lastpost.label'} = WebGUI::International::get(1017);
|
||||||
$var{areMultipleForums} = ($count > 2);
|
$var{areMultipleForums} = ($count > 1);
|
||||||
$var{forum_loop} = \@forum_loop;
|
$var{forum_loop} = \@forum_loop;
|
||||||
return $self->processTemplate(\%var,$self->get("templateId"));
|
return $self->processTemplate(\%var,$self->get("templateId"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue