BUG: Share session namespace with CMS main when adding documents.

The changes to the session management in 3.1 mean that editing when
uploading a document no longer worked as the page ID was not correctly
managed in the session. This addresses that issue by sharing a session
state with CMSMain.
This commit is contained in:
Andrew Short 2013-10-09 00:49:39 +11:00
parent f718b90b69
commit 893c10955a

View File

@ -7,6 +7,8 @@ class DMSDocumentAddController extends LeftAndMain {
private static $required_permission_codes = 'CMS_ACCESS_AssetAdmin';
private static $menu_title = 'Edit Page';
private static $tree_class = 'SiteTree';
private static $session_namespace = 'CMSMain';
static $allowed_extensions = array();
private static $allowed_actions = array (
@ -44,15 +46,7 @@ class DMSDocumentAddController extends LeftAndMain {
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
*/
public function currentPageID() {
if(is_numeric($this->request->requestVar('ID'))) {
return $this->request->requestVar('ID');
} elseif (is_numeric($this->urlParams['ID'])) {
return $this->urlParams['ID'];
} elseif(Session::get("{$this->class}.currentPage")) {
return Session::get("{$this->class}.currentPage");
} else {
return 0;
}
return ($result = parent::currentPageID()) === null ? 0 : $result;
}
/**