Try to fix some errors in ajax actions

- Disable / enable did not work
- Refresh grid via ajax did not work
This commit is contained in:
Nathan Gray 2014-02-13 19:00:11 +00:00
parent bad65780bc
commit efbdc7f532
2 changed files with 32 additions and 41 deletions

View File

@ -733,24 +733,15 @@ class mail_sieve
}
$msg = 'the rule with priority moved from ' . $from . ' to ' . $to;
egw_framework::message($msg);
$this->rules = $newrules;
$this->updateScript();
$this->saveSessionData();
//Calling to referesh after move action
$this->sieve_egw_refresh($msg);
}
/**
* call the client side refresh method
*
* @param type $msg
*/
function sieve_egw_refresh($msg)
{
$response = egw_json_response::get();
$response->call('app.mail.sieve_egw_refresh',null,$msg);
$response->call('app.mail.sieve_refresh',null,$msg);
}
/**
@ -765,25 +756,11 @@ class mail_sieve
$response = egw_json_response::get();
$request= etemplate_request::read($execId);
$content['rg'] = $this->get_rows($rows,$readonlys);
$content['msg'] = $msg;
$request->content = $content;
$data = array(
'etemplate_exec_id' => $request->id(),
'app_header' => $request->app_header,
'content' => $request->content,
'sel_options' => $request->sel_options,
'readonlys' => $request->readonlys,
'modifications' => $request->modifications,
'validation_errors' => $validation_errors,
);
$response->generic('et2_load', array(
'name' => 'mail.sieve.index',
'url' => $GLOBALS['egw_info']['server']['webserver_url'].etemplate_widget_template::relPath('mail.sieve.index'),
'data' => $data,
'DOMNodeID' => 'mail-sieve-index'
$response->generic('assign',array(
'etemplate_exec_id' => $execId,
'id' => 'rg',
'key' => 'value',
'value' => array('content' => $this->get_rows($rows,$readonlys))
));
//error_log(__METHOD__. "RESPONSE".array2string($response));
}
@ -796,7 +773,7 @@ class mail_sieve
* @param type $action_msg
* @param type $msg
*/
function ajax_action($action,$checked,$msg)
function ajax_action($exec_id, $action,$checked,$msg)
{
$this->getRules(null);
@ -826,11 +803,17 @@ class mail_sieve
break;
}
$this->updateScript();
ob_start();
$result = $this->updateScript();
if($result)
{
egw_json_response::get()->error($result);
return;
}
$this->saveSessionData();
//Refresh the form
$this->sieve_egw_refresh($msg);
$this->ajax_sieve_egw_refresh($exec_id,$msg);
}
/**
@ -992,7 +975,7 @@ class mail_sieve
{
if (!$this->bosieve->setRules($this->scriptToEdit, $this->rules))
{
print "update failed<br>";exit;
return "update failed";
}
}

View File

@ -2552,7 +2552,7 @@ app.classes.mail = AppJS.extend(
{
if (_typeID && _data)
{
var request = egw().json('mail.mail_sieve.ajax_action', [_typeID,_selectedID,_msg],null,null,true);
var request = egw().json('mail.mail_sieve.ajax_action', [this.et2_obj.etemplate_exec_id, _typeID,_selectedID,_msg],null,null,true);
request.sendRequest();
}
},
@ -2563,10 +2563,9 @@ app.classes.mail = AppJS.extend(
*
*
*/
sieve_refresh: function(_execid,_msg)
sieve_refresh: function()
{
var request = egw().json('mail.mail_sieve.ajax_sieve_egw_refresh', [this.et2_obj.etemplate_exec_id,_msg],null,this.et2_obj,true);
console.log(request);
var request = egw().json('mail.mail_sieve.ajax_sieve_egw_refresh', [this.et2_obj.etemplate_exec_id],null,this.et2_obj,true);
request.sendRequest();
},
@ -2626,12 +2625,21 @@ app.classes.mail = AppJS.extend(
},
/**
* Open seive filter list
*
* @param {egwAction} action - Action user did to get here
* @param {egwActionObject[]} selected - selected row(s)
*
* @todo get the account id and open the relevant sieve, ATM alway open sieve rules which is set in preferences
*/
edit_sieve: function()
edit_sieve: function(action, selected)
{
this.egw.open_link('mail.mail_sieve.index');
this.egw.open_link(this.egw.link('/index.php',
{
'menuaction': 'mail.mail_sieve.index',
'ajax': 'true'
}
));
},
/**