Fix for pages admin add to campaign modal

This commit is contained in:
Christopher Joe 2016-08-23 12:39:01 +12:00
parent c46490ea3a
commit c411c500a5

View File

@ -102,6 +102,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
private static $page_length = 15; private static $page_length = 15;
private static $allowed_actions = array( private static $allowed_actions = array(
'AddToCampaignForm',
'archive', 'archive',
'deleteitems', 'deleteitems',
'DeleteItemsForm', 'DeleteItemsForm',
@ -1309,6 +1310,26 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $this->getResponseNegotiator()->respond($this->getRequest()); 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 * Action handler for adding pages to a campaign
* *
@ -1317,7 +1338,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* @return DBHTMLText|SS_HTTPResponse * @return DBHTMLText|SS_HTTPResponse
*/ */
public function addtocampaign($data, $form) { public function addtocampaign($data, $form) {
$handler = AddToCampaignHandler::create($form, $data); $handler = AddToCampaignHandler::create($this, $data);
return $handler->handle(); return $handler->handle();
} }