Story Topic skeleton code.
This commit is contained in:
parent
8397b96ef8
commit
b20f4b4a08
2 changed files with 201 additions and 0 deletions
151
lib/WebGUI/Asset/Wobject/StoryTopic.pm
Normal file
151
lib/WebGUI/Asset/Wobject/StoryTopic.pm
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
package WebGUI::Asset::Wobject::StoryTopic;
|
||||
|
||||
$VERSION = "1.0.0";
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Asset::Story;
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( )
|
||||
|
||||
defines wobject properties for New Wobject instances. You absolutely need
|
||||
this method in your new Wobjects. If you choose to "autoGenerateForms", the
|
||||
getEditForm method is unnecessary/redundant/useless.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_StoryTopic');
|
||||
my %properties;
|
||||
tie %properties, 'Tie::IxHash';
|
||||
%properties = (
|
||||
storiesPer => {
|
||||
tab => 'display',
|
||||
fieldType => 'integer',
|
||||
label => $i18n->get('stories per topic'),
|
||||
hoverHelp => $i18n->get('stories per topic help'),
|
||||
defaultValue => 15,
|
||||
},
|
||||
storiesShort => {
|
||||
tab => 'display',
|
||||
fieldType => 'integer',
|
||||
label => $i18n->get('stories short'),
|
||||
hoverHelp => $i18n->get('stories short help'),
|
||||
defaultValue => 5,
|
||||
},
|
||||
storyTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => $i18n->get('story template'),
|
||||
hoverHelp => $i18n->get('story template help'),
|
||||
filter => 'fixId',
|
||||
namespace => 'Story',
|
||||
defaultValue => '',
|
||||
},
|
||||
);
|
||||
push(@{$definition}, {
|
||||
assetName=>$i18n->get('assetName'),
|
||||
icon=>'assets.gif',
|
||||
autoGenerateForms=>1,
|
||||
tableName=>'StoryTopic',
|
||||
className=>'WebGUI::Asset::Wobject::StoryTopic',
|
||||
properties=>\%properties,
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 duplicate ( )
|
||||
|
||||
duplicates a New Wobject. This method is unnecessary, but if you have
|
||||
auxiliary, ancillary, or "collateral" data or files related to your
|
||||
wobject instances, you will need to duplicate them here.
|
||||
|
||||
=cut
|
||||
|
||||
sub duplicate {
|
||||
my $self = shift;
|
||||
my $newAsset = $self->SUPER::duplicate(@_);
|
||||
return $newAsset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareView ( )
|
||||
|
||||
See WebGUI::Asset::prepareView() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
my $template = WebGUI::Asset::Template->new($self->session, $self->get("templateId"));
|
||||
$template->prepare;
|
||||
$self->{_viewTemplate} = $template;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
||||
method called by the www_view method. Returns a processed template
|
||||
to be displayed within the page style.
|
||||
|
||||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
#This automatically creates template variables for all of your wobject's properties.
|
||||
my $var = $self->get;
|
||||
|
||||
#This is an example of debugging code to help you diagnose problems.
|
||||
#WebGUI::ErrorHandler::warn($self->get("templateId"));
|
||||
|
||||
return $self->processTemplate($var, undef, $self->{_viewTemplate});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
||||
Web facing method which is the default edit page. This method is entirely
|
||||
optional. Take it out unless you specifically want to set a submenu in your
|
||||
adminConsole views.
|
||||
|
||||
=cut
|
||||
|
||||
#sub www_edit {
|
||||
# my $self = shift;
|
||||
# return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
# return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
# my $i18n = WebGUI::International->new($self->session, "Asset_NewWobject");
|
||||
# return $self->getAdminConsole->render($self->getEditForm->print, $i18n->get("edit title"));
|
||||
#}
|
||||
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
50
lib/WebGUI/i18n/English/Asset_StoryTopic.pm
Normal file
50
lib/WebGUI/i18n/English/Asset_StoryTopic.pm
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package WebGUI::i18n::English::Asset_StoryTopic;
|
||||
use strict;
|
||||
|
||||
our $I18N = {
|
||||
|
||||
'assetName' => {
|
||||
message => q|Story Topic|,
|
||||
context => q|An Asset that displays stories based on keywords.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'stories per topic' => {
|
||||
message => q|Stories Per Topic|,
|
||||
context => q|Label in the edit screen and template.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'stories per topic' => {
|
||||
message => q|The number of stories displayed in RSS and Atom feeds from this Story Topic, and when viewing the Topic directly.|,
|
||||
context => q|Hoverhelp in the edit screen and template.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'stories short' => {
|
||||
message => q|Stories Per Page|,
|
||||
context => q|Label in the edit screen and template.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'stories short help' => {
|
||||
message => q|The number of stories displayed on a page.|,
|
||||
context => q|Hoverhelp in the edit screen and template.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'story template' => {
|
||||
message => q|Story Template|,
|
||||
context => q|Label in the edit screen and template.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'story template help' => {
|
||||
message => q|The Template used to display Story assets from this Story Topic.|,
|
||||
context => q|Hoverhelp in the edit screen and template.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue