From fbd573c9d69f31552851dcaa9416fcaeac8c8e81 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 28 Mar 2011 16:36:16 -0500 Subject: [PATCH] move admin console links into asset helpers --- lib/WebGUI/Asset/Sku/Subscription.pm | 54 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/lib/WebGUI/Asset/Sku/Subscription.pm b/lib/WebGUI/Asset/Sku/Subscription.pm index 699aaff7b..90514a699 100644 --- a/lib/WebGUI/Asset/Sku/Subscription.pm +++ b/lib/WebGUI/Asset/Sku/Subscription.pm @@ -277,7 +277,9 @@ a shelf. Override master class to add different form. sub getAddToCartForm { my $self = shift; - my $session = $self->session; + :cn + :cn + my $i18n = WebGUI::International->new($session, 'Asset_Subscription'); return WebGUI::Form::formHeader($session, {action => $self->getUrl}) @@ -289,27 +291,6 @@ sub getAddToCartForm { #------------------------------------------------------------------- -=head2 getAdminConsoleWithSubmenu ( ) - -Returns an admin console with management links added to the submenu. - -=cut - -sub getAdminConsoleWithSubmenu { - my $self = shift; - my $session = $self->session; - my $ac = $self->getAdminConsole; - my $i18n = WebGUI::International->new( $session, 'Asset_Subscription' ); - - $ac->addSubmenuItem( $self->getUrl('func=createSubscriptionCodeBatch'), $i18n->get('generate batch')); - $ac->addSubmenuItem( $self->getUrl('func=listSubscriptionCodes;selection=dc'), $i18n->get('manage codes') ); - $ac->addSubmenuItem( $self->getUrl('func=listSubscriptionCodeBatches'), $i18n->get('manage batches')); - - return $ac; -} - -#------------------------------------------------------------------- - =head2 getCode ( code ) Returns a hashref with the properties of the passed code. @@ -415,6 +396,35 @@ sub getExpirationOffset { #------------------------------------------------------------------- +=head2 getHelpers ( ) + +Get the some links to manage subscription codes + +=cut + +override getHelpers => sub { + my ( $self ) = @_; + my $helpers = super(); + my $i18n = WebGUI::International->new( $session, 'Asset_Subscription' ); + + $helpers->{createSubscriptionCodeBatch} = { + url => $self->getUrl('func=createSubscriptionCodeBatch'), + label => $i18n->get('generate batch'), + }; + $helpers->{listSubscriptionCodes} = { + url => $self->getUrl('func=listSubscriptionCodes;selection=dc'), + label => $i18n->get('manage codes'), + }; + $helpers->{listSubscriptionCodeBatches} = { + url => $self->getUrl('func=listSubscriptionCodeBatches'), + label => $i18n->get('manage batches'), + }; + + return $helpers; +} + +#------------------------------------------------------------------- + =head2 getPrice Returns configured price, 0.00 if neither of those are available.