2009-11-21 03:36:00 +01:00
|
|
|
(function($) {
|
2009-11-21 03:36:26 +01:00
|
|
|
$('body.CMSMain').concrete('ss', function($){return{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference to jQuery.layout element
|
|
|
|
*/
|
2009-11-21 03:36:22 +01:00
|
|
|
MainLayout: null,
|
2009-11-21 03:36:00 +01:00
|
|
|
|
|
|
|
onmatch: function() {
|
2009-11-21 03:36:22 +01:00
|
|
|
var self = this;
|
|
|
|
|
2009-11-21 03:36:26 +01:00
|
|
|
this.setMainLayout(this._setupLayout());
|
2009-11-21 03:36:09 +01:00
|
|
|
|
|
|
|
// artificially delay the resize event 200ms
|
|
|
|
// to avoid overlapping height changes in different onresize() methods
|
|
|
|
$(window).resize(function () {
|
|
|
|
var timerID = "timerCMSMainResize";
|
|
|
|
if (window[timerID]) clearTimeout(window[timerID]);
|
2009-11-21 03:36:26 +01:00
|
|
|
window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
|
2009-11-21 03:36:09 +01:00
|
|
|
});
|
2009-11-21 03:36:22 +01:00
|
|
|
|
2009-11-21 03:36:26 +01:00
|
|
|
this._resizeChildren();
|
2009-11-21 03:36:22 +01:00
|
|
|
|
|
|
|
this._super();
|
2009-11-21 03:36:09 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
_resizeChildren: function() {
|
2009-11-21 03:36:26 +01:00
|
|
|
$("#treepanes", this).accordion("resize");
|
|
|
|
$('#sitetree_and_tools', this).fitHeightToParent();
|
|
|
|
$('#contentPanel form', this).fitHeightToParent();
|
|
|
|
$('#contentPanel form fieldset', this).fitHeightToParent();
|
|
|
|
$('#contentPanel form fieldset .content', this).fitHeightToParent();
|
2009-11-21 03:36:22 +01:00
|
|
|
|
|
|
|
this._super();
|
ENHANCEMENT Using jQuery layout manager plugin to size panels in main CMS interface. Removed custom javascript resizing and CSS rules.
API CHANGE Removed custom resizing javascript methods: window.ontabschanged, window.onresize, fixRightWidth(), fixHeight_left()
API CHANGE Removed DraggableSeparator, SideTabs, SideTabItem javascript classes
API CHANGE Removed Effect.ReSize and Highlighter javascript helper classes
API CHANGE Modified template structure in CMSMain_left.ss, CMSMain_right.ss and LeftAndMain.ss
API CHANGE Modified markup IDs in LeftAndMain/CMSMain templates, removed "left", "right", "contentPanel", "bottom"
ENHANCEMENT Using jquery-latest (currently 1.3) in CMSMain and LeftAndMain
ENHANCEMENT Added jQuery UI library and "smoothness" theme to default CMS interface
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92581 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-11-21 03:35:20 +01:00
|
|
|
},
|
2009-11-21 03:36:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize jQuery layout manager with the following panes:
|
|
|
|
* - east: Tree, Page Version History, Site Reports
|
|
|
|
* - center: Form
|
|
|
|
* - west: "Insert Image", "Insert Link", "Insert Flash" panes
|
|
|
|
* - north: CMS area menu bar
|
|
|
|
* - south: "Page view", "profile" and "logout" links
|
|
|
|
*/
|
|
|
|
_setupLayout: function() {
|
2009-11-21 03:36:22 +01:00
|
|
|
var self = this;
|
|
|
|
|
2009-11-21 03:36:00 +01:00
|
|
|
// layout containing the tree, CMS menu, the main form etc.
|
|
|
|
var layout = $('body').layout({
|
|
|
|
defaults: {
|
|
|
|
// TODO Reactivate once we have localized values
|
|
|
|
togglerTip_open: '',
|
|
|
|
togglerTip_closed: '',
|
|
|
|
resizerTip: '',
|
2009-11-21 03:36:26 +01:00
|
|
|
sliderTip: '',
|
|
|
|
onresize: function() {self._resizeChildren();},
|
2009-11-21 03:36:57 +01:00
|
|
|
onopen: function() {self._resizeChildren();}
|
2009-11-21 03:36:00 +01:00
|
|
|
},
|
|
|
|
north: {
|
|
|
|
slidable: false,
|
|
|
|
resizable: false,
|
|
|
|
size: 35,
|
|
|
|
togglerLength_open: 0
|
|
|
|
},
|
|
|
|
south: {
|
|
|
|
slidable: false,
|
|
|
|
resizable: false,
|
|
|
|
size: 20,
|
|
|
|
togglerLength_open: 0
|
|
|
|
},
|
|
|
|
west: {
|
|
|
|
size: 250,
|
2009-11-21 03:36:22 +01:00
|
|
|
fxName: "none"
|
|
|
|
},
|
|
|
|
east: {
|
|
|
|
initClosed: true,
|
2009-11-21 03:36:26 +01:00
|
|
|
fxName: "none",
|
|
|
|
size: 250
|
2009-11-21 03:36:00 +01:00
|
|
|
},
|
|
|
|
center: {}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Adjust tree accordion etc. in left panel to work correctly
|
|
|
|
// with jQuery.layout (see http://layout.jquery-dev.net/tips.html#Widget_Accordion)
|
|
|
|
this.find("#treepanes").accordion({
|
|
|
|
fillSpace: true,
|
|
|
|
animated: false
|
|
|
|
});
|
|
|
|
|
|
|
|
return layout;
|
ENHANCEMENT Using jQuery layout manager plugin to size panels in main CMS interface. Removed custom javascript resizing and CSS rules.
API CHANGE Removed custom resizing javascript methods: window.ontabschanged, window.onresize, fixRightWidth(), fixHeight_left()
API CHANGE Removed DraggableSeparator, SideTabs, SideTabItem javascript classes
API CHANGE Removed Effect.ReSize and Highlighter javascript helper classes
API CHANGE Modified template structure in CMSMain_left.ss, CMSMain_right.ss and LeftAndMain.ss
API CHANGE Modified markup IDs in LeftAndMain/CMSMain templates, removed "left", "right", "contentPanel", "bottom"
ENHANCEMENT Using jquery-latest (currently 1.3) in CMSMain and LeftAndMain
ENHANCEMENT Added jQuery UI library and "smoothness" theme to default CMS interface
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92581 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-11-21 03:35:20 +01:00
|
|
|
}
|
2009-11-21 03:36:26 +01:00
|
|
|
}});
|
2009-11-21 03:36:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CMS-specific form behaviour
|
|
|
|
*/
|
2009-11-21 03:36:26 +01:00
|
|
|
$('#Form_EditForm').concrete('ss', function($){return{
|
2009-11-21 03:36:13 +01:00
|
|
|
onmatch: function() {
|
|
|
|
// Alert the user on change of page-type - this might have implications
|
|
|
|
// on the available form fields etc.
|
|
|
|
this.find(':input[name=ClassName]').bind('change',
|
|
|
|
function() {
|
|
|
|
alert('The page type will be updated after the page is saved');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
this.find(':input[name=ParentID]')
|
|
|
|
}
|
2009-11-21 03:36:26 +01:00
|
|
|
}});
|
2009-11-21 03:36:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ParentType / ParentID field combination - mostly toggling between
|
|
|
|
* the two radiobuttons and setting the hidden "ParentID" field
|
|
|
|
*/
|
2009-11-21 03:36:26 +01:00
|
|
|
$('#Form_EditForm_ParentType').concrete('ss', function($){return{
|
2009-11-21 03:36:13 +01:00
|
|
|
onmatch : function() {
|
|
|
|
var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
|
|
|
|
var parentTypeSubpageEl = $('#Form_EditForm_ParentType_subpage');
|
|
|
|
if(parentTypeRootEl) {
|
|
|
|
parentTypeRootEl.onclick = this.rootClick.bind(this);
|
|
|
|
}
|
|
|
|
if(parentTypeSubpageEl) {
|
|
|
|
parentTypeSubpageEl.onclick = this.showHide;
|
|
|
|
}
|
|
|
|
this.showHide();
|
|
|
|
},
|
|
|
|
|
|
|
|
rootClick : function() {
|
|
|
|
$('#Form_EditForm_ParentID').val(0);
|
|
|
|
this.showHide();
|
|
|
|
},
|
|
|
|
|
|
|
|
showHide : function() {
|
|
|
|
var parentTypeRootEl = $('#Form_EditForm_ParentType_root');
|
|
|
|
if(parentTypeRootEl && parentTypeRootEl.checked) {
|
|
|
|
$('#ParentID').hide();
|
|
|
|
} else {
|
|
|
|
$('#ParentID').show();
|
|
|
|
}
|
|
|
|
}
|
2009-11-21 03:36:26 +01:00
|
|
|
}});
|
2009-11-21 03:36:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Email containing the link to the archived version of the page.
|
|
|
|
* Visible on readonly older versions of a specific page at the moment.
|
|
|
|
*/
|
2009-11-21 03:36:26 +01:00
|
|
|
$('#Form_EditForm .Actions #Form_EditForm_action_email').concrete('ss', function($){return{
|
2009-11-21 03:36:13 +01:00
|
|
|
onclick: function(e) {
|
|
|
|
window.open(
|
|
|
|
'mailto:?subject='
|
|
|
|
+ $('input[name=ArchiveEmailSubject]', this[0].form).val()
|
|
|
|
+ '&body='
|
|
|
|
+ $(':input[name=ArchiveEmailMessage]', this[0].form).val(),
|
|
|
|
'archiveemail'
|
|
|
|
);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2009-11-21 03:36:26 +01:00
|
|
|
}});
|
2009-11-21 03:36:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a printable representation of the form in a new window.
|
|
|
|
* Used for readonly older versions of a specific page.
|
|
|
|
*/
|
2009-11-21 03:36:26 +01:00
|
|
|
$('#Form_EditForm .Actions #Form_EditForm_action_print').concrete('ss', function($){return{
|
2009-11-21 03:36:13 +01:00
|
|
|
onclick: function(e) {
|
|
|
|
var printURL = $(this[0].form).attr('action').replace(/\?.*$/,'')
|
|
|
|
+ '/printable/'
|
|
|
|
+ $(':input[name=ID]',this[0].form).val();
|
|
|
|
if(printURL.substr(0,7) != 'http://') printURL = $('base').attr('href') + printURL;
|
|
|
|
|
|
|
|
window.open(printURL, 'printable');
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2009-11-21 03:36:26 +01:00
|
|
|
}});
|
2009-11-21 03:36:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A "rollback" to a specific version needs user confirmation.
|
|
|
|
*/
|
2009-11-21 03:36:26 +01:00
|
|
|
$('#Form_EditForm .Actions #Form_EditForm_action_rollback').concrete('ss', function($){return{
|
2009-11-21 03:36:13 +01:00
|
|
|
onclick: function(e) {
|
|
|
|
// @todo i18n
|
|
|
|
return confirm("Do you really want to copy the published content to the stage site?");
|
|
|
|
}
|
2009-11-21 03:36:26 +01:00
|
|
|
}});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All forms in the right content panel should have closeable jQuery UI style titles.
|
|
|
|
*/
|
|
|
|
$('#contentPanel form').concrete('ss', function($){return{
|
|
|
|
onmatch: function() {
|
|
|
|
// Style as title bar
|
|
|
|
this.find(':header:first').titlebar({
|
|
|
|
closeButton:true
|
|
|
|
});
|
|
|
|
// The close button should close the east panel of the layout
|
|
|
|
this.find(':header:first .ui-dialog-titlebar-close').bind('click', function(e) {
|
|
|
|
$('body.CMSMain').concrete('ss').MainLayout().close('east');
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}});
|
2009-11-21 03:36:09 +01:00
|
|
|
|
2009-11-21 03:36:26 +01:00
|
|
|
})(jQuery);
|