added a more visual interface to the ad manager
This commit is contained in:
parent
22a1338bdb
commit
c0225f6b35
2 changed files with 27 additions and 15 deletions
|
|
@ -115,20 +115,28 @@ sub DESTROY {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayImpression ()
|
||||
=head2 displayImpression ( dontCount )
|
||||
|
||||
Finds out what the next ad is to display, increments it's impression counter, and returns the HTML to display it.
|
||||
|
||||
=head3 dontCount
|
||||
|
||||
A boolean that tells the ad system not to count this impression if true.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayImpression {
|
||||
my $self = shift;
|
||||
my $dontCount = shift;
|
||||
my ($id, $ad, $priority, $clicks, $clicksBought, $impressions, $impressionsBought) = $self->session->db->quickArray("select adId, renderedAd, priority, clicks, clicksBought, impressions, impressionsBought from advertisement where adSpaceId=? and isActive=1 order by nextInPriority asc limit 1",[$self->getId]);
|
||||
my $isActive = 1;
|
||||
if ($clicks >= $clicksBought && $impressions >= $impressionsBought) {
|
||||
$isActive = 0;
|
||||
unless ($dontCount) {
|
||||
my $isActive = 1;
|
||||
if ($clicks >= $clicksBought && $impressions >= $impressionsBought) {
|
||||
$isActive = 0;
|
||||
}
|
||||
$self->session->db->write("update advertisement set impressions=impressions+1, nextInPriority=?, isActive=? where adId=?",
|
||||
[time()+$priority, $isActive, $id]);
|
||||
}
|
||||
$self->session->db->write("update advertisement set impressions=impressions+1, nextInPriority=?, isActive=? where adId=?", [time()+$priority, $isActive, $id]);
|
||||
return $ad;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -321,18 +321,18 @@ sub www_editAdSpace {
|
|||
);
|
||||
$f->submit;
|
||||
my $ads = "";
|
||||
my $code = "";
|
||||
if (defined $adSpace) {
|
||||
$ads .= '<p style="padding: 10px; line-height: 30px; text-align: center; border: 3px outset black; width: 250px; float: right;">'.$i18n->get("macro code prompt").'<br /><b>^AdSpace('.$adSpace->get("name").');</b></p>'
|
||||
."<p>";
|
||||
my $rs = $session->db->read("select adId, title from advertisement where adSpaceId=?",[$id]);
|
||||
while (my ($adId, $title) = $rs->array) {
|
||||
$ads .= $session->icon->delete("op=deleteAd;adSpaceId=".$id.";adId=".$adId, undef, $i18n->get("confirm ad delete"))
|
||||
$code = '<p style="padding: 5px; line-height: 20px; text-align: center; border: 3px outset black; font-family: helvetica; font-size: 11px; width: 200px; float: right;">'.$i18n->get("macro code prompt").'<br /><b>^AdSpace('.$adSpace->get("name").');</b></p>';
|
||||
my $rs = $session->db->read("select adId, title, renderedAd from advertisement where adSpaceId=?",[$id]);
|
||||
while (my ($adId, $title, $ad) = $rs->array) {
|
||||
$ads .= '<div style="margin: 15px; float: left;">'.$session->icon->delete("op=deleteAd;adSpaceId=".$id.";adId=".$adId, undef, $i18n->get("confirm ad delete"))
|
||||
.$session->icon->edit("op=editAd;adSpaceId=".$id.";adId=".$adId)
|
||||
.' '.$title.'<br />';
|
||||
.' '.$title.'<br />'.$ad.'</div>';
|
||||
}
|
||||
$ads .= "</p>";
|
||||
$ads .= '<div style="clear: both;"></div>';
|
||||
}
|
||||
$ac->render($f->print.$ads, $i18n->get("edit ad space"));
|
||||
$ac->render($code.$f->print.$ads, $i18n->get("edit ad space"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -380,10 +380,14 @@ sub www_manageAdSpaces {
|
|||
my $output = "";
|
||||
my $rs = $session->db->read("select adSpaceId, title from adSpace order by title");
|
||||
while (my ($id, $title) = $rs->array) {
|
||||
$output .= $session->icon->delete("op=deleteAdSpace;adSpaceId=".$id, undef, $i18n->get("confirm ad space delete"))
|
||||
$output .= '<div style="float: left; margin: 10px;">'
|
||||
.$session->icon->delete("op=deleteAdSpace;adSpaceId=".$id, undef, $i18n->get("confirm ad space delete"))
|
||||
.$session->icon->edit("op=editAdSpace;adSpaceId=".$id)
|
||||
.' '.$title.'<br />';
|
||||
.' '.$title.'<br />'
|
||||
.WebGUI::AdSpace->new($session, $id)->displayImpression(1)
|
||||
.'</div>';
|
||||
}
|
||||
$output .= '<div style="clear: both;"></div>';
|
||||
$ac->addSubmenuItem($session->url->page("op=editAdSpace"), $i18n->get("add ad space"));
|
||||
return $ac->render($output);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue