mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
API CHANGE Removed ajaxActionsAtTop() and prepareAjaxActions() javascript methods, to be replaced with new concrete implementation
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92598 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
df79a947a3
commit
1b312ae81b
@ -62,52 +62,6 @@ function unlockStatusMessage() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move form actions to the top and make them ajax
|
||||
*/
|
||||
function ajaxActionsAtTop(formName, actionHolderName, tabName) {
|
||||
var actions = document.getElementsBySelector('#' + formName + ' .Actions')[0];
|
||||
var holder;
|
||||
|
||||
if((holder = $(actionHolderName)) && holder != actions) {
|
||||
holder.parentNode.removeChild(holder);
|
||||
}
|
||||
|
||||
if(actions) {
|
||||
actions.id = actionHolderName;
|
||||
actions.className = 'ajaxActions';
|
||||
|
||||
$(tabName).appendChild(actions);
|
||||
prepareAjaxActions(actions, formName, tabName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the ajax actions so that the buttons actually do something
|
||||
*/
|
||||
function prepareAjaxActions(actions, formName, tabName) {
|
||||
var i, button, list = actions.getElementsByTagName('input')
|
||||
for (i=0;button=list[i];i++) {
|
||||
button.ownerForm = $(formName);
|
||||
|
||||
button.onclick = function(e) {
|
||||
if(!e) e = window.event;
|
||||
// tries to call a custom method of the format "action_<youraction>_right"
|
||||
if(window[this.name + '_' + tabName]) {
|
||||
window[this.name + '_' + tabName](e);
|
||||
} else {
|
||||
statusMessage('...');
|
||||
Ajax.SubmitForm(this.ownerForm, this.name, {
|
||||
onSuccess: Ajax.Evaluator,
|
||||
onFailure: ajaxErrorHandler
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// behaveAs(button, StatusTitle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the given form and evaluate the Ajax response.
|
||||
* Needs to be bound to an object with the following parameters to work:
|
||||
|
@ -22,7 +22,6 @@ CMSForm.prototype = {
|
||||
* Processing called whenever a page is loaded in the right - including the initial one
|
||||
*/
|
||||
prepareForm : function() {
|
||||
ajaxActionsAtTop(this.id, 'form_actions_' + this.formName, this.formName);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -31,7 +30,6 @@ CMSForm.prototype = {
|
||||
loadActionsFromString : function(actionHTML) {
|
||||
var actionHolder = $('form_actions_' + this.formName);
|
||||
actionHolder.innerHTML = actionHTML;
|
||||
prepareAjaxActions(actionHolder, this.id, this.formName);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -398,10 +398,4 @@ function fixHeight_left() {
|
||||
//fitToParent('LeftPane');
|
||||
fitToParent('Search_holder',12);
|
||||
fitToParent('ResultTable_holder',12);
|
||||
}
|
||||
|
||||
function prepareAjaxActions(actions, formName, tabName) {
|
||||
// @todo HACK Overwrites LeftAndMain.js version of this method to avoid double form actions
|
||||
// (by new jQuery and legacy prototype)
|
||||
return false;
|
||||
}
|
@ -10,7 +10,6 @@ Behaviour.register({
|
||||
* Processing called whenever a page is loaded in the right - including the initial one
|
||||
*/
|
||||
prepareForm : function() {
|
||||
ajaxActionsAtTop('Form_EditForm', 'form_actions', 'right');
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user