@@ -63,7 +63,7 @@ |
||
| 63 | 63 | 50 |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - // $df->setSize(100); |
|
| 66 | + // $df->setSize(100); |
|
| 67 | 67 | $params->push($df); |
| 68 | 68 | |
| 69 | 69 | return $params; |
@@ -16,23 +16,23 @@ discard block |
||
| 16 | 16 | 'IsCached' => 'Boolean', |
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | - /* |
|
| 19 | + /* |
|
| 20 | 20 | Add a Location tab containing the map |
| 21 | 21 | */ |
| 22 | - public function updateCMSFields(FieldList $fields) |
|
| 23 | - { |
|
| 24 | - $categoryfield = new DropdownField('AdvertCategoryID', 'Category', AdvertCategory::get()->sort('Title')->map('ID', 'Title')); |
|
| 25 | - $categoryfield->setEmptyString('(Select one)'); |
|
| 26 | - $fields->addFieldToTab('Root.AdvertCategory', $categoryfield); |
|
| 27 | - } |
|
| 22 | + public function updateCMSFields(FieldList $fields) |
|
| 23 | + { |
|
| 24 | + $categoryfield = new DropdownField('AdvertCategoryID', 'Category', AdvertCategory::get()->sort('Title')->map('ID', 'Title')); |
|
| 25 | + $categoryfield->setEmptyString('(Select one)'); |
|
| 26 | + $fields->addFieldToTab('Root.AdvertCategory', $categoryfield); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /* |
|
| 29 | + /* |
|
| 30 | 30 | Prior to an item being saved, check for the category having being changed. If so we need to clear the category cache |
| 31 | 31 | for all items in the database, and cache this one. |
| 32 | 32 | */ |
| 33 | - public function onBeforeWrite() |
|
| 34 | - { |
|
| 35 | - $savedpage = SiteTree::get()->byID($this->owner->ID); |
|
| 33 | + public function onBeforeWrite() |
|
| 34 | + { |
|
| 35 | + $savedpage = SiteTree::get()->byID($this->owner->ID); |
|
| 36 | 36 | //error_log("Formerly saved category id = ".$savedpage->AdvertCategory()->Title); |
| 37 | 37 | //error_log("Category before save for page ".$this->owner->ID." is :".$this->owner->AdvertCategory()->Title); |
| 38 | 38 | if ($savedpage->AdvertCategoryID != $this->owner->AdvertCategoryID) { |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | } else { |
| 45 | 45 | //error_log("CACHE CAN KEEP GOING"); |
| 46 | 46 | } |
| 47 | - parent::onBeforeWrite(); |
|
| 48 | - } |
|
| 47 | + parent::onBeforeWrite(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /* |
|
| 50 | + /* |
|
| 51 | 51 | Get the advert category. Either use the cached advert category, or traverse the tree towards the root looking for it |
| 52 | 52 | */ |
| 53 | 53 | public function CalculateAdvertCategoryID() |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public static $searchable_fields = array( |
| 10 | 10 | 'Title', |
| 11 | - ); |
|
| 11 | + ); |
|
| 12 | 12 | |
| 13 | 13 | public static $db = array( |
| 14 | 14 | // name of the layout type, e.g. 'main banner' or 'skyscraper' |
@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | // whether or not ads are enabled |
| 18 | 18 | 'Width' => 'Int', |
| 19 | 19 | 'Height' => 'Int', |
| 20 | - ); |
|
| 20 | + ); |
|
| 21 | 21 | |
| 22 | 22 | public static $summary_fields = array( |
| 23 | 23 | 'Title' => 'Title', |
| 24 | 24 | 'Width' => 'Width', |
| 25 | 25 | 'Height' => 'Height', |
| 26 | - ); |
|
| 26 | + ); |
|
| 27 | 27 | |
| 28 | 28 | public static $has_many = array( |
| 29 | 29 | 'Adverts' => 'Advert', |
| 30 | - ); |
|
| 30 | + ); |
|
| 31 | 31 | |
| 32 | 32 | public function getCMSFields() |
| 33 | 33 | { |
@@ -8,11 +8,11 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public static $searchable_fields = array( |
| 10 | 10 | 'Title', |
| 11 | - ); |
|
| 11 | + ); |
|
| 12 | 12 | |
| 13 | 13 | public static $has_many = array( |
| 14 | 14 | 'Adverts' => 'Advert', |
| 15 | - ); |
|
| 15 | + ); |
|
| 16 | 16 | |
| 17 | 17 | public static $db = array( |
| 18 | 18 | // name of the category |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | // whether or not ads are enabled |
| 22 | 22 | 'Enabled' => 'Boolean', |
| 23 | 23 | |
| 24 | - ); |
|
| 24 | + ); |
|
| 25 | 25 | |
| 26 | 26 | public static $summary_fields = array( |
| 27 | 27 | 'Title' => 'Title', |
| 28 | 28 | 'Enabled' => 'Enabled', |
| 29 | - ); |
|
| 29 | + ); |
|
| 30 | 30 | |
| 31 | 31 | public function getCMSFields() |
| 32 | 32 | { |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | public static $db = array( |
| 6 | 6 | 'MpuAboveFoldPosition' => 'Int', |
| 7 | 7 | 'MpuBelowFoldPosition' => 'Int', |
| 8 | - ); |
|
| 8 | + ); |
|
| 9 | 9 | |
| 10 | 10 | public static $defaults = array( |
| 11 | 11 | 'MpuAboveFoldPosition' => '4', |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | class AdvertAdmin extends ModelAdmin |
| 4 | 4 | { |
| 5 | 5 | public static $managed_models = array( //since 2.3.2 |
| 6 | - 'Advert', 'AdvertCategory', 'AdvertLayoutType', |
|
| 7 | - ); |
|
| 6 | + 'Advert', 'AdvertCategory', 'AdvertLayoutType', |
|
| 7 | + ); |
|
| 8 | 8 | |
| 9 | 9 | public static $url_segment = 'adverts'; // will be linked as /admin/adverts |
| 10 | - public static $menu_title = 'Adverts'; |
|
| 10 | + public static $menu_title = 'Adverts'; |
|
| 11 | 11 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | public static $searchable_fields = array( |
| 9 | 9 | 'WebsiteLink', |
| 10 | - ); |
|
| 10 | + ); |
|
| 11 | 11 | |
| 12 | 12 | public static $db = array( |
| 13 | 13 | // title to show in model admin |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | // stats |
| 34 | 34 | 'Impressions' => 'Int', |
| 35 | 35 | 'Clickthroughs' => 'Int', |
| 36 | - ); |
|
| 36 | + ); |
|
| 37 | 37 | |
| 38 | 38 | public static $has_one = array( |
| 39 | 39 | 'AdvertImage' => 'Image', |
| 40 | 40 | 'AdvertCategory' => 'AdvertCategory', |
| 41 | 41 | 'AdvertLayoutType' => 'AdvertLayoutType', |
| 42 | - ); |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | 44 | public static $summary_fields = array( |
| 45 | 45 | 'Title' => 'Title', |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | 'AdvertLayoutType.Title', |
| 48 | 48 | 'StartDate' => 'StartDate', |
| 49 | 49 | 'FinishDate' => 'FinishDate', |
| 50 | - ); |
|
| 50 | + ); |
|
| 51 | 51 | |
| 52 | - // add an index in the db for the digital signature and date ranges |
|
| 52 | + // add an index in the db for the digital signature and date ranges |
|
| 53 | 53 | public static $indexes = array( |
| 54 | 54 | 'DigitalSignature' => true, |
| 55 | 55 | 'StartDate' => '(StartDate)', |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | Requirements::javascript('weboftalent-adverts/javascript/advertedit.js'); |
| 63 | 63 | |
| 64 | - // throw away the scaffolding and start afresh |
|
| 64 | + // throw away the scaffolding and start afresh |
|
| 65 | 65 | $fields = new FieldList(); |
| 66 | 66 | |
| 67 | 67 | // add a main tab |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | // a Javascript toggle on this field displays either the adbroker text field, or an image with URL |
| 76 | 76 | $fields->addFieldToTab('Root.Main', new DropdownField('AdvertSource', 'The type of advert', |
| 77 | 77 | singleton('Advert')->dbObject('AdvertSource')->enumValues() |
| 78 | - )); |
|
| 78 | + )); |
|
| 79 | 79 | |
| 80 | 80 | if ($this->ID == 0) { |
| 81 | 81 | $html = '<div class="field text">An image can be uploaded after the advert is saved for the first time</div>'; |
@@ -119,21 +119,21 @@ discard block |
||
| 119 | 119 | parent::onBeforeWrite(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - /* |
|
| 122 | + /* |
|
| 123 | 123 | Calculate a digital signature from several of the fields |
| 124 | 124 | */ |
| 125 | - public function CalculateDigitalSignature() |
|
| 126 | - { |
|
| 127 | - //error_log("Calculating dig sig"); |
|
| 125 | + public function CalculateDigitalSignature() |
|
| 126 | + { |
|
| 127 | + //error_log("Calculating dig sig"); |
|
| 128 | 128 | /* because we save the impression counter on every rendition this cannot include |
| 129 | 129 | - number of impressions |
| 130 | 130 | - last edited |
| 131 | 131 | Otherwise the clickthrough will fail |
| 132 | 132 | */ |
| 133 | 133 | $data = $this->ID.'_'.$this->AdvertCategory()->Title.'_'.$this->AdvertLayoutType()->Title.'_'.$this->AdbrokerJavascript; |
| 134 | - $data .= '_'.$this->StartDate.'_'.$this->FinishDate.'_'.$this->ClickThroughs.'_advert'; |
|
| 135 | - $hashed = hash('sha512', $data); |
|
| 134 | + $data .= '_'.$this->StartDate.'_'.$this->FinishDate.'_'.$this->ClickThroughs.'_advert'; |
|
| 135 | + $hashed = hash('sha512', $data); |
|
| 136 | 136 | //error_log("HASH CREATED:".$hashed); |
| 137 | 137 | return $hashed; |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | 'Adverts' => $adverts, |
| 79 | 79 | 'Advert' => $firstad, |
| 80 | 80 | 'CacheKey' => $cachekey, |
| 81 | - )); |
|
| 81 | + )); |
|
| 82 | 82 | |
| 83 | 83 | return $forTemplate->renderWith($template); |
| 84 | 84 | } else { |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Handles requests for secure files by url. |
|
| 4 | - * |
|
| 5 | - * @author Hamish Campbell <[email protected]> |
|
| 6 | - * @copyright copyright (c) 2010, Hamish Campbell |
|
| 7 | - */ |
|
| 3 | + * Handles requests for secure files by url. |
|
| 4 | + * |
|
| 5 | + * @author Hamish Campbell <[email protected]> |
|
| 6 | + * @copyright copyright (c) 2010, Hamish Campbell |
|
| 7 | + */ |
|
| 8 | 8 | class SecureFileController extends Controller implements PermissionProvider |
| 9 | 9 | { |
| 10 | 10 | /** |