From 94ea53a6885b9ec9d9bdd827cd7740275a02a5b5 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 19 Jan 2015 12:12:18 +0000 Subject: [PATCH] * Mail/Sieve: Fix sieve save into folder with wrong namespace --- mail/inc/class.mail_compose.inc.php | 14 +++++++++++--- mail/inc/class.mail_sieve.inc.php | 18 +++++++++++++++--- mail/templates/default/sieve.edit.xet | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 28762fa9b7..b9a90240e0 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -3084,8 +3084,16 @@ class mail_compose return $_string; } } - - function ajax_searchFolder($_searchStringLength=2, $_returnList=false, $_mailaccountToSearch=null) { + /** + * Callback function to search mail folders + * + * @param int $_searchStringLength + * @param boolean $_returnList + * @param int $_mailaccountToSearch + * @param boolean $_noPrefixID = false, if set to true folders name does not get prefixed by account id + * @return type + */ + function ajax_searchFolder($_searchStringLength=2, $_returnList=false, $_mailaccountToSearch=null, $_noPrefixId=false) { //error_log(__METHOD__.__LINE__.':'.array2string($_REQUEST)); static $useCacheIfPossible = null; if (is_null($useCacheIfPossible)) $useCacheIfPossible = true; @@ -3116,7 +3124,7 @@ class mail_compose { //error_log(__METHOD__.__LINE__.$_searchString.'/'.$searchString.' in '.$k.'->'.$fA->displayName); $f=false; - $key = $_mailaccountToSearch.'::'.$k; + $key = $_noPrefixId?$k:$_mailaccountToSearch.'::'.$k; if ($_searchStringLength<=0) { $f=true; diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index 0dc7c56c54..b12eb69c4f 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -223,7 +223,7 @@ class mail_sieve { //Instantiate an etemplate_new object, representing sieve.edit template $etmpl = new etemplate_new('mail.sieve.edit'); - + $etmpl->setElementAttribute('action_folder_text','autocomplete_params', array('noPrefixId'=> true)); if (!is_array($content)) { if ( $this->getRules($_GET['ruleID']) && isset($_GET['ruleID'])) @@ -376,8 +376,7 @@ class mail_sieve ); //Set the preselect_options for mail/folders as we are not allow free entry for folder taglist - $mailCompose = new mail_compose(); - $sel_options['action_folder_text'] = $mailCompose->ajax_searchFolder(0,true); + $sel_options['action_folder_text'] = $this->ajax_getFolders(0,true,null,true); return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,array(),2); } @@ -1233,5 +1232,18 @@ class mail_sieve ); return $actions; } + /** + * Callback function to get mail folders + * int $_searchStringLength + * @param boolean $_returnList + * @param int $_mailaccountToSearch + * @param boolean $_noPrefixID = false, if set to true folders name does not get prefixed by account id + */ + function ajax_getFolders ($_searchStringLength=2, $_returnList=false, $_mailaccountToSearch=null, $_noPrefixId=false) + { + $mailCompose = new mail_compose(); + if ($_REQUEST['noPrefixId']) $_noPrefixID = $_REQUEST['noPrefixId']; + $mailCompose->ajax_searchFolder($_searchStringLength,$_returnList,$_mailaccountToSearch,$_noPrefixID); + } } diff --git a/mail/templates/default/sieve.edit.xet b/mail/templates/default/sieve.edit.xet index 0589fd3c98..8089156258 100644 --- a/mail/templates/default/sieve.edit.xet +++ b/mail/templates/default/sieve.edit.xet @@ -92,7 +92,7 @@ - +