nuther check point
This commit is contained in:
parent
e6fc38a502
commit
3c56bb64ae
4 changed files with 371 additions and 23 deletions
|
|
@ -167,9 +167,80 @@ sub prepareView {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareManage
|
||||
|
||||
Prepares the template.
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareManage {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
my $templateId = $self->get("manageTemplate");
|
||||
my $template = WebGUI::Asset::Template->new($self->session, $templateId);
|
||||
$template->prepare($self->getMetaDataAsTemplateVariables);
|
||||
$self->{_viewTemplate} = $template;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_manage
|
||||
|
||||
manage previously purchased ads
|
||||
|
||||
=cut
|
||||
|
||||
sub www_manage {
|
||||
my $self = shift;
|
||||
my $check = $self->checkView;
|
||||
return $check if (defined $check);
|
||||
$self->session->http->setLastModified($self->getContentLastModified);
|
||||
$self->session->http->sendHeader;
|
||||
$self->prepareManage;
|
||||
my $style = $self->processStyle($self->getSeparator);
|
||||
my ($head, $foot) = split($self->getSeparator,$style);
|
||||
$self->session->output->print($head, 1);
|
||||
$self->session->output->print($self->manage);
|
||||
$self->session->output->print($foot, 1);
|
||||
return "chunked";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 manage
|
||||
|
||||
generate template vars for manage page
|
||||
|
||||
=cut
|
||||
|
||||
sub manage {
|
||||
my ($self) = @_;
|
||||
my $session = $self->session;
|
||||
|
||||
my $i18n = WebGUI::International->new($session, "Asset_AdSku");
|
||||
# TODO get the user id, get the asset collateral crud by uid, sort by purchase date descending, pull out unique adids
|
||||
my %var = (
|
||||
formHeader => WebGUI::Form::formHeader($session, { action=>$self->getUrl })
|
||||
. WebGUI::Form::hidden( $session, { name=>"func", value=>"purchaseAdSku" }),
|
||||
formFooter => WebGUI::Form::formFooter($session),
|
||||
form_submit => WebGUI::Form::submit( $session, { value => $i18n->get("purchase button") }),
|
||||
hasAddedToCart => $self->{_hasAddedToCart},
|
||||
continueShoppingUrl => $self->getUrl,
|
||||
purchaseLink => $self->getUrl,
|
||||
myAds => [
|
||||
# TODO foreach unique adis create a row here
|
||||
{ rowTitle => 'here is an ad', rowClicks => '5/200', rowImpressions => '100/2000', rowDeleted => 0, rowRenewLink => '' },
|
||||
{ rowTitle => 'yet another ad', rowClicks => '99/4000', rowImpressions => '10/200', rowDeleted => 1, rowRenewLink => '' },
|
||||
],
|
||||
);
|
||||
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view
|
||||
|
||||
Displays the donation form.
|
||||
Displays the purchase adspace form
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -182,16 +253,88 @@ sub view {
|
|||
formHeader => WebGUI::Form::formHeader($session, { action=>$self->getUrl })
|
||||
. WebGUI::Form::hidden( $session, { name=>"func", value=>"purchaseAdSku" }),
|
||||
formFooter => WebGUI::Form::formFooter($session),
|
||||
purchaseButton => WebGUI::Form::submit( $session, { value => $i18n->get("purchase button") }),
|
||||
form_submit => WebGUI::Form::submit( $session, { value => $i18n->get("purchase button") }),
|
||||
hasAddedToCart => $self->{_hasAddedToCart},
|
||||
continueShoppingUrl => $self->getUrl,
|
||||
price => sprintf("%.2f", $self->getPrice),
|
||||
manageLink => $self->getUrl("func=manage"),
|
||||
adSkuTitle => $self->get('title'),
|
||||
adSkuDescription => $self->get('description'),
|
||||
form_title => WebGUI::Form::text($session, {
|
||||
-name=>"form_title",
|
||||
-value=>$self->{title},
|
||||
-size=>40
|
||||
}),
|
||||
form_link => WebGUI::Form::Url($session, {
|
||||
-name=>"form_link",
|
||||
-value=>$self->{link},
|
||||
-size=>40
|
||||
}),
|
||||
form_image => WebGUI::Form::Image($session, {
|
||||
-name=>"form_image",
|
||||
-value=>$self->{image},
|
||||
-size=>40
|
||||
}),
|
||||
form_clicks => WebGUI::Form::Integer($session, {
|
||||
-name=>"form_clicks",
|
||||
-value=>$self->{clicks},
|
||||
-size=>40
|
||||
}),
|
||||
form_impressions => WebGUI::Form::Integer($session, {
|
||||
-name=>"form_impressions",
|
||||
-value=>$self->{impressions},
|
||||
-size=>40
|
||||
}),
|
||||
click_price => $self->get('pricePerClick'),
|
||||
impression_price => $self->get('pricePerImpression'),
|
||||
click_discount => $self->getClickDiscountText,
|
||||
impression_discount => $self->getImpressionDiscountText,
|
||||
);
|
||||
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDiscountCountList -- class level function
|
||||
|
||||
returns a string with a coma seperated list of counts fromt he discount text
|
||||
|
||||
=cut
|
||||
|
||||
sub getDiscountCountList {
|
||||
# TODO
|
||||
# parse the discount text -- for each line, get the first number
|
||||
# join all the number in a coma,list
|
||||
return '500';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getClickDiscountText
|
||||
|
||||
returns the text to display the number of clicks purchasaed where discounts apply
|
||||
|
||||
=cut
|
||||
|
||||
sub getClickDiscountText {
|
||||
my $self = shift;
|
||||
return getDiscountCountList($self->get('ClickDiscounts'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getImpressionDiscountText
|
||||
|
||||
returns the text to display the number of impressions purchased where discounts apply
|
||||
|
||||
=cut
|
||||
|
||||
sub getImpressionDiscountText {
|
||||
my $self = shift;
|
||||
return getDiscountCountList($self->get('impressionDiscounts'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_purchaseAdSKu
|
||||
|
||||
Add this subscription to the cart.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue