diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index 46ff5c00..aa8702c4 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -938,15 +938,24 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
Versioned::reading_stage('Stage');
if(isset($descendantsRemoved)) {
- $descRemoved = " and $descendantsRemoved descendants";
- $descRemoved = ' ' . _t('CMSMain.DESCREMOVED', 'and {count} descendants', array('count' => $descendantsRemoved));
+ $descRemoved = ' ' . _t(
+ 'CMSMain.DESCREMOVED',
+ 'and {count} descendants',
+ array('count' => $descendantsRemoved)
+ );
} else {
$descRemoved = '';
}
$this->response->addHeader(
'X-Status',
- rawurlencode(sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved))
+ rawurlencode(
+ _t(
+ 'CMSMain.REMOVED',
+ 'Deleted \'{title}\'{description} from live site',
+ array('title' => $recordTitle, 'description' => $descRemoved)
+ )
+ )
);
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php
index 05730d0a..7e392536 100644
--- a/code/controllers/CMSPageAddController.php
+++ b/code/controllers/CMSPageAddController.php
@@ -19,7 +19,7 @@ class CMSPageAddController extends CMSPageEditController {
$pageTypes = array();
foreach($this->PageTypes() as $type) {
$html = sprintf('%s%s',
- $type->getField('Title'),
+ $type->getField('ClassName'),
$type->getField('AddAction'),
$type->getField('Description')
);
diff --git a/code/controllers/CMSSettingsController.php b/code/controllers/CMSSettingsController.php
index 100769ab..338e1bf0 100644
--- a/code/controllers/CMSSettingsController.php
+++ b/code/controllers/CMSSettingsController.php
@@ -8,6 +8,12 @@ class CMSSettingsController extends LeftAndMain {
static $tree_class = 'SiteConfig';
static $required_permission_codes = array('EDIT_SITECONFIG');
+ public function init() {
+ parent::init();
+
+ Requirements::javascript(CMS_DIR . '/javascript/CMSMain.EditForm.js');
+ }
+
public function getResponseNegotiator() {
$neg = parent::getResponseNegotiator();
$controller = $this;
diff --git a/code/controllers/SilverStripeNavigator.php b/code/controllers/SilverStripeNavigator.php
index c90f2449..728bf86f 100644
--- a/code/controllers/SilverStripeNavigator.php
+++ b/code/controllers/SilverStripeNavigator.php
@@ -212,8 +212,12 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
}
public function canView($member = null) {
- // Don't show in CMS
- return !(Controller::curr() instanceof CMSMain);
+ return (
+ // Don't show in CMS
+ !(Controller::curr() instanceof CMSMain)
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
}
@@ -242,11 +246,16 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
}
public function getLink() {
- return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
+ return Controller::join_links($this->record->PreviewLink(), '?stage=Stage');
}
public function canView($member = null) {
- return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
+ return (
+ $this->record->hasExtension('Versioned')
+ && $this->getDraftPage()
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
public function isActive() {
@@ -290,11 +299,16 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
}
public function getLink() {
- return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
+ return Controller::join_links($this->record->PreviewLink(), '?stage=Live');
}
public function canView($member = null) {
- return ($this->record->hasExtension('Versioned') && $this->getLivePage());
+ return (
+ $this->record->hasExtension('Versioned')
+ && $this->getLivePage()
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
public function isActive() {
@@ -319,7 +333,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
static $priority = 40;
public function getHTML() {
- $this->recordLink = $this->record->AbsoluteLink();
+ $this->recordLink = $this->record->PreviewLink();
return "recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."";
}
@@ -336,11 +350,16 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
}
public function getLink() {
- return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited;
+ return $this->record->PreviewLink() . '?archiveDate=' . $this->record->LastEdited;
}
public function canView($member = null) {
- return ($this->record->hasExtension('Versioned') && $this->isArchived());
+ return (
+ $this->record->hasExtension('Versioned')
+ && $this->isArchived()
+ // Don't follow redirects in preview, they break the CMS editing form
+ && !($this->record instanceof RedirectorPage)
+ );
}
public function isActive() {
diff --git a/code/model/SiteConfig.php b/code/model/SiteConfig.php
index 0fff4f9f..c5e3d89e 100644
--- a/code/model/SiteConfig.php
+++ b/code/model/SiteConfig.php
@@ -58,13 +58,28 @@ class SiteConfig extends DataObject implements PermissionProvider {
$tabAccess = new Tab('Access',
$viewersOptionsField = new OptionsetField("CanViewType", _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?")),
$viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
- ->setMultiple(true)->setSource($groupsMap),
+ ->setMultiple(true)
+ ->setSource($groupsMap)
+ ->setAttribute(
+ 'data-placeholder',
+ _t('SiteTree.GroupPlaceholder', 'Click to select group')
+ ),
$editorsOptionsField = new OptionsetField("CanEditType", _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?")),
$editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
- ->setMultiple(true)->setSource($groupsMap),
+ ->setMultiple(true)
+ ->setSource($groupsMap)
+ ->setAttribute(
+ 'data-placeholder',
+ _t('SiteTree.GroupPlaceholder', 'Click to select group')
+ ),
$topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType", _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?")),
$topLevelCreatorsGroupsField = ListboxField::create("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))
- ->setMultiple(true)->setSource($groupsMap)
+ ->setMultiple(true)
+ ->setSource($groupsMap)
+ ->setAttribute(
+ 'data-placeholder',
+ _t('SiteTree.GroupPlaceholder', 'Click to select group')
+ )
)
),
new HiddenField('ID')
diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php
index 7f7bf33d..6c838675 100644
--- a/code/model/SiteTree.php
+++ b/code/model/SiteTree.php
@@ -412,6 +412,18 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
return Director::absoluteURL($this->Link($action));
}
}
+
+ /**
+ * Base link used for previewing. Defaults to absolute URL,
+ * in order to account for domain changes, e.g. on multi site setups.
+ * Does not contain hints about the stage, see {@link SilverStripeNavigator} for details.
+ *
+ * @param string $action See {@link Link()}
+ * @return string
+ */
+ public function PreviewLink($action = null) {
+ return $this->AbsoluteLink($action);
+ }
/**
* Return the link for this {@link SiteTree} object relative to the SilverStripe root.
@@ -1666,24 +1678,36 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// We merge all into a regular SS_List, because DataList doesn't support merge
if($contentLinks = $this->BackLinkTracking()) {
- foreach($contentLinks as $item) $item->DependentLinkType = 'Content link';
- $items->merge($contentLinks);
+ $linkList = new ArrayList();
+ foreach($contentLinks as $item) {
+ $item->DependentLinkType = 'Content link';
+ $linkList->push($item);
+ }
+ $items->merge($linkList);
}
// Virtual pages
if($includeVirtuals) {
$virtuals = $this->VirtualPages();
if($virtuals) {
- foreach($virtuals as $item) $item->DependentLinkType = 'Virtual page';
- $items->merge($virtuals);
+ $virtualList = new ArrayList();
+ foreach($virtuals as $item) {
+ $item->DependentLinkType = 'Virtual page';
+ $virtualList->push($item);
+ }
+ $items->merge($virtualList);
}
}
// Redirector pages
$redirectors = DataObject::get("RedirectorPage", "\"RedirectorPage\".\"RedirectionType\" = 'Internal' AND \"LinkToID\" = $this->ID");
if($redirectors) {
- foreach($redirectors as $item) $item->DependentLinkType = 'Redirector page';
- $items->merge($redirectors);
+ $redirectorList = new ArrayList();
+ foreach($redirectors as $item) {
+ $item->DependentLinkType = 'Redirector page';
+ $redirectorList->push($item);
+ }
+ $items->merge($redirectorList);
}
if(class_exists('Subsite')) Subsite::disable_subsite_filter($origDisableSubsiteFilter);
@@ -1793,6 +1817,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$dependentPages
);
$dependentTable->getConfig()->getComponentByType('GridFieldDataColumns')
+ ->setDisplayFields($dependentColumns)
->setFieldFormatting(array(
'Title' => '$Title',
'AbsoluteLink' => '$value',
@@ -1865,7 +1890,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if($this->ObsoleteClassName) {
$obsoleteWarning = _t(
'SiteTree.OBSOLETECLASS',
- "This page is of obsolete type {type}. Saving will reset it's type and you may lose data",
+ "This page is of obsolete type {type}. Saving will reset its type and you may lose data",
array('type' => $this->ObsoleteClassName)
);
@@ -1931,13 +1956,23 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
_t('SiteTree.ACCESSHEADER', "Who can view this page?")
),
$viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
- ->setMultiple(true)->setSource($groupsMap),
+ ->setMultiple(true)
+ ->setSource($groupsMap)
+ ->setAttribute(
+ 'data-placeholder',
+ _t('SiteTree.GroupPlaceholder', 'Click to select group')
+ ),
$editorsOptionsField = new OptionsetField(
"CanEditType",
_t('SiteTree.EDITHEADER', "Who can edit this page?")
),
$editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
- ->setMultiple(true)->setSource($groupsMap)
+ ->setMultiple(true)
+ ->setSource($groupsMap)
+ ->setAttribute(
+ 'data-placeholder',
+ _t('SiteTree.GroupPlaceholder', 'Click to select group')
+ )
)
)
);
@@ -2073,9 +2108,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$rootTabSet->addExtraClass('ss-ui-action-tabset action-menus');
// Render page information into the "more-options" drop-up, on the top.
+ $live = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\"='$this->ID'");
$moreOptions->push(
new LiteralField('Information',
$this->customise(array(
+ 'Live' => $live,
'ExistsOnLive' => $existsOnLive
))->renderWith('SiteTree_Information')
)
diff --git a/code/staticpublisher/FilesystemPublisher.php b/code/staticpublisher/FilesystemPublisher.php
index abe16a4b..fe9bb716 100644
--- a/code/staticpublisher/FilesystemPublisher.php
+++ b/code/staticpublisher/FilesystemPublisher.php
@@ -223,6 +223,14 @@ class FilesystemPublisher extends StaticPublisher {
}
}
+ if(StaticPublisher::$include_caching_metadata) {
+ $content = str_replace(
+ '