adding skeletons.

This commit is contained in:
Matthew Wilson 2005-12-12 18:23:11 +00:00
parent 0ca14186fe
commit e7b1b16efc
4 changed files with 494 additions and 0 deletions

View file

@ -0,0 +1,6 @@
MajorVersionNumber.MinorReleaseNumber.PointReleaseNumber
- New Features added here, for example...
- Converted all the max((assetData.)revisionDate) calls to use mysql5/(4.1)
nested queries.
- Bugfixes listed here, for example...
- fix [ 1323184 ] CS Submissions Not Sorting on multiple sites

View file

@ -0,0 +1,185 @@
package WebGUI::Asset::Wobject::NewWobject;
$VERSION = "1.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 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::ErrorHandler;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Asset::Wobject;
our @ISA = qw(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 $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
templateId =>{
#See the list of field/control types in /lib/WebGUI/Form/
fieldType=>"template",
defaultValue=>'NewWobjectTmpl00000001',
tab=>"display",
#www_editSave will ignore anyone's attempts to update this field if this is set to 1
noFormPost=>0,
#This is an option specific to the template fieldType.
namespace=>"NewWobject",
#This is what will appear when the user hovers the mouse over the label
# of your form field.
hoverHelp=>WebGUI::International::get('templateId label description','Asset_NewWobject'),
# This is the text that will appear to the left of your form field.
label=>WebGUI::International::get('templateId label,"Asset_NewWobject")
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_NewWobject"),
icon=>'newWobject.gif',
autoGenerateForms=>1,
tableName=>'NewWobject',
className=>'WebGUI::Asset::Wobject::NewWobject',
properties=>\%properties
});
return $class->SUPER::definition($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(shift);
return $newAsset;
}
#-------------------------------------------------------------------
=head2 getEditForm
returns the tabform object that will be used in generating the edit page for New Wobjects.
This method is optional if you set autoGenerateForms=1 in the definition.
=cut
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue("templateId"),
-label=>WebGUI::International::get("template_label","NewWobject"),
-namespace=>"NewWobject"
);
return $tabform;
}
#-------------------------------------------------------------------
=head2 purge ( )
removes collateral data associated with a NewWobject when the system
purges it's data. This method is unnecessary, but if you have
auxiliary, ancillary, or "collateral" data or files related to your
wobject instances, you will need to purge them here.
=cut
sub purge {
my $self = shift;
#purge your wobject-specific data here. This does not include fields
# you create for your NewWobject asset/wobject table.
return $self->SUPER::purge;
}
#-------------------------------------------------------------------
=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;
#This automatically creates template variables for all of your wobject's properties.
my $var = $self->get;
#This is where you will store your wobject's extras files, any javascript, css, or any other files your wobject may use.
$var->{'extrasFolder'} = $session{config}{extrasURL}."/wobject/NewWobject";
#This is an example of debugging code to help you diagnose problems.
#WebGUI::ErrorHandler::warn($self->get("templateId"));
return $self->processTemplate($var, $self->get("templateId"));
}
#-------------------------------------------------------------------
=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 WebGUI::Privilege::insufficient() unless $self->canEdit;
# $self->getAdminConsole->setHelp("new wobject add/edit", "NewWobject");
# return $self->getAdminConsole->render($self->getEditForm->print,
# WebGUI::International::get("edit_title","NewWobject"));
#}
#-------------------------------------------------------------------
=head2 www_view ( )
Override www_view method and call the superclass's object method, passing
in a 1 to disable wobject-level cache. Only use this method if you want
to explicitly disable caching, or do something else when /yourWobjectUrl?func=view or just /yourWobjectUrl is requested.
=cut
sub www_view {
my $self = shift;
return $self->SUPER::www_view(1);
# default: return $self->SUPER::www_view();
}
1;

View file

