Update EMSRibbon for Moose.
This commit is contained in:
parent
b48587cc06
commit
6c26c2ee3b
1 changed files with 24 additions and 50 deletions
|
|
@ -15,8 +15,26 @@ package WebGUI::Asset::Sku::EMSRibbon;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use base 'WebGUI::Asset::Sku';
|
||||
use WebGUI::Definition::Asset;
|
||||
extends 'WebGUI::Asset::Sku';
|
||||
aspect assetName => ['ems ribbon', 'Asset_EMSRibbon'],
|
||||
aspect icon => 'EMSRibbon.gif',
|
||||
aspect tableName => 'EMSRibbon',
|
||||
property price => (
|
||||
tab => "shop",
|
||||
fieldType => "float",
|
||||
default => 0.00,
|
||||
label => ["price", 'Asset_EMSRibbon'],
|
||||
hoverHelp => ["price help", 'Asset_EMSRibbon'],
|
||||
);
|
||||
property percentageDiscount => (
|
||||
tab => "shop",
|
||||
fieldType => "float",
|
||||
default => 10.0,
|
||||
label => ["percentage discount", 'Asset_EMSRibbon'],
|
||||
hoverHelp => ["percentage discount help", 'Asset_EMSRibbon'],
|
||||
);
|
||||
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -39,50 +57,6 @@ These methods are available from this class:
|
|||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition
|
||||
|
||||
Add price field to the definition.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my %properties;
|
||||
tie %properties, 'Tie::IxHash';
|
||||
my $i18n = WebGUI::International->new($session, "Asset_EventManagementSystem");
|
||||
my $date = WebGUI::DateTime->new($session, time());
|
||||
%properties = (
|
||||
price => {
|
||||
tab => "shop",
|
||||
fieldType => "float",
|
||||
defaultValue => 0.00,
|
||||
label => $i18n->get("price"),
|
||||
hoverHelp => $i18n->get("price help"),
|
||||
},
|
||||
percentageDiscount => {
|
||||
tab => "shop",
|
||||
fieldType => "float",
|
||||
defaultValue => 10.0,
|
||||
label => $i18n->get("percentage discount"),
|
||||
hoverHelp => $i18n->get("percentage discount help"),
|
||||
},
|
||||
);
|
||||
push(@{$definition}, {
|
||||
assetName => $i18n->get('ems ribbon'),
|
||||
icon => 'EMSRibbon.gif',
|
||||
autoGenerateForms => 1,
|
||||
tableName => 'EMSRibbon',
|
||||
className => 'WebGUI::Asset::Sku::EMSRibbon',
|
||||
properties => \%properties
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAddToCartForm
|
||||
|
|
@ -139,7 +113,7 @@ Returns the price from the definition.
|
|||
|
||||
sub getPrice {
|
||||
my $self = shift;
|
||||
return $self->get("price");
|
||||
return $self->price;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -215,10 +189,10 @@ sub view {
|
|||
|
||||
# render the page;
|
||||
my $output = '<h1>'.$self->getTitle.'</h1>'
|
||||
.'<p>'.$self->get('description').'</p>';
|
||||
.'<p>'.$self->description.'</p>';
|
||||
|
||||
# build the add to cart form
|
||||
if ($form->get('badgeId') ne '') {
|
||||
if ($form->badgeId ne '') {
|
||||
my $addToCart = WebGUI::HTMLForm->new($self->session, action=>$self->getUrl);
|
||||
$addToCart->hidden(name=>"func", value=>"addToCart");
|
||||
$addToCart->hidden(name=>"badgeId", value=>$form->get('badgeId'));
|
||||
|
|
@ -256,7 +230,7 @@ Override to return to appropriate page.
|
|||
sub www_delete {
|
||||
my ($self) = @_;
|
||||
return $self->session->privilege->insufficient() unless ($self->canEdit && $self->canEditIfLocked);
|
||||
return $self->session->privilege->vitalComponent() if $self->get('isSystem');
|
||||
return $self->session->privilege->vitalComponent() if $self->isSystem;
|
||||
return $self->session->privilege->vitalComponent() if (isIn($self->getId,
|
||||
$self->session->setting->get("defaultPage"), $self->session->setting->get("notFoundPage")));
|
||||
$self->trash;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue