mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge remote-tracking branch 'origin/3'
This commit is contained in:
commit
f0b9627298
@ -50,8 +50,8 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
|
|||||||
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
||||||
*/
|
*/
|
||||||
public function currentPageID() {
|
public function currentPageID() {
|
||||||
if(is_numeric($this->request->requestVar('ID'))) {
|
if(is_numeric($this->getRequest()->requestVar('ID'))) {
|
||||||
return $this->request->requestVar('ID');
|
return $this->getRequest()->requestVar('ID');
|
||||||
} elseif (is_numeric($this->urlParams['ID'])) {
|
} elseif (is_numeric($this->urlParams['ID'])) {
|
||||||
return $this->urlParams['ID'];
|
return $this->urlParams['ID'];
|
||||||
} elseif(Session::get("{$this->class}.currentPage")) {
|
} elseif(Session::get("{$this->class}.currentPage")) {
|
||||||
@ -100,15 +100,15 @@ JS
|
|||||||
$context = $this->getSearchContext();
|
$context = $this->getSearchContext();
|
||||||
// Overwrite name filter to search both Name and Title attributes
|
// Overwrite name filter to search both Name and Title attributes
|
||||||
$context->removeFilterByName('Name');
|
$context->removeFilterByName('Name');
|
||||||
$params = $this->request->requestVar('q');
|
$params = $this->getRequest()->requestVar('q');
|
||||||
$list = $context->getResults($params);
|
$list = $context->getResults($params);
|
||||||
|
|
||||||
// Don't filter list when a detail view is requested,
|
// Don't filter list when a detail view is requested,
|
||||||
// to avoid edge cases where the filtered list wouldn't contain the requested
|
// to avoid edge cases where the filtered list wouldn't contain the requested
|
||||||
// record due to faulty session state (current folder not always encoded in URL, see #7408).
|
// record due to faulty session state (current folder not always encoded in URL, see #7408).
|
||||||
if(!$folder->ID
|
if(!$folder->ID
|
||||||
&& $this->request->requestVar('ID') === null
|
&& $this->getRequest()->requestVar('ID') === null
|
||||||
&& ($this->request->param('ID') == 'field')
|
&& ($this->getRequest()->param('ID') == 'field')
|
||||||
) {
|
) {
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ JS
|
|||||||
$form->setFormMethod('GET');
|
$form->setFormMethod('GET');
|
||||||
$form->setFormAction(Controller::join_links($this->Link('show'), $folder->ID));
|
$form->setFormAction(Controller::join_links($this->Link('show'), $folder->ID));
|
||||||
$form->addExtraClass('cms-search-form');
|
$form->addExtraClass('cms-search-form');
|
||||||
$form->loadDataFrom($this->request->getVars());
|
$form->loadDataFrom($this->getRequest()->getVars());
|
||||||
$form->disableSecurityToken();
|
$form->disableSecurityToken();
|
||||||
// This have to match data-name attribute on the gridfield so that the javascript selectors work
|
// This have to match data-name attribute on the gridfield so that the javascript selectors work
|
||||||
$form->setAttribute('data-gridfield', 'File');
|
$form->setAttribute('data-gridfield', 'File');
|
||||||
@ -437,7 +437,7 @@ JS
|
|||||||
'AddForm',
|
'AddForm',
|
||||||
new FieldList(
|
new FieldList(
|
||||||
new TextField("Name", _t('File.Name')),
|
new TextField("Name", _t('File.Name')),
|
||||||
new HiddenField('ParentID', false, $this->request->getVar('ParentID'))
|
new HiddenField('ParentID', false, $this->getRequest()->getVar('ParentID'))
|
||||||
),
|
),
|
||||||
new FieldList(
|
new FieldList(
|
||||||
FormAction::create('doAdd', _t('AssetAdmin_left_ss.GO','Go'))
|
FormAction::create('doAdd', _t('AssetAdmin_left_ss.GO','Go'))
|
||||||
@ -669,16 +669,16 @@ JS
|
|||||||
$items[0]->Link = Controller::join_links(singleton('AssetAdmin')->Link('show'), 0);
|
$items[0]->Link = Controller::join_links(singleton('AssetAdmin')->Link('show'), 0);
|
||||||
|
|
||||||
// If a search is in progress, don't show the path
|
// If a search is in progress, don't show the path
|
||||||
if($this->request->requestVar('q')) {
|
if($this->getRequest()->requestVar('q')) {
|
||||||
$items = $items->limit(1);
|
$items = $items->limit(1);
|
||||||
$items->push(new ArrayData(array(
|
$items->push(new ArrayData(array(
|
||||||
'Title' => _t('LeftAndMain.SearchResults', 'Search Results'),
|
'Title' => _t('LeftAndMain.SearchResults', 'Search Results'),
|
||||||
'Link' => Controller::join_links($this->Link(), '?' . http_build_query(array('q' => $this->request->requestVar('q'))))
|
'Link' => Controller::join_links($this->Link(), '?' . http_build_query(array('q' => $this->getRequest()->requestVar('q'))))
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're adding a folder, note that in breadcrumbs as well
|
// If we're adding a folder, note that in breadcrumbs as well
|
||||||
if($this->request->param('Action') == 'addfolder') {
|
if($this->getRequest()->param('Action') == 'addfolder') {
|
||||||
$items->push(new ArrayData(array(
|
$items->push(new ArrayData(array(
|
||||||
'Title' => _t('Folder.AddFolderButton', 'Add folder'),
|
'Title' => _t('Folder.AddFolderButton', 'Add folder'),
|
||||||
'Link' => false
|
'Link' => false
|
||||||
|
@ -36,8 +36,8 @@ class CMSFileAddController extends LeftAndMain {
|
|||||||
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
||||||
*/
|
*/
|
||||||
public function currentPageID() {
|
public function currentPageID() {
|
||||||
if(is_numeric($this->request->requestVar('ID'))) {
|
if(is_numeric($this->getRequest()->requestVar('ID'))) {
|
||||||
return $this->request->requestVar('ID');
|
return $this->getRequest()->requestVar('ID');
|
||||||
} elseif (is_numeric($this->urlParams['ID'])) {
|
} elseif (is_numeric($this->urlParams['ID'])) {
|
||||||
return $this->urlParams['ID'];
|
return $this->urlParams['ID'];
|
||||||
} elseif(Session::get("{$this->class}.currentPage")) {
|
} elseif(Session::get("{$this->class}.currentPage")) {
|
||||||
|
@ -59,7 +59,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
// set reading lang
|
// set reading lang
|
||||||
if(SiteTree::has_extension('Translatable') && !$this->request->isAjax()) {
|
if(SiteTree::has_extension('Translatable') && !$this->getRequest()->isAjax()) {
|
||||||
Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
|
Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,8 +203,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
public function LinkWithSearch($link) {
|
public function LinkWithSearch($link) {
|
||||||
// Whitelist to avoid side effects
|
// Whitelist to avoid side effects
|
||||||
$params = array(
|
$params = array(
|
||||||
'q' => (array)$this->request->getVar('q'),
|
'q' => (array)$this->getRequest()->getVar('q'),
|
||||||
'ParentID' => $this->request->getVar('ParentID')
|
'ParentID' => $this->getRequest()->getVar('ParentID')
|
||||||
);
|
);
|
||||||
$link = Controller::join_links(
|
$link = Controller::join_links(
|
||||||
$link,
|
$link,
|
||||||
@ -265,7 +265,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function TreeIsFiltered() {
|
public function TreeIsFiltered() {
|
||||||
return $this->request->getVar('q');
|
return $this->getRequest()->getVar('q');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ExtraTreeTools() {
|
public function ExtraTreeTools() {
|
||||||
@ -344,7 +344,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
->unsetValidator();
|
->unsetValidator();
|
||||||
|
|
||||||
// Load the form with previously sent search data
|
// Load the form with previously sent search data
|
||||||
$form->loadDataFrom($this->request->getVars());
|
$form->loadDataFrom($this->getRequest()->getVars());
|
||||||
|
|
||||||
// Allow decorators to modify the form
|
// Allow decorators to modify the form
|
||||||
$this->extend('updateSearchForm', $form);
|
$this->extend('updateSearchForm', $form);
|
||||||
@ -367,7 +367,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function doSearch($data, $form) {
|
public function doSearch($data, $form) {
|
||||||
return $this->getsubtree($this->request);
|
return $this->getsubtree($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -402,7 +402,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
// Generate basic cache key. Too complex to encompass all variations
|
// Generate basic cache key. Too complex to encompass all variations
|
||||||
$cache = SS_Cache::factory('CMSMain_SiteTreeHints');
|
$cache = SS_Cache::factory('CMSMain_SiteTreeHints');
|
||||||
$cacheKey = md5(implode('_', array(Member::currentUserID(), implode(',', $cacheCanCreate), implode(',', $classes))));
|
$cacheKey = md5(implode('_', array(Member::currentUserID(), implode(',', $cacheCanCreate), implode(',', $classes))));
|
||||||
if($this->request->getVar('flush')) $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
if($this->getRequest()->getVar('flush')) $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
||||||
$json = $cache->load($cacheKey);
|
$json = $cache->load($cacheKey);
|
||||||
if(!$json) {
|
if(!$json) {
|
||||||
$def['Root'] = array();
|
$def['Root'] = array();
|
||||||
@ -515,8 +515,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
else if($id && is_numeric($id)) {
|
else if($id && is_numeric($id)) {
|
||||||
if($this->request->getVar('Version')) {
|
if($this->getRequest()->getVar('Version')) {
|
||||||
$versionID = (int) $this->request->getVar('Version');
|
$versionID = (int) $this->getRequest()->getVar('Version');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($versionID) {
|
if($versionID) {
|
||||||
@ -753,8 +753,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function ListViewForm() {
|
public function ListViewForm() {
|
||||||
$params = $this->request->requestVar('q');
|
$params = $this->getRequest()->requestVar('q');
|
||||||
$list = $this->getList($params, $parentID = $this->request->requestVar('ParentID'));
|
$list = $this->getList($params, $parentID = $this->getRequest()->requestVar('ParentID'));
|
||||||
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
||||||
new GridFieldSortableHeader(),
|
new GridFieldSortableHeader(),
|
||||||
new GridFieldDataColumns(),
|
new GridFieldDataColumns(),
|
||||||
@ -895,7 +895,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$record->doPublish();
|
$record->doPublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1004,7 +1004,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1051,7 +1051,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1074,7 +1074,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function publish($data, $form) {
|
public function publish($data, $form) {
|
||||||
@ -1097,7 +1097,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
rawurlencode(_t('CMSMain.REMOVEDPAGE',"Removed '{title}' from the published site", array('title' => $record->Title)))
|
rawurlencode(_t('CMSMain.REMOVEDPAGE',"Removed '{title}' from the published site", array('title' => $record->Title)))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1106,7 +1106,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
public function rollback() {
|
public function rollback() {
|
||||||
return $this->doRollback(array(
|
return $this->doRollback(array(
|
||||||
'ID' => $this->currentPageID(),
|
'ID' => $this->currentPageID(),
|
||||||
'Version' => $this->request->param('VersionID')
|
'Version' => $this->getRequest()->param('VersionID')
|
||||||
), null);
|
), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1148,10 +1148,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
// The X-Pjax header forces a "full" content refresh on redirect.
|
// The X-Pjax header forces a "full" content refresh on redirect.
|
||||||
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID);
|
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID);
|
||||||
$this->response->addHeader('X-ControllerURL', $url);
|
$this->response->addHeader('X-ControllerURL', $url);
|
||||||
$this->request->addHeader('X-Pjax', 'Content');
|
$this->getRequest()->addHeader('X-Pjax', 'Content');
|
||||||
$this->response->addHeader('X-Pjax', 'Content');
|
$this->response->addHeader('X-Pjax', 'Content');
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1301,7 +1301,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function duplicate($request) {
|
public function duplicate($request) {
|
||||||
@ -1331,10 +1331,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $newPage->ID);
|
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $newPage->ID);
|
||||||
$this->response->addHeader('X-ControllerURL', $url);
|
$this->response->addHeader('X-ControllerURL', $url);
|
||||||
$this->request->addHeader('X-Pjax', 'Content');
|
$this->getRequest()->addHeader('X-Pjax', 'Content');
|
||||||
$this->response->addHeader('X-Pjax', 'Content');
|
$this->response->addHeader('X-Pjax', 'Content');
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
} else {
|
} else {
|
||||||
return new SS_HTTPResponse("CMSMain::duplicate() Bad ID: '$id'", 400);
|
return new SS_HTTPResponse("CMSMain::duplicate() Bad ID: '$id'", 400);
|
||||||
}
|
}
|
||||||
@ -1361,10 +1361,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $newPage->ID);
|
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $newPage->ID);
|
||||||
$this->response->addHeader('X-ControllerURL', $url);
|
$this->response->addHeader('X-ControllerURL', $url);
|
||||||
$this->request->addHeader('X-Pjax', 'Content');
|
$this->getRequest()->addHeader('X-Pjax', 'Content');
|
||||||
$this->response->addHeader('X-Pjax', 'Content');
|
$this->response->addHeader('X-Pjax', 'Content');
|
||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
} else {
|
} else {
|
||||||
return new SS_HTTPResponse("CMSMain::duplicatewithchildren() Bad ID: '$id'", 400);
|
return new SS_HTTPResponse("CMSMain::duplicatewithchildren() Bad ID: '$id'", 400);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
|
|
||||||
// CMSMain->currentPageID() automatically sets the homepage,
|
// CMSMain->currentPageID() automatically sets the homepage,
|
||||||
// which we need to counteract in the default selection (which should default to root, ID=0)
|
// which we need to counteract in the default selection (which should default to root, ID=0)
|
||||||
if($parentID = $this->request->getVar('ParentID')) {
|
if($parentID = $this->getRequest()->getVar('ParentID')) {
|
||||||
$parentModeField->setValue('child');
|
$parentModeField->setValue('child');
|
||||||
$parentField->setValue((int)$parentID);
|
$parentField->setValue((int)$parentID);
|
||||||
} else {
|
} else {
|
||||||
@ -156,7 +156,7 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
$record->write();
|
$record->write();
|
||||||
} catch(ValidationException $ex) {
|
} catch(ValidationException $ex) {
|
||||||
$form->sessionMessage($ex->getResult()->message(), 'bad');
|
$form->sessionMessage($ex->getResult()->message(), 'bad');
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
$editController = singleton('CMSPageEditController');
|
$editController = singleton('CMSPageEditController');
|
||||||
|
@ -80,7 +80,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getSilverStripeNavigator() {
|
public function getSilverStripeNavigator() {
|
||||||
$record = $this->getRecord($this->currentPageID(), $this->request->param('VersionID'));
|
$record = $this->getRecord($this->currentPageID(), $this->getRequest()->param('VersionID'));
|
||||||
if($record) {
|
if($record) {
|
||||||
$navigator = new SilverStripeNavigator($record);
|
$navigator = new SilverStripeNavigator($record);
|
||||||
return $navigator->renderWith($this->getTemplatesWithSuffix('_SilverStripeNavigator'));
|
return $navigator->renderWith($this->getTemplatesWithSuffix('_SilverStripeNavigator'));
|
||||||
@ -194,9 +194,9 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
$page = $this->getRecord($id);
|
$page = $this->getRecord($id);
|
||||||
$versionsHtml = '';
|
$versionsHtml = '';
|
||||||
|
|
||||||
$action = $this->request->param('Action');
|
$action = $this->getRequest()->param('Action');
|
||||||
$versionID = $this->request->param('VersionID');
|
$versionID = $this->getRequest()->param('VersionID');
|
||||||
$otherVersionID = $this->request->param('OtherVersionID');
|
$otherVersionID = $this->getRequest()->param('OtherVersionID');
|
||||||
|
|
||||||
$showUnpublishedChecked = 0;
|
$showUnpublishedChecked = 0;
|
||||||
$compareModeChecked = ($action == "compare");
|
$compareModeChecked = ($action == "compare");
|
||||||
@ -260,7 +260,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
$actions
|
$actions
|
||||||
)->setHTMLID('Form_VersionsForm');
|
)->setHTMLID('Form_VersionsForm');
|
||||||
$form->setResponseNegotiator($this->getResponseNegotiator());
|
$form->setResponseNegotiator($this->getResponseNegotiator());
|
||||||
$form->loadDataFrom($this->request->requestVars());
|
$form->loadDataFrom($this->getRequest()->requestVars());
|
||||||
$hiddenID->setValue($id);
|
$hiddenID->setValue($id);
|
||||||
$form->unsetValidator();
|
$form->unsetValidator();
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
$form = $this->CompareVersionsForm($version1, $version2);
|
$form = $this->CompareVersionsForm($version1, $version2);
|
||||||
|
|
||||||
// javascript solution, render into template
|
// javascript solution, render into template
|
||||||
if($this->request->isAjax()) {
|
if($this->getRequest()->isAjax()) {
|
||||||
return $this->customise(array(
|
return $this->customise(array(
|
||||||
"EditForm" => $form
|
"EditForm" => $form
|
||||||
))->renderWith(array(
|
))->renderWith(array(
|
||||||
|
@ -20,7 +20,7 @@ class CMSPagesController extends CMSMain {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public function ViewState() {
|
public function ViewState() {
|
||||||
return $this->request->getVar('view');
|
return $this->getRequest()->getVar('view');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCurrentPage(DataObject $record) {
|
public function isCurrentPage(DataObject $record) {
|
||||||
@ -31,7 +31,7 @@ class CMSPagesController extends CMSMain {
|
|||||||
$items = parent::Breadcrumbs($unlinked);
|
$items = parent::Breadcrumbs($unlinked);
|
||||||
|
|
||||||
//special case for building the breadcrumbs when calling the listchildren Pages ListView action
|
//special case for building the breadcrumbs when calling the listchildren Pages ListView action
|
||||||
if($parentID = $this->request->getVar('ParentID')) {
|
if($parentID = $this->getRequest()->getVar('ParentID')) {
|
||||||
$page = DataObject::get_by_id('SiteTree', $parentID);
|
$page = DataObject::get_by_id('SiteTree', $parentID);
|
||||||
|
|
||||||
//build a reversed list of the parent tree
|
//build a reversed list of the parent tree
|
||||||
@ -43,8 +43,8 @@ class CMSPagesController extends CMSMain {
|
|||||||
|
|
||||||
//turns the title and link of the breadcrumbs into template-friendly variables
|
//turns the title and link of the breadcrumbs into template-friendly variables
|
||||||
$params = array_filter(array(
|
$params = array_filter(array(
|
||||||
'view' => $this->request->getVar('view'),
|
'view' => $this->getRequest()->getVar('view'),
|
||||||
'q' => $this->request->getVar('q')
|
'q' => $this->getRequest()->getVar('q')
|
||||||
));
|
));
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
$params['ParentID'] = $page->ID;
|
$params['ParentID'] = $page->ID;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
abstract class CMSSiteTreeFilter extends Object {
|
abstract class CMSSiteTreeFilter extends Object implements LeftAndMain_SearchFilter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Array Search parameters, mostly properties on {@link SiteTree}.
|
* @var Array Search parameters, mostly properties on {@link SiteTree}.
|
||||||
@ -22,9 +22,21 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
protected $params = array();
|
protected $params = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Array
|
* List of filtered items and all their parents
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_cache_ids = null;
|
protected $_cache_ids = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subset of $_cache_ids which include only items that appear directly in search results.
|
||||||
|
* When highlighting these, item IDs in this subset should be visually distinguished from
|
||||||
|
* others in the complete set.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_cache_highlight_ids = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Array
|
* @var Array
|
||||||
@ -75,22 +87,25 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method on {@link Hierarchy} objects which is used to traverse into children relationships.
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public function getChildrenMethod() {
|
public function getChildrenMethod() {
|
||||||
return $this->childrenMethod;
|
return $this->childrenMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method on {@link Hierarchy} objects which is used find the number of children for a parent page
|
|
||||||
*/
|
|
||||||
public function getNumChildrenMethod() {
|
public function getNumChildrenMethod() {
|
||||||
return $this->numChildrenMethod;
|
return $this->numChildrenMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPageClasses($page) {
|
||||||
|
if($this->_cache_ids === NULL) {
|
||||||
|
$this->populateIDs();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If directly selected via filter, apply highlighting
|
||||||
|
if(!empty($this->_cache_highlight_ids[$page->ID])) {
|
||||||
|
return 'filtered-item';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of filtered pages
|
* Gets the list of filtered pages
|
||||||
*
|
*
|
||||||
@ -113,6 +128,7 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
protected function populateIDs() {
|
protected function populateIDs() {
|
||||||
$parents = array();
|
$parents = array();
|
||||||
$this->_cache_ids = array();
|
$this->_cache_ids = array();
|
||||||
|
$this->_cache_highlight_ids = array();
|
||||||
|
|
||||||
if($pages = $this->pagesIncluded()) {
|
if($pages = $this->pagesIncluded()) {
|
||||||
|
|
||||||
@ -121,6 +137,7 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
foreach($pages as $pageArr) {
|
foreach($pages as $pageArr) {
|
||||||
$parents[$pageArr['ParentID']] = true;
|
$parents[$pageArr['ParentID']] = true;
|
||||||
$this->_cache_ids[$pageArr['ID']] = true;
|
$this->_cache_ids[$pageArr['ID']] = true;
|
||||||
|
$this->_cache_highlight_ids[$pageArr['ID']] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(!empty($parents)) {
|
while(!empty($parents)) {
|
||||||
@ -136,17 +153,12 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns TRUE if the given page should be included in the tree.
|
|
||||||
* Caution: Does NOT check view permissions on the page.
|
|
||||||
*
|
|
||||||
* @param SiteTree $page
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
|
||||||
public function isPageIncluded($page) {
|
public function isPageIncluded($page) {
|
||||||
if($this->_cache_ids === NULL) $this->populateIDs();
|
if($this->_cache_ids === NULL) {
|
||||||
|
$this->populateIDs();
|
||||||
|
}
|
||||||
|
|
||||||
return (isset($this->_cache_ids[$page->ID]) && $this->_cache_ids[$page->ID]);
|
return !empty($this->_cache_ids[$page->ID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +215,7 @@ class ContentController extends Controller {
|
|||||||
*/
|
*/
|
||||||
public function httpError($code, $message = null) {
|
public function httpError($code, $message = null) {
|
||||||
// Don't use the HTML response for media requests
|
// Don't use the HTML response for media requests
|
||||||
$response = $this->request->isMedia() ? null : ErrorPage::response_for($code);
|
$response = $this->getRequest()->isMedia() ? null : ErrorPage::response_for($code);
|
||||||
// Failover to $message if the HTML response is unavailable / inappropriate
|
// Failover to $message if the HTML response is unavailable / inappropriate
|
||||||
parent::httpError($code, $response ? $response : $message);
|
parent::httpError($code, $response ? $response : $message);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
* @return SS_HTTPResponse
|
* @return SS_HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
|
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
|
||||||
$this->request = $request;
|
$this->setRequest($request);
|
||||||
$this->setDataModel($model);
|
$this->setDataModel($model);
|
||||||
|
|
||||||
$this->pushCurrent();
|
$this->pushCurrent();
|
||||||
@ -75,7 +75,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
$result = $this->getNestedController();
|
$result = $this->getNestedController();
|
||||||
|
|
||||||
if($result instanceof RequestHandler) {
|
if($result instanceof RequestHandler) {
|
||||||
$result = $result->handleRequest($this->request, $model);
|
$result = $result->handleRequest($this->getRequest(), $model);
|
||||||
} else if(!($result instanceof SS_HTTPResponse)) {
|
} else if(!($result instanceof SS_HTTPResponse)) {
|
||||||
user_error("ModelAsController::getNestedController() returned bad object type '" .
|
user_error("ModelAsController::getNestedController() returned bad object type '" .
|
||||||
get_class($result)."'", E_USER_WARNING);
|
get_class($result)."'", E_USER_WARNING);
|
||||||
@ -93,7 +93,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
* @throws Exception If URLSegment not passed in as a request parameter.
|
* @throws Exception If URLSegment not passed in as a request parameter.
|
||||||
*/
|
*/
|
||||||
public function getNestedController() {
|
public function getNestedController() {
|
||||||
$request = $this->request;
|
$request = $this->getRequest();
|
||||||
|
|
||||||
if(!$URLSegment = $request->param('URLSegment')) {
|
if(!$URLSegment = $request->param('URLSegment')) {
|
||||||
throw new Exception('ModelAsController->getNestedController(): was not passed a URLSegment value.');
|
throw new Exception('ModelAsController->getNestedController(): was not passed a URLSegment value.');
|
||||||
@ -125,7 +125,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
Debug::message("Using record #$sitetree->ID of type $sitetree->class with link {$sitetree->Link()}");
|
Debug::message("Using record #$sitetree->ID of type $sitetree->class with link {$sitetree->Link()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::controller_for($sitetree, $this->request->param('Action'));
|
return self::controller_for($sitetree, $this->getRequest()->param('Action'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,8 +17,8 @@ class ContentControllerSearchExtension extends Extension {
|
|||||||
public function SearchForm() {
|
public function SearchForm() {
|
||||||
$searchText = _t('SearchForm.SEARCH', 'Search');
|
$searchText = _t('SearchForm.SEARCH', 'Search');
|
||||||
|
|
||||||
if($this->owner->request && $this->owner->request->getVar('Search')) {
|
if($this->owner->getRequest() && $this->owner->getRequest()->getVar('Search')) {
|
||||||
$searchText = $this->owner->request->getVar('Search');
|
$searchText = $this->owner->getRequest()->getVar('Search');
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
|
@ -19,7 +19,18 @@ $ExtraTreeTools
|
|||||||
</div>
|
</div>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
<div class="cms-tree" data-url-tree="$LinkWithSearch($Link(getsubtree))" data-url-savetreenode="$Link(savetreenode)" data-url-updatetreenodes="$Link(updatetreenodes)" data-url-addpage="{$LinkPageAdd('AddForm/?action_doAdd=1', 'ParentID=%s&PageType=%s')}" data-url-editpage="$LinkPageEdit('%s')" data-url-duplicate="{$Link('duplicate/%s')}" data-url-duplicatewithchildren="{$Link('duplicatewithchildren/%s')}" data-url-listview="{$Link('?view=list')}" data-hints="$SiteTreeHints.XML" data-childfilter="$Link('childfilter')" data-extra-params="SecurityID=$SecurityID">
|
<div class="cms-tree <% if $TreeIsFiltered %>filtered-list<% end_if %>"
|
||||||
|
data-url-tree="$LinkWithSearch($Link(getsubtree))"
|
||||||
|
data-url-savetreenode="$Link(savetreenode)"
|
||||||
|
data-url-updatetreenodes="$Link(updatetreenodes)"
|
||||||
|
data-url-addpage="{$LinkPageAdd('AddForm/?action_doAdd=1', 'ParentID=%s&PageType=%s')}"
|
||||||
|
data-url-editpage="$LinkPageEdit('%s')"
|
||||||
|
data-url-duplicate="{$Link('duplicate/%s')}"
|
||||||
|
data-url-duplicatewithchildren="{$Link('duplicatewithchildren/%s')}"
|
||||||
|
data-url-listview="{$Link('?view=list')}"
|
||||||
|
data-hints="$SiteTreeHints.XML"
|
||||||
|
data-childfilter="$Link('childfilter')"
|
||||||
|
data-extra-params="SecurityID=$SecurityID">
|
||||||
$SiteTreeAsUL
|
$SiteTreeAsUL
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user