API CHANGE Removed ajaxLoadPage(), ajaxLoadPage_success(), ajaxLink() javascript methods - were never used in core

MINOR Moved ajaxSubmitFieldSet() javascript from LeftAndMain.js to MemberTableField.js (only place where its actually used)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92594 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:35:48 +00:00
parent 908409a5d8
commit 7fd337f5f8
2 changed files with 26 additions and 53 deletions

View File

@ -145,59 +145,6 @@ function ajaxSubmitForm(automated, callAfter, form, action, verb) {
return false; return false;
}; };
/**
* Post the given fields to the given url
*/
function ajaxSubmitFieldSet(href, fieldSet, extraData) {
// Build data
var i,field,data = "ajax=1";
for(i=0;field=fieldSet[i];i++) {
data += '&' + Form.Element.serialize(field);
}
if(extraData){
data += '&'+extraData;
}
// Send request
new Ajax.Request(href, {
method : 'post', postBody : data,
onSuccess : function(response) {
//alert(response.responseText);
Ajax.Evaluator(response);
},
onFailure : function(response) {
alert(response.responseText);
//errorMessage('Error: ', response);
}
});
}
/**
* Post the given fields to the given url
*/
function ajaxLink(href) {
// Send request
new Ajax.Request(href + (href.indexOf("?") == -1 ? "?" : "&") + "ajax=1", {
method : 'get',
onSuccess : Ajax.Evaluator,
onFailure : ajaxErrorHandler
});
}
/**
* Load a URL into the given form
*/
function ajaxLoadPage() {
statusMessage('loading...', 2, true);
new Ajax.Request(this.URL + '&ajax=1', {
method : 'get',
onSuccess : ajaxLoadPage_success.bind(this)
});
}
function ajaxLoadPage_success(response) {
statusMessage('loaded');
$(this.form).loadNewPage(response.responseText);
}
/** /**
* Behaviour of the statuts message. * Behaviour of the statuts message.
*/ */

View File

@ -277,3 +277,29 @@ MemberFilterButton.prototype = {
Behaviour.register({ Behaviour.register({
'#Form_EditForm div.MemberTableField table.data input.text' : AjaxMemberLookup '#Form_EditForm div.MemberTableField table.data input.text' : AjaxMemberLookup
}); });
/**
* Post the given fields to the given url
*/
function ajaxSubmitFieldSet(href, fieldSet, extraData) {
// Build data
var i,field,data = "ajax=1";
for(i=0;field=fieldSet[i];i++) {
data += '&' + Form.Element.serialize(field);
}
if(extraData){
data += '&'+extraData;
}
// Send request
new Ajax.Request(href, {
method : 'post', postBody : data,
onSuccess : function(response) {
//alert(response.responseText);
Ajax.Evaluator(response);
},
onFailure : function(response) {
alert(response.responseText);
//errorMessage('Error: ', response);
}
});
}