silverstripe-cms/javascript/TranslationTab.js
Ingo Schommer b0bbadc665 BUGFIX Creating a translation of a new page in a new language fails - fixed by adding locale to /createtranslation ajax call (see #4021)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@76611 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-12 02:28:18 +00:00

22 lines
668 B
JavaScript
Executable File

Behaviour.register({
'input#Form_EditForm_createtranslation': {
onclick: function(e) {
var st = $('sitetree');
var originalID = st.getIdxOf(st.firstSelected());
if(originalID && originalID.substr(0,3) == 'new') {
alert("You have to save a page before translating it");
} else {
var url = baseHref() + 'admin/' + this.name.substring(7) + '?ID=' + $('Form_EditForm_ID').value + '&newlang=' +
$('Form_EditForm_NewTransLang').value + '&ajax=1';
url += "&locale=" + $('Form_EditForm_Locale').value;
new Ajax.Request( url, {
onSuccess: Ajax.Evaluator,
onFailure: Ajax.Evaluator
});
return false;
}
}
}
});