Beginning of Topic showing an Story.
Story now has a crumb trail. Needs to be added to template vars and to template.
This commit is contained in:
parent
e06d53c122
commit
4867750fd9
3 changed files with 159 additions and 13 deletions
|
|
@ -257,6 +257,40 @@ sub getAutoCommitWorkflowId {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getCrumbTrail ( )
|
||||
|
||||
Returns the crumb trail for this Story. If rendered from inside
|
||||
a Topic, it will insert the Topic information into the crumb trail.
|
||||
|
||||
The crumb trail will be a loop of variables, in order from this Story's
|
||||
StoryArchive, the topic, if present, and then this story.
|
||||
|
||||
=cut
|
||||
|
||||
sub getCrumbTrail {
|
||||
my $self = shift;
|
||||
my $crumb_loop = [];
|
||||
my $archive = $self->getArchive;
|
||||
push @{ $crumb_loop }, {
|
||||
title => $archive->getTitle,
|
||||
url => $archive->getUrl,
|
||||
};
|
||||
my $topic = $self->topic;
|
||||
if ($topic) {
|
||||
push @{ $crumb_loop }, {
|
||||
title => $topic->getTitle,
|
||||
url => $topic->getUrl,
|
||||
};
|
||||
}
|
||||
push @{ $crumb_loop }, {
|
||||
title => $self->getTitle,
|
||||
url => $self->getUrl,
|
||||
};
|
||||
return $crumb_loop;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm ( )
|
||||
|
|
@ -397,7 +431,6 @@ sub prepareView {
|
|||
my $self = shift;
|
||||
my $templateId = shift || $self->getArchive->get('storyTemplateId');
|
||||
$self->SUPER::prepareView();
|
||||
$self->session->log->warn("storyTemplateId: $templateId");
|
||||
my $template = WebGUI::Asset::Template->new($self->session, $templateId);
|
||||
$template->prepare;
|
||||
$self->{_viewTemplate} = $template;
|
||||
|
|
@ -430,7 +463,8 @@ Cleaning up storage objects in all revisions.
|
|||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = $self->session->db->read("select storageId from Story where assetId=".$self->session->db->quote($self->getId));
|
||||
##Delete all storage locations from all revisions of the Asset
|
||||
my $sth = $self->session->db->read("select storageId from Story where assetId=?",[$self->getId]);
|
||||
STORAGE: while (my ($storageId) = $sth->array) {
|
||||
next STORAGE unless $storageId;
|
||||
WebGUI::Storage->get($self->session,$storageId)->delete;
|
||||
|
|
@ -552,6 +586,28 @@ sub setStorageLocation {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 topic ( $topicAsset )
|
||||
|
||||
Tells the Story that it is being viewed from a Topic, and to behave
|
||||
accordingly. Returns a StoryTopic asset if set.
|
||||
|
||||
=head3 $topicAsset
|
||||
|
||||
The topic that is displaying this Story.
|
||||
|
||||
=cut
|
||||
|
||||
sub topic {
|
||||
my $self = shift;
|
||||
my $topic = shift;
|
||||
if (defined $topic) {
|
||||
$self->{_topic} = $topic;
|
||||
}
|
||||
return $self->{_topic};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 update
|
||||
|
||||
Extend the superclass to make sure that the asset always stays hidden from navigation.
|
||||
|
|
@ -646,6 +702,8 @@ Web facing method which is the default edit page. Unless the method needs
|
|||
special handling or formatting, it does not need to be included in
|
||||
the module.
|
||||
|
||||
Overridden because the standard, autogenerated form is not used.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
|
|
|
|||
|
|
@ -120,12 +120,6 @@ sub view {
|
|||
return $self->processTemplate($var, undef, $self->{_viewTemplate});
|
||||
}
|
||||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
$self->{_standAlone} = 1;
|
||||
return $self->SUPER::www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 viewTemplateVars ( )
|
||||
|
|
@ -178,6 +172,48 @@ sub viewTemplateVariables {
|
|||
return $var;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_view ( )
|
||||
|
||||
Overside the method inherited from Wobject to set the mode so template
|
||||
variables are set correctly in viewTemplateVars.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
$self->{_standAlone} = 1;
|
||||
return $self->SUPER::www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewStory ( )
|
||||
|
||||
Display a story, set in the form variable assetId
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub www_viewStory {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $storyId = $session->form->get('assetId');
|
||||
my $story;
|
||||
if ($storyId) {
|
||||
$story = WebGUI::Asset->new($session, $storyId);
|
||||
}
|
||||
if (! $story) {
|
||||
my $notFound = WebGUI::Asset->getNotFound($session);
|
||||
$session->asset($notFound);
|
||||
return $notFound->www_view;
|
||||
}
|
||||
$story->topic($self);
|
||||
return $story->www_view;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue