Using new egw json api for sending submits

This commit is contained in:
Andreas Stöckel 2012-03-05 15:02:32 +00:00
parent 1bc16c1b8e
commit 65ca8b0c1b
2 changed files with 25 additions and 25 deletions

View File

@ -214,9 +214,9 @@ var et2_dataview_grid = Class.extend(et2_dataview_IViewRange, {
// regarding to the count of elements managed in it
if (count < Math.pow(ET2_PARTITION_TREE_WIDTH, depth - 1))
{
this.egw().debug("info", "Rebuilding dataview partition tree");
egw.debug("info", "Rebuilding dataview partition tree");
this._partitionTree.rebuild();
this.egw().debug("info", "Done.");
egw.debug("info", "Done.");
}
// Reset the "treeChanged" function.

View File

@ -44,7 +44,8 @@
et2_core_interfaces;
// Include the client side api core
egw_core;
jsapi.egw_core;
jsapi.egw_json;
*/
/**
@ -252,8 +253,10 @@ etemplate2.prototype.submit = function(button)
// Create the request object
if (typeof egw_json_request != "undefined" && this.menuaction)
{
var request = new egw_json_request(this.menuaction, [this.etemplate_exec_id,values], this);
request.sendRequest(true);
var api = egw(window);
// api.debug("Blablub");
var request = api.json(this.menuaction, [this.etemplate_exec_id,values], null, this);
request.sendRequest();
}
else
{
@ -341,36 +344,33 @@ etemplate2.prototype.getValues = function(_root)
return result;
}
/**
* Function which handles the EGW JSON et2_load response
*/
function etemplate2_handle_response(_type, _response)
function etemplate2_handle_load(_type, _response)
{
if (_type == "et2_load")
// Check the parameters
var data = _response.data;
if (typeof data.url == "string" && data.data instanceof Object)
{
// Check the parameters
var data = _response.data;
if (typeof data.url == "string" && data.data instanceof Object)
{
this.load(data.url, data.data);
return true;
}
throw("Error while parsing et2_load response");
} else if (_type == "et2_validation_error") {
// Display validation errors
// $j(':input',this.DOMContainer).data("validator").invalidate(_response.data);
this.load(data.url, data.data);
return true;
}
return false;
throw("Error while parsing et2_load response");
}
function etemplate2_handle_validation_error(_type, _response)
{
// Display validation errors
//$j(':input',this.DOMContainer).data("validator").invalidate(_response.data);
}
// Register the egw_json result object
if (typeof egw_json_register_plugin != "undefined")
if (typeof egw != "undefined")
{
// Calls etemplate2_handle_response in the context of the object which
// requested the response from the server
egw_json_register_plugin(etemplate2_handle_response, null);
egw(window).registerJSONPlugin(etemplate2_handle_load, null, 'et2_load');
egw(window).registerJSONPlugin(etemplate2_handle_validation_error, null, 'et2_validation_error');
}
else
{