From 7dfc75f3558b5d692ebd94a4ca11e8bfb6d88945 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 11 May 2010 07:45:08 +0000 Subject: [PATCH] fix for bug reported at the developer list regarding apply with allof/anyof; fix for bug regarding the visibility of the rerdirect address --- felamimail/inc/class.uisieve.inc.php | 30 ++++++++++++++----- .../templates/default/sieveEditForm.tpl | 1 + 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/felamimail/inc/class.uisieve.inc.php b/felamimail/inc/class.uisieve.inc.php index 0c68022a64..e416aa7f5c 100644 --- a/felamimail/inc/class.uisieve.inc.php +++ b/felamimail/inc/class.uisieve.inc.php @@ -339,14 +339,15 @@ } } - function displayRule($_ruleID, $_ruleData) { + function displayRule($_ruleID, $_ruleData, $msg='') { + $preferences = $this->mailPreferences; // display the header $this->display_app_header(); - + $msg = html::purify($msg); // initialize the template $this->t->set_file(array("filterForm" => "sieveEditForm.tpl")); $this->t->set_block('filterForm','main'); - + $this->t->set_var('message',$msg); $linkData = array ( 'menuaction' => 'felamimail.uisieve.editRule', @@ -368,6 +369,8 @@ $this->t->set_var('keep_checked','checked'); if($_ruleData['regexp']) $this->t->set_var('regexp_checked','checked'); + if(intval($_ruleData['anyof'])==1) + $_ruleData['anyof'] = 4; // set the anyof to 4 if set at all, as the template var anyof_selected is anyof_selected0 or anyof_selected4 $this->t->set_var('anyof_selected'.intval($_ruleData['anyof']),'selected'); $this->t->set_var('value_from',htmlspecialchars($_ruleData['from'], ENT_QUOTES, $GLOBALS['egw']->translation->charset())); $this->t->set_var('value_to',htmlspecialchars($_ruleData['to'], ENT_QUOTES, $GLOBALS['egw']->translation->charset())); @@ -382,9 +385,9 @@ { $this->t->set_var('folderName',$_ruleData['action_arg']); } - if (($_ruleData['action'] == 'address') || - (empty($preferences->preferences['prefpreventforwarding']) || - $preferences->preferences['prefpreventforwarding'] == 0 )) + if (($_ruleData['action'] == 'address') && + (!empty($preferences->preferences['prefpreventforwarding']) && + $preferences->preferences['prefpreventforwarding'] == 1 )) { $this->t->set_var('checked_action_address',''); $this->t->set_var('value_address',lang('not allowed')); @@ -411,6 +414,9 @@ function editRule() { + $preferences = $this->mailPreferences; + $msg = ''; + $error = 0; $this->getRules(); /* ADDED BY GHORTH */ $ruleType = get_var('ruletype',array('GET')); @@ -465,6 +471,11 @@ $newRule['action'] = 'address'; $newRule['action_arg'] = get_var('address',array('POST')); } + else + { + $msg .= lang('Error creating rule while trying to use forward/redirect.'); + $error++; + } break; case 'discard': @@ -478,14 +489,17 @@ $this->bosieve->setRules($this->scriptName, $this->rules); $this->saveSessionData(); + } else { + $msg .= "\n".lang("Error: Could not save rule"); + $error++; } // refresh the list $js = "opener.location.href = '".addslashes(egw::link('/index.php','menuaction=felamimail.uisieve.listRules'))."';"; - if(isset($_POST['save'])) { + if(isset($_POST['save']) && $error == 0) { echo "\n"; } else { $GLOBALS['egw']->js->set_onload($js); - $this->displayRule($ruleID, $newRule); + $this->displayRule($ruleID, $newRule, $msg); } } else diff --git a/felamimail/templates/default/sieveEditForm.tpl b/felamimail/templates/default/sieveEditForm.tpl index 2bc38cdd07..9a6904bf3a 100644 --- a/felamimail/templates/default/sieveEditForm.tpl +++ b/felamimail/templates/default/sieveEditForm.tpl @@ -12,6 +12,7 @@ function SubmitForm(a) } +
{message}
{lang_condition}