diff --git a/docs/upgrades/upgrade_7.7.19-7.8.0.pl b/docs/upgrades/upgrade_7.7.19-7.8.0.pl index 4e0f7bd17..abbfca06d 100644 --- a/docs/upgrades/upgrade_7.7.19-7.8.0.pl +++ b/docs/upgrades/upgrade_7.7.19-7.8.0.pl @@ -31,6 +31,7 @@ my $quiet; # this line required my $session = start(); # this line required # upgrade functions go here +reorganizeAdSpaceProperties($session); finish($session); # this line required @@ -44,6 +45,18 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +# Describe what our function does +sub reorganizeAdSpaceProperties { + my $session = shift; + print "\tReorganize AdSpace and Ad Sales properties... " unless $quiet; + $session->db->write(q|ALTER TABLE adSpace DROP COLUMN costPerClick|); + $session->db->write(q|ALTER TABLE adSpace DROP COLUMN costPerImpression|); + $session->db->write(q|ALTER TABLE adSpace DROP COLUMN groupToPurchase|); + # and here's our code + print "DONE!\n" unless $quiet; +} + # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- diff --git a/lib/WebGUI/AdSpace.pm b/lib/WebGUI/AdSpace.pm index c113de56b..5eae370c6 100644 --- a/lib/WebGUI/AdSpace.pm +++ b/lib/WebGUI/AdSpace.pm @@ -302,18 +302,10 @@ A human readable title for this ad space. A human readable description for this ad space. -=head4 costPerImpression - -A float that represents how much it will cost an advertiser every time an ad is viewed in this ad space. - =head4 minimumImpressions An integer indicating the minimum number of impressions an advertiser is allowed to purchase. -=head4 costPerClick - -A float that represents how much it will cost an advertiser everytime someone clicks on an ad in this ad space. - =head4 minimumClicks An integer indicating the minimum number of clicks an advertiser is allowed to purchase. @@ -344,8 +336,6 @@ sub set { $self->{_properties}{title} = exists $properties->{title} ? $properties->{title} : $self->{_properties}{title} || "Untitled"; $self->{_properties}{description} = exists $properties->{description} ? $properties->{description} : $self->{_properties}{description}; - $self->{_properties}{costPerImpression} = exists $properties->{costPerImpression} ? $properties->{costPerImpression} : $self->{_properties}{costPerImpression}; - $self->{_properties}{costPerClick} = exists $properties->{costPerClick} ? $properties->{costPerClick} : $self->{_properties}{costPerClick}; $self->{_properties}{minimumImpressions} = $properties->{minimumImpressions} || $self->{_properties}{minimumImpressions}; $self->{_properties}{minimumClicks} = $properties->{minimumClicks} || $self->{_properties}{minimumClicks}; $self->{_properties}{groupToPurchase} = $properties->{groupToPurchase} || $self->{_properties}{groupToPurchase} || "3"; diff --git a/lib/WebGUI/Operation/AdSpace.pm b/lib/WebGUI/Operation/AdSpace.pm index 28599aa4c..8b4a97b2c 100644 --- a/lib/WebGUI/Operation/AdSpace.pm +++ b/lib/WebGUI/Operation/AdSpace.pm @@ -345,6 +345,20 @@ sub www_editAdSpace { hoverHelp => $i18n->get("description help"), label => $i18n->get("description"), ); + $f->integer( + name => "minimumClicks", + value => $session->form->get('minimumClicks') || ($adSpace && $adSpace->get('minimumClicks')), + defaultValue => 1000, + hoverHelp => $i18n->get("minimum clicks help"), + label => $i18n->get("minimum clicks"), + ); + $f->integer( + name => "minimumImpressions", + value => $session->form->get('minimumImpressions') || ($adSpace && $adSpace->get('minimumImpressions')), + defaultValue => 1000, + hoverHelp => $i18n->get("minimum impressions help"), + label => $i18n->get("minimum impressions"), + ); $f->integer( name => "width", value => $session->form->get('width') || ($adSpace && $adSpace->get('width')), @@ -396,11 +410,13 @@ sub www_editAdSpaceSave { my $i18n = WebGUI::International->new( $session, "AdSpace" ); my %properties = ( - name => $session->form->process("name", "text"), - title => $session->form->process("title", "text"), - description => $session->form->process("description", "textarea"), - width => $session->form->process("width", "integer"), - height => $session->form->process("height", "integer"), + name => $session->form->process("name", "text"), + title => $session->form->process("title", "text"), + description => $session->form->process("description", "textarea"), + width => $session->form->process("width", "integer"), + height => $session->form->process("height", "integer"), + minimumClicks => $session->form->process("minimumClicks", "integer"), + minimumImpressions => $session->form->process("minimumImpressions", "integer"), ); ### Validate form entry diff --git a/lib/WebGUI/i18n/English/AdSpace.pm b/lib/WebGUI/i18n/English/AdSpace.pm index fab97754b..9cdf1306a 100644 --- a/lib/WebGUI/i18n/English/AdSpace.pm +++ b/lib/WebGUI/i18n/English/AdSpace.pm @@ -294,15 +294,35 @@ our $I18N = { lastUpdated => 0, }, - 'error heading' => { - message => q{There was an error with your Ad Space:}, - lastUpdated => 0, - }, + 'error heading' => { + message => q{There was an error with your Ad Space:}, + lastUpdated => 0, + }, - 'error invalid characters' => { - message => q{There are invalid characters in the title field. Please use only letters, numbers, and spaces.}, - lastUpdated => 0, - }, + 'error invalid characters' => { + message => q{There are invalid characters in the title field. Please use only letters, numbers, and spaces.}, + lastUpdated => 0, + }, + + 'minimum clicks' => { + message => q{Minimum Clicks To Buy.}, + lastUpdated => 0, + }, + + 'minimum clicks help' => { + message => q{This sets a minimum number of clicks that a user would buy when purchasing an Ad for this AdSpace.}, + lastUpdated => 0, + }, + + 'minimum impressions' => { + message => q{Minimum Impressions To Buy.}, + lastUpdated => 0, + }, + + 'minimum impressions help' => { + message => q{This sets a minimum number of impressions that a user would buy when purchasing an Ad for this AdSpace.}, + lastUpdated => 0, + }, };