mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Method visibility according to coding conventions
This commit is contained in:
parent
4af60dfee6
commit
df44239060
@ -6,17 +6,17 @@
|
|||||||
* @subpackage batchaction
|
* @subpackage batchaction
|
||||||
*/
|
*/
|
||||||
class CMSBatchAction_Publish extends CMSBatchAction {
|
class CMSBatchAction_Publish extends CMSBatchAction {
|
||||||
function getActionTitle() {
|
public function getActionTitle() {
|
||||||
return _t('CMSBatchActions.PUBLISH_PAGES', 'Publish');
|
return _t('CMSBatchActions.PUBLISH_PAGES', 'Publish');
|
||||||
}
|
}
|
||||||
|
|
||||||
function run(SS_List $pages) {
|
public function run(SS_List $pages) {
|
||||||
return $this->batchaction($pages, 'doPublish',
|
return $this->batchaction($pages, 'doPublish',
|
||||||
_t('CMSBatchActions.PUBLISHED_PAGES', 'Published %d pages, %d failures')
|
_t('CMSBatchActions.PUBLISHED_PAGES', 'Published %d pages, %d failures')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function applicablePages($ids) {
|
public function applicablePages($ids) {
|
||||||
return $this->applicablePagesHelper($ids, 'canPublish', true, false);
|
return $this->applicablePagesHelper($ids, 'canPublish', true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,11 +28,11 @@ class CMSBatchAction_Publish extends CMSBatchAction {
|
|||||||
* @subpackage batchaction
|
* @subpackage batchaction
|
||||||
*/
|
*/
|
||||||
class CMSBatchAction_Unpublish extends CMSBatchAction {
|
class CMSBatchAction_Unpublish extends CMSBatchAction {
|
||||||
function getActionTitle() {
|
public function getActionTitle() {
|
||||||
return _t('CMSBatchActions.UNPUBLISH_PAGES', 'Un-publish');
|
return _t('CMSBatchActions.UNPUBLISH_PAGES', 'Un-publish');
|
||||||
}
|
}
|
||||||
|
|
||||||
function run(SS_List $pages) {
|
public function run(SS_List $pages) {
|
||||||
return $this->batchaction($pages, 'doUnpublish',
|
return $this->batchaction($pages, 'doUnpublish',
|
||||||
_t('CMSBatchActions.UNPUBLISHED_PAGES', 'Un-published %d pages')
|
_t('CMSBatchActions.UNPUBLISHED_PAGES', 'Un-published %d pages')
|
||||||
);
|
);
|
||||||
@ -46,11 +46,11 @@ class CMSBatchAction_Unpublish extends CMSBatchAction {
|
|||||||
* @subpackage batchaction
|
* @subpackage batchaction
|
||||||
*/
|
*/
|
||||||
class CMSBatchAction_Delete extends CMSBatchAction {
|
class CMSBatchAction_Delete extends CMSBatchAction {
|
||||||
function getActionTitle() {
|
public function getActionTitle() {
|
||||||
return _t('CMSBatchActions.DELETE_DRAFT_PAGES', 'Delete from draft site');
|
return _t('CMSBatchActions.DELETE_DRAFT_PAGES', 'Delete from draft site');
|
||||||
}
|
}
|
||||||
|
|
||||||
function run(SS_List $pages) {
|
public function run(SS_List $pages) {
|
||||||
$status = array(
|
$status = array(
|
||||||
'modified'=>array(),
|
'modified'=>array(),
|
||||||
'deleted'=>array(),
|
'deleted'=>array(),
|
||||||
@ -81,7 +81,7 @@ class CMSBatchAction_Delete extends CMSBatchAction {
|
|||||||
return $this->response(_t('CMSBatchActions.DELETED_DRAFT_PAGES', 'Deleted %d pages from draft site, %d failures'), $status);
|
return $this->response(_t('CMSBatchActions.DELETED_DRAFT_PAGES', 'Deleted %d pages from draft site, %d failures'), $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
function applicablePages($ids) {
|
public function applicablePages($ids) {
|
||||||
return $this->applicablePagesHelper($ids, 'canDelete', true, false);
|
return $this->applicablePagesHelper($ids, 'canDelete', true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,12 +93,12 @@ class CMSBatchAction_Delete extends CMSBatchAction {
|
|||||||
* @subpackage batchaction
|
* @subpackage batchaction
|
||||||
*/
|
*/
|
||||||
class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
|
class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
|
||||||
function getActionTitle() {
|
public function getActionTitle() {
|
||||||
return _t('CMSBatchActions.DELETE_PAGES', 'Delete from published site');
|
return _t('CMSBatchActions.DELETE_PAGES', 'Delete from published site');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function run(SS_List $pages) {
|
public function run(SS_List $pages) {
|
||||||
$status = array(
|
$status = array(
|
||||||
'modified'=>array(),
|
'modified'=>array(),
|
||||||
'deleted'=>array()
|
'deleted'=>array()
|
||||||
@ -126,7 +126,7 @@ class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
|
|||||||
return $this->response(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from published site, %d failures'), $status);
|
return $this->response(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from published site, %d failures'), $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
function applicablePages($ids) {
|
public function applicablePages($ids) {
|
||||||
return $this->applicablePagesHelper($ids, 'canDelete', false, true);
|
return $this->applicablePagesHelper($ids, 'canDelete', false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ JS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {
|
public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {
|
||||||
if (!$childrenMethod) $childrenMethod = 'ChildFolders';
|
if (!$childrenMethod) $childrenMethod = 'ChildFolders';
|
||||||
return parent::getSiteTreeFor($className, $rootID, $childrenMethod, $numChildrenMethod, $filterFunction, $minNodeCount);
|
return parent::getSiteTreeFor($className, $rootID, $childrenMethod, $numChildrenMethod, $filterFunction, $minNodeCount);
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ JS
|
|||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
function providePermissions() {
|
public function providePermissions() {
|
||||||
$title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
|
$title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
|
||||||
return array(
|
return array(
|
||||||
"CMS_ACCESS_AssetAdmin" => array(
|
"CMS_ACCESS_AssetAdmin" => array(
|
||||||
|
@ -81,7 +81,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
|
CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
|
||||||
}
|
}
|
||||||
|
|
||||||
function index($request) {
|
public function index($request) {
|
||||||
// In case we're not showing a specific record, explicitly remove any session state,
|
// In case we're not showing a specific record, explicitly remove any session state,
|
||||||
// to avoid it being highlighted in the tree, and causing an edit form to show.
|
// to avoid it being highlighted in the tree, and causing an edit form to show.
|
||||||
if(!$request->param('Action')) $this->setCurrentPageId(null);
|
if(!$request->param('Action')) $this->setCurrentPageId(null);
|
||||||
@ -104,7 +104,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function ShowSwitchView() {
|
public function ShowSwitchView() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
* Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able
|
* Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able
|
||||||
* to switch view also for archived versions.
|
* to switch view also for archived versions.
|
||||||
*/
|
*/
|
||||||
function SwitchView($page = null) {
|
public function SwitchView($page = null) {
|
||||||
if(!$page) {
|
if(!$page) {
|
||||||
$page = $this->currentPage();
|
$page = $this->currentPage();
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
function LinkPageAdd($extraArguments = null) {
|
public function LinkPageAdd($extraArguments = null) {
|
||||||
$link = singleton("CMSPageAddController")->Link();
|
$link = singleton("CMSPageAddController")->Link();
|
||||||
$this->extend('updateLinkPageAdd', $link);
|
$this->extend('updateLinkPageAdd', $link);
|
||||||
if($extraArguments) $link = Controller::join_links ($link, $extraArguments);
|
if($extraArguments) $link = Controller::join_links ($link, $extraArguments);
|
||||||
@ -245,7 +245,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SearchForm() {
|
public function SearchForm() {
|
||||||
// get all page types in a dropdown-compatible format
|
// get all page types in a dropdown-compatible format
|
||||||
$pageTypeClasses = SiteTree::page_type_classes();
|
$pageTypeClasses = SiteTree::page_type_classes();
|
||||||
$pageTypes = array();
|
$pageTypes = array();
|
||||||
@ -313,7 +313,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSearch($data, $form) {
|
public function doSearch($data, $form) {
|
||||||
return $this->getsubtree($this->request);
|
return $this->getsubtree($this->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,13 +993,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
function publish($data, $form) {
|
public function publish($data, $form) {
|
||||||
$data['publish'] = '1';
|
$data['publish'] = '1';
|
||||||
|
|
||||||
return $this->save($data, $form);
|
return $this->save($data, $form);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unpublish($data, $form) {
|
public function unpublish($data, $form) {
|
||||||
$className = $this->stat('tree_class');
|
$className = $this->stat('tree_class');
|
||||||
$record = DataObject::get_by_id($className, $data['ID']);
|
$record = DataObject::get_by_id($className, $data['ID']);
|
||||||
|
|
||||||
@ -1019,7 +1019,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
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->request->param('VersionID')
|
||||||
@ -1034,7 +1034,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @return html
|
* @return html
|
||||||
*/
|
*/
|
||||||
function doRollback($data, $form) {
|
public function doRollback($data, $form) {
|
||||||
$this->extend('onBeforeRollback', $data['ID']);
|
$this->extend('onBeforeRollback', $data['ID']);
|
||||||
|
|
||||||
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
|
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
|
||||||
@ -1074,11 +1074,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
/**
|
/**
|
||||||
* Batch Actions Handler
|
* Batch Actions Handler
|
||||||
*/
|
*/
|
||||||
function batchactions() {
|
public function batchactions() {
|
||||||
return new CMSBatchActionHandler($this, 'batchactions');
|
return new CMSBatchActionHandler($this, 'batchactions');
|
||||||
}
|
}
|
||||||
|
|
||||||
function BatchActionParameters() {
|
public function BatchActionParameters() {
|
||||||
$batchActions = CMSBatchActionHandler::$batch_actions;
|
$batchActions = CMSBatchActionHandler::$batch_actions;
|
||||||
|
|
||||||
$forms = array();
|
$forms = array();
|
||||||
@ -1101,11 +1101,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
/**
|
/**
|
||||||
* Returns a list of batch actions
|
* Returns a list of batch actions
|
||||||
*/
|
*/
|
||||||
function BatchActionList() {
|
public function BatchActionList() {
|
||||||
return $this->batchactions()->batchActionList();
|
return $this->batchactions()->batchActionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildbrokenlinks($request) {
|
public function buildbrokenlinks($request) {
|
||||||
// Protect against CSRF on destructive action
|
// Protect against CSRF on destructive action
|
||||||
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
|
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
|
||||||
|
|
||||||
@ -1141,7 +1141,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function publishall($request) {
|
public function publishall($request) {
|
||||||
if(!Permission::check('ADMIN')) return Security::permissionFailure($this);
|
if(!Permission::check('ADMIN')) return Security::permissionFailure($this);
|
||||||
|
|
||||||
increase_time_limit_to();
|
increase_time_limit_to();
|
||||||
@ -1198,7 +1198,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
/**
|
/**
|
||||||
* Restore a completely deleted page from the SiteTree_versions table.
|
* Restore a completely deleted page from the SiteTree_versions table.
|
||||||
*/
|
*/
|
||||||
function restore($data, $form) {
|
public function restore($data, $form) {
|
||||||
if(!isset($data['ID']) || !is_numeric($data['ID'])) {
|
if(!isset($data['ID']) || !is_numeric($data['ID'])) {
|
||||||
return new SS_HTTPResponse("Please pass an ID in the form content", 400);
|
return new SS_HTTPResponse("Please pass an ID in the form content", 400);
|
||||||
}
|
}
|
||||||
@ -1221,7 +1221,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
function duplicate($request) {
|
public function duplicate($request) {
|
||||||
// Protect against CSRF on destructive action
|
// Protect against CSRF on destructive action
|
||||||
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
|
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
|
||||||
|
|
||||||
@ -1247,7 +1247,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function duplicatewithchildren($request) {
|
public function duplicatewithchildren($request) {
|
||||||
// Protect against CSRF on destructive action
|
// Protect against CSRF on destructive action
|
||||||
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
|
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
|
||||||
|
|
||||||
@ -1288,7 +1288,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function providePermissions() {
|
public function providePermissions() {
|
||||||
$title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController'));
|
$title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController'));
|
||||||
return array(
|
return array(
|
||||||
"CMS_ACCESS_CMSMain" => array(
|
"CMS_ACCESS_CMSMain" => array(
|
||||||
|
@ -15,7 +15,7 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
/**
|
/**
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
function AddForm() {
|
public function AddForm() {
|
||||||
$record = $this->currentPage();
|
$record = $this->currentPage();
|
||||||
|
|
||||||
$pageTypes = array();
|
$pageTypes = array();
|
||||||
|
@ -39,7 +39,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function show($request) {
|
public function show($request) {
|
||||||
$form = $this->ShowVersionForm($request->param('VersionID'));
|
$form = $this->ShowVersionForm($request->param('VersionID'));
|
||||||
|
|
||||||
$negotiator = $this->getResponseNegotiator();
|
$negotiator = $this->getResponseNegotiator();
|
||||||
@ -57,7 +57,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function compare($request) {
|
public function compare($request) {
|
||||||
$form = $this->CompareVersionsForm(
|
$form = $this->CompareVersionsForm(
|
||||||
$request->param('VersionID'),
|
$request->param('VersionID'),
|
||||||
$request->param('OtherVersionID')
|
$request->param('OtherVersionID')
|
||||||
@ -88,7 +88,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
*
|
*
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null) {
|
public function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null) {
|
||||||
if(!$id) $id = $this->currentPageID();
|
if(!$id) $id = $this->currentPageID();
|
||||||
|
|
||||||
$record = $this->getRecord($id, $versionID);
|
$record = $this->getRecord($id, $versionID);
|
||||||
@ -178,7 +178,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
*
|
*
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
function VersionsForm() {
|
public function VersionsForm() {
|
||||||
$id = $this->currentPageID();
|
$id = $this->currentPageID();
|
||||||
$page = $this->getRecord($id);
|
$page = $this->getRecord($id);
|
||||||
$versionsHtml = '';
|
$versionsHtml = '';
|
||||||
@ -269,7 +269,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
*
|
*
|
||||||
* @return html
|
* @return html
|
||||||
*/
|
*/
|
||||||
function doCompare($data, $form) {
|
public function doCompare($data, $form) {
|
||||||
$versions = $data['Versions'];
|
$versions = $data['Versions'];
|
||||||
if(count($versions) < 2) return null;
|
if(count($versions) < 2) return null;
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
*
|
*
|
||||||
* @return html
|
* @return html
|
||||||
*/
|
*/
|
||||||
function doShowVersion($data, $form) {
|
public function doShowVersion($data, $form) {
|
||||||
$versionID = null;
|
$versionID = null;
|
||||||
|
|
||||||
if(isset($data['Versions']) && is_array($data['Versions'])) {
|
if(isset($data['Versions']) && is_array($data['Versions'])) {
|
||||||
@ -334,7 +334,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
/**
|
/**
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
function ShowVersionForm($versionID = null) {
|
public function ShowVersionForm($versionID = null) {
|
||||||
if(!$versionID) return null;
|
if(!$versionID) return null;
|
||||||
|
|
||||||
$id = $this->currentPageID();
|
$id = $this->currentPageID();
|
||||||
@ -346,7 +346,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
/**
|
/**
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
function CompareVersionsForm($versionID, $otherVersionID) {
|
public function CompareVersionsForm($versionID, $otherVersionID) {
|
||||||
if($versionID > $otherVersionID) {
|
if($versionID > $otherVersionID) {
|
||||||
$toVersion = $versionID;
|
$toVersion = $versionID;
|
||||||
$fromVersion = $otherVersionID;
|
$fromVersion = $otherVersionID;
|
||||||
|
@ -11,7 +11,7 @@ class CMSPageSettingsController extends CMSMain {
|
|||||||
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
||||||
static $session_namespace = 'CMSMain';
|
static $session_namespace = 'CMSMain';
|
||||||
|
|
||||||
function getEditForm($id = null, $fields = null) {
|
public function getEditForm($id = null, $fields = null) {
|
||||||
$record = $this->getRecord($id ? $id : $this->currentPageID());
|
$record = $this->getRecord($id ? $id : $this->currentPageID());
|
||||||
|
|
||||||
return parent::getEditForm($record, ($record) ? $record->getSettingsFields() : null);
|
return parent::getEditForm($record, ($record) ? $record->getSettingsFields() : null);
|
||||||
|
@ -12,7 +12,7 @@ class CMSPagesController extends CMSMain {
|
|||||||
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
||||||
static $session_namespace = 'CMSMain';
|
static $session_namespace = 'CMSMain';
|
||||||
|
|
||||||
function LinkPreview() {
|
public function LinkPreview() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class CMSSettingsController extends LeftAndMain {
|
|||||||
/**
|
/**
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
function getEditForm($id = null, $fields = null) {
|
public function getEditForm($id = null, $fields = null) {
|
||||||
$siteConfig = SiteConfig::current_site_config();
|
$siteConfig = SiteConfig::current_site_config();
|
||||||
$fields = $siteConfig->getCMSFields();
|
$fields = $siteConfig->getCMSFields();
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class CMSSettingsController extends LeftAndMain {
|
|||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function save_siteconfig($data, $form) {
|
public function save_siteconfig($data, $form) {
|
||||||
$siteConfig = SiteConfig::current_site_config();
|
$siteConfig = SiteConfig::current_site_config();
|
||||||
$form->saveInto($siteConfig);
|
$form->saveInto($siteConfig);
|
||||||
$siteConfig->write();
|
$siteConfig->write();
|
||||||
@ -60,11 +60,11 @@ class CMSSettingsController extends LeftAndMain {
|
|||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
function LinkPreview() {
|
public function LinkPreview() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Breadcrumbs($unlinked = false) {
|
public function Breadcrumbs($unlinked = false) {
|
||||||
$defaultTitle = self::menu_title_for_class(get_class($this));
|
$defaultTitle = self::menu_title_for_class(get_class($this));
|
||||||
return new ArrayList(array(
|
return new ArrayList(array(
|
||||||
new ArrayData(array(
|
new ArrayData(array(
|
||||||
|
@ -36,7 +36,7 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
*/
|
*/
|
||||||
protected $childrenMethod = null;
|
protected $childrenMethod = null;
|
||||||
|
|
||||||
function __construct($params = null) {
|
public function __construct($params = null) {
|
||||||
if($params) $this->params = $params;
|
if($params) $this->params = $params;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -46,14 +46,14 @@ abstract class CMSSiteTreeFilter extends Object {
|
|||||||
* @return String Method on {@link Hierarchy} objects
|
* @return String Method on {@link Hierarchy} objects
|
||||||
* which is used to traverse into children relationships.
|
* which is used to traverse into children relationships.
|
||||||
*/
|
*/
|
||||||
function getChildrenMethod() {
|
public function getChildrenMethod() {
|
||||||
return $this->childrenMethod;
|
return $this->childrenMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Array Map of Page IDs to their respective ParentID values.
|
* @return Array Map of Page IDs to their respective ParentID values.
|
||||||
*/
|
*/
|
||||||
function pagesIncluded() {}
|
public function pagesIncluded() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate the IDs of the pages returned by pagesIncluded(), also including
|
* Populate the IDs of the pages returned by pagesIncluded(), also including
|
||||||
@ -116,11 +116,11 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter {
|
|||||||
|
|
||||||
protected $childrenMethod = "AllHistoricalChildren";
|
protected $childrenMethod = "AllHistoricalChildren";
|
||||||
|
|
||||||
static function title() {
|
static public function title() {
|
||||||
return _t('CMSSiteTreeFilter_DeletedPages.Title', "All pages, including deleted");
|
return _t('CMSSiteTreeFilter_DeletedPages.Title', "All pages, including deleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
function pagesIncluded() {
|
public function pagesIncluded() {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
// TODO Not very memory efficient, but usually not very many deleted pages exist
|
// TODO Not very memory efficient, but usually not very many deleted pages exist
|
||||||
$pages = Versioned::get_including_deleted('SiteTree');
|
$pages = Versioned::get_including_deleted('SiteTree');
|
||||||
@ -139,11 +139,11 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter {
|
|||||||
*/
|
*/
|
||||||
class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
|
class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
|
||||||
|
|
||||||
static function title() {
|
static public function title() {
|
||||||
return _t('CMSSiteTreeFilter_ChangedPages.Title', "Changed pages");
|
return _t('CMSSiteTreeFilter_ChangedPages.Title', "Changed pages");
|
||||||
}
|
}
|
||||||
|
|
||||||
function pagesIncluded() {
|
public function pagesIncluded() {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
$q = new SQLQuery();
|
$q = new SQLQuery();
|
||||||
$q->setSelect(array('"SiteTree"."ID"','"SiteTree"."ParentID"'))
|
$q->setSelect(array('"SiteTree"."ID"','"SiteTree"."ParentID"'))
|
||||||
@ -165,7 +165,7 @@ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
|
|||||||
*/
|
*/
|
||||||
class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter {
|
class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter {
|
||||||
|
|
||||||
static function title() {
|
static public function title() {
|
||||||
return _t('CMSSiteTreeFilter_Search.Title', "All pages");
|
return _t('CMSSiteTreeFilter_Search.Title', "All pages");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class ContentController extends Controller {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function project() {
|
public function project() {
|
||||||
global $project;
|
global $project;
|
||||||
return $project;
|
return $project;
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ HTML;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SiteConfig() {
|
public function SiteConfig() {
|
||||||
if(method_exists($this->dataRecord, 'getSiteConfig')) {
|
if(method_exists($this->dataRecord, 'getSiteConfig')) {
|
||||||
return $this->dataRecord->getSiteConfig();
|
return $this->dataRecord->getSiteConfig();
|
||||||
} else {
|
} else {
|
||||||
@ -347,7 +347,7 @@ HTML;
|
|||||||
* @deprecated 2.5 Use ContentLocale() instead and write attribute names suitable to XHTML/HTML
|
* @deprecated 2.5 Use ContentLocale() instead and write attribute names suitable to XHTML/HTML
|
||||||
* templates directly in the template.
|
* templates directly in the template.
|
||||||
*/
|
*/
|
||||||
function LangAttributes() {
|
public function LangAttributes() {
|
||||||
Deprecation::notice('2.5', 'Use ContentLocale() instead and write attribute names suitable to XHTML/HTML instead.');
|
Deprecation::notice('2.5', 'Use ContentLocale() instead and write attribute names suitable to XHTML/HTML instead.');
|
||||||
$locale = $this->ContentLocale();
|
$locale = $this->ContentLocale();
|
||||||
return "xml:lang=\"$locale\" lang=\"$locale\"";
|
return "xml:lang=\"$locale\" lang=\"$locale\"";
|
||||||
@ -364,7 +364,7 @@ HTML;
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ContentLocale() {
|
public function ContentLocale() {
|
||||||
if($this->dataRecord && $this->dataRecord->hasExtension('Translatable')) {
|
if($this->dataRecord && $this->dataRecord->hasExtension('Translatable')) {
|
||||||
$locale = $this->dataRecord->Locale;
|
$locale = $this->dataRecord->Locale;
|
||||||
} elseif(class_exists('Translatable') && Object::has_extension('SiteTree', 'Translatable')) {
|
} elseif(class_exists('Translatable') && Object::has_extension('SiteTree', 'Translatable')) {
|
||||||
@ -379,7 +379,7 @@ HTML;
|
|||||||
/**
|
/**
|
||||||
* This action is called by the installation system
|
* This action is called by the installation system
|
||||||
*/
|
*/
|
||||||
function successfullyinstalled() {
|
public function successfullyinstalled() {
|
||||||
// The manifest should be built by now, so it's safe to publish the 404 page
|
// The manifest should be built by now, so it's safe to publish the 404 page
|
||||||
$fourohfour = Versioned::get_one_by_stage('ErrorPage', 'Stage', '"ErrorCode" = 404');
|
$fourohfour = Versioned::get_one_by_stage('ErrorPage', 'Stage', '"ErrorCode" = 404');
|
||||||
if($fourohfour) {
|
if($fourohfour) {
|
||||||
@ -406,7 +406,7 @@ HTML;
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteinstallfiles() {
|
public function deleteinstallfiles() {
|
||||||
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
|
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
|
||||||
|
|
||||||
$title = new Varchar("Title");
|
$title = new Varchar("Title");
|
||||||
|
@ -16,7 +16,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @return ContentController
|
* @return ContentController
|
||||||
*/
|
*/
|
||||||
public static function controller_for(SiteTree $sitetree, $action = null) {
|
static public function controller_for(SiteTree $sitetree, $action = null) {
|
||||||
if($sitetree->class == 'SiteTree') $controller = "ContentController";
|
if($sitetree->class == 'SiteTree') $controller = "ContentController";
|
||||||
else $controller = "{$sitetree->class}_Controller";
|
else $controller = "{$sitetree->class}_Controller";
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
* @param int $parentID The ID of the parent of the page the URLSegment belongs to.
|
* @param int $parentID The ID of the parent of the page the URLSegment belongs to.
|
||||||
* @return SiteTree
|
* @return SiteTree
|
||||||
*/
|
*/
|
||||||
static function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) {
|
static public function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) {
|
||||||
$URLSegment = Convert::raw2sql(rawurlencode($URLSegment));
|
$URLSegment = Convert::raw2sql(rawurlencode($URLSegment));
|
||||||
|
|
||||||
$useParentIDFilter = SiteTree::nested_urls() && $parentID;
|
$useParentIDFilter = SiteTree::nested_urls() && $parentID;
|
||||||
|
@ -63,7 +63,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
* @param Member $member
|
* @param Member $member
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
if(!$member && $member !== FALSE) $member = Member::currentUser();
|
if(!$member && $member !== FALSE) $member = Member::currentUser();
|
||||||
|
|
||||||
if(!parent::canView($member)) return false;
|
if(!parent::canView($member)) return false;
|
||||||
@ -101,7 +101,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function has_reports() {
|
static public function has_reports() {
|
||||||
return sizeof(SS_Report::get_reports()) > 0;
|
return sizeof(SS_Report::get_reports()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
function providePermissions() {
|
public function providePermissions() {
|
||||||
$title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
|
$title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
|
||||||
return array(
|
return array(
|
||||||
"CMS_ACCESS_ReportAdmin" => array(
|
"CMS_ACCESS_ReportAdmin" => array(
|
||||||
|
@ -26,7 +26,7 @@ class RootURLController extends Controller {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function get_homepage_link() {
|
static public function get_homepage_link() {
|
||||||
if(!self::$cached_homepage_link) {
|
if(!self::$cached_homepage_link) {
|
||||||
// TODO Move to 'homepagefordomain' module
|
// TODO Move to 'homepagefordomain' module
|
||||||
if(class_exists('HomepageForDomainExtension')) {
|
if(class_exists('HomepageForDomainExtension')) {
|
||||||
@ -63,7 +63,7 @@ class RootURLController extends Controller {
|
|||||||
*
|
*
|
||||||
* @param string $urlsegment the URL segment for your home page
|
* @param string $urlsegment the URL segment for your home page
|
||||||
*/
|
*/
|
||||||
public static function set_default_homepage_link($urlsegment = "home") {
|
static public function set_default_homepage_link($urlsegment = "home") {
|
||||||
self::$default_homepage_link = $urlsegment;
|
self::$default_homepage_link = $urlsegment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class RootURLController extends Controller {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function get_default_homepage_link() {
|
static public function get_default_homepage_link() {
|
||||||
return self::$default_homepage_link;
|
return self::$default_homepage_link;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class RootURLController extends Controller {
|
|||||||
* @param SiteTree $page
|
* @param SiteTree $page
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function should_be_on_root(SiteTree $page) {
|
static public function should_be_on_root(SiteTree $page) {
|
||||||
if(!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/')) {
|
if(!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/')) {
|
||||||
return !(
|
return !(
|
||||||
class_exists('Translatable') && $page->hasExtension('Translatable') && $page->Locale && $page->Locale != Translatable::default_locale()
|
class_exists('Translatable') && $page->hasExtension('Translatable') && $page->Locale && $page->Locale != Translatable::default_locale()
|
||||||
@ -96,7 +96,7 @@ class RootURLController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* Resets the cached homepage link value - useful for testing.
|
* Resets the cached homepage link value - useful for testing.
|
||||||
*/
|
*/
|
||||||
public static function reset() {
|
static public function reset() {
|
||||||
self::$cached_homepage_link = null;
|
self::$cached_homepage_link = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class SilverStripeNavigator extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* @param DataObject
|
* @param DataObject
|
||||||
*/
|
*/
|
||||||
function __construct($record) {
|
public function __construct($record) {
|
||||||
if(!in_array('CMSPreviewable', class_implements($record))) {
|
if(!in_array('CMSPreviewable', class_implements($record))) {
|
||||||
throw new InvalidArgumentException('SilverStripeNavigator: Record of type %s doesn\'t implement CMSPreviewable', get_class($record));
|
throw new InvalidArgumentException('SilverStripeNavigator: Record of type %s doesn\'t implement CMSPreviewable', get_class($record));
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ class SilverStripeNavigator extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* @return SS_List of SilverStripeNavigatorItem
|
* @return SS_List of SilverStripeNavigatorItem
|
||||||
*/
|
*/
|
||||||
function getItems() {
|
public function getItems() {
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
$classes = ClassInfo::subclassesFor('SilverStripeNavigatorItem');
|
$classes = ClassInfo::subclassesFor('SilverStripeNavigatorItem');
|
||||||
@ -65,7 +65,7 @@ class SilverStripeNavigator extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* @return DataObject
|
* @return DataObject
|
||||||
*/
|
*/
|
||||||
function getRecord() {
|
public function getRecord() {
|
||||||
return $this->record;
|
return $this->record;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class SilverStripeNavigator extends ViewableData {
|
|||||||
* @param DataObject $record
|
* @param DataObject $record
|
||||||
* @return Array template data
|
* @return Array template data
|
||||||
*/
|
*/
|
||||||
static function get_for_record($record) {
|
static public function get_for_record($record) {
|
||||||
$html = '';
|
$html = '';
|
||||||
$message = '';
|
$message = '';
|
||||||
$navigator = new SilverStripeNavigator($record);
|
$navigator = new SilverStripeNavigator($record);
|
||||||
@ -110,7 +110,7 @@ class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* @param DataObject
|
* @param DataObject
|
||||||
*/
|
*/
|
||||||
function __construct($record) {
|
public function __construct($record) {
|
||||||
$this->record = $record;
|
$this->record = $record;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,13 +118,13 @@ class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
* @return String HTML, mostly a link - but can be more complex as well.
|
* @return String HTML, mostly a link - but can be more complex as well.
|
||||||
* For example, a "future state" item might show a date selector.
|
* For example, a "future state" item might show a date selector.
|
||||||
*/
|
*/
|
||||||
function getHTML() {}
|
public function getHTML() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
* Text displayed in watermark
|
* Text displayed in watermark
|
||||||
*/
|
*/
|
||||||
function getWatermark() {}
|
public function getWatermark() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional link to a specific view of this record.
|
* Optional link to a specific view of this record.
|
||||||
@ -133,24 +133,24 @@ class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function getLink() {}
|
public function getLink() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function getMessage() {}
|
public function getMessage() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DataObject
|
* @return DataObject
|
||||||
*/
|
*/
|
||||||
function getRecord() {
|
public function getRecord() {
|
||||||
return $this->record;
|
return $this->record;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Int
|
* @return Int
|
||||||
*/
|
*/
|
||||||
function getPriority() {
|
public function getPriority() {
|
||||||
return $this->stat('priority');
|
return $this->stat('priority');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isActive() {
|
public function isActive() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
* @param Member
|
* @param Member
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
|
class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
|
||||||
static $priority = 10;
|
static $priority = 10;
|
||||||
|
|
||||||
function getHTML() {
|
public function getHTML() {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%s">%s</a>',
|
||||||
$this->record->CMSEditLink(),
|
$this->record->CMSEditLink(),
|
||||||
@ -191,15 +191,15 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink() {
|
public function getLink() {
|
||||||
return $this->record->CMSEditLink();
|
return $this->record->CMSEditLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive() {
|
public function isActive() {
|
||||||
return (Controller::curr() instanceof CMSMain);
|
return (Controller::curr() instanceof CMSMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
// Don't show in CMS
|
// Don't show in CMS
|
||||||
return !(Controller::curr() instanceof CMSMain);
|
return !(Controller::curr() instanceof CMSMain);
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
|
|||||||
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
||||||
static $priority = 20;
|
static $priority = 20;
|
||||||
|
|
||||||
function getHTML() {
|
public function getHTML() {
|
||||||
$draftPage = $this->getDraftPage();
|
$draftPage = $this->getDraftPage();
|
||||||
if($draftPage) {
|
if($draftPage) {
|
||||||
$this->recordLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage");
|
$this->recordLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage");
|
||||||
@ -221,23 +221,23 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWatermark() {
|
public function getWatermark() {
|
||||||
return _t('ContentController.DRAFTSITE');
|
return _t('ContentController.DRAFTSITE');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessage() {
|
public function getMessage() {
|
||||||
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</div>";
|
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink() {
|
public function getLink() {
|
||||||
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
|
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
|
||||||
}
|
}
|
||||||
|
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
|
return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive() {
|
public function isActive() {
|
||||||
return (
|
return (
|
||||||
Versioned::current_stage() == 'Stage'
|
Versioned::current_stage() == 'Stage'
|
||||||
&& !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime())
|
&& !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime())
|
||||||
@ -261,7 +261,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
|||||||
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
||||||
static $priority = 30;
|
static $priority = 30;
|
||||||
|
|
||||||
function getHTML() {
|
public function getHTML() {
|
||||||
$livePage = $this->getLivePage();
|
$livePage = $this->getLivePage();
|
||||||
if($livePage) {
|
if($livePage) {
|
||||||
$this->recordLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live");
|
$this->recordLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live");
|
||||||
@ -269,23 +269,23 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWatermark() {
|
public function getWatermark() {
|
||||||
return _t('ContentController.PUBLISHEDSITE');
|
return _t('ContentController.PUBLISHEDSITE');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessage() {
|
public function getMessage() {
|
||||||
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</div>";
|
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink() {
|
public function getLink() {
|
||||||
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
|
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
|
||||||
}
|
}
|
||||||
|
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return ($this->record->hasExtension('Versioned') && $this->getLivePage());
|
return ($this->record->hasExtension('Versioned') && $this->getLivePage());
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive() {
|
public function isActive() {
|
||||||
return (!Versioned::current_stage() || Versioned::current_stage() == 'Live');
|
return (!Versioned::current_stage() || Versioned::current_stage() == 'Live');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,12 +306,12 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
|||||||
class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
||||||
static $priority = 40;
|
static $priority = 40;
|
||||||
|
|
||||||
function getHTML() {
|
public function getHTML() {
|
||||||
$this->recordLink = $this->record->AbsoluteLink();
|
$this->recordLink = $this->record->AbsoluteLink();
|
||||||
return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
|
return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessage() {
|
public function getMessage() {
|
||||||
if($date = Versioned::current_archived_date()) {
|
if($date = Versioned::current_archived_date()) {
|
||||||
$dateObj = Datetime::create();
|
$dateObj = Datetime::create();
|
||||||
$dateObj->setValue($date);
|
$dateObj->setValue($date);
|
||||||
@ -319,15 +319,15 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink() {
|
public function getLink() {
|
||||||
return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited;
|
return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return ($this->record->hasExtension('Versioned') && $this->isArchived());
|
return ($this->record->hasExtension('Versioned') && $this->isArchived());
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive() {
|
public function isActive() {
|
||||||
return (Versioned::current_archived_date());
|
return (Versioned::current_archived_date());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isArchived() {
|
public function isArchived() {
|
||||||
if(!$this->record->hasExtension('Versioned')) return false;
|
if(!$this->record->hasExtension('Versioned')) return false;
|
||||||
|
|
||||||
$baseTable = ClassInfo::baseDataClass($this->record->class);
|
$baseTable = ClassInfo::baseDataClass($this->record->class);
|
||||||
|
@ -27,7 +27,7 @@ class StaticExporter extends Controller {
|
|||||||
'export',
|
'export',
|
||||||
);
|
);
|
||||||
|
|
||||||
function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
@ -35,16 +35,16 @@ class StaticExporter extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Link($action = null) {
|
public function Link($action = null) {
|
||||||
return "StaticExporter/$action";
|
return "StaticExporter/$action";
|
||||||
}
|
}
|
||||||
|
|
||||||
function index() {
|
public function index() {
|
||||||
echo "<h1>"._t('StaticExporter.NAME','Static exporter')."</h1>";
|
echo "<h1>"._t('StaticExporter.NAME','Static exporter')."</h1>";
|
||||||
echo $this->StaticExportForm()->forTemplate();
|
echo $this->StaticExportForm()->forTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function StaticExportForm() {
|
public function StaticExportForm() {
|
||||||
return new Form($this, 'StaticExportForm', new FieldList(
|
return new Form($this, 'StaticExportForm', new FieldList(
|
||||||
// new TextField('folder', _t('StaticExporter.FOLDEREXPORT','Folder to export to')),
|
// new TextField('folder', _t('StaticExporter.FOLDEREXPORT','Folder to export to')),
|
||||||
new TextField('baseurl', _t('StaticExporter.BASEURL','Base URL'))
|
new TextField('baseurl', _t('StaticExporter.BASEURL','Base URL'))
|
||||||
@ -53,7 +53,7 @@ class StaticExporter extends Controller {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function export() {
|
public function export() {
|
||||||
// specify custom baseurl for publishing to other webroot
|
// specify custom baseurl for publishing to other webroot
|
||||||
if(isset($_REQUEST['baseurl'])) {
|
if(isset($_REQUEST['baseurl'])) {
|
||||||
$base = $_REQUEST['baseurl'];
|
$base = $_REQUEST['baseurl'];
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
class FileList extends TableListField {
|
class FileList extends TableListField {
|
||||||
// bdc: added sort by Title as default behaviour
|
// bdc: added sort by Title as default behaviour
|
||||||
protected $folder;
|
protected $folder;
|
||||||
function __construct($name, $folder) {
|
public function __construct($name, $folder) {
|
||||||
$this->folder = $folder;
|
$this->folder = $folder;
|
||||||
parent::__construct($name, "File", array("Title" => "Title", "LinkedURL" => "URL"), "", "Title");
|
parent::__construct($name, "File", array("Title" => "Title", "LinkedURL" => "URL"), "", "Title");
|
||||||
$this->Markable = true;
|
$this->Markable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sourceItems() {
|
public function sourceItems() {
|
||||||
return DataObject::get("File", "\"ParentID\" = '" . $this->folder->ID . "' AND \"ClassName\" <> 'Folder'", '"Title"');
|
return DataObject::get("File", "\"ParentID\" = '" . $this->folder->ID . "' AND \"ClassName\" <> 'Folder'", '"Title"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,16 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
'suggest'
|
'suggest'
|
||||||
);
|
);
|
||||||
|
|
||||||
function Value() {
|
public function Value() {
|
||||||
return rawurldecode($this->value);
|
return rawurldecode($this->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Field($properties = array()) {
|
public function Field($properties = array()) {
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/SiteTreeURLSegmentField.js');
|
Requirements::javascript(CMS_DIR . '/javascript/SiteTreeURLSegmentField.js');
|
||||||
return parent::Field($properties);
|
return parent::Field($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
function suggest($request) {
|
public function suggest($request) {
|
||||||
if(!$request->getVar('value')) return $this->httpError(405);
|
if(!$request->getVar('value')) return $this->httpError(405);
|
||||||
$page = $this->getPage();
|
$page = $this->getPage();
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
/**
|
/**
|
||||||
* @return SiteTree
|
* @return SiteTree
|
||||||
*/
|
*/
|
||||||
function getPage() {
|
public function getPage() {
|
||||||
$idField = $this->getForm()->Fields()->dataFieldByName('ID');
|
$idField = $this->getForm()->Fields()->dataFieldByName('ID');
|
||||||
return ($idField && $idField->Value()) ? DataObject::get_by_id('SiteTree', $idField->Value()) : singleton('SiteTree');
|
return ($idField && $idField->Value()) ? DataObject::get_by_id('SiteTree', $idField->Value()) : singleton('SiteTree');
|
||||||
}
|
}
|
||||||
@ -57,14 +57,14 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
/**
|
/**
|
||||||
* @param string the secondary text to show
|
* @param string the secondary text to show
|
||||||
*/
|
*/
|
||||||
function setHelpText($string){
|
public function setHelpText($string){
|
||||||
$this->helpText = $string;
|
$this->helpText = $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string the secondary text to show in the template
|
* @return string the secondary text to show in the template
|
||||||
*/
|
*/
|
||||||
function getHelpText(){
|
public function getHelpText(){
|
||||||
return $this->helpText;
|
return $this->helpText;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -72,19 +72,19 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
/**
|
/**
|
||||||
* @param the url that prefixes the page url segment field
|
* @param the url that prefixes the page url segment field
|
||||||
*/
|
*/
|
||||||
function setURLPrefix($url){
|
public function setURLPrefix($url){
|
||||||
$this->urlPrefix = $url;
|
$this->urlPrefix = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the url prefixes the page url segment field to show in template
|
* @return the url prefixes the page url segment field to show in template
|
||||||
*/
|
*/
|
||||||
function getURLPrefix(){
|
public function getURLPrefix(){
|
||||||
return $this->urlPrefix;
|
return $this->urlPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Type() {
|
public function Type() {
|
||||||
return 'text urlsegment';
|
return 'text urlsegment';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@ interface CurrentPageIdentifier {
|
|||||||
* Get the current page ID.
|
* Get the current page ID.
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function currentPageID();
|
public function currentPageID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given DataObject is the current page.
|
* Check if the given DataObject is the current page.
|
||||||
* @param DataObject $page The page to check.
|
* @param DataObject $page The page to check.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isCurrentPage(DataObject $page);
|
public function isCurrentPage(DataObject $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class ErrorPage extends Page {
|
|||||||
* @param int $statusCode
|
* @param int $statusCode
|
||||||
* @return SS_HTTPResponse
|
* @return SS_HTTPResponse
|
||||||
*/
|
*/
|
||||||
public static function response_for($statusCode) {
|
static public function response_for($statusCode) {
|
||||||
// first attempt to dynamically generate the error page
|
// first attempt to dynamically generate the error page
|
||||||
if($errorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = $statusCode")) {
|
if($errorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = $statusCode")) {
|
||||||
return ModelAsController::controller_for($errorPage)->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
|
return ModelAsController::controller_for($errorPage)->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
|
||||||
@ -64,7 +64,7 @@ class ErrorPage extends Page {
|
|||||||
* ErrorPage with a 404 and 500 error code. If there
|
* ErrorPage with a 404 and 500 error code. If there
|
||||||
* is not, one is created when the DB is built.
|
* is not, one is created when the DB is built.
|
||||||
*/
|
*/
|
||||||
function requireDefaultRecords() {
|
public function requireDefaultRecords() {
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
if ($this->class == 'ErrorPage' && SiteTree::get_create_default_pages()) {
|
if ($this->class == 'ErrorPage' && SiteTree::get_create_default_pages()) {
|
||||||
@ -131,7 +131,7 @@ class ErrorPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCMSFields() {
|
public function getCMSFields() {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$fields->addFieldToTab(
|
$fields->addFieldToTab(
|
||||||
@ -179,7 +179,7 @@ class ErrorPage extends Page {
|
|||||||
* @param string $toStage Place to copy to. Must be a stage name.
|
* @param string $toStage Place to copy to. Must be a stage name.
|
||||||
* @param boolean $createNewVersion Set this to true to create a new version number. By default, the existing version number will be copied over.
|
* @param boolean $createNewVersion Set this to true to create a new version number. By default, the existing version number will be copied over.
|
||||||
*/
|
*/
|
||||||
function doPublish() {
|
public function doPublish() {
|
||||||
parent::doPublish();
|
parent::doPublish();
|
||||||
|
|
||||||
// Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
|
// Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
|
||||||
@ -221,7 +221,7 @@ class ErrorPage extends Page {
|
|||||||
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
|
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fieldLabels($includerelations = true) {
|
public function fieldLabels($includerelations = true) {
|
||||||
$labels = parent::fieldLabels($includerelations);
|
$labels = parent::fieldLabels($includerelations);
|
||||||
$labels['ErrorCode'] = _t('ErrorPage.CODE', "Error code");
|
$labels['ErrorCode'] = _t('ErrorPage.CODE', "Error code");
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ class ErrorPage extends Page {
|
|||||||
* @param String $locale A locale, e.g. 'de_DE' (Optional)
|
* @param String $locale A locale, e.g. 'de_DE' (Optional)
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
static function get_filepath_for_errorcode($statusCode, $locale = null) {
|
static public function get_filepath_for_errorcode($statusCode, $locale = null) {
|
||||||
if (singleton('ErrorPage')->hasMethod('alternateFilepathForErrorcode')) {
|
if (singleton('ErrorPage')->hasMethod('alternateFilepathForErrorcode')) {
|
||||||
return singleton('ErrorPage')-> alternateFilepathForErrorcode($statusCode, $locale);
|
return singleton('ErrorPage')-> alternateFilepathForErrorcode($statusCode, $locale);
|
||||||
}
|
}
|
||||||
@ -253,14 +253,14 @@ class ErrorPage extends Page {
|
|||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
*/
|
*/
|
||||||
static function set_static_filepath($path) {
|
static public function set_static_filepath($path) {
|
||||||
self::$static_filepath = $path;
|
self::$static_filepath = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function get_static_filepath() {
|
static public function get_static_filepath() {
|
||||||
return self::$static_filepath;
|
return self::$static_filepath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ class ErrorPage extends Page {
|
|||||||
* @package cms
|
* @package cms
|
||||||
*/
|
*/
|
||||||
class ErrorPage_Controller extends Page_Controller {
|
class ErrorPage_Controller extends Page_Controller {
|
||||||
function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
$action = $this->request->param('Action');
|
$action = $this->request->param('Action');
|
||||||
|
@ -30,7 +30,7 @@ class RedirectorPage extends Page {
|
|||||||
* returns the target page.
|
* returns the target page.
|
||||||
* @return SiteTree
|
* @return SiteTree
|
||||||
*/
|
*/
|
||||||
function ContentSource() {
|
public function ContentSource() {
|
||||||
if($this->RedirectionType == 'Internal') {
|
if($this->RedirectionType == 'Internal') {
|
||||||
return $this->LinkTo();
|
return $this->LinkTo();
|
||||||
} else {
|
} else {
|
||||||
@ -44,7 +44,7 @@ class RedirectorPage extends Page {
|
|||||||
* destination, to prevent unnecessary 30x redirections. However, if it's misconfigured, then
|
* destination, to prevent unnecessary 30x redirections. However, if it's misconfigured, then
|
||||||
* it will return a link to itself, which will then display an error message.
|
* it will return a link to itself, which will then display an error message.
|
||||||
*/
|
*/
|
||||||
function Link() {
|
public function Link() {
|
||||||
if($link = $this->redirectionLink()) return $link;
|
if($link = $this->redirectionLink()) return $link;
|
||||||
else return $this->regularLink();
|
else return $this->regularLink();
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class RedirectorPage extends Page {
|
|||||||
* Return the normal link directly to this page. Once you visit this link, a 30x redirection
|
* Return the normal link directly to this page. Once you visit this link, a 30x redirection
|
||||||
* will take you to your final destination.
|
* will take you to your final destination.
|
||||||
*/
|
*/
|
||||||
function regularLink($action = null) {
|
public function regularLink($action = null) {
|
||||||
return parent::Link($action);
|
return parent::Link($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class RedirectorPage extends Page {
|
|||||||
* Return the link that we should redirect to.
|
* Return the link that we should redirect to.
|
||||||
* Only return a value if there is a legal redirection destination.
|
* Only return a value if there is a legal redirection destination.
|
||||||
*/
|
*/
|
||||||
function redirectionLink() {
|
public function redirectionLink() {
|
||||||
if($this->RedirectionType == 'External') {
|
if($this->RedirectionType == 'External') {
|
||||||
if($this->ExternalURL) {
|
if($this->ExternalURL) {
|
||||||
return $this->ExternalURL;
|
return $this->ExternalURL;
|
||||||
@ -90,7 +90,7 @@ class RedirectorPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncLinkTracking() {
|
public function syncLinkTracking() {
|
||||||
if ($this->RedirectionType == 'Internal') {
|
if ($this->RedirectionType == 'Internal') {
|
||||||
if($this->LinkToID) {
|
if($this->LinkToID) {
|
||||||
$this->HasBrokenLink = DataObject::get_by_id('SiteTree', $this->LinkToID) ? false : true;
|
$this->HasBrokenLink = DataObject::get_by_id('SiteTree', $this->LinkToID) ? false : true;
|
||||||
@ -104,7 +104,7 @@ class RedirectorPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeWrite() {
|
public function onBeforeWrite() {
|
||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
|
|
||||||
// Prefix the URL with "http://" if no prefix is found
|
// Prefix the URL with "http://" if no prefix is found
|
||||||
@ -113,7 +113,7 @@ class RedirectorPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCMSFields() {
|
public function getCMSFields() {
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/RedirectorPage.js');
|
Requirements::javascript(CMS_DIR . '/javascript/RedirectorPage.js');
|
||||||
|
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
@ -151,7 +151,7 @@ class RedirectorPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't cache RedirectorPages
|
// Don't cache RedirectorPages
|
||||||
function subPagesToCache() {
|
public function subPagesToCache() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ class RedirectorPage extends Page {
|
|||||||
*/
|
*/
|
||||||
class RedirectorPage_Controller extends Page_Controller {
|
class RedirectorPage_Controller extends Page_Controller {
|
||||||
|
|
||||||
function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
if($link = $this->redirectionLink()) {
|
if($link = $this->redirectionLink()) {
|
||||||
@ -175,7 +175,7 @@ class RedirectorPage_Controller extends Page_Controller {
|
|||||||
/**
|
/**
|
||||||
* If we ever get this far, it means that the redirection failed.
|
* If we ever get this far, it means that the redirection failed.
|
||||||
*/
|
*/
|
||||||
function Content() {
|
public function Content() {
|
||||||
return "<p class=\"message-setupWithoutRedirect\">" .
|
return "<p class=\"message-setupWithoutRedirect\">" .
|
||||||
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
|
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
|
||||||
"</p>";
|
"</p>";
|
||||||
|
@ -24,11 +24,11 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
|
|
||||||
protected static $disabled_themes = array();
|
protected static $disabled_themes = array();
|
||||||
|
|
||||||
public static function disable_theme($theme) {
|
static public function disable_theme($theme) {
|
||||||
self::$disabled_themes[$theme] = $theme;
|
self::$disabled_themes[$theme] = $theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateDefaults()
|
public function populateDefaults()
|
||||||
{
|
{
|
||||||
$this->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
|
$this->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
|
||||||
$this->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here");
|
$this->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here");
|
||||||
@ -43,7 +43,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
*
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
public function getCMSFields() {
|
||||||
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
|
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
|
||||||
|
|
||||||
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
|
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
|
||||||
@ -130,7 +130,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
*
|
*
|
||||||
* @return Fieldset
|
* @return Fieldset
|
||||||
*/
|
*/
|
||||||
function getCMSActions() {
|
public function getCMSActions() {
|
||||||
if (Permission::check('ADMIN') || Permission::check('EDIT_SITECONFIG')) {
|
if (Permission::check('ADMIN') || Permission::check('EDIT_SITECONFIG')) {
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
FormAction::create('save_siteconfig', _t('CMSMain.SAVE','Save'))
|
FormAction::create('save_siteconfig', _t('CMSMain.SAVE','Save'))
|
||||||
@ -148,7 +148,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function CMSEditLink() {
|
public function CMSEditLink() {
|
||||||
return singleton('CMSSettingsController')->Link();
|
return singleton('CMSSettingsController')->Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
*
|
*
|
||||||
* @return SiteConfig
|
* @return SiteConfig
|
||||||
*/
|
*/
|
||||||
static function current_site_config() {
|
static public function current_site_config() {
|
||||||
if ($siteConfig = DataObject::get_one('SiteConfig')) return $siteConfig;
|
if ($siteConfig = DataObject::get_one('SiteConfig')) return $siteConfig;
|
||||||
|
|
||||||
return self::make_site_config();
|
return self::make_site_config();
|
||||||
@ -167,7 +167,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
/**
|
/**
|
||||||
* Setup a default SiteConfig record if none exists
|
* Setup a default SiteConfig record if none exists
|
||||||
*/
|
*/
|
||||||
function requireDefaultRecords() {
|
public function requireDefaultRecords() {
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
$siteConfig = DataObject::get_one('SiteConfig');
|
$siteConfig = DataObject::get_one('SiteConfig');
|
||||||
if(!$siteConfig) {
|
if(!$siteConfig) {
|
||||||
@ -182,7 +182,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
* @param string $locale
|
* @param string $locale
|
||||||
* @return SiteConfig
|
* @return SiteConfig
|
||||||
*/
|
*/
|
||||||
static function make_site_config() {
|
static public function make_site_config() {
|
||||||
$config = SiteConfig::create();
|
$config = SiteConfig::create();
|
||||||
$config->write();
|
$config->write();
|
||||||
return $config;
|
return $config;
|
||||||
@ -236,7 +236,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function providePermissions() {
|
public function providePermissions() {
|
||||||
return array(
|
return array(
|
||||||
'EDIT_SITECONFIG' => array(
|
'EDIT_SITECONFIG' => array(
|
||||||
'name' => _t('SiteConfig.EDIT_PERMISSION', 'Manage site configuration'),
|
'name' => _t('SiteConfig.EDIT_PERMISSION', 'Manage site configuration'),
|
||||||
|
@ -210,14 +210,14 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @param boolean
|
* @param boolean
|
||||||
*/
|
*/
|
||||||
public static function set_enforce_strict_hierarchy($to) {
|
static public function set_enforce_strict_hierarchy($to) {
|
||||||
self::$enforce_strict_hierarchy = $to;
|
self::$enforce_strict_hierarchy = $to;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function get_enforce_strict_hierarchy() {
|
static public function get_enforce_strict_hierarchy() {
|
||||||
return self::$enforce_strict_hierarchy;
|
return self::$enforce_strict_hierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +226,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function nested_urls() {
|
static public function nested_urls() {
|
||||||
return self::$nested_urls;
|
return self::$nested_urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function enable_nested_urls() {
|
static public function enable_nested_urls() {
|
||||||
self::$nested_urls = true;
|
self::$nested_urls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function disable_nested_urls() {
|
static public function disable_nested_urls() {
|
||||||
self::$nested_urls = false;
|
self::$nested_urls = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @param bool $option
|
* @param bool $option
|
||||||
*/
|
*/
|
||||||
public static function set_create_default_pages($option = true) {
|
static public function set_create_default_pages($option = true) {
|
||||||
self::$create_default_pages = $option;
|
self::$create_default_pages = $option;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function get_create_default_pages() {
|
static public function get_create_default_pages() {
|
||||||
return self::$create_default_pages;
|
return self::$create_default_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param bool $cache
|
* @param bool $cache
|
||||||
* @return SiteTree
|
* @return SiteTree
|
||||||
*/
|
*/
|
||||||
public static function get_by_link($link, $cache = true) {
|
static public function get_by_link($link, $cache = true) {
|
||||||
if(trim($link, '/')) {
|
if(trim($link, '/')) {
|
||||||
$link = trim(Director::makeRelative($link), '/');
|
$link = trim(Director::makeRelative($link), '/');
|
||||||
} else {
|
} else {
|
||||||
@ -333,7 +333,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function page_type_classes() {
|
static public function page_type_classes() {
|
||||||
$classes = ClassInfo::getValidSubClasses();
|
$classes = ClassInfo::getValidSubClasses();
|
||||||
|
|
||||||
$baseClassIndex = array_search('SiteTree', $classes);
|
$baseClassIndex = array_search('SiteTree', $classes);
|
||||||
@ -370,7 +370,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function link_shortcode_handler($arguments, $content = null, $parser = null) {
|
static public function link_shortcode_handler($arguments, $content = null, $parser = null) {
|
||||||
if(!isset($arguments['id']) || !is_numeric($arguments['id'])) return;
|
if(!isset($arguments['id']) || !is_numeric($arguments['id'])) return;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -472,7 +472,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function CMSEditLink() {
|
public function CMSEditLink() {
|
||||||
return Controller::join_links(singleton('CMSPageEditController')->Link('show'), $this->ID);
|
return Controller::join_links(singleton('CMSPageEditController')->Link('show'), $this->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param string $seperator Seperating string
|
* @param string $seperator Seperating string
|
||||||
* @return string The resulting string
|
* @return string The resulting string
|
||||||
*/
|
*/
|
||||||
function NestedTitle($level = 2, $separator = " - ") {
|
public function NestedTitle($level = 2, $separator = " - ") {
|
||||||
$item = $this;
|
$item = $this;
|
||||||
while($item && $level > 0) {
|
while($item && $level > 0) {
|
||||||
$parts[] = $item->Title;
|
$parts[] = $item->Title;
|
||||||
@ -713,7 +713,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* Defaults to the currently logged in user.
|
* Defaults to the currently logged in user.
|
||||||
* @return boolean True if the the member is allowed to do the given action.
|
* @return boolean True if the the member is allowed to do the given action.
|
||||||
*/
|
*/
|
||||||
function can($perm, $member = null) {
|
public function can($perm, $member = null) {
|
||||||
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
|
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
|
||||||
$member = Member::currentUserID();
|
$member = Member::currentUserID();
|
||||||
}
|
}
|
||||||
@ -827,7 +827,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param Member $member
|
* @param Member $member
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function canViewStage($stage, $member = null) {
|
public function canViewStage($stage, $member = null) {
|
||||||
if(!$member) $member = Member::currentUser();
|
if(!$member) $member = Member::currentUser();
|
||||||
|
|
||||||
if(
|
if(
|
||||||
@ -990,7 +990,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Stub method to get the site config, provided so it's easy to override
|
* Stub method to get the site config, provided so it's easy to override
|
||||||
*/
|
*/
|
||||||
function getSiteConfig() {
|
public function getSiteConfig() {
|
||||||
|
|
||||||
if($this->hasMethod('alternateSiteConfig')) {
|
if($this->hasMethod('alternateSiteConfig')) {
|
||||||
$altConfig = $this->alternateSiteConfig();
|
$altConfig = $this->alternateSiteConfig();
|
||||||
@ -1003,7 +1003,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* @deprecated 3.0 Use prepopulate_permission_cache() instead (without the extraneous "p" in "prepopulate")
|
* @deprecated 3.0 Use prepopulate_permission_cache() instead (without the extraneous "p" in "prepopulate")
|
||||||
*/
|
*/
|
||||||
static function prepopuplate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
|
static public function prepopuplate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
|
||||||
Deprecation::notice("3.0", "Use prepopulate_permission_cache instead.");
|
Deprecation::notice("3.0", "Use prepopulate_permission_cache instead.");
|
||||||
self::prepopulate_permission_cache($permission, $ids, $batchCallback);
|
self::prepopulate_permission_cache($permission, $ids, $batchCallback);
|
||||||
}
|
}
|
||||||
@ -1017,7 +1017,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param $batchCallBack The function/static method to call to calculate permissions. Defaults
|
* @param $batchCallBack The function/static method to call to calculate permissions. Defaults
|
||||||
* to 'SiteTree::can_(permission)_multiple'
|
* to 'SiteTree::can_(permission)_multiple'
|
||||||
*/
|
*/
|
||||||
static function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
|
static public function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
|
||||||
if(!$batchCallback) $batchCallback = "SiteTree::can_{$permission}_multiple";
|
if(!$batchCallback) $batchCallback = "SiteTree::can_{$permission}_multiple";
|
||||||
|
|
||||||
if(is_callable($batchCallback)) {
|
if(is_callable($batchCallback)) {
|
||||||
@ -1046,7 +1046,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param Boolean $useCached
|
* @param Boolean $useCached
|
||||||
* @return Array An map of {@link SiteTree} ID keys, to boolean values
|
* @return Array An map of {@link SiteTree} ID keys, to boolean values
|
||||||
*/
|
*/
|
||||||
static function batch_permission_check($ids, $memberID, $typeField, $groupJoinTable, $siteConfigMethod, $globalPermission = 'CMS_ACCESS_CMSMain', $useCached = true) {
|
static public function batch_permission_check($ids, $memberID, $typeField, $groupJoinTable, $siteConfigMethod, $globalPermission = 'CMS_ACCESS_CMSMain', $useCached = true) {
|
||||||
// Sanitise the IDs
|
// Sanitise the IDs
|
||||||
$ids = array_filter($ids, 'is_numeric');
|
$ids = array_filter($ids, 'is_numeric');
|
||||||
|
|
||||||
@ -1164,7 +1164,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @return A map where the IDs are keys and the values are booleans stating whether the given
|
* @return A map where the IDs are keys and the values are booleans stating whether the given
|
||||||
* page can be edited.
|
* page can be edited.
|
||||||
*/
|
*/
|
||||||
static function can_edit_multiple($ids, $memberID, $useCached = true) {
|
static public function can_edit_multiple($ids, $memberID, $useCached = true) {
|
||||||
return self::batch_permission_check($ids, $memberID, 'CanEditType', 'SiteTree_EditorGroups', 'canEdit', 'CMS_ACCESS_CMSMain', $useCached);
|
return self::batch_permission_check($ids, $memberID, 'CanEditType', 'SiteTree_EditorGroups', 'canEdit', 'CMS_ACCESS_CMSMain', $useCached);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1173,7 +1173,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param An array of IDs of the SiteTree pages to look up.
|
* @param An array of IDs of the SiteTree pages to look up.
|
||||||
* @param useCached Return values from the permission cache if they exist.
|
* @param useCached Return values from the permission cache if they exist.
|
||||||
*/
|
*/
|
||||||
static function can_delete_multiple($ids, $memberID, $useCached = true) {
|
static public function can_delete_multiple($ids, $memberID, $useCached = true) {
|
||||||
$deletable = array();
|
$deletable = array();
|
||||||
$result = array_fill_keys($ids, false);
|
$result = array_fill_keys($ids, false);
|
||||||
$cacheKey = "delete-$memberID";
|
$cacheKey = "delete-$memberID";
|
||||||
@ -1321,7 +1321,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* records when the database is built, but make sure you call
|
* records when the database is built, but make sure you call
|
||||||
* parent::requireDefaultRecords().
|
* parent::requireDefaultRecords().
|
||||||
*/
|
*/
|
||||||
function requireDefaultRecords() {
|
public function requireDefaultRecords() {
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
// default pages
|
// default pages
|
||||||
@ -1420,7 +1420,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncLinkTracking() {
|
public function syncLinkTracking() {
|
||||||
// Build a list of HTMLText fields
|
// Build a list of HTMLText fields
|
||||||
$allFields = $this->db();
|
$allFields = $this->db();
|
||||||
$htmlFields = array();
|
$htmlFields = array();
|
||||||
@ -1446,7 +1446,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
$this->extend('augmentSyncLinkTracking');
|
$this->extend('augmentSyncLinkTracking');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAfterWrite() {
|
public function onAfterWrite() {
|
||||||
// Need to flush cache to avoid outdated versionnumber references
|
// Need to flush cache to avoid outdated versionnumber references
|
||||||
$this->flushCache();
|
$this->flushCache();
|
||||||
|
|
||||||
@ -1466,7 +1466,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
parent::onAfterWrite();
|
parent::onAfterWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeDelete() {
|
public function onBeforeDelete() {
|
||||||
parent::onBeforeDelete();
|
parent::onBeforeDelete();
|
||||||
|
|
||||||
// If deleting this page, delete all its children.
|
// If deleting this page, delete all its children.
|
||||||
@ -1478,7 +1478,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onAfterDelete() {
|
public function onAfterDelete() {
|
||||||
// Need to flush cache to avoid outdated versionnumber references
|
// Need to flush cache to avoid outdated versionnumber references
|
||||||
$this->flushCache();
|
$this->flushCache();
|
||||||
|
|
||||||
@ -1492,12 +1492,12 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
parent::onAfterDelete();
|
parent::onAfterDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
function flushCache($persistent = true) {
|
public function flushCache($persistent = true) {
|
||||||
parent::flushCache($persistent);
|
parent::flushCache($persistent);
|
||||||
$this->_cache_statusFlags = null;
|
$this->_cache_statusFlags = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate() {
|
public function validate() {
|
||||||
$result = parent::validate();
|
$result = parent::validate();
|
||||||
|
|
||||||
// Allowed children validation
|
// Allowed children validation
|
||||||
@ -1594,7 +1594,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param string $title Page title.
|
* @param string $title Page title.
|
||||||
* @return string Generated url segment
|
* @return string Generated url segment
|
||||||
*/
|
*/
|
||||||
function generateURLSegment($title){
|
public function generateURLSegment($title){
|
||||||
$filter = URLSegmentFilter::create();
|
$filter = URLSegmentFilter::create();
|
||||||
$t = $filter->filter($title);
|
$t = $filter->filter($title);
|
||||||
|
|
||||||
@ -1610,7 +1610,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getStageURLSegment() {
|
public function getStageURLSegment() {
|
||||||
$stageRecord = Versioned::get_one_by_stage(
|
$stageRecord = Versioned::get_one_by_stage(
|
||||||
'SiteTree',
|
'SiteTree',
|
||||||
'Stage',
|
'Stage',
|
||||||
@ -1622,7 +1622,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getLiveURLSegment() {
|
public function getLiveURLSegment() {
|
||||||
$liveRecord = Versioned::get_one_by_stage(
|
$liveRecord = Versioned::get_one_by_stage(
|
||||||
'SiteTree',
|
'SiteTree',
|
||||||
'Live',
|
'Live',
|
||||||
@ -1635,7 +1635,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* Rewrite a file URL on this page, after its been renamed.
|
* Rewrite a file URL on this page, after its been renamed.
|
||||||
* Triggers the onRenameLinkedAsset action on extensions.
|
* Triggers the onRenameLinkedAsset action on extensions.
|
||||||
*/
|
*/
|
||||||
function rewriteFileURL($old, $new) {
|
public function rewriteFileURL($old, $new) {
|
||||||
$fields = $this->inheritedDatabaseFields();
|
$fields = $this->inheritedDatabaseFields();
|
||||||
// Update the content without actually creating a new version
|
// Update the content without actually creating a new version
|
||||||
foreach(array("SiteTree_Live", "SiteTree") as $table) {
|
foreach(array("SiteTree_Live", "SiteTree") as $table) {
|
||||||
@ -1671,7 +1671,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @param $includeVirtuals Set to false to exlcude virtual pages.
|
* @param $includeVirtuals Set to false to exlcude virtual pages.
|
||||||
*/
|
*/
|
||||||
function DependentPages($includeVirtuals = true) {
|
public function DependentPages($includeVirtuals = true) {
|
||||||
if(class_exists('Subsite')) {
|
if(class_exists('Subsite')) {
|
||||||
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
|
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
|
||||||
Subsite::disable_subsite_filter(true);
|
Subsite::disable_subsite_filter(true);
|
||||||
@ -1712,7 +1712,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @param $includeVirtuals Set to false to exlcude virtual pages.
|
* @param $includeVirtuals Set to false to exlcude virtual pages.
|
||||||
*/
|
*/
|
||||||
function DependentPagesCount($includeVirtuals = true) {
|
public function DependentPagesCount($includeVirtuals = true) {
|
||||||
$links = DB::query("SELECT COUNT(*) FROM \"SiteTree_LinkTracking\"
|
$links = DB::query("SELECT COUNT(*) FROM \"SiteTree_LinkTracking\"
|
||||||
INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"SiteTree_LinkTracking\".\"SiteTreeID\"
|
INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"SiteTree_LinkTracking\".\"SiteTreeID\"
|
||||||
WHERE \"ChildID\" = $this->ID ")->value();
|
WHERE \"ChildID\" = $this->ID ")->value();
|
||||||
@ -1734,7 +1734,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Return all virtual pages that link to this page
|
* Return all virtual pages that link to this page
|
||||||
*/
|
*/
|
||||||
function VirtualPages() {
|
public function VirtualPages() {
|
||||||
if(!$this->ID) return null;
|
if(!$this->ID) return null;
|
||||||
if(class_exists('Subsite')) {
|
if(class_exists('Subsite')) {
|
||||||
return Subsite::get_from_all_subsites('VirtualPage', "\"CopyContentFromID\" = " . (int)$this->ID);
|
return Subsite::get_from_all_subsites('VirtualPage', "\"CopyContentFromID\" = " . (int)$this->ID);
|
||||||
@ -1757,7 +1757,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return FieldList The fields to be displayed in the CMS.
|
* @return FieldList The fields to be displayed in the CMS.
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
public function getCMSFields() {
|
||||||
require_once("forms/Form.php");
|
require_once("forms/Form.php");
|
||||||
// Status / message
|
// Status / message
|
||||||
// Create a status message for multiple parents
|
// Create a status message for multiple parents
|
||||||
@ -1914,7 +1914,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
function getSettingsFields() {
|
public function getSettingsFields() {
|
||||||
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
|
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
|
||||||
asort($groupsMap);
|
asort($groupsMap);
|
||||||
|
|
||||||
@ -2015,7 +2015,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
|
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fieldLabels($includerelations = true) {
|
public function fieldLabels($includerelations = true) {
|
||||||
$cacheKey = $this->class . '_' . $includerelations;
|
$cacheKey = $this->class . '_' . $includerelations;
|
||||||
if(!isset(self::$_cache_field_labels[$cacheKey])) {
|
if(!isset(self::$_cache_field_labels[$cacheKey])) {
|
||||||
$labels = parent::fieldLabels($includerelations);
|
$labels = parent::fieldLabels($includerelations);
|
||||||
@ -2062,7 +2062,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* Get the actions available in the CMS for this page - eg Save, Publish.
|
* Get the actions available in the CMS for this page - eg Save, Publish.
|
||||||
* @return FieldList The available actions for this page.
|
* @return FieldList The available actions for this page.
|
||||||
*/
|
*/
|
||||||
function getCMSActions() {
|
public function getCMSActions() {
|
||||||
$minorActions = CompositeField::create()->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
|
$minorActions = CompositeField::create()->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
|
||||||
$actions = new FieldList($minorActions);
|
$actions = new FieldList($minorActions);
|
||||||
|
|
||||||
@ -2150,7 +2150,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @uses SiteTreeExtension->onBeforePublish()
|
* @uses SiteTreeExtension->onBeforePublish()
|
||||||
* @uses SiteTreeExtension->onAfterPublish()
|
* @uses SiteTreeExtension->onAfterPublish()
|
||||||
*/
|
*/
|
||||||
function doPublish() {
|
public function doPublish() {
|
||||||
if (!$this->canPublish()) return false;
|
if (!$this->canPublish()) return false;
|
||||||
|
|
||||||
$original = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $this->ID");
|
$original = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $this->ID");
|
||||||
@ -2195,7 +2195,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @uses SiteTreeExtension->onBeforeUnpublish()
|
* @uses SiteTreeExtension->onBeforeUnpublish()
|
||||||
* @uses SiteTreeExtension->onAfterUnpublish()
|
* @uses SiteTreeExtension->onAfterUnpublish()
|
||||||
*/
|
*/
|
||||||
function doUnpublish() {
|
public function doUnpublish() {
|
||||||
if(!$this->canDeleteFromLive()) return false;
|
if(!$this->canDeleteFromLive()) return false;
|
||||||
if(!$this->ID) return false;
|
if(!$this->ID) return false;
|
||||||
|
|
||||||
@ -2237,7 +2237,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Revert the draft changes: replace the draft content with the content on live
|
* Revert the draft changes: replace the draft content with the content on live
|
||||||
*/
|
*/
|
||||||
function doRevertToLive() {
|
public function doRevertToLive() {
|
||||||
$this->publish("Live", "Stage", false);
|
$this->publish("Live", "Stage", false);
|
||||||
|
|
||||||
// Use a clone to get the updates made by $this->publish
|
// Use a clone to get the updates made by $this->publish
|
||||||
@ -2257,7 +2257,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* Restore the content in the active copy of this SiteTree page to the stage site.
|
* Restore the content in the active copy of this SiteTree page to the stage site.
|
||||||
* @return The SiteTree object.
|
* @return The SiteTree object.
|
||||||
*/
|
*/
|
||||||
function doRestoreToStage() {
|
public function doRestoreToStage() {
|
||||||
// if no record can be found on draft stage (meaning it has been "deleted from draft" before),
|
// if no record can be found on draft stage (meaning it has been "deleted from draft" before),
|
||||||
// create an empty record
|
// create an empty record
|
||||||
if(!DB::query("SELECT \"ID\" FROM \"SiteTree\" WHERE \"ID\" = $this->ID")->value()) {
|
if(!DB::query("SELECT \"ID\" FROM \"SiteTree\" WHERE \"ID\" = $this->ID")->value()) {
|
||||||
@ -2288,7 +2288,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Synonym of {@link doUnpublish}
|
* Synonym of {@link doUnpublish}
|
||||||
*/
|
*/
|
||||||
function doDeleteFromLive() {
|
public function doDeleteFromLive() {
|
||||||
return $this->doUnpublish();
|
return $this->doUnpublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2298,7 +2298,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return boolean True if this page is new.
|
* @return boolean True if this page is new.
|
||||||
*/
|
*/
|
||||||
function isNew() {
|
public function isNew() {
|
||||||
/**
|
/**
|
||||||
* This check was a problem for a self-hosted site, and may indicate a
|
* This check was a problem for a self-hosted site, and may indicate a
|
||||||
* bug in the interpreter on their server, or a bug here
|
* bug in the interpreter on their server, or a bug here
|
||||||
@ -2318,7 +2318,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return boolean True if this page has been published.
|
* @return boolean True if this page has been published.
|
||||||
*/
|
*/
|
||||||
function isPublished() {
|
public function isPublished() {
|
||||||
if($this->isNew())
|
if($this->isNew())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2387,7 +2387,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function allowedChildren() {
|
public function allowedChildren() {
|
||||||
$allowedChildren = array();
|
$allowedChildren = array();
|
||||||
$candidates = $this->stat('allowed_children');
|
$candidates = $this->stat('allowed_children');
|
||||||
if($candidates && $candidates != "none" && $candidates != "SiteTree_root") {
|
if($candidates && $candidates != "none" && $candidates != "SiteTree_root") {
|
||||||
@ -2414,7 +2414,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function defaultChild() {
|
public function defaultChild() {
|
||||||
$default = $this->stat('default_child');
|
$default = $this->stat('default_child');
|
||||||
$allowed = $this->allowedChildren();
|
$allowed = $this->allowedChildren();
|
||||||
if($allowed) {
|
if($allowed) {
|
||||||
@ -2431,7 +2431,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function defaultParent() {
|
public function defaultParent() {
|
||||||
return $this->stat('default_parent');
|
return $this->stat('default_parent');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2441,7 +2441,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getMenuTitle(){
|
public function getMenuTitle(){
|
||||||
if($value = $this->getField("MenuTitle")) {
|
if($value = $this->getField("MenuTitle")) {
|
||||||
return $value;
|
return $value;
|
||||||
} else {
|
} else {
|
||||||
@ -2455,7 +2455,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
function setMenuTitle($value) {
|
public function setMenuTitle($value) {
|
||||||
if($value == $this->getField("Title")) {
|
if($value == $this->getField("Title")) {
|
||||||
$this->setField("MenuTitle", null);
|
$this->setField("MenuTitle", null);
|
||||||
} else {
|
} else {
|
||||||
@ -2479,7 +2479,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @param Boolean $cached
|
* @param Boolean $cached
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getStatusFlags($cached = true) {
|
public function getStatusFlags($cached = true) {
|
||||||
if(!$this->_cache_statusFlags || !$cached) {
|
if(!$this->_cache_statusFlags || !$cached) {
|
||||||
$flags = array();
|
$flags = array();
|
||||||
if($this->IsDeletedFromStage) {
|
if($this->IsDeletedFromStage) {
|
||||||
@ -2518,7 +2518,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* @deprecated 3.0 Use getTreeTitle()
|
* @deprecated 3.0 Use getTreeTitle()
|
||||||
*/
|
*/
|
||||||
function TreeTitle() {
|
public function TreeTitle() {
|
||||||
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
|
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
|
||||||
return $this->getTreeTitle();
|
return $this->getTreeTitle();
|
||||||
}
|
}
|
||||||
@ -2530,7 +2530,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return string a html string ready to be directly used in a template
|
* @return string a html string ready to be directly used in a template
|
||||||
*/
|
*/
|
||||||
function getTreeTitle() {
|
public function getTreeTitle() {
|
||||||
$flags = $this->getStatusFlags();
|
$flags = $this->getStatusFlags();
|
||||||
$treeTitle = sprintf(
|
$treeTitle = sprintf(
|
||||||
"<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>",
|
"<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>",
|
||||||
@ -2568,7 +2568,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function CMSTreeClasses() {
|
public function CMSTreeClasses() {
|
||||||
$classes = sprintf('class-%s', $this->class);
|
$classes = sprintf('class-%s', $this->class);
|
||||||
if($this->HasBrokenFile || $this->HasBrokenLink)
|
if($this->HasBrokenFile || $this->HasBrokenLink)
|
||||||
$classes .= " BrokenLink";
|
$classes .= " BrokenLink";
|
||||||
@ -2599,7 +2599,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function getIsDeletedFromStage() {
|
public function getIsDeletedFromStage() {
|
||||||
if(!$this->ID) return true;
|
if(!$this->ID) return true;
|
||||||
if($this->isNew()) return false;
|
if($this->isNew()) return false;
|
||||||
|
|
||||||
@ -2612,7 +2612,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
/**
|
/**
|
||||||
* Return true if this page exists on the live site
|
* Return true if this page exists on the live site
|
||||||
*/
|
*/
|
||||||
function getExistsOnLive() {
|
public function getExistsOnLive() {
|
||||||
return (bool)Versioned::get_versionnumber_by_stage('SiteTree', 'Live', $this->ID);
|
return (bool)Versioned::get_versionnumber_by_stage('SiteTree', 'Live', $this->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2656,7 +2656,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* of SiteTree in a extension. Call before calling parent::getCMSFields(),
|
* of SiteTree in a extension. Call before calling parent::getCMSFields(),
|
||||||
* and reenable afterwards.
|
* and reenable afterwards.
|
||||||
*/
|
*/
|
||||||
public static function disableCMSFieldsExtensions() {
|
static public function disableCMSFieldsExtensions() {
|
||||||
self::$runCMSFieldsExtensions = false;
|
self::$runCMSFieldsExtensions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2664,11 +2664,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* Reenables extendCMSFields() being called on getCMSFields() after
|
* Reenables extendCMSFields() being called on getCMSFields() after
|
||||||
* it has been disabled by disableCMSFieldsExtensions().
|
* it has been disabled by disableCMSFieldsExtensions().
|
||||||
*/
|
*/
|
||||||
public static function enableCMSFieldsExtensions() {
|
static public function enableCMSFieldsExtensions() {
|
||||||
self::$runCMSFieldsExtensions = true;
|
self::$runCMSFieldsExtensions = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function providePermissions() {
|
public function providePermissions() {
|
||||||
return array(
|
return array(
|
||||||
'SITETREE_GRANT_ACCESS' => array(
|
'SITETREE_GRANT_ACCESS' => array(
|
||||||
'name' => _t('SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION', 'Manage access rights for content'),
|
'name' => _t('SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION', 'Manage access rights for content'),
|
||||||
@ -2708,7 +2708,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function i18n_singular_name() {
|
public function i18n_singular_name() {
|
||||||
// Convert 'Page' to 'SiteTree' for correct localization lookups
|
// Convert 'Page' to 'SiteTree' for correct localization lookups
|
||||||
$class = ($this->class == 'Page') ? 'SiteTree' : $this->class;
|
$class = ($this->class == 'Page') ? 'SiteTree' : $this->class;
|
||||||
return _t($class.'.SINGULARNAME', $this->singular_name());
|
return _t($class.'.SINGULARNAME', $this->singular_name());
|
||||||
@ -2718,7 +2718,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* Overloaded to also provide entities for 'Page' class which is usually
|
* Overloaded to also provide entities for 'Page' class which is usually
|
||||||
* located in custom code, hence textcollector picks it up for the wrong folder.
|
* located in custom code, hence textcollector picks it up for the wrong folder.
|
||||||
*/
|
*/
|
||||||
function provideI18nEntities() {
|
public function provideI18nEntities() {
|
||||||
$entities = parent::provideI18nEntities();
|
$entities = parent::provideI18nEntities();
|
||||||
|
|
||||||
if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR;
|
if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR;
|
||||||
@ -2735,15 +2735,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
return $entities;
|
return $entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParentType() {
|
public function getParentType() {
|
||||||
return $this->ParentID == 0 ? 'root' : 'subpage';
|
return $this->ParentID == 0 ? 'root' : 'subpage';
|
||||||
}
|
}
|
||||||
|
|
||||||
static function reset() {
|
static public function reset() {
|
||||||
self::$cache_permissions = array();
|
self::$cache_permissions = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function on_db_reset() {
|
static public function on_db_reset() {
|
||||||
self::$cache_permissions = array();
|
self::$cache_permissions = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,22 +7,22 @@
|
|||||||
*/
|
*/
|
||||||
abstract class SiteTreeExtension extends DataExtension {
|
abstract class SiteTreeExtension extends DataExtension {
|
||||||
|
|
||||||
function onBeforePublish(&$original) {
|
public function onBeforePublish(&$original) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAfterPublish(&$original) {
|
public function onAfterPublish(&$original) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeUnpublish() {
|
public function onBeforeUnpublish() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAfterUnpublish() {
|
public function onAfterUnpublish() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function canAddChildren($member) {
|
public function canAddChildren($member) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function canPublish($member) {
|
public function canPublish($member) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class SiteTreeFileExtension extends DataExtension {
|
|||||||
'BackLinkTracking' => 'SiteTree'
|
'BackLinkTracking' => 'SiteTree'
|
||||||
);
|
);
|
||||||
|
|
||||||
function updateCMSFields(FieldList $fields) {
|
public function updateCMSFields(FieldList $fields) {
|
||||||
$fields->insertAfter(new ReadonlyField('BackLinkCount',
|
$fields->insertAfter(new ReadonlyField('BackLinkCount',
|
||||||
_t('AssetTableField.BACKLINKCOUNT', 'Used on:'),
|
_t('AssetTableField.BACKLINKCOUNT', 'Used on:'),
|
||||||
$this->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')),
|
$this->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')),
|
||||||
@ -22,7 +22,7 @@ class SiteTreeFileExtension extends DataExtension {
|
|||||||
*
|
*
|
||||||
* @return ComponentSet
|
* @return ComponentSet
|
||||||
*/
|
*/
|
||||||
function BackLinkTracking($filter = "", $sort = "", $join = "", $limit = "") {
|
public function BackLinkTracking($filter = "", $sort = "", $join = "", $limit = "") {
|
||||||
if(class_exists("Subsite")){
|
if(class_exists("Subsite")){
|
||||||
$rememberSubsiteFilter = Subsite::$disable_subsite_filter;
|
$rememberSubsiteFilter = Subsite::$disable_subsite_filter;
|
||||||
Subsite::disable_subsite_filter(true);
|
Subsite::disable_subsite_filter(true);
|
||||||
@ -43,7 +43,7 @@ class SiteTreeFileExtension extends DataExtension {
|
|||||||
*
|
*
|
||||||
* @return Integer
|
* @return Integer
|
||||||
*/
|
*/
|
||||||
function BackLinkTrackingCount() {
|
public function BackLinkTrackingCount() {
|
||||||
$pages = $this->owner->BackLinkTracking();
|
$pages = $this->owner->BackLinkTracking();
|
||||||
if($pages) {
|
if($pages) {
|
||||||
return $pages->Count();
|
return $pages->Count();
|
||||||
@ -55,7 +55,7 @@ class SiteTreeFileExtension extends DataExtension {
|
|||||||
/**
|
/**
|
||||||
* Updates link tracking.
|
* Updates link tracking.
|
||||||
*/
|
*/
|
||||||
function onAfterDelete() {
|
public function onAfterDelete() {
|
||||||
// We query the explicit ID list, because BackLinkTracking will get modified after the stage
|
// We query the explicit ID list, because BackLinkTracking will get modified after the stage
|
||||||
// site does its thing
|
// site does its thing
|
||||||
$brokenPageIDs = $this->owner->BackLinkTracking()->column("ID");
|
$brokenPageIDs = $this->owner->BackLinkTracking()->column("ID");
|
||||||
@ -86,7 +86,7 @@ class SiteTreeFileExtension extends DataExtension {
|
|||||||
* @param String $old File path relative to the webroot
|
* @param String $old File path relative to the webroot
|
||||||
* @param String $new File path relative to the webroot
|
* @param String $new File path relative to the webroot
|
||||||
*/
|
*/
|
||||||
function updateLinks($old, $new) {
|
public function updateLinks($old, $new) {
|
||||||
if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
|
if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
|
||||||
|
|
||||||
$pages = $this->owner->BackLinkTracking();
|
$pages = $this->owner->BackLinkTracking();
|
||||||
|
@ -49,7 +49,7 @@ class VirtualPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* Generates the array of fields required for the page type.
|
* Generates the array of fields required for the page type.
|
||||||
*/
|
*/
|
||||||
function getVirtualFields() {
|
public function getVirtualFields() {
|
||||||
$nonVirtualFields = array_merge(self::$non_virtual_fields, self::$initially_copied_fields);
|
$nonVirtualFields = array_merge(self::$non_virtual_fields, self::$initially_copied_fields);
|
||||||
$record = $this->CopyContentFrom();
|
$record = $this->CopyContentFrom();
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ class VirtualPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* @return SiteTree Returns the linked page, or failing that, a new object.
|
* @return SiteTree Returns the linked page, or failing that, a new object.
|
||||||
*/
|
*/
|
||||||
function CopyContentFrom() {
|
public function CopyContentFrom() {
|
||||||
$copyContentFromID = $this->CopyContentFromID;
|
$copyContentFromID = $this->CopyContentFromID;
|
||||||
if(!$copyContentFromID) return new SiteTree();
|
if(!$copyContentFromID) return new SiteTree();
|
||||||
|
|
||||||
@ -87,12 +87,12 @@ class VirtualPage extends Page {
|
|||||||
|
|
||||||
return $this->components['CopyContentFrom'] ? $this->components['CopyContentFrom'] : new SiteTree();
|
return $this->components['CopyContentFrom'] ? $this->components['CopyContentFrom'] : new SiteTree();
|
||||||
}
|
}
|
||||||
function setCopyContentFromID($val) {
|
public function setCopyContentFromID($val) {
|
||||||
if($val && DataObject::get_by_id('SiteTree', $val) instanceof VirtualPage) $val = 0;
|
if($val && DataObject::get_by_id('SiteTree', $val) instanceof VirtualPage) $val = 0;
|
||||||
return $this->setField("CopyContentFromID", $val);
|
return $this->setField("CopyContentFromID", $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ContentSource() {
|
public function ContentSource() {
|
||||||
return $this->CopyContentFrom();
|
return $this->CopyContentFrom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class VirtualPage extends Page {
|
|||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowedChildren() {
|
public function allowedChildren() {
|
||||||
if($this->CopyContentFrom()) {
|
if($this->CopyContentFrom()) {
|
||||||
return $this->CopyContentFrom()->allowedChildren();
|
return $this->CopyContentFrom()->allowedChildren();
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ class VirtualPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* Generate the CMS fields from the fields from the original page.
|
* Generate the CMS fields from the fields from the original page.
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
public function getCMSFields() {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
// Setup the linking to the original page.
|
// Setup the linking to the original page.
|
||||||
@ -209,7 +209,7 @@ class VirtualPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* We have to change it to copy all the content from the original page first.
|
* We have to change it to copy all the content from the original page first.
|
||||||
*/
|
*/
|
||||||
function onBeforeWrite() {
|
public function onBeforeWrite() {
|
||||||
$performCopyFrom = null;
|
$performCopyFrom = null;
|
||||||
|
|
||||||
// Determine if we need to copy values.
|
// Determine if we need to copy values.
|
||||||
@ -245,7 +245,7 @@ class VirtualPage extends Page {
|
|||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAfterWrite() {
|
public function onAfterWrite() {
|
||||||
parent::onAfterWrite();
|
parent::onAfterWrite();
|
||||||
|
|
||||||
// Don't do this stuff when we're publishing
|
// Don't do this stuff when we're publishing
|
||||||
@ -292,7 +292,7 @@ class VirtualPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate() {
|
public function validate() {
|
||||||
$result = parent::validate();
|
$result = parent::validate();
|
||||||
|
|
||||||
// "Can be root" validation
|
// "Can be root" validation
|
||||||
@ -314,7 +314,7 @@ class VirtualPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* Ensure we have an up-to-date version of everything.
|
* Ensure we have an up-to-date version of everything.
|
||||||
*/
|
*/
|
||||||
function copyFrom($source, $updateImageTracking = true) {
|
public function copyFrom($source, $updateImageTracking = true) {
|
||||||
if($source) {
|
if($source) {
|
||||||
foreach($this->getVirtualFields() as $virtualField) {
|
foreach($this->getVirtualFields() as $virtualField) {
|
||||||
$this->$virtualField = $source->$virtualField;
|
$this->$virtualField = $source->$virtualField;
|
||||||
@ -332,7 +332,7 @@ class VirtualPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateImageTracking() {
|
public function updateImageTracking() {
|
||||||
// Doesn't work on unsaved records
|
// Doesn't work on unsaved records
|
||||||
if(!$this->ID) return;
|
if(!$this->ID) return;
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ class VirtualPage extends Page {
|
|||||||
$this->ImageTracking()->setByIdList($this->CopyContentFrom()->ImageTracking()->column('ID'));
|
$this->ImageTracking()->setByIdList($this->CopyContentFrom()->ImageTracking()->column('ID'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function CMSTreeClasses() {
|
public function CMSTreeClasses() {
|
||||||
return parent::CMSTreeClasses() . ' VirtualPage-' . $this->CopyContentFrom()->ClassName;
|
return parent::CMSTreeClasses() . ' VirtualPage-' . $this->CopyContentFrom()->ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ class VirtualPage extends Page {
|
|||||||
* @param string $field
|
* @param string $field
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function __get($field) {
|
public function __get($field) {
|
||||||
if(parent::hasMethod($funcName = "get$field")) {
|
if(parent::hasMethod($funcName = "get$field")) {
|
||||||
return $this->$funcName();
|
return $this->$funcName();
|
||||||
} else if(parent::hasField($field)) {
|
} else if(parent::hasField($field)) {
|
||||||
@ -370,7 +370,7 @@ class VirtualPage extends Page {
|
|||||||
* @param string $method
|
* @param string $method
|
||||||
* @param string $args
|
* @param string $args
|
||||||
*/
|
*/
|
||||||
function __call($method, $args) {
|
public function __call($method, $args) {
|
||||||
if(parent::hasMethod($method)) {
|
if(parent::hasMethod($method)) {
|
||||||
return parent::__call($method, $args);
|
return parent::__call($method, $args);
|
||||||
} else {
|
} else {
|
||||||
@ -393,7 +393,7 @@ class VirtualPage extends Page {
|
|||||||
* @param string $method
|
* @param string $method
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function hasMethod($method) {
|
public function hasMethod($method) {
|
||||||
if(parent::hasMethod($method)) return true;
|
if(parent::hasMethod($method)) return true;
|
||||||
return $this->copyContentFrom()->hasMethod($method);
|
return $this->copyContentFrom()->hasMethod($method);
|
||||||
}
|
}
|
||||||
@ -412,13 +412,13 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
/**
|
/**
|
||||||
* Reloads the content if the version is different ;-)
|
* Reloads the content if the version is different ;-)
|
||||||
*/
|
*/
|
||||||
function reloadContent() {
|
public function reloadContent() {
|
||||||
$this->failover->copyFrom($this->failover->CopyContentFrom());
|
$this->failover->copyFrom($this->failover->CopyContentFrom());
|
||||||
$this->failover->write();
|
$this->failover->write();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getViewer($action) {
|
public function getViewer($action) {
|
||||||
$originalClass = get_class($this->CopyContentFrom());
|
$originalClass = get_class($this->CopyContentFrom());
|
||||||
if ($originalClass == 'SiteTree') $name = 'Page_Controller';
|
if ($originalClass == 'SiteTree') $name = 'Page_Controller';
|
||||||
else $name = $originalClass."_Controller";
|
else $name = $originalClass."_Controller";
|
||||||
@ -432,7 +432,7 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
* NOTE: Virtual page must have a container object of subclass of sitetree.
|
* NOTE: Virtual page must have a container object of subclass of sitetree.
|
||||||
* We can't load the content without an ID or record to copy it from.
|
* We can't load the content without an ID or record to copy it from.
|
||||||
*/
|
*/
|
||||||
function init(){
|
public function init(){
|
||||||
if(isset($this->record) && $this->record->ID){
|
if(isset($this->record) && $this->record->ID){
|
||||||
if($this->record->VersionID != $this->failover->CopyContentFrom()->Version){
|
if($this->record->VersionID != $this->failover->CopyContentFrom()->Version){
|
||||||
$this->reloadContent();
|
$this->reloadContent();
|
||||||
@ -442,7 +442,7 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
parent::init();
|
parent::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadcontentall() {
|
public function loadcontentall() {
|
||||||
$pages = DataObject::get("VirtualPage");
|
$pages = DataObject::get("VirtualPage");
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
$page->copyFrom($page->CopyContentFrom());
|
$page->copyFrom($page->CopyContentFrom());
|
||||||
@ -458,7 +458,7 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
* @param string $method
|
* @param string $method
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function hasMethod($method) {
|
public function hasMethod($method) {
|
||||||
$haveIt = parent::hasMethod($method);
|
$haveIt = parent::hasMethod($method);
|
||||||
if (!$haveIt) {
|
if (!$haveIt) {
|
||||||
$originalClass = get_class($this->CopyContentFrom());
|
$originalClass = get_class($this->CopyContentFrom());
|
||||||
@ -476,7 +476,7 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
* @param string $method
|
* @param string $method
|
||||||
* @param string $args
|
* @param string $args
|
||||||
*/
|
*/
|
||||||
function __call($method, $args) {
|
public function __call($method, $args) {
|
||||||
try {
|
try {
|
||||||
return parent::__call($method, $args);
|
return parent::__call($method, $args);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
class BrokenLinksReport extends SS_Report {
|
class BrokenLinksReport extends SS_Report {
|
||||||
|
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('BrokenLinksReport.BROKENLINKS',"Broken links report");
|
return _t('BrokenLinksReport.BROKENLINKS',"Broken links report");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sourceRecords($params, $sort, $limit) {
|
public function sourceRecords($params, $sort, $limit) {
|
||||||
$join = '';
|
$join = '';
|
||||||
$sortBrokenReason = false;
|
$sortBrokenReason = false;
|
||||||
if($sort) {
|
if($sort) {
|
||||||
@ -73,7 +73,7 @@ class BrokenLinksReport extends SS_Report {
|
|||||||
|
|
||||||
return $returnSet;
|
return $returnSet;
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
if(isset($_REQUEST['CheckSite']) && $_REQUEST['CheckSite'] == 'Draft') {
|
if(isset($_REQUEST['CheckSite']) && $_REQUEST['CheckSite'] == 'Draft') {
|
||||||
$dateTitle = _t('BrokenLinksReport.ColumnDateLastModified', 'Date last modified');
|
$dateTitle = _t('BrokenLinksReport.ColumnDateLastModified', 'Date last modified');
|
||||||
} else {
|
} else {
|
||||||
@ -112,7 +112,7 @@ class BrokenLinksReport extends SS_Report {
|
|||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
function parameterFields() {
|
public function parameterFields() {
|
||||||
return new FieldList(
|
return new FieldList(
|
||||||
new DropdownField('CheckSite', _t('BrokenLinksReport.CheckSite','Check site'), array(
|
new DropdownField('CheckSite', _t('BrokenLinksReport.CheckSite','Check site'), array(
|
||||||
'Published' => _t('BrokenLinksReport.CheckSiteDropdownPublished', 'Published Site'),
|
'Published' => _t('BrokenLinksReport.CheckSiteDropdownPublished', 'Published Site'),
|
||||||
|
@ -77,7 +77,7 @@ class SS_Report extends ViewableData {
|
|||||||
* - overriding description(), which lets you support i18n
|
* - overriding description(), which lets you support i18n
|
||||||
* - defining the $description property
|
* - defining the $description property
|
||||||
*/
|
*/
|
||||||
function title() {
|
public function title() {
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,14 +88,14 @@ class SS_Report extends ViewableData {
|
|||||||
* - overriding description(), which lets you support i18n
|
* - overriding description(), which lets you support i18n
|
||||||
* - defining the $description property
|
* - defining the $description property
|
||||||
*/
|
*/
|
||||||
function description() {
|
public function description() {
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link SQLQuery} that provides your report data.
|
* Return the {@link SQLQuery} that provides your report data.
|
||||||
*/
|
*/
|
||||||
function sourceQuery($params) {
|
public function sourceQuery($params) {
|
||||||
if($this->hasMethod('sourceRecords')) {
|
if($this->hasMethod('sourceRecords')) {
|
||||||
return $this->sourceRecords()->dataQuery();
|
return $this->sourceRecords()->dataQuery();
|
||||||
} else {
|
} else {
|
||||||
@ -106,7 +106,7 @@ class SS_Report extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* Return a SS_List records for this report.
|
* Return a SS_List records for this report.
|
||||||
*/
|
*/
|
||||||
function records($params) {
|
public function records($params) {
|
||||||
if($this->hasMethod('sourceRecords')) {
|
if($this->hasMethod('sourceRecords')) {
|
||||||
return $this->sourceRecords($params, null, null);
|
return $this->sourceRecords($params, null, null);
|
||||||
} else {
|
} else {
|
||||||
@ -124,11 +124,11 @@ class SS_Report extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* Return the data class for this report
|
* Return the data class for this report
|
||||||
*/
|
*/
|
||||||
function dataClass() {
|
public function dataClass() {
|
||||||
return $this->dataClass;
|
return $this->dataClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink($action = null) {
|
public function getLink($action = null) {
|
||||||
return Controller::join_links(
|
return Controller::join_links(
|
||||||
'admin/reports/',
|
'admin/reports/',
|
||||||
"$this->class",
|
"$this->class",
|
||||||
@ -147,7 +147,7 @@ class SS_Report extends ViewableData {
|
|||||||
* @param $priority The priority. Higher numbers will appear furhter up in the reports list.
|
* @param $priority The priority. Higher numbers will appear furhter up in the reports list.
|
||||||
* The default value is zero.
|
* The default value is zero.
|
||||||
*/
|
*/
|
||||||
static function register($list, $reportClass, $priority = 0) {
|
static public function register($list, $reportClass, $priority = 0) {
|
||||||
Deprecation::notice('3.0', 'All subclasses of SS_Report now appear in the report admin, no need to register');
|
Deprecation::notice('3.0', 'All subclasses of SS_Report now appear in the report admin, no need to register');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ class SS_Report extends ViewableData {
|
|||||||
* @deprecated 3.0
|
* @deprecated 3.0
|
||||||
* All subclasses of SS_Report now appear in the report admin, no need to register or unregister.
|
* All subclasses of SS_Report now appear in the report admin, no need to register or unregister.
|
||||||
*/
|
*/
|
||||||
static function unregister($list, $reportClass) {
|
static public function unregister($list, $reportClass) {
|
||||||
self::add_excluded_reports($reportClass);
|
self::add_excluded_reports($reportClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ class SS_Report extends ViewableData {
|
|||||||
* Exclude certain reports classes from the list of Reports in the CMS
|
* Exclude certain reports classes from the list of Reports in the CMS
|
||||||
* @param $reportClass Can be either a string with the report classname or an array of reports classnames
|
* @param $reportClass Can be either a string with the report classname or an array of reports classnames
|
||||||
*/
|
*/
|
||||||
static function add_excluded_reports($reportClass) {
|
static public function add_excluded_reports($reportClass) {
|
||||||
if (is_array($reportClass)) {
|
if (is_array($reportClass)) {
|
||||||
self::$excluded_reports = array_merge(self::$excluded_reports, $reportClass);
|
self::$excluded_reports = array_merge(self::$excluded_reports, $reportClass);
|
||||||
} else {
|
} else {
|
||||||
@ -179,7 +179,7 @@ class SS_Report extends ViewableData {
|
|||||||
* the list of reports in report admin in the CMS.
|
* the list of reports in report admin in the CMS.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static function get_excluded_reports() {
|
static public function get_excluded_reports() {
|
||||||
return self::$excluded_reports;
|
return self::$excluded_reports;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ class SS_Report extends ViewableData {
|
|||||||
* Return the SS_Report objects making up the given list.
|
* Return the SS_Report objects making up the given list.
|
||||||
* @return ArrayList an arraylist of SS_Report objects
|
* @return ArrayList an arraylist of SS_Report objects
|
||||||
*/
|
*/
|
||||||
static function get_reports() {
|
static public function get_reports() {
|
||||||
$reports = ClassInfo::subclassesFor(get_called_class());
|
$reports = ClassInfo::subclassesFor(get_called_class());
|
||||||
|
|
||||||
$reportsArray = array();
|
$reportsArray = array();
|
||||||
@ -226,7 +226,7 @@ class SS_Report extends ViewableData {
|
|||||||
*
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
public function getCMSFields() {
|
||||||
$fields = new FieldList();
|
$fields = new FieldList();
|
||||||
|
|
||||||
if($title = $this->title()) {
|
if($title = $this->title()) {
|
||||||
@ -257,7 +257,7 @@ class SS_Report extends ViewableData {
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCMSActions() {
|
public function getCMSActions() {
|
||||||
// getCMSActions() can be extended with updateCMSActions() on a extension
|
// getCMSActions() can be extended with updateCMSActions() on a extension
|
||||||
$actions = new FieldList();
|
$actions = new FieldList();
|
||||||
$this->extend('updateCMSActions', $actions);
|
$this->extend('updateCMSActions', $actions);
|
||||||
@ -273,7 +273,7 @@ class SS_Report extends ViewableData {
|
|||||||
*
|
*
|
||||||
* @return FormField subclass
|
* @return FormField subclass
|
||||||
*/
|
*/
|
||||||
function getReportField() {
|
public function getReportField() {
|
||||||
// TODO Remove coupling with global state
|
// TODO Remove coupling with global state
|
||||||
$params = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : array();
|
$params = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : array();
|
||||||
$items = $this->sourceRecords($params, null, null);
|
$items = $this->sourceRecords($params, null, null);
|
||||||
@ -318,7 +318,7 @@ class SS_Report extends ViewableData {
|
|||||||
* @param Member $member
|
* @param Member $member
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
if(!$member && $member !== FALSE) {
|
if(!$member && $member !== FALSE) {
|
||||||
$member = Member::currentUser();
|
$member = Member::currentUser();
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ class SS_Report extends ViewableData {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function TreeTitle() {
|
public function TreeTitle() {
|
||||||
return $this->title();
|
return $this->title();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,27 +360,27 @@ class SS_Report extends ViewableData {
|
|||||||
abstract class SS_ReportWrapper extends SS_Report {
|
abstract class SS_ReportWrapper extends SS_Report {
|
||||||
protected $baseReport;
|
protected $baseReport;
|
||||||
|
|
||||||
function __construct($baseReport) {
|
public function __construct($baseReport) {
|
||||||
$this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport;
|
$this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport;
|
||||||
$this->dataClass = $this->baseReport->dataClass();
|
$this->dataClass = $this->baseReport->dataClass();
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function ID() {
|
public function ID() {
|
||||||
return get_class($this->baseReport) . '_' . get_class($this);
|
return get_class($this->baseReport) . '_' . get_class($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Filtering
|
// Filtering
|
||||||
|
|
||||||
function parameterFields() {
|
public function parameterFields() {
|
||||||
return $this->baseReport->parameterFields();
|
return $this->baseReport->parameterFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Columns
|
// Columns
|
||||||
|
|
||||||
function columns() {
|
public function columns() {
|
||||||
return $this->baseReport->columns();
|
return $this->baseReport->columns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,16 +390,16 @@ abstract class SS_ReportWrapper extends SS_Report {
|
|||||||
/**
|
/**
|
||||||
* Override this method to perform some actions prior to querying.
|
* Override this method to perform some actions prior to querying.
|
||||||
*/
|
*/
|
||||||
function beforeQuery($params) {
|
public function beforeQuery($params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method to perform some actions after querying.
|
* Override this method to perform some actions after querying.
|
||||||
*/
|
*/
|
||||||
function afterQuery() {
|
public function afterQuery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sourceQuery($params) {
|
public function sourceQuery($params) {
|
||||||
if($this->baseReport->hasMethod('sourceRecords')) {
|
if($this->baseReport->hasMethod('sourceRecords')) {
|
||||||
// The default implementation will create a fake query from our sourceRecords() method
|
// The default implementation will create a fake query from our sourceRecords() method
|
||||||
return parent::sourceQuery($params);
|
return parent::sourceQuery($params);
|
||||||
@ -416,7 +416,7 @@ abstract class SS_ReportWrapper extends SS_Report {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sourceRecords($params = array(), $sort = null, $limit = null) {
|
public function sourceRecords($params = array(), $sort = null, $limit = null) {
|
||||||
$this->beforeQuery($params);
|
$this->beforeQuery($params);
|
||||||
$records = $this->baseReport->sourceRecords($params, $sort, $limit);
|
$records = $this->baseReport->sourceRecords($params, $sort, $limit);
|
||||||
$this->afterQuery();
|
$this->afterQuery();
|
||||||
@ -427,23 +427,23 @@ abstract class SS_ReportWrapper extends SS_Report {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Pass-through
|
// Pass-through
|
||||||
|
|
||||||
function title() {
|
public function title() {
|
||||||
return $this->baseReport->title();
|
return $this->baseReport->title();
|
||||||
}
|
}
|
||||||
|
|
||||||
function group() {
|
public function group() {
|
||||||
return $this->baseReport->hasMethod('group') ? $this->baseReport->group() : 'Group';
|
return $this->baseReport->hasMethod('group') ? $this->baseReport->group() : 'Group';
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort() {
|
public function sort() {
|
||||||
return $this->baseReport->hasMethod('sort') ? $this->baseReport->sort() : 0;
|
return $this->baseReport->hasMethod('sort') ? $this->baseReport->sort() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function description() {
|
public function description() {
|
||||||
return $this->baseReport->description();
|
return $this->baseReport->description();
|
||||||
}
|
}
|
||||||
|
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return $this->baseReport->canView($member);
|
return $this->baseReport->canView($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,25 +14,25 @@ class SideReportView extends ViewableData {
|
|||||||
protected $controller, $report;
|
protected $controller, $report;
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
function __construct($controller, $report) {
|
public function __construct($controller, $report) {
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
$this->report = $report;
|
$this->report = $report;
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.OtherGroupTitle', "Other");
|
return _t('SideReport.OtherGroupTitle', "Other");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort() {
|
public function sort() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setParameters($parameters) {
|
public function setParameters($parameters) {
|
||||||
$this->parameters = $parameters;
|
$this->parameters = $parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
function forTemplate() {
|
public function forTemplate() {
|
||||||
$records = $this->report->records($this->parameters);
|
$records = $this->report->records($this->parameters);
|
||||||
$columns = $this->report->columns();
|
$columns = $this->report->columns();
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class SideReportView extends ViewableData {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReportWrapper extends SS_ReportWrapper {
|
class SideReportWrapper extends SS_ReportWrapper {
|
||||||
function columns() {
|
public function columns() {
|
||||||
if($this->baseReport->hasMethod('sideReportColumns')) {
|
if($this->baseReport->hasMethod('sideReportColumns')) {
|
||||||
return $this->baseReport->sideReportColumns();
|
return $this->baseReport->sideReportColumns();
|
||||||
} else {
|
} else {
|
||||||
@ -129,20 +129,20 @@ class SideReportWrapper extends SS_ReportWrapper {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReport_EmptyPages extends SS_Report {
|
class SideReport_EmptyPages extends SS_Report {
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('SideReport.EMPTYPAGES',"Pages with no content");
|
return _t('SideReport.EMPTYPAGES',"Pages with no content");
|
||||||
}
|
}
|
||||||
|
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.ContentGroupTitle', "Content reports");
|
return _t('SideReport.ContentGroupTitle', "Content reports");
|
||||||
}
|
}
|
||||||
function sort() {
|
public function sort() {
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
return DataObject::get("SiteTree", "\"ClassName\" != 'RedirectorPage' AND (\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '<p></p>' OR \"Content\" LIKE '<p> </p>')", '"Title"');
|
return DataObject::get("SiteTree", "\"ClassName\" != 'RedirectorPage' AND (\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '<p></p>' OR \"Content\" LIKE '<p> </p>')", '"Title"');
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Title", // todo: use NestedTitle(2)
|
"title" => "Title", // todo: use NestedTitle(2)
|
||||||
@ -159,20 +159,20 @@ class SideReport_EmptyPages extends SS_Report {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReport_RecentlyEdited extends SS_Report {
|
class SideReport_RecentlyEdited extends SS_Report {
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
||||||
}
|
}
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.ContentGroupTitle', "Content reports");
|
return _t('SideReport.ContentGroupTitle', "Content reports");
|
||||||
}
|
}
|
||||||
function sort() {
|
public function sort() {
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
$threshold = strtotime('-14 days', SS_Datetime::now()->Format('U'));
|
$threshold = strtotime('-14 days', SS_Datetime::now()->Format('U'));
|
||||||
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
|
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Title", // todo: use NestedTitle(2)
|
"title" => "Title", // todo: use NestedTitle(2)
|
||||||
@ -189,13 +189,13 @@ class SideReport_RecentlyEdited extends SS_Report {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReport_BrokenLinks extends SS_Report {
|
class SideReport_BrokenLinks extends SS_Report {
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENLINKS',"Pages with broken links");
|
return _t('SideReport.BROKENLINKS',"Pages with broken links");
|
||||||
}
|
}
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
||||||
}
|
}
|
||||||
function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
// Get class names for page types that are not virtual pages or redirector pages
|
// Get class names for page types that are not virtual pages or redirector pages
|
||||||
$classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage'));
|
$classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage'));
|
||||||
$classNames = "'".join("','", $classes)."'";
|
$classNames = "'".join("','", $classes)."'";
|
||||||
@ -204,7 +204,7 @@ class SideReport_BrokenLinks extends SS_Report {
|
|||||||
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => _t('ReportAdmin.ReportTitle', 'Title'), // todo: use NestedTitle(2)
|
"title" => _t('ReportAdmin.ReportTitle', 'Title'), // todo: use NestedTitle(2)
|
||||||
@ -212,7 +212,7 @@ class SideReport_BrokenLinks extends SS_Report {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function getParameterFields() {
|
public function getParameterFields() {
|
||||||
return new FieldList(
|
return new FieldList(
|
||||||
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
||||||
);
|
);
|
||||||
@ -227,13 +227,13 @@ class SideReport_BrokenLinks extends SS_Report {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReport_BrokenFiles extends SS_Report {
|
class SideReport_BrokenFiles extends SS_Report {
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENFILES',"Pages with broken files");
|
return _t('SideReport.BROKENFILES',"Pages with broken files");
|
||||||
}
|
}
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
||||||
}
|
}
|
||||||
function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
// Get class names for page types that are not virtual pages or redirector pages
|
// Get class names for page types that are not virtual pages or redirector pages
|
||||||
$classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage'));
|
$classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage'));
|
||||||
$classNames = "'".join("','", $classes)."'";
|
$classNames = "'".join("','", $classes)."'";
|
||||||
@ -242,7 +242,7 @@ class SideReport_BrokenFiles extends SS_Report {
|
|||||||
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenFile = 1");
|
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenFile = 1");
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Title", // todo: use NestedTitle(2)
|
"title" => "Title", // todo: use NestedTitle(2)
|
||||||
@ -251,7 +251,7 @@ class SideReport_BrokenFiles extends SS_Report {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParameterFields() {
|
public function getParameterFields() {
|
||||||
return new FieldList(
|
return new FieldList(
|
||||||
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
||||||
);
|
);
|
||||||
@ -263,20 +263,20 @@ class SideReport_BrokenFiles extends SS_Report {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReport_BrokenVirtualPages extends SS_Report {
|
class SideReport_BrokenVirtualPages extends SS_Report {
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENVIRTUALPAGES', 'VirtualPages pointing to deleted pages');
|
return _t('SideReport.BROKENVIRTUALPAGES', 'VirtualPages pointing to deleted pages');
|
||||||
}
|
}
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
||||||
}
|
}
|
||||||
function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
$classNames = "'".join("','", ClassInfo::subclassesFor('VirtualPage'))."'";
|
$classNames = "'".join("','", ClassInfo::subclassesFor('VirtualPage'))."'";
|
||||||
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
||||||
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Title", // todo: use NestedTitle(2)
|
"title" => "Title", // todo: use NestedTitle(2)
|
||||||
@ -285,7 +285,7 @@ class SideReport_BrokenVirtualPages extends SS_Report {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParameterFields() {
|
public function getParameterFields() {
|
||||||
return new FieldList(
|
return new FieldList(
|
||||||
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
||||||
);
|
);
|
||||||
@ -297,13 +297,13 @@ class SideReport_BrokenVirtualPages extends SS_Report {
|
|||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
class SideReport_BrokenRedirectorPages extends SS_Report {
|
class SideReport_BrokenRedirectorPages extends SS_Report {
|
||||||
function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENREDIRECTORPAGES', 'RedirectorPages pointing to deleted pages');
|
return _t('SideReport.BROKENREDIRECTORPAGES', 'RedirectorPages pointing to deleted pages');
|
||||||
}
|
}
|
||||||
function group() {
|
public function group() {
|
||||||
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
|
||||||
}
|
}
|
||||||
function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
$classNames = "'".join("','", ClassInfo::subclassesFor('RedirectorPage'))."'";
|
$classNames = "'".join("','", ClassInfo::subclassesFor('RedirectorPage'))."'";
|
||||||
|
|
||||||
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1");
|
||||||
@ -311,7 +311,7 @@ class SideReport_BrokenRedirectorPages extends SS_Report {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Title", // todo: use NestedTitle(2)
|
"title" => "Title", // todo: use NestedTitle(2)
|
||||||
@ -320,7 +320,7 @@ class SideReport_BrokenRedirectorPages extends SS_Report {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParameterFields() {
|
public function getParameterFields() {
|
||||||
return new FieldList(
|
return new FieldList(
|
||||||
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
|
||||||
);
|
);
|
||||||
|
@ -14,7 +14,7 @@ class ContentControllerSearchExtension extends Extension {
|
|||||||
/**
|
/**
|
||||||
* Site search form
|
* Site search form
|
||||||
*/
|
*/
|
||||||
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->request && $this->owner->request->getVar('Search')) {
|
||||||
@ -39,7 +39,7 @@ class ContentControllerSearchExtension extends Extension {
|
|||||||
* @param SearchForm $form The form instance that was submitted
|
* @param SearchForm $form The form instance that was submitted
|
||||||
* @param SS_HTTPRequest $request Request generated for this action
|
* @param SS_HTTPRequest $request Request generated for this action
|
||||||
*/
|
*/
|
||||||
function results($data, $form, $request) {
|
public function results($data, $form, $request) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'Results' => $form->getResults(),
|
'Results' => $form->getResults(),
|
||||||
'Query' => $form->getSearchQuery(),
|
'Query' => $form->getSearchQuery(),
|
||||||
|
@ -35,7 +35,7 @@ class SearchForm extends Form {
|
|||||||
* if fields are added to the form.
|
* if fields are added to the form.
|
||||||
* @param FieldList $actions Optional, defaults to a single field named "Go".
|
* @param FieldList $actions Optional, defaults to a single field named "Go".
|
||||||
*/
|
*/
|
||||||
function __construct($controller, $name, $fields = null, $actions = null) {
|
public function __construct($controller, $name, $fields = null, $actions = null) {
|
||||||
if(!$fields) {
|
if(!$fields) {
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
new TextField('Search', _t('SearchForm.SEARCH', 'Search')
|
new TextField('Search', _t('SearchForm.SEARCH', 'Search')
|
||||||
@ -70,7 +70,7 @@ class SearchForm extends Form {
|
|||||||
* Set the classes to search.
|
* Set the classes to search.
|
||||||
* Currently you can only choose from "SiteTree" and "File", but a future version might improve this.
|
* Currently you can only choose from "SiteTree" and "File", but a future version might improve this.
|
||||||
*/
|
*/
|
||||||
function classesToSearch($classes) {
|
public function classesToSearch($classes) {
|
||||||
$illegalClasses = array_diff($classes, array('SiteTree', 'File'));
|
$illegalClasses = array_diff($classes, array('SiteTree', 'File'));
|
||||||
if($illegalClasses) {
|
if($illegalClasses) {
|
||||||
user_error("SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses) . "'. At this stage, only File and SiteTree are allowed", E_USER_WARNING);
|
user_error("SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses) . "'. At this stage, only File and SiteTree are allowed", E_USER_WARNING);
|
||||||
@ -84,7 +84,7 @@ class SearchForm extends Form {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getClassesToSearch() {
|
public function getClassesToSearch() {
|
||||||
return $this->classesToSearch;
|
return $this->classesToSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class FilesystemPublisher extends StaticPublisher {
|
|||||||
* Set a different base URL for the static copy of the site.
|
* Set a different base URL for the static copy of the site.
|
||||||
* This can be useful if you are running the CMS on a different domain from the website.
|
* This can be useful if you are running the CMS on a different domain from the website.
|
||||||
*/
|
*/
|
||||||
static function set_static_base_url($url) {
|
static public function set_static_base_url($url) {
|
||||||
self::$static_base_url = $url;
|
self::$static_base_url = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class FilesystemPublisher extends StaticPublisher {
|
|||||||
* with the filename 'index.html'. If you set the extension to PHP, then a simple PHP script will
|
* with the filename 'index.html'. If you set the extension to PHP, then a simple PHP script will
|
||||||
* be generated that can do appropriate cache & redirect header negotation.
|
* be generated that can do appropriate cache & redirect header negotation.
|
||||||
*/
|
*/
|
||||||
function __construct($destFolder = 'cache', $fileExtension = null) {
|
public function __construct($destFolder = 'cache', $fileExtension = null) {
|
||||||
// Remove trailing slash from folder
|
// Remove trailing slash from folder
|
||||||
if(substr($destFolder, -1) == '/') $destFolder = substr($destFolder, 0, -1);
|
if(substr($destFolder, -1) == '/') $destFolder = substr($destFolder, 0, -1);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class FilesystemPublisher extends StaticPublisher {
|
|||||||
* @param Array $urls Absolute or relative URLs
|
* @param Array $urls Absolute or relative URLs
|
||||||
* @return Array Map of original URLs to filesystem paths (relative to {@link $destFolder}).
|
* @return Array Map of original URLs to filesystem paths (relative to {@link $destFolder}).
|
||||||
*/
|
*/
|
||||||
function urlsToPaths($urls) {
|
public function urlsToPaths($urls) {
|
||||||
$mappedUrls = array();
|
$mappedUrls = array();
|
||||||
foreach($urls as $url) {
|
foreach($urls as $url) {
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class FilesystemPublisher extends StaticPublisher {
|
|||||||
return $mappedUrls;
|
return $mappedUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unpublishPages($urls) {
|
public function unpublishPages($urls) {
|
||||||
// Do we need to map these?
|
// Do we need to map these?
|
||||||
// Detect a numerically indexed arrays
|
// Detect a numerically indexed arrays
|
||||||
if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls);
|
if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls);
|
||||||
@ -142,7 +142,7 @@ class FilesystemPublisher extends StaticPublisher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function publishPages($urls) {
|
public function publishPages($urls) {
|
||||||
// Do we need to map these?
|
// Do we need to map these?
|
||||||
// Detect a numerically indexed arrays
|
// Detect a numerically indexed arrays
|
||||||
if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls);
|
if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls);
|
||||||
|
@ -24,7 +24,7 @@ class RsyncMultiHostPublisher extends FilesystemPublisher {
|
|||||||
*
|
*
|
||||||
* @param $targets An array of targets to publish to. These can either be local file names, or scp-style targets, in the form "user@server:path"
|
* @param $targets An array of targets to publish to. These can either be local file names, or scp-style targets, in the form "user@server:path"
|
||||||
*/
|
*/
|
||||||
static function set_targets($targets) {
|
static public function set_targets($targets) {
|
||||||
self::$targets = $targets;
|
self::$targets = $targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ class RsyncMultiHostPublisher extends FilesystemPublisher {
|
|||||||
* Specify folders to exclude from the rsync
|
* Specify folders to exclude from the rsync
|
||||||
* For example, you could exclude assets.
|
* For example, you could exclude assets.
|
||||||
*/
|
*/
|
||||||
static function set_excluded_folders($folders) {
|
static public function set_excluded_folders($folders) {
|
||||||
self::$excluded_folders = $folders;
|
self::$excluded_folders = $folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
function publishPages($urls) {
|
public function publishPages($urls) {
|
||||||
parent::publishPages($urls);
|
parent::publishPages($urls);
|
||||||
$base = Director::baseFolder();
|
$base = Director::baseFolder();
|
||||||
$framework = FRAMEWORK_DIR;
|
$framework = FRAMEWORK_DIR;
|
||||||
|
@ -24,18 +24,18 @@ abstract class StaticPublisher extends DataExtension {
|
|||||||
*/
|
*/
|
||||||
static $static_publisher_theme=false;
|
static $static_publisher_theme=false;
|
||||||
|
|
||||||
abstract function publishPages($pages);
|
abstract public function publishPages($pages);
|
||||||
abstract function unpublishPages($pages);
|
abstract public function unpublishPages($pages);
|
||||||
|
|
||||||
static function set_static_publisher_theme($theme){
|
static public function set_static_publisher_theme($theme){
|
||||||
self::$static_publisher_theme=$theme;
|
self::$static_publisher_theme=$theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function static_publisher_theme(){
|
static public function static_publisher_theme(){
|
||||||
return self::$static_publisher_theme;
|
return self::$static_publisher_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function echo_progress() {
|
static public function echo_progress() {
|
||||||
return (boolean)self::$echo_progress;
|
return (boolean)self::$echo_progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,14 +43,14 @@ abstract class StaticPublisher extends DataExtension {
|
|||||||
* Either turns on (boolean true) or off (boolean false) the progress indicators.
|
* Either turns on (boolean true) or off (boolean false) the progress indicators.
|
||||||
* @see StaticPublisher::$echo_progress
|
* @see StaticPublisher::$echo_progress
|
||||||
*/
|
*/
|
||||||
static function set_echo_progress($progress) {
|
static public function set_echo_progress($progress) {
|
||||||
self::$echo_progress = (boolean)$progress;
|
self::$echo_progress = (boolean)$progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after a page is published.
|
* Called after a page is published.
|
||||||
*/
|
*/
|
||||||
function onAfterPublish($original) {
|
public function onAfterPublish($original) {
|
||||||
$this->republish($original);
|
$this->republish($original);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,11 +60,11 @@ abstract class StaticPublisher extends DataExtension {
|
|||||||
*
|
*
|
||||||
* Only called if the published content exists and has been modified.
|
* Only called if the published content exists and has been modified.
|
||||||
*/
|
*/
|
||||||
function onRenameLinkedAsset($original) {
|
public function onRenameLinkedAsset($original) {
|
||||||
$this->republish($original);
|
$this->republish($original);
|
||||||
}
|
}
|
||||||
|
|
||||||
function republish($original) {
|
public function republish($original) {
|
||||||
if (self::$disable_realtime) return;
|
if (self::$disable_realtime) return;
|
||||||
|
|
||||||
$urls = array();
|
$urls = array();
|
||||||
@ -102,7 +102,7 @@ abstract class StaticPublisher extends DataExtension {
|
|||||||
* On after unpublish, get changes and hook into underlying
|
* On after unpublish, get changes and hook into underlying
|
||||||
* functionality
|
* functionality
|
||||||
*/
|
*/
|
||||||
function onAfterUnpublish($page) {
|
public function onAfterUnpublish($page) {
|
||||||
if (self::$disable_realtime) return;
|
if (self::$disable_realtime) return;
|
||||||
|
|
||||||
// Get the affected URLs
|
// Get the affected URLs
|
||||||
@ -125,7 +125,7 @@ abstract class StaticPublisher extends DataExtension {
|
|||||||
/**
|
/**
|
||||||
* Get all external references to CSS, JS,
|
* Get all external references to CSS, JS,
|
||||||
*/
|
*/
|
||||||
function externalReferencesFor($content) {
|
public function externalReferencesFor($content) {
|
||||||
$CLI_content = escapeshellarg($content);
|
$CLI_content = escapeshellarg($content);
|
||||||
$tidy = `echo $CLI_content | tidy -numeric -asxhtml`;
|
$tidy = `echo $CLI_content | tidy -numeric -asxhtml`;
|
||||||
$tidy = preg_replace('/xmlns="[^"]+"/','', $tidy);
|
$tidy = preg_replace('/xmlns="[^"]+"/','', $tidy);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function windowName(suffix) {
|
public function windowName(suffix) {
|
||||||
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
|
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
|
||||||
return base + suffix;
|
return base + suffix;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class FilesystemSyncTask extends BuildTask {
|
|||||||
should be called whenever files are added to the assets/ folder from outside
|
should be called whenever files are added to the assets/ folder from outside
|
||||||
SilverStripe, for example, if an author uploads files via FTP.";
|
SilverStripe, for example, if an author uploads files via FTP.";
|
||||||
|
|
||||||
function run($request) {
|
public function run($request) {
|
||||||
if(isset($_GET['folderID'])) {
|
if(isset($_GET['folderID'])) {
|
||||||
$folderID = $_GET['folderID'];
|
$folderID = $_GET['folderID'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,7 +11,7 @@ class RebuildStaticCacheTask extends Controller {
|
|||||||
'index',
|
'index',
|
||||||
);
|
);
|
||||||
|
|
||||||
function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
Versioned::reading_stage('live');
|
Versioned::reading_stage('live');
|
||||||
@ -20,7 +20,7 @@ class RebuildStaticCacheTask extends Controller {
|
|||||||
if(!$canAccess) return Security::permissionFailure($this);
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
function index() {
|
public function index() {
|
||||||
StaticPublisher::set_echo_progress(true);
|
StaticPublisher::set_echo_progress(true);
|
||||||
|
|
||||||
$page = singleton('Page');
|
$page = singleton('Page');
|
||||||
@ -44,7 +44,7 @@ class RebuildStaticCacheTask extends Controller {
|
|||||||
* @param array $urls The URLs of pages to re-fetch and cache.
|
* @param array $urls The URLs of pages to re-fetch and cache.
|
||||||
* @param bool $removeAll Remove all stale cache files (default TRUE).
|
* @param bool $removeAll Remove all stale cache files (default TRUE).
|
||||||
*/
|
*/
|
||||||
function rebuildCache($urls, $removeAll = true) {
|
public function rebuildCache($urls, $removeAll = true) {
|
||||||
|
|
||||||
if(!is_array($urls)) {
|
if(!is_array($urls)) {
|
||||||
// $urls must be an array
|
// $urls must be an array
|
||||||
@ -117,7 +117,7 @@ class RebuildStaticCacheTask extends Controller {
|
|||||||
echo "\n\n== Done! ==";
|
echo "\n\n== Done! ==";
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
public function show() {
|
||||||
$urls = singleton('Page')->allPagesToCache();
|
$urls = singleton('Page')->allPagesToCache();
|
||||||
echo "<pre>\n";
|
echo "<pre>\n";
|
||||||
print_r($urls);
|
print_r($urls);
|
||||||
|
@ -48,11 +48,11 @@ in the other stage:<br />
|
|||||||
|
|
||||||
protected $orphanedSearchClass = 'SiteTree';
|
protected $orphanedSearchClass = 'SiteTree';
|
||||||
|
|
||||||
function Link() {
|
public function Link() {
|
||||||
return $this->class;
|
return $this->class;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
if(!Permission::check('ADMIN')) {
|
if(!Permission::check('ADMIN')) {
|
||||||
@ -60,7 +60,7 @@ in the other stage:<br />
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function index() {
|
public function index() {
|
||||||
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
|
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
|
||||||
Requirements::customCSS('#OrphanIDs .middleColumn {width: auto;}');
|
Requirements::customCSS('#OrphanIDs .middleColumn {width: auto;}');
|
||||||
Requirements::customCSS('#OrphanIDs label {display: inline;}');
|
Requirements::customCSS('#OrphanIDs label {display: inline;}');
|
||||||
@ -68,7 +68,7 @@ in the other stage:<br />
|
|||||||
return $this->renderWith('BlankPage');
|
return $this->renderWith('BlankPage');
|
||||||
}
|
}
|
||||||
|
|
||||||
function Form() {
|
public function Form() {
|
||||||
$fields = new FieldList();
|
$fields = new FieldList();
|
||||||
$source = array();
|
$source = array();
|
||||||
|
|
||||||
@ -179,11 +179,11 @@ in the other stage:<br />
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
function run($request) {
|
public function run($request) {
|
||||||
// @todo Merge with BuildTask functionality
|
// @todo Merge with BuildTask functionality
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSubmit($data, $form) {
|
public function doSubmit($data, $form) {
|
||||||
set_time_limit(60*10); // 10 minutes
|
set_time_limit(60*10); // 10 minutes
|
||||||
|
|
||||||
if(!isset($data['OrphanIDs']) || !isset($data['OrphanOperation'])) return false;
|
if(!isset($data['OrphanIDs']) || !isset($data['OrphanOperation'])) return false;
|
||||||
@ -321,7 +321,7 @@ in the other stage:<br />
|
|||||||
* @param int|array $limit
|
* @param int|array $limit
|
||||||
* @return SS_List
|
* @return SS_List
|
||||||
*/
|
*/
|
||||||
function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null) {
|
public function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null) {
|
||||||
$filter .= ($filter) ? ' AND ' : '';
|
$filter .= ($filter) ? ' AND ' : '';
|
||||||
$filter .= sprintf("\"%s\".\"ParentID\" != 0 AND \"Parents\".\"ID\" IS NULL", $class);
|
$filter .= sprintf("\"%s\".\"ParentID\" != 0 AND \"Parents\".\"ID\" IS NULL", $class);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class SiteTreeMaintenanceTask extends Controller {
|
|||||||
'*' => 'ADMIN'
|
'*' => 'ADMIN'
|
||||||
);
|
);
|
||||||
|
|
||||||
function makelinksunique() {
|
public function makelinksunique() {
|
||||||
$badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'";
|
$badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'";
|
||||||
$pages = DataObject::get("SiteTree", "\"URLSegment\" IN ($badURLs)");
|
$pages = DataObject::get("SiteTree", "\"URLSegment\" IN ($badURLs)");
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class UpgradeSiteTreePermissionSchemaTask extends BuildTask {
|
|||||||
See http://open.silverstripe.com/ticket/2847
|
See http://open.silverstripe.com/ticket/2847
|
||||||
";
|
";
|
||||||
|
|
||||||
function run($request) {
|
public function run($request) {
|
||||||
// transfer values for changed column name
|
// transfer values for changed column name
|
||||||
foreach(array('SiteTree','SiteTree_Live','SiteTree_versions') as $table) {
|
foreach(array('SiteTree','SiteTree_Live','SiteTree_versions') as $table) {
|
||||||
DB::query("UPDATE \"{$table}\" SET \"CanViewType\" = 'Viewers';");
|
DB::query("UPDATE \"{$table}\" SET \"CanViewType\" = 'Viewers';");
|
||||||
|
@ -11,7 +11,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
|
|
||||||
static protected $orig = array();
|
static protected $orig = array();
|
||||||
|
|
||||||
static function set_up_once() {
|
static public function set_up_once() {
|
||||||
self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions;
|
self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions;
|
||||||
CMSBatchActionHandler::$batch_actions = array(
|
CMSBatchActionHandler::$batch_actions = array(
|
||||||
'publish' => 'CMSBatchAction_Publish',
|
'publish' => 'CMSBatchAction_Publish',
|
||||||
@ -22,7 +22,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
parent::set_up_once();
|
parent::set_up_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function tear_down_once() {
|
static public function tear_down_once() {
|
||||||
CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions'];
|
CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions'];
|
||||||
|
|
||||||
parent::tear_down_once();
|
parent::tear_down_once();
|
||||||
@ -31,7 +31,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
/**
|
/**
|
||||||
* @todo Test the results of a publication better
|
* @todo Test the results of a publication better
|
||||||
*/
|
*/
|
||||||
function testPublish() {
|
public function testPublish() {
|
||||||
$page1 = $this->objFromFixture('Page', "page1");
|
$page1 = $this->objFromFixture('Page', "page1");
|
||||||
$page2 = $this->objFromFixture('Page', "page2");
|
$page2 = $this->objFromFixture('Page', "page2");
|
||||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||||
@ -74,7 +74,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
/**
|
/**
|
||||||
* Test publication of one of every page type
|
* Test publication of one of every page type
|
||||||
*/
|
*/
|
||||||
function testPublishOneOfEachKindOfPage() {
|
public function testPublishOneOfEachKindOfPage() {
|
||||||
return;
|
return;
|
||||||
$classes = ClassInfo::subclassesFor("SiteTree");
|
$classes = ClassInfo::subclassesFor("SiteTree");
|
||||||
array_shift($classes);
|
array_shift($classes);
|
||||||
@ -100,7 +100,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
* Test that getCMSFields works on each page type.
|
* Test that getCMSFields works on each page type.
|
||||||
* Mostly, this is just checking that the method doesn't return an error
|
* Mostly, this is just checking that the method doesn't return an error
|
||||||
*/
|
*/
|
||||||
function testThatGetCMSFieldsWorksOnEveryPageType() {
|
public function testThatGetCMSFieldsWorksOnEveryPageType() {
|
||||||
$classes = ClassInfo::subclassesFor("SiteTree");
|
$classes = ClassInfo::subclassesFor("SiteTree");
|
||||||
array_shift($classes);
|
array_shift($classes);
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff() {
|
public function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff() {
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
SiteTree::set_enforce_strict_hierarchy(true);
|
SiteTree::set_enforce_strict_hierarchy(true);
|
||||||
@ -139,7 +139,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
/**
|
/**
|
||||||
* Test that a draft-deleted page can still be opened in the CMS
|
* Test that a draft-deleted page can still be opened in the CMS
|
||||||
*/
|
*/
|
||||||
function testDraftDeletedPageCanBeOpenedInCMS() {
|
public function testDraftDeletedPageCanBeOpenedInCMS() {
|
||||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||||
|
|
||||||
// Set up a page that is delete from live
|
// Set up a page that is delete from live
|
||||||
@ -161,7 +161,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
/**
|
/**
|
||||||
* Test CMSMain::getRecord()
|
* Test CMSMain::getRecord()
|
||||||
*/
|
*/
|
||||||
function testGetRecord() {
|
public function testGetRecord() {
|
||||||
// Set up a page that is delete from live
|
// Set up a page that is delete from live
|
||||||
$page1 = $this->objFromFixture('Page','page1');
|
$page1 = $this->objFromFixture('Page','page1');
|
||||||
$page1ID = $page1->ID;
|
$page1ID = $page1->ID;
|
||||||
@ -185,14 +185,14 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeletedPagesSiteTreeFilter() {
|
public function testDeletedPagesSiteTreeFilter() {
|
||||||
$id = $this->idFromFixture('Page', 'page3');
|
$id = $this->idFromFixture('Page', 'page3');
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
$result = $this->get('admin/pages/getsubtree?filter=CMSSiteTreeFilter_DeletedPages&ajax=1&ID=' . $id);
|
$result = $this->get('admin/pages/getsubtree?filter=CMSSiteTreeFilter_DeletedPages&ajax=1&ID=' . $id);
|
||||||
$this->assertEquals(200, $result->getStatusCode());
|
$this->assertEquals(200, $result->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreationOfTopLevelPage(){
|
public function testCreationOfTopLevelPage(){
|
||||||
$cmsUser = $this->objFromFixture('Member', 'allcmssectionsuser');
|
$cmsUser = $this->objFromFixture('Member', 'allcmssectionsuser');
|
||||||
$rootEditUser = $this->objFromFixture('Member', 'rootedituser');
|
$rootEditUser = $this->objFromFixture('Member', 'rootedituser');
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', NULL);
|
$this->session()->inst_set('loggedInAs', NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreationOfRestrictedPage(){
|
public function testCreationOfRestrictedPage(){
|
||||||
$adminUser = $this->objFromFixture('Member', 'admin');
|
$adminUser = $this->objFromFixture('Member', 'admin');
|
||||||
$adminUser->logIn();
|
$adminUser->logIn();
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', NULL);
|
$this->session()->inst_set('loggedInAs', NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBreadcrumbs() {
|
public function testBreadcrumbs() {
|
||||||
$page3 = $this->objFromFixture('Page', 'page3');
|
$page3 = $this->objFromFixture('Page', 'page3');
|
||||||
$page31 = $this->objFromFixture('Page', 'page31');
|
$page31 = $this->objFromFixture('Page', 'page31');
|
||||||
$adminuser = $this->objFromFixture('Member', 'admin');
|
$adminuser = $this->objFromFixture('Member', 'admin');
|
||||||
|
@ -12,7 +12,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
private $versionUnpublishedCheck, $versionPublishCheck, $versionUnpublishedCheck2;
|
private $versionUnpublishedCheck, $versionPublishCheck, $versionUnpublishedCheck2;
|
||||||
private $page;
|
private $page;
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->loginWithPermission('ADMIN');
|
$this->loginWithPermission('ADMIN');
|
||||||
@ -40,7 +40,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
$this->versionPublishCheck2 = $this->page->Version;
|
$this->versionPublishCheck2 = $this->page->Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetEditForm() {
|
public function testGetEditForm() {
|
||||||
$controller = new CMSPageHistoryController();
|
$controller = new CMSPageHistoryController();
|
||||||
|
|
||||||
// should get the latest version which we cannot rollback to
|
// should get the latest version which we cannot rollback to
|
||||||
@ -84,7 +84,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
* @todo should be less tied to cms theme.
|
* @todo should be less tied to cms theme.
|
||||||
* @todo check highlighting for comparing pages.
|
* @todo check highlighting for comparing pages.
|
||||||
*/
|
*/
|
||||||
function testVersionsForm() {
|
public function testVersionsForm() {
|
||||||
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
||||||
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
|
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
$this->assertEquals(4, count($rows));
|
$this->assertEquals(4, count($rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testVersionsFormTableContainsInformation() {
|
public function testVersionsFormTableContainsInformation() {
|
||||||
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
||||||
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
|
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
|
||||||
$rows = $form[0]->xpath("fieldset/table/tbody/tr");
|
$rows = $form[0]->xpath("fieldset/table/tbody/tr");
|
||||||
@ -126,7 +126,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
$this->assertThat((string) $rows[1]->attributes()->class, $this->logicalNot($this->stringContains('active')));
|
$this->assertThat((string) $rows[1]->attributes()->class, $this->logicalNot($this->stringContains('active')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testVersionsFormSelectsUnpublishedCheckbox() {
|
public function testVersionsFormSelectsUnpublishedCheckbox() {
|
||||||
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
||||||
$checkbox = $this->cssParser()->getBySelector("#Form_VersionsForm #ShowUnpublished input");
|
$checkbox = $this->cssParser()->getBySelector("#Form_VersionsForm #ShowUnpublished input");
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
|
|||||||
|
|
||||||
static $fixture_file = 'CMSSiteTreeFilterTest.yml';
|
static $fixture_file = 'CMSSiteTreeFilterTest.yml';
|
||||||
|
|
||||||
function testSearchFilterEmpty() {
|
public function testSearchFilterEmpty() {
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
$page2 = $this->objFromFixture('Page', 'page2');
|
$page2 = $this->objFromFixture('Page', 'page2');
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
|
|||||||
$this->assertTrue($f->isPageIncluded($page2));
|
$this->assertTrue($f->isPageIncluded($page2));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSearchFilterByTitle() {
|
public function testSearchFilterByTitle() {
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
$page2 = $this->objFromFixture('Page', 'page2');
|
$page2 = $this->objFromFixture('Page', 'page2');
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testIncludesParentsForNestedMatches() {
|
public function testIncludesParentsForNestedMatches() {
|
||||||
$parent = $this->objFromFixture('Page', 'page3');
|
$parent = $this->objFromFixture('Page', 'page3');
|
||||||
$child = $this->objFromFixture('Page', 'page3b');
|
$child = $this->objFromFixture('Page', 'page3b');
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testChangedPagesFilter() {
|
public function testChangedPagesFilter() {
|
||||||
$unchangedPage = $this->objFromFixture('Page', 'page1');
|
$unchangedPage = $this->objFromFixture('Page', 'page1');
|
||||||
$unchangedPage->doPublish();
|
$unchangedPage->doPublish();
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeletedPagesFilter() {
|
public function testDeletedPagesFilter() {
|
||||||
$deletedPage = $this->objFromFixture('Page', 'page2');
|
$deletedPage = $this->objFromFixture('Page', 'page2');
|
||||||
$deletedPage->publish('Stage', 'Live');
|
$deletedPage->publish('Stage', 'Live');
|
||||||
$deletedPageID = $deletedPage->ID;
|
$deletedPageID = $deletedPage->ID;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class ContentControllerSearchExtensionTest extends SapphireTest {
|
class ContentControllerSearchExtensionTest extends SapphireTest {
|
||||||
|
|
||||||
function testCustomSearchFormClassesToTest() {
|
public function testCustomSearchFormClassesToTest() {
|
||||||
FulltextSearchable::enable('File');
|
FulltextSearchable::enable('File');
|
||||||
|
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
|
@ -19,7 +19,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
* This setup will enable nested-urls for this test and resets the state
|
* This setup will enable nested-urls for this test and resets the state
|
||||||
* after the tests have been performed.
|
* after the tests have been performed.
|
||||||
*/
|
*/
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->orig['nested_urls'] = SiteTree::nested_urls();
|
$this->orig['nested_urls'] = SiteTree::nested_urls();
|
||||||
@ -32,7 +32,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
* This setup will enable nested-urls for this test and resets the state
|
* This setup will enable nested-urls for this test and resets the state
|
||||||
* after the tests have been performed.
|
* after the tests have been performed.
|
||||||
*/
|
*/
|
||||||
function tearDown() {
|
public function tearDown() {
|
||||||
|
|
||||||
if (isset($this->orig['nested_urls']) && !$this->orig['nested_urls']) {
|
if (isset($this->orig['nested_urls']) && !$this->orig['nested_urls']) {
|
||||||
SiteTree::disable_nested_urls();
|
SiteTree::disable_nested_urls();
|
||||||
@ -131,7 +131,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
$response->getHeader("Location"));
|
$response->getHeader("Location"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDoesntRedirectToNestedChildrenOutsideOfOwnHierarchy() {
|
public function testDoesntRedirectToNestedChildrenOutsideOfOwnHierarchy() {
|
||||||
$this->generateNestedPagesFixture();
|
$this->generateNestedPagesFixture();
|
||||||
|
|
||||||
$otherParent = new Page(array(
|
$otherParent = new Page(array(
|
||||||
@ -156,7 +156,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
* NOTE: This test requires nested_urls
|
* NOTE: This test requires nested_urls
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function testRedirectsNestedRenamedPagesWithGetParameters() {
|
public function testRedirectsNestedRenamedPagesWithGetParameters() {
|
||||||
$this->generateNestedPagesFixture();
|
$this->generateNestedPagesFixture();
|
||||||
|
|
||||||
// check third level URLSegment
|
// check third level URLSegment
|
||||||
@ -173,7 +173,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
* NOTE: This test requires nested_urls
|
* NOTE: This test requires nested_urls
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function testDoesntRedirectToNestedRenamedPageWhenNewExists() {
|
public function testDoesntRedirectToNestedRenamedPageWhenNewExists() {
|
||||||
$this->generateNestedPagesFixture();
|
$this->generateNestedPagesFixture();
|
||||||
|
|
||||||
$otherLevel1 = new Page(array(
|
$otherLevel1 = new Page(array(
|
||||||
@ -202,7 +202,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
* NOTE: This test requires nested_urls
|
* NOTE: This test requires nested_urls
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function testFindOldPage(){
|
public function testFindOldPage(){
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
$page->Title = 'First Level';
|
$page->Title = 'First Level';
|
||||||
$page->URLSegment = 'oldurl';
|
$page->URLSegment = 'oldurl';
|
||||||
@ -239,7 +239,7 @@ class ModelAsControllerTest extends FunctionalTest {
|
|||||||
*
|
*
|
||||||
* NOTE: This test requires nested_urls
|
* NOTE: This test requires nested_urls
|
||||||
*/
|
*/
|
||||||
function testChildOfDraft() {
|
public function testChildOfDraft() {
|
||||||
RootURLController::reset();
|
RootURLController::reset();
|
||||||
SiteTree::enable_nested_urls();
|
SiteTree::enable_nested_urls();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class SilverStripeNavigatorTest extends SapphireTest {
|
|||||||
|
|
||||||
static $fixture_file = 'cms/tests/controller/CMSMainTest.yml';
|
static $fixture_file = 'cms/tests/controller/CMSMainTest.yml';
|
||||||
|
|
||||||
function testGetItems() {
|
public function testGetItems() {
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$navigator = new SilverStripeNavigator($page);
|
$navigator = new SilverStripeNavigator($page);
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class SilverStripeNavigatorTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanView() {
|
public function testCanView() {
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$admin = $this->objFromFixture('Member', 'admin');
|
$admin = $this->objFromFixture('Member', 'admin');
|
||||||
$author = $this->objFromFixture('Member', 'assetsonlyuser');
|
$author = $this->objFromFixture('Member', 'assetsonlyuser');
|
||||||
@ -47,7 +47,7 @@ class SilverStripeNavigatorTest_TestItem extends SilverStripeNavigatorItem imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SilverStripeNavigatorTest_ProtectedTestItem extends SilverStripeNavigatorItem implements TestOnly {
|
class SilverStripeNavigatorTest_ProtectedTestItem extends SilverStripeNavigatorItem implements TestOnly {
|
||||||
function canView($member = null) {
|
public function canView($member = null) {
|
||||||
if(!$member) $member = Member::currentUser();
|
if(!$member) $member = Member::currentUser();
|
||||||
return Permission::checkMember($member, 'ADMIN');
|
return Permission::checkMember($member, 'ADMIN');
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class ErrorPageTest extends FunctionalTest {
|
|||||||
|
|
||||||
protected $tmpAssetsPath = '';
|
protected $tmpAssetsPath = '';
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->orig['ErrorPage_staticfilepath'] = ErrorPage::get_static_filepath();
|
$this->orig['ErrorPage_staticfilepath'] = ErrorPage::get_static_filepath();
|
||||||
@ -23,7 +23,7 @@ class ErrorPageTest extends FunctionalTest {
|
|||||||
Director::set_environment_type('live');
|
Director::set_environment_type('live');
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
ErrorPage::set_static_filepath($this->orig['ErrorPage_staticfilepath']);
|
ErrorPage::set_static_filepath($this->orig['ErrorPage_staticfilepath']);
|
||||||
@ -33,7 +33,7 @@ class ErrorPageTest extends FunctionalTest {
|
|||||||
Filesystem::removeFolder($this->tmpAssetsPath);
|
Filesystem::removeFolder($this->tmpAssetsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test404ErrorPage() {
|
public function test404ErrorPage() {
|
||||||
$page = $this->objFromFixture('ErrorPage', '404');
|
$page = $this->objFromFixture('ErrorPage', '404');
|
||||||
// ensure that the errorpage exists as a physical file
|
// ensure that the errorpage exists as a physical file
|
||||||
$page->publish('Stage', 'Live');
|
$page->publish('Stage', 'Live');
|
||||||
@ -50,7 +50,7 @@ class ErrorPageTest extends FunctionalTest {
|
|||||||
$this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"');
|
$this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBehaviourOfShowInMenuAndShowInSearchFlags() {
|
public function testBehaviourOfShowInMenuAndShowInSearchFlags() {
|
||||||
$page = $this->objFromFixture('ErrorPage', '404');
|
$page = $this->objFromFixture('ErrorPage', '404');
|
||||||
|
|
||||||
/* Don't show the error page in the menus */
|
/* Don't show the error page in the menus */
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
class FileLinkTrackingTest extends SapphireTest {
|
class FileLinkTrackingTest extends SapphireTest {
|
||||||
static $fixture_file = "FileLinkTrackingTest.yml";
|
static $fixture_file = "FileLinkTrackingTest.yml";
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class FileLinkTrackingTest extends SapphireTest {
|
|||||||
fclose($fh);
|
fclose($fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
$testFiles = array(
|
$testFiles = array(
|
||||||
'/testscript-test-file.pdf',
|
'/testscript-test-file.pdf',
|
||||||
@ -28,7 +28,7 @@ class FileLinkTrackingTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testFileRenameUpdatesDraftAndPublishedPages() {
|
public function testFileRenameUpdatesDraftAndPublishedPages() {
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$this->assertTrue($page->doPublish());
|
$this->assertTrue($page->doPublish());
|
||||||
$this->assertContains('<img src="assets/testscript-test-file.pdf"',
|
$this->assertContains('<img src="assets/testscript-test-file.pdf"',
|
||||||
@ -44,7 +44,7 @@ class FileLinkTrackingTest extends SapphireTest {
|
|||||||
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
|
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testFileLinkRewritingOnVirtualPages() {
|
public function testFileLinkRewritingOnVirtualPages() {
|
||||||
// Publish the source page
|
// Publish the source page
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$this->assertTrue($page->doPublish());
|
$this->assertTrue($page->doPublish());
|
||||||
@ -67,7 +67,7 @@ class FileLinkTrackingTest extends SapphireTest {
|
|||||||
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $svp->ID")->value());
|
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $svp->ID")->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft() {
|
public function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft() {
|
||||||
// Publish the source page
|
// Publish the source page
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$this->assertTrue($page->doPublish());
|
$this->assertTrue($page->doPublish());
|
||||||
@ -86,7 +86,7 @@ class FileLinkTrackingTest extends SapphireTest {
|
|||||||
$this->assertFalse($page->IsModifiedOnStage);
|
$this->assertFalse($page->IsModifiedOnStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testTwoFileRenamesInARowWork() {
|
public function testTwoFileRenamesInARowWork() {
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$this->assertTrue($page->doPublish());
|
$this->assertTrue($page->doPublish());
|
||||||
$this->assertContains('<img src="assets/testscript-test-file.pdf"',
|
$this->assertContains('<img src="assets/testscript-test-file.pdf"',
|
||||||
|
@ -4,14 +4,14 @@ class RedirectorPageTest extends FunctionalTest {
|
|||||||
static $fixture_file = 'RedirectorPageTest.yml';
|
static $fixture_file = 'RedirectorPageTest.yml';
|
||||||
static $use_draft_site = true;
|
static $use_draft_site = true;
|
||||||
|
|
||||||
function testGoodRedirectors() {
|
public function testGoodRedirectors() {
|
||||||
/* For good redirectors, the final destination URL will be returned */
|
/* For good redirectors, the final destination URL will be returned */
|
||||||
$this->assertEquals("http://www.google.com", $this->objFromFixture('RedirectorPage','goodexternal')->Link());
|
$this->assertEquals("http://www.google.com", $this->objFromFixture('RedirectorPage','goodexternal')->Link());
|
||||||
$this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->redirectionLink());
|
$this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->redirectionLink());
|
||||||
$this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->Link());
|
$this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->Link());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEmptyRedirectors() {
|
public function testEmptyRedirectors() {
|
||||||
/* If a redirector page is misconfigured, then its link method will just return the usual URLSegment-generated value */
|
/* If a redirector page is misconfigured, then its link method will just return the usual URLSegment-generated value */
|
||||||
$page1 = $this->objFromFixture('RedirectorPage','badexternal');
|
$page1 = $this->objFromFixture('RedirectorPage','badexternal');
|
||||||
$this->assertEquals(Director::baseURL() . 'bad-external/', $page1->Link());
|
$this->assertEquals(Director::baseURL() . 'bad-external/', $page1->Link());
|
||||||
@ -27,7 +27,7 @@ class RedirectorPageTest extends FunctionalTest {
|
|||||||
$this->assertContains('message-setupWithoutRedirect', $content);
|
$this->assertContains('message-setupWithoutRedirect', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testReflexiveAndTransitiveInternalRedirectors() {
|
public function testReflexiveAndTransitiveInternalRedirectors() {
|
||||||
/* Reflexive redirectors are those that point to themselves. They should behave the same as an empty redirector */
|
/* Reflexive redirectors are those that point to themselves. They should behave the same as an empty redirector */
|
||||||
$page = $this->objFromFixture('RedirectorPage','reflexive');
|
$page = $this->objFromFixture('RedirectorPage','reflexive');
|
||||||
$this->assertEquals(Director::baseURL() . 'reflexive/', $page->Link());
|
$this->assertEquals(Director::baseURL() . 'reflexive/', $page->Link());
|
||||||
@ -44,7 +44,7 @@ class RedirectorPageTest extends FunctionalTest {
|
|||||||
$this->assertEquals(Director::baseURL() . "redirection-dest/", $response->getHeader("Location"));
|
$this->assertEquals(Director::baseURL() . "redirection-dest/", $response->getHeader("Location"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testExternalURLGetsPrefixIfNotSet() {
|
public function testExternalURLGetsPrefixIfNotSet() {
|
||||||
$page = $this->objFromFixture('RedirectorPage', 'externalnoprefix');
|
$page = $this->objFromFixture('RedirectorPage', 'externalnoprefix');
|
||||||
$this->assertEquals($page->ExternalURL, 'http://google.com', 'onBeforeWrite has prefixed with http');
|
$this->assertEquals($page->ExternalURL, 'http://google.com', 'onBeforeWrite has prefixed with http');
|
||||||
$page->write();
|
$page->write();
|
||||||
|
@ -12,7 +12,7 @@ class SiteConfigTest extends SapphireTest {
|
|||||||
'SiteTree' => array('SiteTreeSubsites')
|
'SiteTree' => array('SiteTreeSubsites')
|
||||||
);
|
);
|
||||||
|
|
||||||
function testAvailableThemes() {
|
public function testAvailableThemes() {
|
||||||
$config = SiteConfig::current_site_config();
|
$config = SiteConfig::current_site_config();
|
||||||
$ds = DIRECTORY_SEPARATOR;
|
$ds = DIRECTORY_SEPARATOR;
|
||||||
$testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes';
|
$testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes';
|
||||||
|
@ -16,19 +16,19 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
|
|
||||||
static $fixture_file = 'SiteTreeActionsTest.yml';
|
static $fixture_file = 'SiteTreeActionsTest.yml';
|
||||||
|
|
||||||
static function set_up_once() {
|
static public function set_up_once() {
|
||||||
SiteTreeTest::set_up_once();
|
SiteTreeTest::set_up_once();
|
||||||
|
|
||||||
parent::set_up_once();
|
parent::set_up_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function tear_down_once() {
|
static public function tear_down_once() {
|
||||||
SiteTreeTest::tear_down_once();
|
SiteTreeTest::tear_down_once();
|
||||||
|
|
||||||
parent::tear_down_once();
|
parent::tear_down_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testActionsReadonly() {
|
public function testActionsReadonly() {
|
||||||
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
||||||
|
|
||||||
$readonlyEditor = $this->objFromFixture('Member', 'cmsreadonlyeditor');
|
$readonlyEditor = $this->objFromFixture('Member', 'cmsreadonlyeditor');
|
||||||
@ -50,7 +50,7 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
$this->assertNull($actions->dataFieldByName('action_revert'));
|
$this->assertNull($actions->dataFieldByName('action_revert'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testActionsNoDeletePublishedRecord() {
|
public function testActionsNoDeletePublishedRecord() {
|
||||||
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
||||||
|
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
@ -79,7 +79,7 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
$this->assertNotNull($actions->dataFieldByName('action_deletefromlive'));
|
$this->assertNotNull($actions->dataFieldByName('action_deletefromlive'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testActionsPublishedRecord() {
|
public function testActionsPublishedRecord() {
|
||||||
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
||||||
|
|
||||||
$author = $this->objFromFixture('Member', 'cmseditor');
|
$author = $this->objFromFixture('Member', 'cmseditor');
|
||||||
@ -101,7 +101,7 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
$this->assertNull($actions->dataFieldByName('action_revert'));
|
$this->assertNull($actions->dataFieldByName('action_revert'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testActionsDeletedFromStageRecord() {
|
public function testActionsDeletedFromStageRecord() {
|
||||||
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
||||||
|
|
||||||
$author = $this->objFromFixture('Member', 'cmseditor');
|
$author = $this->objFromFixture('Member', 'cmseditor');
|
||||||
@ -129,7 +129,7 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
$this->assertNotNull($actions->dataFieldByName('action_revert'));
|
$this->assertNotNull($actions->dataFieldByName('action_revert'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testActionsChangedOnStageRecord() {
|
public function testActionsChangedOnStageRecord() {
|
||||||
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
||||||
|
|
||||||
$author = $this->objFromFixture('Member', 'cmseditor');
|
$author = $this->objFromFixture('Member', 'cmseditor');
|
||||||
@ -153,7 +153,7 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
$this->assertNull($actions->dataFieldByName('action_revert'));
|
$this->assertNull($actions->dataFieldByName('action_revert'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testActionsViewingOldVersion() {
|
public function testActionsViewingOldVersion() {
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Content = 'test page first version';
|
$p->Content = 'test page first version';
|
||||||
$p->write();
|
$p->write();
|
||||||
@ -175,11 +175,11 @@ class SiteTreeActionsTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SiteTreeActionsTest_Page extends Page implements TestOnly {
|
class SiteTreeActionsTest_Page extends Page implements TestOnly {
|
||||||
function canEdit($member = null) {
|
public function canEdit($member = null) {
|
||||||
return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANEDIT');
|
return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANEDIT');
|
||||||
}
|
}
|
||||||
|
|
||||||
function canDelete($member = null) {
|
public function canDelete($member = null) {
|
||||||
return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANDELETE');
|
return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANDELETE');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,19 +7,19 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
'SiteTree' => array('SiteTreeBacklinksTest_DOD'),
|
'SiteTree' => array('SiteTreeBacklinksTest_DOD'),
|
||||||
);
|
);
|
||||||
|
|
||||||
static function set_up_once() {
|
static public function set_up_once() {
|
||||||
SiteTreeTest::set_up_once();
|
SiteTreeTest::set_up_once();
|
||||||
|
|
||||||
parent::set_up_once();
|
parent::set_up_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function tear_down_once() {
|
static public function tear_down_once() {
|
||||||
SiteTreeTest::tear_down_once();
|
SiteTreeTest::tear_down_once();
|
||||||
|
|
||||||
parent::tear_down_once();
|
parent::tear_down_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Log in as admin so that we don't run into permission issues. That's not what we're
|
// Log in as admin so that we don't run into permission issues. That's not what we're
|
||||||
@ -27,7 +27,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSavingPageWithLinkAddsBacklink() {
|
public function testSavingPageWithLinkAddsBacklink() {
|
||||||
// load page 1
|
// load page 1
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->assertContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 exists');
|
$this->assertContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRemovingLinkFromPageRemovesBacklink() {
|
public function testRemovingLinkFromPageRemovesBacklink() {
|
||||||
// load page 1
|
// load page 1
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->assertNotContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 doesn\'t exist');
|
$this->assertNotContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 doesn\'t exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testChangingUrlOnDraftSiteRewritesLink() {
|
public function testChangingUrlOnDraftSiteRewritesLink() {
|
||||||
// load page 1
|
// load page 1
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
|
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testChangingUrlOnLiveSiteRewritesLink() {
|
public function testChangingUrlOnLiveSiteRewritesLink() {
|
||||||
// publish page 1 & 3
|
// publish page 1 & 3
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
$page3 = $this->objFromFixture('Page', 'page3');
|
$page3 = $this->objFromFixture('Page', 'page3');
|
||||||
@ -120,7 +120,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
|
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPublishingPageWithModifiedUrlRewritesLink() {
|
public function testPublishingPageWithModifiedUrlRewritesLink() {
|
||||||
// publish page 1 & 3
|
// publish page 1 & 3
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
$page3 = $this->objFromFixture('Page', 'page3');
|
$page3 = $this->objFromFixture('Page', 'page3');
|
||||||
@ -155,7 +155,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new published url exists on page 3');
|
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new published url exists on page 3');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPublishingPageWithModifiedLinksRewritesLinks() {
|
public function testPublishingPageWithModifiedLinksRewritesLinks() {
|
||||||
// publish page 1 & 3
|
// publish page 1 & 3
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
$page3 = $this->objFromFixture('Page', 'page3');
|
$page3 = $this->objFromFixture('Page', 'page3');
|
||||||
@ -195,7 +195,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
|
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLinkTrackingOnExtraContentFields() {
|
public function testLinkTrackingOnExtraContentFields() {
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
$page2 = $this->objFromFixture('Page', 'page2');
|
$page2 = $this->objFromFixture('Page', 'page2');
|
||||||
$page1->doPublish();
|
$page1->doPublish();
|
||||||
@ -248,7 +248,7 @@ class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly {
|
|||||||
'ExtraContent' => 'HTMLText',
|
'ExtraContent' => 'HTMLText',
|
||||||
);
|
);
|
||||||
|
|
||||||
function updateCMSFields(FieldList $fields) {
|
public function updateCMSFields(FieldList $fields) {
|
||||||
$fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent"));
|
$fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
class SiteTreeBrokenLinksTest extends SapphireTest {
|
class SiteTreeBrokenLinksTest extends SapphireTest {
|
||||||
static $fixture_file = 'SiteTreeBrokenLinksTest.yml';
|
static $fixture_file = 'SiteTreeBrokenLinksTest.yml';
|
||||||
|
|
||||||
static function set_up_once() {
|
static public function set_up_once() {
|
||||||
SiteTreeTest::set_up_once();
|
SiteTreeTest::set_up_once();
|
||||||
|
|
||||||
parent::set_up_once();
|
parent::set_up_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function tear_down_once() {
|
static public function tear_down_once() {
|
||||||
SiteTreeTest::tear_down_once();
|
SiteTreeTest::tear_down_once();
|
||||||
|
|
||||||
parent::tear_down_once();
|
parent::tear_down_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrokenLinksBetweenPages() {
|
public function testBrokenLinksBetweenPages() {
|
||||||
$obj = $this->objFromFixture('Page','content');
|
$obj = $this->objFromFixture('Page','content');
|
||||||
|
|
||||||
$obj->Content = '<a href="[sitetree_link,id=3423423]">this is a broken link</a>';
|
$obj->Content = '<a href="[sitetree_link,id=3423423]">this is a broken link</a>';
|
||||||
@ -30,7 +30,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
$this->assertFalse($obj->HasBrokenLink, 'Page does NOT have a broken link');
|
$this->assertFalse($obj->HasBrokenLink, 'Page does NOT have a broken link');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrokenVirtualPages() {
|
public function testBrokenVirtualPages() {
|
||||||
$obj = $this->objFromFixture('Page','content');
|
$obj = $this->objFromFixture('Page','content');
|
||||||
$vp = new VirtualPage();
|
$vp = new VirtualPage();
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
$this->assertTrue($vp->HasBrokenLink, 'Broken virtual page IS marked as such');
|
$this->assertTrue($vp->HasBrokenLink, 'Broken virtual page IS marked as such');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrokenInternalRedirectorPages() {
|
public function testBrokenInternalRedirectorPages() {
|
||||||
$obj = $this->objFromFixture('Page','content');
|
$obj = $this->objFromFixture('Page','content');
|
||||||
$rp = new RedirectorPage();
|
$rp = new RedirectorPage();
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
$this->assertTrue($rp->HasBrokenLink, 'Broken redirector page IS marked as such');
|
$this->assertTrue($rp->HasBrokenLink, 'Broken redirector page IS marked as such');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrokenAssetLinks() {
|
public function testBrokenAssetLinks() {
|
||||||
$obj = $this->objFromFixture('Page','content');
|
$obj = $this->objFromFixture('Page','content');
|
||||||
|
|
||||||
$obj->Content = '<a href="assets/nofilehere.pdf">this is a broken link to a pdf file</a>';
|
$obj->Content = '<a href="assets/nofilehere.pdf">this is a broken link to a pdf file</a>';
|
||||||
@ -70,7 +70,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
$this->assertFalse($obj->HasBrokenFile, 'Page does NOT have a broken file');
|
$this->assertFalse($obj->HasBrokenFile, 'Page does NOT have a broken file');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeletingFileMarksBackedPagesAsBroken() {
|
public function testDeletingFileMarksBackedPagesAsBroken() {
|
||||||
// Test entry
|
// Test entry
|
||||||
$file = new File();
|
$file = new File();
|
||||||
$file->Filename = 'test-file.pdf';
|
$file->Filename = 'test-file.pdf';
|
||||||
@ -99,7 +99,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
$liveObj = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $obj->ID");
|
$liveObj = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $obj->ID");
|
||||||
$this->assertEquals(1, $liveObj->HasBrokenFile);
|
$this->assertEquals(1, $liveObj->HasBrokenFile);
|
||||||
}
|
}
|
||||||
function testDeletingMarksBackLinkedPagesAsBroken() {
|
public function testDeletingMarksBackLinkedPagesAsBroken() {
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
// Set up two published pages with a link from content -> about
|
// Set up two published pages with a link from content -> about
|
||||||
@ -142,7 +142,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
WHERE \"ID\" = $linkSrc->ID")->value());
|
WHERE \"ID\" = $linkSrc->ID")->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPublishingSourceBeforeDestHasBrokenLink() {
|
public function testPublishingSourceBeforeDestHasBrokenLink() {
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
// Set up two draft pages with a link from content -> about
|
// Set up two draft pages with a link from content -> about
|
||||||
@ -164,7 +164,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testRestoreFixesBrokenLinks() {
|
public function testRestoreFixesBrokenLinks() {
|
||||||
// Create page and virutal page
|
// Create page and virutal page
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Title = "source";
|
$p->Title = "source";
|
||||||
@ -239,7 +239,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRevertToLiveFixesBrokenLinks() {
|
public function testRevertToLiveFixesBrokenLinks() {
|
||||||
// Create page and virutal page
|
// Create page and virutal page
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Title = "source";
|
$p->Title = "source";
|
||||||
|
@ -13,19 +13,19 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
'SiteTree' => array('SiteTreeSubsites')
|
'SiteTree' => array('SiteTreeSubsites')
|
||||||
);
|
);
|
||||||
|
|
||||||
static function set_up_once() {
|
static public function set_up_once() {
|
||||||
SiteTreeTest::set_up_once();
|
SiteTreeTest::set_up_once();
|
||||||
|
|
||||||
parent::set_up_once();
|
parent::set_up_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function tear_down_once() {
|
static public function tear_down_once() {
|
||||||
SiteTreeTest::tear_down_once();
|
SiteTreeTest::tear_down_once();
|
||||||
|
|
||||||
parent::tear_down_once();
|
parent::tear_down_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->useDraftSite();
|
$this->useDraftSite();
|
||||||
@ -35,7 +35,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testAccessingStageWithBlankStage() {
|
public function testAccessingStageWithBlankStage() {
|
||||||
$this->useDraftSite(false);
|
$this->useDraftSite(false);
|
||||||
$this->autoFollowRedirection = false;
|
$this->autoFollowRedirection = false;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->assertEquals($response->getStatusCode(), '404');
|
$this->assertEquals($response->getStatusCode(), '404');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPermissionCheckingWorksOnDeletedPages() {
|
public function testPermissionCheckingWorksOnDeletedPages() {
|
||||||
// Set up fixture - a published page deleted from draft
|
// Set up fixture - a published page deleted from draft
|
||||||
$this->logInWithPermission("ADMIN");
|
$this->logInWithPermission("ADMIN");
|
||||||
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
|
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
|
||||||
@ -94,7 +94,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->assertTrue($page->canEdit());
|
$this->assertTrue($page->canEdit());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPermissionCheckingWorksOnUnpublishedPages() {
|
public function testPermissionCheckingWorksOnUnpublishedPages() {
|
||||||
// Set up fixture - an unpublished page
|
// Set up fixture - an unpublished page
|
||||||
$this->logInWithPermission("ADMIN");
|
$this->logInWithPermission("ADMIN");
|
||||||
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
|
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
|
||||||
@ -116,7 +116,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->assertTrue($page->canEdit());
|
$this->assertTrue($page->canEdit());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanEditOnPageDeletedFromStageAndLiveReturnsFalse() {
|
public function testCanEditOnPageDeletedFromStageAndLiveReturnsFalse() {
|
||||||
// Find a page that exists and delete it from both stage and published
|
// Find a page that exists and delete it from both stage and published
|
||||||
$this->logInWithPermission("ADMIN");
|
$this->logInWithPermission("ADMIN");
|
||||||
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
|
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
|
||||||
@ -134,7 +134,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->assertFalse($page->canEdit());
|
$this->assertFalse($page->canEdit());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanViewStage() {
|
public function testCanViewStage() {
|
||||||
$page = $this->objFromFixture('Page', 'standardpage');
|
$page = $this->objFromFixture('Page', 'standardpage');
|
||||||
$editor = $this->objFromFixture('Member', 'editor');
|
$editor = $this->objFromFixture('Member', 'editor');
|
||||||
$websiteuser = $this->objFromFixture('Member', 'websiteuser');
|
$websiteuser = $this->objFromFixture('Member', 'websiteuser');
|
||||||
@ -146,7 +146,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->assertTrue($page->canViewStage('Stage', $editor));
|
$this->assertTrue($page->canViewStage('Stage', $editor));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAccessTabOnlyDisplaysWithGrantAccessPermissions() {
|
public function testAccessTabOnlyDisplaysWithGrantAccessPermissions() {
|
||||||
$page = $this->objFromFixture('Page', 'standardpage');
|
$page = $this->objFromFixture('Page', 'standardpage');
|
||||||
|
|
||||||
$subadminuser = $this->objFromFixture('Member', 'subadmin');
|
$subadminuser = $this->objFromFixture('Member', 'subadmin');
|
||||||
@ -176,7 +176,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', null);
|
$this->session()->inst_set('loggedInAs', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedViewLoggedInUsers() {
|
public function testRestrictedViewLoggedInUsers() {
|
||||||
$page = $this->objFromFixture('Page', 'restrictedViewLoggedInUsers');
|
$page = $this->objFromFixture('Page', 'restrictedViewLoggedInUsers');
|
||||||
|
|
||||||
// unauthenticated users
|
// unauthenticated users
|
||||||
@ -208,7 +208,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', null);
|
$this->session()->inst_set('loggedInAs', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedViewOnlyTheseUsers() {
|
public function testRestrictedViewOnlyTheseUsers() {
|
||||||
$page = $this->objFromFixture('Page', 'restrictedViewOnlyWebsiteUsers');
|
$page = $this->objFromFixture('Page', 'restrictedViewOnlyWebsiteUsers');
|
||||||
|
|
||||||
// unauthenticcated users
|
// unauthenticcated users
|
||||||
@ -255,7 +255,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', null);
|
$this->session()->inst_set('loggedInAs', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedEditLoggedInUsers() {
|
public function testRestrictedEditLoggedInUsers() {
|
||||||
$page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers');
|
$page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers');
|
||||||
|
|
||||||
// unauthenticcated users
|
// unauthenticcated users
|
||||||
@ -280,7 +280,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedEditOnlySubadminGroup() {
|
public function testRestrictedEditOnlySubadminGroup() {
|
||||||
$page = $this->objFromFixture('Page', 'restrictedEditOnlySubadminGroup');
|
$page = $this->objFromFixture('Page', 'restrictedEditOnlySubadminGroup');
|
||||||
|
|
||||||
// unauthenticated users
|
// unauthenticated users
|
||||||
@ -304,7 +304,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedViewInheritance() {
|
public function testRestrictedViewInheritance() {
|
||||||
$parentPage = $this->objFromFixture('Page', 'parent_restrictedViewOnlySubadminGroup');
|
$parentPage = $this->objFromFixture('Page', 'parent_restrictedViewOnlySubadminGroup');
|
||||||
$childPage = $this->objFromFixture('Page', 'child_restrictedViewOnlySubadminGroup');
|
$childPage = $this->objFromFixture('Page', 'child_restrictedViewOnlySubadminGroup');
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', null);
|
$this->session()->inst_set('loggedInAs', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedEditInheritance() {
|
public function testRestrictedEditInheritance() {
|
||||||
$parentPage = $this->objFromFixture('Page', 'parent_restrictedEditOnlySubadminGroup');
|
$parentPage = $this->objFromFixture('Page', 'parent_restrictedEditOnlySubadminGroup');
|
||||||
$childPage = $this->objFromFixture('Page', 'child_restrictedEditOnlySubadminGroup');
|
$childPage = $this->objFromFixture('Page', 'child_restrictedEditOnlySubadminGroup');
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeleteRestrictedChild() {
|
public function testDeleteRestrictedChild() {
|
||||||
$parentPage = $this->objFromFixture('Page', 'deleteTestParentPage');
|
$parentPage = $this->objFromFixture('Page', 'deleteTestParentPage');
|
||||||
$childPage = $this->objFromFixture('Page', 'deleteTestChildPage');
|
$childPage = $this->objFromFixture('Page', 'deleteTestChildPage');
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestrictedEditLoggedInUsersDeletedFromStage() {
|
public function testRestrictedEditLoggedInUsersDeletedFromStage() {
|
||||||
$page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers');
|
$page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers');
|
||||||
$pageID = $page->ID;
|
$pageID = $page->ID;
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testInheritCanViewFromSiteConfig() {
|
public function testInheritCanViewFromSiteConfig() {
|
||||||
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
||||||
$siteconfig = $this->objFromFixture('SiteConfig', 'default');
|
$siteconfig = $this->objFromFixture('SiteConfig', 'default');
|
||||||
$editor = $this->objFromFixture('Member', 'editor');
|
$editor = $this->objFromFixture('Member', 'editor');
|
||||||
@ -416,7 +416,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
$this->assertFalse($page->canView(FALSE), 'Anonymous can\'t view a page when set to inherit from the SiteConfig, and SiteConfig has canView set to OnlyTheseUsers');
|
$this->assertFalse($page->canView(FALSE), 'Anonymous can\'t view a page when set to inherit from the SiteConfig, and SiteConfig has canView set to OnlyTheseUsers');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testInheritCanEditFromSiteConfig() {
|
public function testInheritCanEditFromSiteConfig() {
|
||||||
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
||||||
$siteconfig = $this->objFromFixture('SiteConfig', 'default');
|
$siteconfig = $this->objFromFixture('SiteConfig', 'default');
|
||||||
$editor = $this->objFromFixture('Member', 'editor');
|
$editor = $this->objFromFixture('Member', 'editor');
|
||||||
|
@ -25,7 +25,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
*/
|
*/
|
||||||
static protected $origTranslatableSettings = array();
|
static protected $origTranslatableSettings = array();
|
||||||
|
|
||||||
static function set_up_once() {
|
static public function set_up_once() {
|
||||||
// needs to recreate the database schema with language properties
|
// needs to recreate the database schema with language properties
|
||||||
self::kill_temp_db();
|
self::kill_temp_db();
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
parent::set_up_once();
|
parent::set_up_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function tear_down_once() {
|
static public function tear_down_once() {
|
||||||
if(class_exists('Translatable')) {
|
if(class_exists('Translatable')) {
|
||||||
if(self::$origTranslatableSettings['has_extension']) {
|
if(self::$origTranslatableSettings['has_extension']) {
|
||||||
Object::add_extension('SiteTree', 'Translatable');
|
Object::add_extension('SiteTree', 'Translatable');
|
||||||
@ -69,7 +69,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
parent::tear_down_once();
|
parent::tear_down_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreateDefaultpages() {
|
public function testCreateDefaultpages() {
|
||||||
$remove = DataObject::get('SiteTree');
|
$remove = DataObject::get('SiteTree');
|
||||||
if($remove) foreach($remove as $page) $page->delete();
|
if($remove) foreach($remove as $page) $page->delete();
|
||||||
// Make sure the table is empty
|
// Make sure the table is empty
|
||||||
@ -97,7 +97,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
* - Resolves duplicates by appending a number
|
* - Resolves duplicates by appending a number
|
||||||
* - renames classes with a class name conflict
|
* - renames classes with a class name conflict
|
||||||
*/
|
*/
|
||||||
function testURLGeneration() {
|
public function testURLGeneration() {
|
||||||
$expectedURLs = array(
|
$expectedURLs = array(
|
||||||
'home' => 'home',
|
'home' => 'home',
|
||||||
'staff' => 'my-staff',
|
'staff' => 'my-staff',
|
||||||
@ -121,7 +121,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Test that publication copies data to SiteTree_Live
|
* Test that publication copies data to SiteTree_Live
|
||||||
*/
|
*/
|
||||||
function testPublishCopiesToLiveTable() {
|
public function testPublishCopiesToLiveTable() {
|
||||||
$obj = $this->objFromFixture('Page','about');
|
$obj = $this->objFromFixture('Page','about');
|
||||||
$obj->publish('Stage', 'Live');
|
$obj->publish('Stage', 'Live');
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Test that field which are set and then cleared are also transferred to the published site.
|
* Test that field which are set and then cleared are also transferred to the published site.
|
||||||
*/
|
*/
|
||||||
function testPublishDeletedFields() {
|
public function testPublishDeletedFields() {
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
$obj = $this->objFromFixture('Page', 'about');
|
$obj = $this->objFromFixture('Page', 'about');
|
||||||
@ -150,7 +150,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testParentNodeCachedInMemory() {
|
public function testParentNodeCachedInMemory() {
|
||||||
$parent = new SiteTree();
|
$parent = new SiteTree();
|
||||||
$parent->Title = 'Section Title';
|
$parent->Title = 'Section Title';
|
||||||
$child = new SiteTree();
|
$child = new SiteTree();
|
||||||
@ -161,7 +161,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertEquals("Section Title", $child->Parent->Title);
|
$this->assertEquals("Section Title", $child->Parent->Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testParentModelReturnType() {
|
public function testParentModelReturnType() {
|
||||||
$parent = new SiteTreeTest_PageNode();
|
$parent = new SiteTreeTest_PageNode();
|
||||||
$child = new SiteTreeTest_PageNode();
|
$child = new SiteTreeTest_PageNode();
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Confirm that DataObject::get_one() gets records from SiteTree_Live
|
* Confirm that DataObject::get_one() gets records from SiteTree_Live
|
||||||
*/
|
*/
|
||||||
function testGetOneFromLive() {
|
public function testGetOneFromLive() {
|
||||||
$s = new SiteTree();
|
$s = new SiteTree();
|
||||||
$s->Title = "V1";
|
$s->Title = "V1";
|
||||||
$s->URLSegment = "get-one-test-page";
|
$s->URLSegment = "get-one-test-page";
|
||||||
@ -190,7 +190,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
Versioned::set_reading_mode($oldMode);
|
Versioned::set_reading_mode($oldMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testChidrenOfRootAreTopLevelPages() {
|
public function testChidrenOfRootAreTopLevelPages() {
|
||||||
$pages = DataObject::get("SiteTree");
|
$pages = DataObject::get("SiteTree");
|
||||||
foreach($pages as $page) $page->publish('Stage', 'Live');
|
foreach($pages as $page) $page->publish('Stage', 'Live');
|
||||||
unset($pages);
|
unset($pages);
|
||||||
@ -215,7 +215,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertNotContains('Staff', $allChildren);
|
$this->assertNotContains('Staff', $allChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanSaveBlankToHasOneRelations() {
|
public function testCanSaveBlankToHasOneRelations() {
|
||||||
/* DataObject::write() should save to a has_one relationship if you set a field called (relname)ID */
|
/* DataObject::write() should save to a has_one relationship if you set a field called (relname)ID */
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$parentID = $this->idFromFixture('Page', 'home');
|
$parentID = $this->idFromFixture('Page', 'home');
|
||||||
@ -229,7 +229,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertEquals(0, DB::query("SELECT \"ParentID\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value());
|
$this->assertEquals(0, DB::query("SELECT \"ParentID\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStageStates() {
|
public function testStageStates() {
|
||||||
// newly created page
|
// newly created page
|
||||||
$createdPage = new SiteTree();
|
$createdPage = new SiteTree();
|
||||||
$createdPage->write();
|
$createdPage->write();
|
||||||
@ -279,7 +279,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Test that a page can be completely deleted and restored to the stage site
|
* Test that a page can be completely deleted and restored to the stage site
|
||||||
*/
|
*/
|
||||||
function testRestoreToStage() {
|
public function testRestoreToStage() {
|
||||||
$page = $this->objFromFixture('Page', 'about');
|
$page = $this->objFromFixture('Page', 'about');
|
||||||
$pageID = $page->ID;
|
$pageID = $page->ID;
|
||||||
$page->delete();
|
$page->delete();
|
||||||
@ -345,7 +345,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRelativeLink() {
|
public function testRelativeLink() {
|
||||||
$about = $this->objFromFixture('Page', 'about');
|
$about = $this->objFromFixture('Page', 'about');
|
||||||
$staff = $this->objFromFixture('Page', 'staff');
|
$staff = $this->objFromFixture('Page', 'staff');
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertEquals('about-us/tom&jerry', $about->RelativeLink('tom&jerry'), 'Doesnt url encode parameter');
|
$this->assertEquals('about-us/tom&jerry', $about->RelativeLink('tom&jerry'), 'Doesnt url encode parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAbsoluteLiveLink() {
|
public function testAbsoluteLiveLink() {
|
||||||
$parent = $this->objFromFixture('Page', 'about');
|
$parent = $this->objFromFixture('Page', 'about');
|
||||||
$child = $this->objFromFixture('Page', 'staff');
|
$child = $this->objFromFixture('Page', 'staff');
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertStringEndsWith('changed-on-live/my-staff/?stage=Live', $child->getAbsoluteLiveLink());
|
$this->assertStringEndsWith('changed-on-live/my-staff/?stage=Live', $child->getAbsoluteLiveLink());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeleteFromStageOperatesRecursively() {
|
public function testDeleteFromStageOperatesRecursively() {
|
||||||
SiteTree::set_enforce_strict_hierarchy(false);
|
SiteTree::set_enforce_strict_hierarchy(false);
|
||||||
$pageAbout = $this->objFromFixture('Page', 'about');
|
$pageAbout = $this->objFromFixture('Page', 'about');
|
||||||
$pageStaff = $this->objFromFixture('Page', 'staff');
|
$pageStaff = $this->objFromFixture('Page', 'staff');
|
||||||
@ -388,7 +388,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
SiteTree::set_enforce_strict_hierarchy(true);
|
SiteTree::set_enforce_strict_hierarchy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeleteFromStageOperatesRecursivelyStrict() {
|
public function testDeleteFromStageOperatesRecursivelyStrict() {
|
||||||
$pageAbout = $this->objFromFixture('Page', 'about');
|
$pageAbout = $this->objFromFixture('Page', 'about');
|
||||||
$pageStaff = $this->objFromFixture('Page', 'staff');
|
$pageStaff = $this->objFromFixture('Page', 'staff');
|
||||||
$pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate');
|
$pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate');
|
||||||
@ -400,7 +400,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertFalse(DataObject::get_by_id('Page', $pageStaffDuplicate->ID));
|
$this->assertFalse(DataObject::get_by_id('Page', $pageStaffDuplicate->ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeleteFromLiveOperatesRecursively() {
|
public function testDeleteFromLiveOperatesRecursively() {
|
||||||
SiteTree::set_enforce_strict_hierarchy(false);
|
SiteTree::set_enforce_strict_hierarchy(false);
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
SiteTree::set_enforce_strict_hierarchy(true);
|
SiteTree::set_enforce_strict_hierarchy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn() {
|
public function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn() {
|
||||||
SiteTree::set_enforce_strict_hierarchy(false);
|
SiteTree::set_enforce_strict_hierarchy(false);
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testDeleteFromLiveOperatesRecursivelyStrict() {
|
public function testDeleteFromLiveOperatesRecursivelyStrict() {
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
$pageAbout = $this->objFromFixture('Page', 'about');
|
$pageAbout = $this->objFromFixture('Page', 'about');
|
||||||
@ -471,7 +471,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
* Simple test to confirm that querying from a particular archive date doesn't throw
|
* Simple test to confirm that querying from a particular archive date doesn't throw
|
||||||
* an error
|
* an error
|
||||||
*/
|
*/
|
||||||
function testReadArchiveDate() {
|
public function testReadArchiveDate() {
|
||||||
Versioned::reading_archived_date('2009-07-02 14:05:07');
|
Versioned::reading_archived_date('2009-07-02 14:05:07');
|
||||||
|
|
||||||
DataObject::get('SiteTree', "\"ParentID\" = 0");
|
DataObject::get('SiteTree', "\"ParentID\" = 0");
|
||||||
@ -479,7 +479,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
Versioned::reading_archived_date(null);
|
Versioned::reading_archived_date(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEditPermissions() {
|
public function testEditPermissions() {
|
||||||
$editor = $this->objFromFixture("Member", "editor");
|
$editor = $this->objFromFixture("Member", "editor");
|
||||||
|
|
||||||
$home = $this->objFromFixture("Page", "home");
|
$home = $this->objFromFixture("Page", "home");
|
||||||
@ -500,7 +500,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertFalse($product4->canEdit($editor));
|
$this->assertFalse($product4->canEdit($editor));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEditPermissionsOnDraftVsLive() {
|
public function testEditPermissionsOnDraftVsLive() {
|
||||||
// Create an inherit-permission page
|
// Create an inherit-permission page
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -539,7 +539,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertTrue($page->canEdit());
|
$this->assertTrue($page->canEdit());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCompareVersions() {
|
public function testCompareVersions() {
|
||||||
// Necessary to avoid
|
// Necessary to avoid
|
||||||
$oldCleanerClass = Diff::$html_cleaner_class;
|
$oldCleanerClass = Diff::$html_cleaner_class;
|
||||||
Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner';
|
Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner';
|
||||||
@ -565,7 +565,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
Diff::$html_cleaner_class = $oldCleanerClass;
|
Diff::$html_cleaner_class = $oldCleanerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAuthorIDAndPublisherIDFilledOutOnPublish() {
|
public function testAuthorIDAndPublisherIDFilledOutOnPublish() {
|
||||||
// Ensure that we have a member ID who is doing all this work
|
// Ensure that we have a member ID who is doing all this work
|
||||||
$member = Member::currentUser();
|
$member = Member::currentUser();
|
||||||
if($member) {
|
if($member) {
|
||||||
@ -785,13 +785,13 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPageTypeClasses() {
|
public function testPageTypeClasses() {
|
||||||
$classes = SiteTree::page_type_classes();
|
$classes = SiteTree::page_type_classes();
|
||||||
$this->assertNotContains('SiteTree', $classes, 'Page types do not include base class');
|
$this->assertNotContains('SiteTree', $classes, 'Page types do not include base class');
|
||||||
$this->assertContains('Page', $classes, 'Page types do contain subclasses');
|
$this->assertContains('Page', $classes, 'Page types do contain subclasses');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAllowedChildren() {
|
public function testAllowedChildren() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
'VirtualPage',
|
'VirtualPage',
|
||||||
@ -828,7 +828,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAllowedChildrenValidation() {
|
public function testAllowedChildrenValidation() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$page->write();
|
$page->write();
|
||||||
$classA = new SiteTreeTest_ClassA();
|
$classA = new SiteTreeTest_ClassA();
|
||||||
@ -867,7 +867,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertFalse($valid->valid(), "Doesnt allow child where only parent class is allowed on parent node, and asterisk prefixing is used");
|
$this->assertFalse($valid->valid(), "Doesnt allow child where only parent class is allowed on parent node, and asterisk prefixing is used");
|
||||||
}
|
}
|
||||||
|
|
||||||
function testClassDropdown() {
|
public function testClassDropdown() {
|
||||||
$sitetree = new SiteTree();
|
$sitetree = new SiteTree();
|
||||||
$method = new ReflectionMethod($sitetree, 'getClassDropdown');
|
$method = new ReflectionMethod($sitetree, 'getClassDropdown');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
@ -884,7 +884,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
Session::set("loggedInAs", null);
|
Session::set("loggedInAs", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanBeRoot() {
|
public function testCanBeRoot() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$page->ParentID = 0;
|
$page->ParentID = 0;
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -902,14 +902,14 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
if(!$isDetected) $this->fail('Fails validation with $can_be_root=false');
|
if(!$isDetected) $this->fail('Fails validation with $can_be_root=false');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testModifyStatusFlagByInheritance(){
|
public function testModifyStatusFlagByInheritance(){
|
||||||
$node = new SiteTreeTest_StageStatusInherit();
|
$node = new SiteTreeTest_StageStatusInherit();
|
||||||
$treeTitle = $node->getTreeTitle();
|
$treeTitle = $node->getTreeTitle();
|
||||||
$this->assertContains('InheritedTitle', $treeTitle);
|
$this->assertContains('InheritedTitle', $treeTitle);
|
||||||
$this->assertContains('inherited-class', $treeTitle);
|
$this->assertContains('inherited-class', $treeTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testMenuTitleIsUnsetWhenEqualsTitle() {
|
public function testMenuTitleIsUnsetWhenEqualsTitle() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$page->Title = 'orig';
|
$page->Title = 'orig';
|
||||||
$page->MenuTitle = 'orig';
|
$page->MenuTitle = 'orig';
|
||||||
@ -956,7 +956,7 @@ class SiteTreeTest_Conflicted_Controller extends Page_Controller implements Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner {
|
class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner {
|
||||||
function cleanHTML($html) {
|
public function cleanHTML($html) {
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -992,7 +992,7 @@ class SiteTreeTest_NotRoot extends Page implements TestOnly {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly {
|
class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly {
|
||||||
function getStatusFlags($cached = true){
|
public function getStatusFlags($cached = true){
|
||||||
$flags = parent::getStatusFlags($cached);
|
$flags = parent::getStatusFlags($cached);
|
||||||
$flags['inherited-class'] = "InheritedTitle";
|
$flags['inherited-class'] = "InheritedTitle";
|
||||||
return $flags;
|
return $flags;
|
||||||
|
@ -13,7 +13,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
'SiteTree' => array('VirtualPageTest_PageExtension')
|
'SiteTree' => array('VirtualPageTest_PageExtension')
|
||||||
);
|
);
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->origInitiallyCopiedFields = VirtualPage::$initially_copied_fields;
|
$this->origInitiallyCopiedFields = VirtualPage::$initially_copied_fields;
|
||||||
@ -23,7 +23,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
VirtualPage::$non_virtual_fields[] = 'MySharedNonVirtualField';
|
VirtualPage::$non_virtual_fields[] = 'MySharedNonVirtualField';
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
VirtualPage::$initially_copied_fields = $this->origInitiallyCopiedFields;
|
VirtualPage::$initially_copied_fields = $this->origInitiallyCopiedFields;
|
||||||
@ -34,7 +34,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
* Test that, after you update the source page of a virtual page, all the virtual pages
|
* Test that, after you update the source page of a virtual page, all the virtual pages
|
||||||
* are updated
|
* are updated
|
||||||
*/
|
*/
|
||||||
function testEditingSourcePageUpdatesVirtualPages() {
|
public function testEditingSourcePageUpdatesVirtualPages() {
|
||||||
$master = $this->objFromFixture('Page', 'master');
|
$master = $this->objFromFixture('Page', 'master');
|
||||||
$master->Title = "New title";
|
$master->Title = "New title";
|
||||||
$master->MenuTitle = "New menutitle";
|
$master->MenuTitle = "New menutitle";
|
||||||
@ -56,7 +56,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
* Test that, after you publish the source page of a virtual page, all the already published
|
* Test that, after you publish the source page of a virtual page, all the already published
|
||||||
* virtual pages are published
|
* virtual pages are published
|
||||||
*/
|
*/
|
||||||
function testPublishingSourcePagePublishesAlreadyPublishedVirtualPages() {
|
public function testPublishingSourcePagePublishesAlreadyPublishedVirtualPages() {
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
$master = $this->objFromFixture('Page', 'master');
|
$master = $this->objFromFixture('Page', 'master');
|
||||||
@ -93,7 +93,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Test that virtual pages get the content from the master page when they are created.
|
* Test that virtual pages get the content from the master page when they are created.
|
||||||
*/
|
*/
|
||||||
function testNewVirtualPagesGrabTheContentFromTheirMaster() {
|
public function testNewVirtualPagesGrabTheContentFromTheirMaster() {
|
||||||
$vp = new VirtualPage();
|
$vp = new VirtualPage();
|
||||||
$vp->write();
|
$vp->write();
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
* This means that when you publish them, they should show the published content of the source
|
* This means that when you publish them, they should show the published content of the source
|
||||||
* page, not the draft content at the time when you clicked 'publish' in the CMS.
|
* page, not the draft content at the time when you clicked 'publish' in the CMS.
|
||||||
*/
|
*/
|
||||||
function testPublishingAVirtualPageCopiedPublishedContentNotDraftContent() {
|
public function testPublishingAVirtualPageCopiedPublishedContentNotDraftContent() {
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Content = "published content";
|
$p->Content = "published content";
|
||||||
$p->write();
|
$p->write();
|
||||||
@ -140,7 +140,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
DB::query('SELECT "Content" from "SiteTree_Live" WHERE "ID" = ' . $vp->ID)->value());
|
DB::query('SELECT "Content" from "SiteTree_Live" WHERE "ID" = ' . $vp->ID)->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCantPublishVirtualPagesBeforeTheirSource() {
|
public function testCantPublishVirtualPagesBeforeTheirSource() {
|
||||||
// An unpublished source page
|
// An unpublished source page
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Content = "test content";
|
$p->Content = "test content";
|
||||||
@ -161,7 +161,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
$this->assertTrue($vp->canPublish());
|
$this->assertTrue($vp->canPublish());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanDeleteOrphanedVirtualPagesFromLive() {
|
public function testCanDeleteOrphanedVirtualPagesFromLive() {
|
||||||
// An unpublished source page
|
// An unpublished source page
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Content = "test content";
|
$p->Content = "test content";
|
||||||
@ -185,7 +185,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
$this->assertNull(DB::query("SELECT \"ID\" FROM \"SiteTree_Live\" WHERE \"ID\" = $vp->ID")->value());
|
$this->assertNull(DB::query("SELECT \"ID\" FROM \"SiteTree_Live\" WHERE \"ID\" = $vp->ID")->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testVirtualPagesArentInappropriatelyPublished() {
|
public function testVirtualPagesArentInappropriatelyPublished() {
|
||||||
// Fixture
|
// Fixture
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Content = "test content";
|
$p->Content = "test content";
|
||||||
@ -237,7 +237,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
$this->assertFalse($vp->IsModifiedOnStage);
|
$this->assertFalse($vp->IsModifiedOnStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testVirtualPagesCreateVersionRecords() {
|
public function testVirtualPagesCreateVersionRecords() {
|
||||||
$source = $this->objFromFixture('Page', 'master');
|
$source = $this->objFromFixture('Page', 'master');
|
||||||
$source->Title = "T0";
|
$source->Title = "T0";
|
||||||
$source->write();
|
$source->write();
|
||||||
@ -275,7 +275,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
WHERE \"RecordID\" = $vp->ID AND \"Version\" = $liveVersion")->value());
|
WHERE \"RecordID\" = $vp->ID AND \"Version\" = $liveVersion")->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
function fixVersionNumberCache($page) {
|
public function fixVersionNumberCache($page) {
|
||||||
$pages = func_get_args();
|
$pages = func_get_args();
|
||||||
foreach($pages as $p) {
|
foreach($pages as $p) {
|
||||||
Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage', array($p->ID));
|
Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage', array($p->ID));
|
||||||
@ -283,7 +283,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testUnpublishingSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
|
public function testUnpublishingSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
|
||||||
// Create page and virutal page
|
// Create page and virutal page
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Title = "source";
|
$p->Title = "source";
|
||||||
@ -315,7 +315,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
$this->assertEquals(1, $vp->HasBrokenLink);
|
$this->assertEquals(1, $vp->HasBrokenLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeletingFromLiveSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
|
public function testDeletingFromLiveSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
|
||||||
// Create page and virutal page
|
// Create page and virutal page
|
||||||
$p = new Page();
|
$p = new Page();
|
||||||
$p->Title = "source";
|
$p->Title = "source";
|
||||||
@ -352,7 +352,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Base functionality tested in {@link SiteTreeTest->testAllowedChildrenValidation()}.
|
* Base functionality tested in {@link SiteTreeTest->testAllowedChildrenValidation()}.
|
||||||
*/
|
*/
|
||||||
function testAllowedChildrenLimitedOnVirtualPages() {
|
public function testAllowedChildrenLimitedOnVirtualPages() {
|
||||||
$classA = new SiteTreeTest_ClassA();
|
$classA = new SiteTreeTest_ClassA();
|
||||||
$classA->write();
|
$classA->write();
|
||||||
$classB = new SiteTreeTest_ClassB();
|
$classB = new SiteTreeTest_ClassB();
|
||||||
@ -375,7 +375,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
$this->assertFalse($valid->valid(), "Doesn't allow child linked to virtual page type disallowed by parent");
|
$this->assertFalse($valid->valid(), "Doesn't allow child linked to virtual page type disallowed by parent");
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetVirtualFields() {
|
public function testGetVirtualFields() {
|
||||||
// Needs association with an original, otherwise will just return the "base" virtual fields
|
// Needs association with an original, otherwise will just return the "base" virtual fields
|
||||||
$page = new VirtualPageTest_ClassA();
|
$page = new VirtualPageTest_ClassA();
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -388,7 +388,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
$this->assertNotContains('MyInitiallyCopiedField', $virtual->getVirtualFields());
|
$this->assertNotContains('MyInitiallyCopiedField', $virtual->getVirtualFields());
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCopyFrom() {
|
public function testCopyFrom() {
|
||||||
$original = new VirtualPageTest_ClassA();
|
$original = new VirtualPageTest_ClassA();
|
||||||
$original->MyInitiallyCopiedField = 'original';
|
$original->MyInitiallyCopiedField = 'original';
|
||||||
$original->MyVirtualField = 'original';
|
$original->MyVirtualField = 'original';
|
||||||
@ -426,7 +426,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testWriteWithoutVersion() {
|
public function testWriteWithoutVersion() {
|
||||||
$original = new SiteTree();
|
$original = new SiteTree();
|
||||||
$original->write();
|
$original->write();
|
||||||
// Create a second version (different behaviour),
|
// Create a second version (different behaviour),
|
||||||
@ -473,7 +473,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCanBeRoot() {
|
public function testCanBeRoot() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$page->ParentID = 0;
|
$page->ParentID = 0;
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -500,7 +500,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
if(!$isDetected) $this->fail('Fails validation with $can_be_root=false');
|
if(!$isDetected) $this->fail('Fails validation with $can_be_root=false');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPageTypeChangeDoesntKeepOrphanedVirtualPageRecord() {
|
public function testPageTypeChangeDoesntKeepOrphanedVirtualPageRecord() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$page->write();
|
$page->write();
|
||||||
$page->publish('Stage', 'Live');
|
$page->publish('Stage', 'Live');
|
||||||
@ -536,7 +536,7 @@ class VirtualPageTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPageTypeChangePropagatesToLive() {
|
public function testPageTypeChangePropagatesToLive() {
|
||||||
$page = new SiteTree();
|
$page = new SiteTree();
|
||||||
$page->MySharedNonVirtualField = 'original';
|
$page->MySharedNonVirtualField = 'original';
|
||||||
$page->write();
|
$page->write();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class ReportTest extends SapphireTest {
|
class ReportTest extends SapphireTest {
|
||||||
|
|
||||||
function testGetReports() {
|
public function testGetReports() {
|
||||||
$reports = SS_Report::get_reports();
|
$reports = SS_Report::get_reports();
|
||||||
$this->assertNotNull($reports, "Reports returned");
|
$this->assertNotNull($reports, "Reports returned");
|
||||||
$previousSort = 0;
|
$previousSort = 0;
|
||||||
@ -12,7 +12,7 @@ class ReportTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testExcludeReport() {
|
public function testExcludeReport() {
|
||||||
$reports = SS_Report::get_reports();
|
$reports = SS_Report::get_reports();
|
||||||
$reportNames = array();
|
$reportNames = array();
|
||||||
foreach($reports as $report) {
|
foreach($reports as $report) {
|
||||||
@ -42,7 +42,7 @@ class ReportTest extends SapphireTest {
|
|||||||
$this->assertNotContains('ReportTest_FakeTest2',$reportNames,'ReportTest_FakeTest2 is NOT in reports list');
|
$this->assertNotContains('ReportTest_FakeTest2',$reportNames,'ReportTest_FakeTest2 is NOT in reports list');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAbstractClassesAreExcluded() {
|
public function testAbstractClassesAreExcluded() {
|
||||||
$reports = SS_Report::get_reports();
|
$reports = SS_Report::get_reports();
|
||||||
$reportNames = array();
|
$reportNames = array();
|
||||||
foreach($reports as $report) {
|
foreach($reports as $report) {
|
||||||
@ -55,62 +55,62 @@ class ReportTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ReportTest_FakeTest extends SS_Report implements TestOnly {
|
class ReportTest_FakeTest extends SS_Report implements TestOnly {
|
||||||
function title() {
|
public function title() {
|
||||||
return 'Report title';
|
return 'Report title';
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Page Title"
|
"title" => "Page Title"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function sourceRecords($params, $sort, $limit) {
|
public function sourceRecords($params, $sort, $limit) {
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort() {
|
public function sort() {
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ReportTest_FakeTest2 extends SS_Report implements TestOnly {
|
class ReportTest_FakeTest2 extends SS_Report implements TestOnly {
|
||||||
function title() {
|
public function title() {
|
||||||
return 'Report title 2';
|
return 'Report title 2';
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Page Title 2"
|
"title" => "Page Title 2"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function sourceRecords($params, $sort, $limit) {
|
public function sourceRecords($params, $sort, $limit) {
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort() {
|
public function sort() {
|
||||||
return 98;
|
return 98;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ReportTest_FakeTest_Abstract extends SS_Report implements TestOnly {
|
abstract class ReportTest_FakeTest_Abstract extends SS_Report implements TestOnly {
|
||||||
function title() {
|
public function title() {
|
||||||
return 'Report title Abstract';
|
return 'Report title Abstract';
|
||||||
}
|
}
|
||||||
function columns() {
|
public function columns() {
|
||||||
return array(
|
return array(
|
||||||
"Title" => array(
|
"Title" => array(
|
||||||
"title" => "Page Title Abstract"
|
"title" => "Page Title Abstract"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function sourceRecords($params, $sort, $limit) {
|
public function sourceRecords($params, $sort, $limit) {
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort() {
|
public function sort() {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class SideReportTest extends SapphireTest {
|
|||||||
|
|
||||||
static $daysAgo = 14;
|
static $daysAgo = 14;
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// set the dates by hand: impossible to set via yml
|
// set the dates by hand: impossible to set via yml
|
||||||
@ -24,7 +24,7 @@ class SideReportTest extends SapphireTest {
|
|||||||
DB::query("UPDATE \"SiteTree\" SET \"Created\"='2009-01-01 00:00:00', \"LastEdited\"='".date('Y-m-d H:i:s', $beforeThreshold)."' WHERE \"ID\"='".$before->ID."'");
|
DB::query("UPDATE \"SiteTree\" SET \"Created\"='2009-01-01 00:00:00', \"LastEdited\"='".date('Y-m-d H:i:s', $beforeThreshold)."' WHERE \"ID\"='".$before->ID."'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRecentlyEdited() {
|
public function testRecentlyEdited() {
|
||||||
SS_Datetime::set_mock_now('31-06-2009 00:00:00');
|
SS_Datetime::set_mock_now('31-06-2009 00:00:00');
|
||||||
|
|
||||||
$after = $this->objFromFixture('SiteTree', 'after');
|
$after = $this->objFromFixture('SiteTree', 'after');
|
||||||
|
@ -5,7 +5,7 @@ class CMSMainSearchFormTest extends FunctionalTest {
|
|||||||
|
|
||||||
protected $autoFollowRedirection = false;
|
protected $autoFollowRedirection = false;
|
||||||
|
|
||||||
function testTitleFilter() {
|
public function testTitleFilter() {
|
||||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||||
|
|
||||||
$response = $this->get(
|
$response = $this->get(
|
||||||
|
@ -14,12 +14,12 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
|
|
||||||
protected $mockController;
|
protected $mockController;
|
||||||
|
|
||||||
function waitUntilIndexingFinished() {
|
public function waitUntilIndexingFinished() {
|
||||||
$db = DB::getConn();
|
$db = DB::getConn();
|
||||||
if (method_exists($db, 'waitUntilIndexingFinished')) DB::getConn()->waitUntilIndexingFinished();
|
if (method_exists($db, 'waitUntilIndexingFinished')) DB::getConn()->waitUntilIndexingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUpOnce() {
|
public function setUpOnce() {
|
||||||
// HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE
|
// HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE
|
||||||
// MySQL will need a different table type
|
// MySQL will need a different table type
|
||||||
self::kill_temp_db();
|
self::kill_temp_db();
|
||||||
@ -29,7 +29,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
parent::setUpOnce();
|
parent::setUpOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$holderPage = $this->objFromFixture('SiteTree', 'searchformholder');
|
$holderPage = $this->objFromFixture('SiteTree', 'searchformholder');
|
||||||
@ -38,7 +38,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
$this->waitUntilIndexingFinished();
|
$this->waitUntilIndexingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPublishedPagesMatchedByTitle() {
|
public function testPublishedPagesMatchedByTitle() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
|
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
|
||||||
@ -53,7 +53,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDoubleQuotesPublishedPagesMatchedByTitle() {
|
public function testDoubleQuotesPublishedPagesMatchedByTitle() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
|
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
|
||||||
@ -71,7 +71,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
function testUnpublishedPagesNotIncluded() {
|
public function testUnpublishedPagesNotIncluded() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$results = $sf->getResults(null, array('Search'=>'publicUnpublishedPage'));
|
$results = $sf->getResults(null, array('Search'=>'publicUnpublishedPage'));
|
||||||
@ -84,7 +84,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function testPagesRestrictedToLoggedinUsersNotIncluded() {
|
public function testPagesRestrictedToLoggedinUsersNotIncluded() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$page = $this->objFromFixture('SiteTree', 'restrictedViewLoggedInUsers');
|
$page = $this->objFromFixture('SiteTree', 'restrictedViewLoggedInUsers');
|
||||||
@ -106,7 +106,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
$member->logOut();
|
$member->logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPagesRestrictedToSpecificGroupNotIncluded() {
|
public function testPagesRestrictedToSpecificGroupNotIncluded() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$page = $this->objFromFixture('SiteTree', 'restrictedViewOnlyWebsiteUsers');
|
$page = $this->objFromFixture('SiteTree', 'restrictedViewOnlyWebsiteUsers');
|
||||||
@ -138,7 +138,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
$member->logOut();
|
$member->logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testInheritedRestrictedPagesNotInlucded() {
|
public function testInheritedRestrictedPagesNotInlucded() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$page = $this->objFromFixture('SiteTree', 'inheritRestrictedView');
|
$page = $this->objFromFixture('SiteTree', 'inheritRestrictedView');
|
||||||
@ -161,7 +161,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
$member->logOut();
|
$member->logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
|
public function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
|
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
|
||||||
@ -173,7 +173,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDisabledShowInSearchFlagNotIncludedForFiles() {
|
public function testDisabledShowInSearchFlagNotIncludedForFiles() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile');
|
$dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile');
|
||||||
@ -193,7 +193,7 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSearchTitleAndContentWithSpecialCharacters() {
|
public function testSearchTitleAndContentWithSpecialCharacters() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$pageWithSpecialChars = $this->objFromFixture('SiteTree', 'pageWithSpecialChars');
|
$pageWithSpecialChars = $this->objFromFixture('SiteTree', 'pageWithSpecialChars');
|
||||||
|
@ -11,7 +11,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
|
|
||||||
protected $orig = array();
|
protected $orig = array();
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
Object::add_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
|
Object::add_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
|
||||||
@ -20,7 +20,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
FilesystemPublisher::$domain_based_caching = false;
|
FilesystemPublisher::$domain_based_caching = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
|
Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
|
||||||
@ -32,7 +32,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testUrlsToPathsWithRelativeUrls() {
|
public function testUrlsToPathsWithRelativeUrls() {
|
||||||
$fsp = new FilesystemPublisher('.', 'html');
|
$fsp = new FilesystemPublisher('.', 'html');
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
@ -54,7 +54,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testUrlsToPathsWithAbsoluteUrls() {
|
public function testUrlsToPathsWithAbsoluteUrls() {
|
||||||
$fsp = new FilesystemPublisher('.', 'html');
|
$fsp = new FilesystemPublisher('.', 'html');
|
||||||
|
|
||||||
$url = Director::absoluteBaseUrl();
|
$url = Director::absoluteBaseUrl();
|
||||||
@ -79,7 +79,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testUrlsToPathsWithDomainBasedCaching() {
|
public function testUrlsToPathsWithDomainBasedCaching() {
|
||||||
$origDomainBasedCaching = FilesystemPublisher::$domain_based_caching;
|
$origDomainBasedCaching = FilesystemPublisher::$domain_based_caching;
|
||||||
FilesystemPublisher::$domain_based_caching = true;
|
FilesystemPublisher::$domain_based_caching = true;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
* is where extension instances are set up and subsequently used by
|
* is where extension instances are set up and subsequently used by
|
||||||
* {@link DataObject::defineMethods()}.
|
* {@link DataObject::defineMethods()}.
|
||||||
*/
|
*/
|
||||||
function testHasCalledParentConstructor() {
|
public function testHasCalledParentConstructor() {
|
||||||
$fsp = new FilesystemPublisher('.', '.html');
|
$fsp = new FilesystemPublisher('.', '.html');
|
||||||
$this->assertEquals($fsp->class, 'FilesystemPublisher');
|
$this->assertEquals($fsp->class, 'FilesystemPublisher');
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
* These are a few simple tests to check that we will be retrieving the correct theme when we need it
|
* These are a few simple tests to check that we will be retrieving the correct theme when we need it
|
||||||
* StaticPublishing needs to be able to retrieve a non-null theme at the time publishPages() is called.
|
* StaticPublishing needs to be able to retrieve a non-null theme at the time publishPages() is called.
|
||||||
*/
|
*/
|
||||||
function testStaticPublisherTheme(){
|
public function testStaticPublisherTheme(){
|
||||||
|
|
||||||
//This will be the name of the default theme of this particular project
|
//This will be the name of the default theme of this particular project
|
||||||
$default_theme=SSViewer::current_theme();
|
$default_theme=SSViewer::current_theme();
|
||||||
|
@ -36,7 +36,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest {
|
|||||||
|
|
||||||
static $use_draft_site = false;
|
static $use_draft_site = false;
|
||||||
|
|
||||||
function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$parent1_published = $this->objFromFixture('Page', 'parent1_published');
|
$parent1_published = $this->objFromFixture('Page', 'parent1_published');
|
||||||
@ -75,7 +75,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest {
|
|||||||
$child2_1_published_orphaned->publish('Stage', 'Live');
|
$child2_1_published_orphaned->publish('Stage', 'Live');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetOrphansByStage() {
|
public function testGetOrphansByStage() {
|
||||||
// all orphans
|
// all orphans
|
||||||
$child1_3_orphaned = $this->objFromFixture('Page', 'child1_3_orphaned');
|
$child1_3_orphaned = $this->objFromFixture('Page', 'child1_3_orphaned');
|
||||||
$child1_4_orphaned_published = $this->objFromFixture('Page', 'child1_4_orphaned_published');
|
$child1_4_orphaned_published = $this->objFromFixture('Page', 'child1_4_orphaned_published');
|
||||||
|
4
thirdparty/multifile/multifile.js
vendored
4
thirdparty/multifile/multifile.js
vendored
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
// Modified by: Silverstripe Ltd. (changed naming of file-input-elements)
|
// Modified by: Silverstripe Ltd. (changed naming of file-input-elements)
|
||||||
|
|
||||||
function ObservableObject() {
|
public function ObservableObject() {
|
||||||
this.functions = [];
|
this.functions = [];
|
||||||
}
|
}
|
||||||
ObservableObject.prototype = {
|
ObservableObject.prototype = {
|
||||||
@ -63,7 +63,7 @@ ObservableObject.prototype = {
|
|||||||
|
|
||||||
var MultiSelectorObserver = new ObservableObject();
|
var MultiSelectorObserver = new ObservableObject();
|
||||||
|
|
||||||
function MultiSelector( list_target, max, upload_button ){
|
public function MultiSelector( list_target, max, upload_button ){
|
||||||
|
|
||||||
this.upload_button = upload_button;
|
this.upload_button = upload_button;
|
||||||
this.upload_button.setAttribute("disabled", "disabled");
|
this.upload_button.setAttribute("disabled", "disabled");
|
||||||
|
Loading…
Reference in New Issue
Block a user