@ -0,0 +1,278 @@
package WebGUI::Asset::NewAsset;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 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
-------------------------------------------------------------------
=cut
use strict;
use Tie::IxHash;
use WebGUI::Asset;
use WebGUI::HTMLForm;
use WebGUI::HTTP;
use WebGUI::Session;
use WebGUI::Utility;
our @ISA = qw(WebGUI::Asset);
=head1 NAME
Package WebGUI::Asset::NewAsset
=head1 DESCRIPTION
Describe your New Asset's functionality and features here.
=head1 SYNOPSIS
use WebGUI::Asset::NewAsset;
=head1 METHODS
These methods are available from this class:
=cut
#-------------------------------------------------------------------
=head2 addRevision
This method exists for demonstration purposes only. The superclass
handles revisions to NewAsset Assets.
=cut
sub addRevision {
my $self = shift;
my $newSelf = $self->SUPER::addRevision(@_);
return $newSelf;
}
#-------------------------------------------------------------------
=head2 definition ( definition )
defines asset properties for New Asset instances. You absolutely need
this method in your new Assets.
=head3 definition
A hash reference passed in from a subclass definition.
=cut
sub definition {
my $class = shift;
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
templateId =>{
#See the list of field/control types in /lib/WebGUI/Form/
fieldType=>"template",
defaultValue=>'NewAssetTmpl0000000001',
tab=>"display",
#www_editSave will ignore anyone's attempts to update this field if this is set to 1
noFormPost=>0,
#This is an option specific to the template fieldType.
namespace=>"NewAsset",
#This is what will appear when the user hovers the mouse over the label
# of your form field.
hoverHelp=>WebGUI::International::get('templateId label description','Asset_NewAsset'),
# This is the text that will appear to the left of your form field.
label=>WebGUI::International::get('templateId label,"Asset_NewAsset")
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_NewAsset"),
icon=>'NewAsset.gif',
tableName=>'NewAsset',
className=>'WebGUI::Asset::NewAsset',
properties=>\%properties
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 duplicate
This method exists for demonstration purposes only. The superclass
handles duplicating NewAsset Assets. This method will be called
whenever a copy action is executed
=cut
sub duplicate {
my $self = shift;
my $newAsset = $self->SUPER::duplicate(shift);
return $newAsset;
}
#-------------------------------------------------------------------
=head2 getEditForm ()
Returns the TabForm object that will be used in generating the edit page for this asset.
=cut
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue("templateId"),
-label=>WebGUI::International::get('template label', 'Asset_NewAsset'),,
-namespace=>"NewAssetAsset"
);
$tabform->getTab("properties")->text (
-name=>"showPage",
-label=>WebGUI::International::get('show page', 'Asset_NewAsset'),
-value=>$self->getValue("showPage"),
-hoverHelp=>WebGUI::International::get('show page description', 'Asset_NewAsset'),
);
return $tabform;
}
#-------------------------------------------------------------------
=head2 getIcon ( small )
Usually, you should leave out this method. Use it if you want to override
the default actions of WebGUI::Asset::getIcon().
=cut
sub getIcon {
my $self = shift;
my $small = shift;
if ($small && ref($self) eq '') {
return $session{config}{extrasURL}.'/assets/small/newAsset.gif';
} elsif ($small) {
return 'nothing.gif';
}
return $session{config}{extrasURL}.'/assets/newAsset.gif';
}
#-------------------------------------------------------------------
=head2 processPropertiesFromFormPost ( )
Used to process properties from the form posted. Do custom things with
noFormPost fields here, or do whatever you want. This method is called
when /yourAssetUrl?func=editSave is requested/posted.
=cut
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
}
#-------------------------------------------------------------------
=head2 purge ( )
This method is called when data is purged by the system.
removes collateral data associated with a NewAsset when the system
purges it's data. This method is unnecessary, but if you have
auxiliary, ancillary, or "collateral" data or files related to your
asset instances, you will need to purge them here.
=cut
sub purge {
my $self = shift;
return $self->SUPER::purge;
}
#-------------------------------------------------------------------
=head2 purgeRevision ( )
This method is called when data is purged by the system.
=cut
sub purgeRevision {
my $self = shift;
return $self->SUPER::purgeRevision;
}
#-------------------------------------------------------------------
=head2 view ( )
method called by the container www_view method.
=cut
sub view {
my $self = shift;
my $var = $self->get; # $var is a hash reference.
$var->{controls} = $self->getToolbar;
$var->{fileUrl} = $self->getFileUrl;
$var->{fileIcon} = $self->getFileIconUrl;
return $self->processTemplate($var,$self->getValue("templateId"));
}
#-------------------------------------------------------------------
=head2 www_edit ( )
Web facing method which is the default edit page
=cut
sub www_edit {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("New Asset add/edit", "New Asset");
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('edit asset',"Asset_NewAsset"));
}
#-------------------------------------------------------------------
=head2 www_view ( )
Web facing method which is the default view page. This method does a
302 redirect to the "showPage" file in the storage location.
=cut
sub www_view {
my $self = shift;
return WebGUI::Privilege::noAccess() unless $self->canView;
if ($session{var}{adminOn}) {
return $self->getContainer->www_view;
}
WebGUI::HTTP::setRedirect($self->getFileUrl($self->getValue("showPage")));
return "";
}
1;

View file

@ -0,0 +1,25 @@
package Hourly::NewHourlyScript;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 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 WebGUI::Asset;
use WebGUI::Session;
use WebGUI::SQL;
#-----------------------------------------
sub process {
# Perform some action that needs to be done on a periodic basis.
}
1;