From c411c500a5325af1a5d07cb4e7d2106b4598f91d Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Tue, 23 Aug 2016 12:39:01 +1200 Subject: [PATCH] Fix for pages admin add to campaign modal --- code/Controllers/CMSMain.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index e370b881..7f55d338 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -102,6 +102,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr private static $page_length = 15; private static $allowed_actions = array( + 'AddToCampaignForm', 'archive', 'deleteitems', 'DeleteItemsForm', @@ -1309,6 +1310,26 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $this->getResponseNegotiator()->respond($this->getRequest()); } + /** + * Action handler for adding pages to a campaign + * + * @param SS_HTTPRequest + * @return DBHTMLText|SS_HTTPResponse + */ + public function AddToCampaignForm($request) { + $data = $request->postVars(); + + if (!$data['Campaign']) { + $this->httpError(400, _t( + 'AddToCampaign.ErrorCampaignNotSelected', + 'There was no campaign selected to be added to' + )); + return null; + } + $handler = AddToCampaignHandler::create($this, $data); + return $handler->handle(); + } + /** * Action handler for adding pages to a campaign * @@ -1317,7 +1338,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr * @return DBHTMLText|SS_HTTPResponse */ public function addtocampaign($data, $form) { - $handler = AddToCampaignHandler::create($form, $data); + $handler = AddToCampaignHandler::create($this, $data); return $handler->handle(); }