mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
APICHANGE: Use the same navigator items in the CMS that are used on the frontend (from r97395)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99114 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2462a9cde9
commit
8d359d1703
@ -117,6 +117,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
function ShowSwitchView() {
|
function ShowSwitchView() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SwitchView() {
|
||||||
|
if($page = $this->currentPage()) {
|
||||||
|
$nav = $page->getNavigatorItems();
|
||||||
|
return $nav['items'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------//
|
//------------------------------------------------------------------------------------------//
|
||||||
// Main controllers
|
// Main controllers
|
||||||
|
@ -361,7 +361,14 @@ class LeftAndMain extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form = $this->EditForm();
|
$form = $this->EditForm();
|
||||||
if ($form) return $form->formHtmlContent();
|
if ($form) {
|
||||||
|
$content = $form->formHtmlContent();
|
||||||
|
if($this->ShowSwitchView()) {
|
||||||
|
$content .= '<div id="AjaxSwitchView">' . $this->SwitchView() . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
else return "";
|
else return "";
|
||||||
}
|
}
|
||||||
public function getLastFormIn($html) {
|
public function getLastFormIn($html) {
|
||||||
|
@ -276,7 +276,6 @@ body.stillLoading select {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 23px;
|
height: 23px;
|
||||||
overflow: hidden;
|
|
||||||
background: #4d4e5a url(../images/textures/footerBg.gif) repeat-x left top;
|
background: #4d4e5a url(../images/textures/footerBg.gif) repeat-x left top;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,4 +719,4 @@ iframe {
|
|||||||
.message.bad {
|
.message.bad {
|
||||||
background-color: #FF8080;
|
background-color: #FF8080;
|
||||||
border-color: #FF0000;
|
border-color: #FF0000;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,13 @@ CMSForm.prototype = {
|
|||||||
*/
|
*/
|
||||||
prepareForm : function() {
|
prepareForm : function() {
|
||||||
ajaxActionsAtTop(this.id, 'form_actions_' + this.formName, this.formName);
|
ajaxActionsAtTop(this.id, 'form_actions_' + this.formName, this.formName);
|
||||||
|
|
||||||
|
// Update the nav items down the bottom
|
||||||
|
if($('AjaxSwitchView')) {
|
||||||
|
$('SwitchView').innerHTML = $('AjaxSwitchView').innerHTML;
|
||||||
|
$('AjaxSwitchView').innerHTML = '';
|
||||||
|
Behaviour.apply('SwitchView'); // This is needed so calendar still works
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -395,49 +402,6 @@ function autoSave(confirmation, callAfter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StageLink = Class.create();
|
|
||||||
StageLink.prototype = {
|
|
||||||
initialize: function(getVars, urlField) {
|
|
||||||
this.getVars = getVars;
|
|
||||||
this.urlField = urlField;
|
|
||||||
|
|
||||||
var boundNewPage = this.newPage.bind(this);
|
|
||||||
|
|
||||||
$('Form_EditForm').observeMethod('PageLoaded', boundNewPage);
|
|
||||||
$('Form_EditForm').observeMethod('PageSaved', boundNewPage);
|
|
||||||
$('Form_EditForm').observeMethod('PagePublished', boundNewPage);
|
|
||||||
$('Form_EditForm').observeMethod('PageUnpublished', boundNewPage);
|
|
||||||
|
|
||||||
this.newPage();
|
|
||||||
},
|
|
||||||
newPage : function() {
|
|
||||||
var linkField = $('Form_EditForm').elements[this.urlField];
|
|
||||||
var linkVal = linkField ? linkField.value : null;
|
|
||||||
if(linkVal) {
|
|
||||||
if(this.id != 'viewArchivedSite') this.style.display = '';
|
|
||||||
this.href = linkVal + this.getVars;
|
|
||||||
} else {
|
|
||||||
if(this.id != 'viewArchivedSite') this.style.display = 'none';
|
|
||||||
}
|
|
||||||
if($('Form_EditForm_Locale')) {
|
|
||||||
this.href += "&locale=" + $('Form_EditForm_Locale').value;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onclick : function() {
|
|
||||||
var w = window.open(this.href, windowName('site'));
|
|
||||||
w.focus();
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
baseURL : function() {
|
|
||||||
return document.getElementsByTagName('base')[0].href;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StageLink.applyTo('#viewStageSite', '?stage=Stage', 'StageURLSegment');
|
|
||||||
StageLink.applyTo('#viewLiveSite', '?stage=Live', 'LiveURLSegment');
|
|
||||||
StageLink.applyTo('#viewArchivedSite', '', 'URLSegment');
|
|
||||||
|
|
||||||
window.name = windowName('cms');
|
window.name = windowName('cms');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,13 +48,10 @@
|
|||||||
<div id="switchView" class="bottomTabs">
|
<div id="switchView" class="bottomTabs">
|
||||||
<% if ShowSwitchView %>
|
<% if ShowSwitchView %>
|
||||||
<div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div>
|
<div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div>
|
||||||
<span class="current" title="<% _t('EDITINCMS', 'Edit this page in the CMS') %>"><% _t('EDIT','Edit') %></span>
|
<span id="SwitchView">$SwitchView</div>
|
||||||
<a id="viewStageSite" title="<% _t('VIEWINDRAFT', 'View the Page in the Draft Site') %>" href="home/?stage=Stage"><% _t('DRAFTS','Draft Site') %></a>
|
|
||||||
<a id="viewLiveSite" title="<% _t('VIEWINPUBLISHED', 'View the Page in the Published Site') %>" href="home/?stage=Live"><% _t('PUBLIS','Published Site') %></a>
|
|
||||||
<a style="display: none; margin-left: 20px;" id="viewArchivedSite" href="home/"><% _t('ARCHS','Archived Site') %></a>
|
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user