fixed a bunch of bugs related to ad management system and finished writing the ui
This commit is contained in:
parent
fba5580d15
commit
540523d6dd
3 changed files with 193 additions and 21 deletions
|
|
@ -58,8 +58,9 @@ The properties used to create this object. See the set() method for details.
|
|||
sub create {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $adSpaceId = shift;
|
||||
my $properties = shift;
|
||||
my $id = $session->db->setRow("adSpace","adSpaceId",{adSpaceId=>"new"});
|
||||
my $id = $session->db->setRow("advertisement","adId",{adSpaceId=>$adSpaceId, adId=>"new"});
|
||||
my $self = $class->new($session, $id);
|
||||
$self->set($properties);
|
||||
return $self;
|
||||
|
|
@ -76,8 +77,8 @@ Deletes this ad.
|
|||
|
||||
sub delete {
|
||||
my $self = shift;
|
||||
my $storage = WebGUI::Storage::Image->new($self->session, $self->get("storageId"));
|
||||
$storage->delete;
|
||||
my $storage = WebGUI::Storage::Image->get($self->session, $self->get("storageId"));
|
||||
$storage->delete if defined $storage;
|
||||
$self->session->db->deleteRow("advertisement","adId",$self->getId);
|
||||
$self = undef;
|
||||
}
|
||||
|
|
@ -186,10 +187,6 @@ A chunk of text, no longer than 255 characters that will be displayed in text ad
|
|||
|
||||
The id of the storage location that holds the image for an image style ad.
|
||||
|
||||
=head4 filename
|
||||
|
||||
The name of the file from the storage location to display for an image ad.
|
||||
|
||||
=head4 richMedia
|
||||
|
||||
A chunk of HTML that will be inserted into the page for rich media ads.
|
||||
|
|
@ -244,7 +241,6 @@ sub set {
|
|||
$self->{_properties}{impressionsBought} = $properties->{impressionsBought} || $self->{_properties}{impressionsBought};
|
||||
$self->{_properties}{url} = $properties->{url} || $self->{_properties}{url};
|
||||
$self->{_properties}{adText} = $properties->{adText} || $self->{_properties}{adText};
|
||||
$self->{_properties}{filename} = $properties->{filename} || $self->{_properties}{filename};
|
||||
$self->{_properties}{storageId} = $properties->{storageId} || $self->{_properties}{storageId};
|
||||
$self->{_properties}{richMedia} = $properties->{richMedia} || $self->{_properties}{richMedia};
|
||||
$self->{_properties}{ownerUserId} = $properties->{ownerUserId} || $self->{_properties}{ownerUserId} || "3";
|
||||
|
|
@ -257,10 +253,16 @@ sub set {
|
|||
# prerender the ad for faster display
|
||||
my $adSpace = WebGUI::AdSpace->new($self->session, $self->get("adSpaceId"));
|
||||
if ($self->get("type") eq "text") {
|
||||
$self->{_properties}{renderedAd} = '<a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'"><div style="overflow: hidden; width: '.$adSpace->get("width").'px; height: '.$adSpace->get("height").'px; color: '.$self->get("textColor").'; background-color: '.$self->get("backgroundColor").'; border: 1px solid '.$self->get("borderColor").';"><b>'.$self->get("title").'</b><br />'.$self->get("adText").'</div></a>';
|
||||
$self->{_properties}{renderedAd} = '<a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId)
|
||||
.'"><div style="overflow: hidden; width: '.$adSpace->get("width")
|
||||
.'px; height: '.$adSpace->get("height").'px; color: '
|
||||
.$self->get("textColor")
|
||||
.'; background-color: '.$self->get("backgroundColor")
|
||||
.'; border: 1px solid '.$self->get("borderColor").';"><b>'
|
||||
.$self->get("title").'</b><br />'.$self->get("adText").'</div></a>';
|
||||
} elsif ($self->get("type") eq "image") {
|
||||
my $storage = WebGUI::Storage::Image->new($self->session, $self->get("storageId"));
|
||||
$self->{_properties}{renderedAd} = '<a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'"><div style="overflow: hidden; width: '.$adSpace->get("width").'px; height: '.$adSpace->get("height").'px;"><img src="'.$storage->getUrl($self->get("filename")).'" style="border: 0px;" alt="'.$self->get("title").'" /></div></a>';
|
||||
my $storage = WebGUI::Storage::Image->get($self->session, $self->get("storageId"));
|
||||
$self->{_properties}{renderedAd} = '<a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'"><div style="overflow: hidden; width: '.$adSpace->get("width").'px; height: '.$adSpace->get("height").'px;"><img src="'.$storage->getUrl($storage->getFiles->[0]).'" style="border: 0px;" alt="'.$self->get("title").'" /></div></a>';
|
||||
|
||||
} elsif ($self->get("type") eq "rich") {
|
||||
$self->{_properties}{renderedAd} = $self->get("richMedia");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue