Fix action enable/disable in mail seive context menu

This commit is contained in:
Hadi Nategh 2014-02-14 16:56:48 +00:00
parent ddab79a83b
commit c3ce366abe

View File

@ -291,7 +291,7 @@ class mail_sieve
//$ruleID is calculated by priority from the selected rule and is an unique ID //$ruleID is calculated by priority from the selected rule and is an unique ID
$ruleID = ($this->rulesByID['priority'] -1) / 2; $ruleID = ($this->rulesByID['priority'] -1) / 2;
$error = 0;
switch ($button) switch ($button)
{ {
@ -391,7 +391,7 @@ class mail_sieve
$sel_options['action_folder_text'] = $mailCompose->ajax_searchFolder(0,true); $sel_options['action_folder_text'] = $mailCompose->ajax_searchFolder(0,true);
return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,$preserv,2); return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,array(),2);
} }
/** /**
@ -646,7 +646,7 @@ class mail_sieve
$content['msg'] = lang('error').':'.lang('Serverside Filterrules (Sieve) are not activated').'. '.lang('Please contact your Administrator to validate if your Server supports Serverside Filterrules, and how to enable them in EGroupware for your active Account (%1) with ID:%2.',$this->currentIdentity['identity_string'],$this->mailbo->profileID); $content['msg'] = lang('error').':'.lang('Serverside Filterrules (Sieve) are not activated').'. '.lang('Please contact your Administrator to validate if your Server supports Serverside Filterrules, and how to enable them in EGroupware for your active Account (%1) with ID:%2.',$this->currentIdentity['identity_string'],$this->mailbo->profileID);
$content['hideIfSieveDisabled']='mail_DisplayNone'; $content['hideIfSieveDisabled']='mail_DisplayNone';
} }
$vtmpl->exec('mail.mail_sieve.editVacation',$content,$sel_options,$readonlys,array(),2); $vtmpl->exec('mail.mail_sieve.editVacation',$content,$sel_options,array(),array(),2);
} }
/** /**
@ -755,19 +755,18 @@ class mail_sieve
* Ajax function to handle the server side content for refreshing the form * Ajax function to handle the server side content for refreshing the form
* *
* @param type $execId, * @param type $execId,
* @param type $msg *
*/ */
function ajax_sieve_egw_refresh($execId,$msg) function ajax_sieve_egw_refresh($execId)
{ {
//Need to read the template to use for refreshing the form //Need to read the template to use for refreshing the form
$response = egw_json_response::get(); $response = egw_json_response::get();
$request= etemplate_request::read($execId);
$response->generic('assign',array( $response->generic('assign',array(
'etemplate_exec_id' => $execId, 'etemplate_exec_id' => $execId,
'id' => 'rg', 'id' => 'rg',
'key' => 'value', 'key' => 'value',
'value' => array('content' => $this->get_rows($rows,$readonlys)) 'value' => array('content' => $this->get_rows($rows))
)); ));
//error_log(__METHOD__. "RESPONSE".array2string($response)); //error_log(__METHOD__. "RESPONSE".array2string($response));
} }
@ -838,7 +837,7 @@ class mail_sieve
*/ */
function addScript() function addScript()
{ {
if($scriptName = $_POST['newScriptName']) if(($scriptName = $_POST['newScriptName']))
{ {
$this->bosieve->installScript($scriptName, ''); $this->bosieve->installScript($scriptName, '');
} }
@ -1012,7 +1011,7 @@ class mail_sieve
*/ */
function getRules($ruleID = null) function getRules($ruleID = null)
{ {
if($script = $this->bosieve->getScript($this->scriptName)) if(($script = $this->bosieve->getScript($this->scriptName)))
{ {
$this->scriptToEdit = $this->scriptName; $this->scriptToEdit = $this->scriptName;
if(PEAR::isError($error = $this->bosieve->retrieveRules($this->scriptName)) ) if(PEAR::isError($error = $this->bosieve->retrieveRules($this->scriptName)) )
@ -1060,7 +1059,7 @@ class mail_sieve
* *
* @return {boolean|array} Array of rows | false if failed * @return {boolean|array} Array of rows | false if failed
*/ */
function get_rows(&$rows,&$readonlys) function get_rows(&$rows)
{ {
$rows = array(); $rows = array();
$this->getRules(null); /* ADDED BY GHORTH */ $this->getRules(null); /* ADDED BY GHORTH */
@ -1074,9 +1073,9 @@ class mail_sieve
{ {
$row['rules'] = $this->buildRule($row); $row['rules'] = $this->buildRule($row);
$row['ruleID'] =(string)(($row['priority'] -1) / 2 ); $row['ruleID'] =(string)(($row['priority'] -1) / 2 );
if ($row ['status'] === 'ENABLED') if ($row ['status'] === 'DISABLED')
{ {
$row['class'] = 'mail_sieve_ENABLED'; $row['class'] = 'mail_sieve_DISABLED';
} }
} }
}else }else
@ -1092,18 +1091,17 @@ class mail_sieve
/** /**
* Get actions / context menu for index * Get actions / context menu for index
* *
* @param {array} $query
*
* @return {array} returns defined actions as an array * @return {array} returns defined actions as an array
*/ */
private function get_actions(array $query=array()) private function get_actions()
{ {
$actions =array( $actions =array(
'edit' => array( 'edit' => array(
'caption' => 'Edit', 'caption' => 'Edit',
'default' => true, 'default' => true,
'onExecute' => 'javaScript:app.mail.action' 'onExecute' => 'javaScript:app.mail.action',
'disableClass' => 'th'
), ),
'add' => array( 'add' => array(
'caption' => 'Add', 'caption' => 'Add',
@ -1112,15 +1110,14 @@ class mail_sieve
'enable' => array( 'enable' => array(
'caption' => 'Enable', 'caption' => 'Enable',
'onExecute' => 'javaScript:app.mail.action', 'onExecute' => 'javaScript:app.mail.action',
//'enableClass' => 'mail_sieve_ENABLED', 'enableClass' => 'mail_sieve_DISABLED',
//'hideOnDisabled' => true, 'hideOnDisabled' => true
), ),
'disable' => array( 'disable' => array(
'caption' => 'Disable', 'caption' => 'Disable',
'onExecute' => 'javaScript:app.mail.action', 'onExecute' => 'javaScript:app.mail.action',
'disableClass' => 'mail_sieve_ENABLED', 'disableClass' => 'mail_sieve_DISABLED',
'hideOnDisabled' => true, 'hideOnDisabled' => true
), ),
'delete' => array( 'delete' => array(
'caption' => 'Delete', 'caption' => 'Delete',