2007-07-19 12:40:05 +02:00
|
|
|
function action_publish_right() {
|
2008-10-03 02:48:34 +02:00
|
|
|
$('Form_EditForm_action_publish').value = ss.i18n._t('CMSMAIN.PUBLISHING');
|
2007-09-15 03:11:50 +02:00
|
|
|
$('Form_EditForm_action_publish').className = 'action loading';
|
2007-09-15 03:00:03 +02:00
|
|
|
var publish = true;
|
|
|
|
$('Form_EditForm').save(false, null, 'save', publish);
|
2007-07-19 12:40:05 +02:00
|
|
|
}
|
|
|
|
function action_revert_right() {
|
2008-10-03 02:48:34 +02:00
|
|
|
$('Form_EditForm_action_revert').value = ss.i18n._t('CMSMAIN.RESTORING');
|
2007-09-16 04:29:34 +02:00
|
|
|
$('Form_EditForm_action_revert').className = 'action loading';
|
2007-07-19 12:40:05 +02:00
|
|
|
Ajax.SubmitForm('Form_EditForm', 'action_revert', {
|
|
|
|
onSuccess : Ajax.Evaluator,
|
|
|
|
onFailure : function(response) {
|
2008-10-03 02:48:34 +02:00
|
|
|
errorMessage(ss.i18n._t('CMSMAIN.ERRORREVERTING'), response);
|
2007-07-19 12:40:05 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2009-02-03 03:50:25 +01:00
|
|
|
|
2007-07-19 12:40:05 +02:00
|
|
|
function action_rollback_right() {
|
|
|
|
var options = {
|
|
|
|
OK: function() {
|
|
|
|
var pageID = $('Form_EditForm').elements.ID.value;
|
|
|
|
|
|
|
|
Ajax.SubmitForm('Form_EditForm', 'action_rollback', {
|
|
|
|
onSuccess : function(response) {
|
|
|
|
$('Form_EditForm').getPageFromServer(pageID);
|
|
|
|
statusMessage(response.responseText,'good');
|
|
|
|
},
|
|
|
|
onFailure : function(response) {
|
|
|
|
errorMessage('Error rolling back content', response);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
Cancel:function() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-13 01:04:25 +01:00
|
|
|
if($('Form_EditForm').elements.Version && $('Form_EditForm').elements.Version.value) {
|
|
|
|
var message = "Do you really want to roll back to version #"
|
|
|
|
+ $('Form_EditForm').elements.Version.value + " of this page?";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
var message = "Do you really want to copy the published content to the stage site?";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(confirm(message)) {
|
2007-10-29 02:58:01 +01:00
|
|
|
options.OK();
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2007-07-19 12:40:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Email containing the link to the archived version of the page
|
|
|
|
*/
|
|
|
|
function action_email_right() {
|
|
|
|
window.open( 'mailto:?subject=' + $('Form_EditForm_ArchiveEmailSubject').value + '&body=' + $('Form_EditForm_ArchiveEmailMessage').value, 'archiveemail' );
|
|
|
|
}
|
|
|
|
|
|
|
|
function action_print_right() {
|
|
|
|
var printURL = $('Form_EditForm').action.replace(/\?.*$/,'') + '/printable/' + $('Form_EditForm').elements.ID.value;
|
|
|
|
if(printURL.substr(0,7) != 'http://') printURL = baseHref() + printURL;
|
|
|
|
|
|
|
|
window.open(printURL, 'printable');
|
|
|
|
}
|
|
|
|
|
|
|
|
function suggestStageSiteLink() {
|
|
|
|
var el = $('viewStageSite');
|
|
|
|
el.flasher = setInterval(flashColor.bind(el), 300);
|
|
|
|
setTimeout(stopFlashing.bind(el), 3000);
|
|
|
|
}
|
|
|
|
function flashColor() {
|
|
|
|
if(!this.style.color) this.style.color = '';
|
|
|
|
this.style.color = (this.style.color == '') ? '#00FF00' : '';
|
|
|
|
}
|
|
|
|
function stopFlashing() {
|
|
|
|
clearInterval(this.flasher);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Behaviour.register({
|
|
|
|
'a.cmsEditlink' : {
|
|
|
|
onclick : function() {
|
|
|
|
if(this.href.match(/admin\/show\/([0-9]+)($|#|\?)/)) {
|
|
|
|
$('Form_EditForm').getPageFromServer(RegExp.$1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Behaviour.register({
|
|
|
|
'select#Form_EditForm_ClassName' : {
|
|
|
|
onchange: function() {
|
|
|
|
alert('The page type will be updated after the page is saved');
|
|
|
|
}
|
2009-05-04 03:27:35 +02:00
|
|
|
},
|
2007-07-19 12:40:05 +02:00
|
|
|
|
|
|
|
'#Form_EditForm' : {
|
|
|
|
changeDetection_fieldsToIgnore : {
|
|
|
|
'restricted-chars[Form_EditForm_URLSegment]' : true,
|
|
|
|
'Sort' : true
|
|
|
|
}
|
2009-05-04 03:27:35 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
// ParentType / ParentID field combination
|
|
|
|
'#Form_EditForm_ParentType' : {
|
|
|
|
initialize : function() {
|
2009-05-06 07:53:22 +02:00
|
|
|
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;
|
|
|
|
}
|
2009-05-04 03:27:35 +02:00
|
|
|
this.showHide();
|
|
|
|
},
|
|
|
|
|
|
|
|
rootClick : function() {
|
|
|
|
$('Form_EditForm_ParentID').setValue(0);
|
|
|
|
this.showHide();
|
|
|
|
},
|
|
|
|
|
|
|
|
showHide : function() {
|
2009-05-06 07:53:22 +02:00
|
|
|
var parentTypeRootEl = $('Form_EditForm_ParentType_root');
|
|
|
|
if(parentTypeRootEl && parentTypeRootEl.checked) {
|
2009-05-04 03:27:35 +02:00
|
|
|
Element.hide('ParentID');
|
|
|
|
} else {
|
|
|
|
Element.show('ParentID');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|