* Mail/Sieve: Fix sieve save into folder with wrong namespace

This commit is contained in:
Hadi Nategh 2015-01-19 12:12:18 +00:00
parent 3c4cb54f34
commit 94ea53a688
3 changed files with 27 additions and 7 deletions

View File

@ -3084,8 +3084,16 @@ class mail_compose
return $_string; 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)); //error_log(__METHOD__.__LINE__.':'.array2string($_REQUEST));
static $useCacheIfPossible = null; static $useCacheIfPossible = null;
if (is_null($useCacheIfPossible)) $useCacheIfPossible = true; if (is_null($useCacheIfPossible)) $useCacheIfPossible = true;
@ -3116,7 +3124,7 @@ class mail_compose
{ {
//error_log(__METHOD__.__LINE__.$_searchString.'/'.$searchString.' in '.$k.'->'.$fA->displayName); //error_log(__METHOD__.__LINE__.$_searchString.'/'.$searchString.' in '.$k.'->'.$fA->displayName);
$f=false; $f=false;
$key = $_mailaccountToSearch.'::'.$k; $key = $_noPrefixId?$k:$_mailaccountToSearch.'::'.$k;
if ($_searchStringLength<=0) if ($_searchStringLength<=0)
{ {
$f=true; $f=true;

View File

@ -223,7 +223,7 @@ class mail_sieve
{ {
//Instantiate an etemplate_new object, representing sieve.edit template //Instantiate an etemplate_new object, representing sieve.edit template
$etmpl = new etemplate_new('mail.sieve.edit'); $etmpl = new etemplate_new('mail.sieve.edit');
$etmpl->setElementAttribute('action_folder_text','autocomplete_params', array('noPrefixId'=> true));
if (!is_array($content)) if (!is_array($content))
{ {
if ( $this->getRules($_GET['ruleID']) && isset($_GET['ruleID'])) 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 //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'] = $this->ajax_getFolders(0,true,null,true);
$sel_options['action_folder_text'] = $mailCompose->ajax_searchFolder(0,true);
return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,array(),2); return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,array(),2);
} }
@ -1233,5 +1232,18 @@ class mail_sieve
); );
return $actions; 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);
}
} }

View File

@ -92,7 +92,7 @@
<row> <row>
<radio label="File into:" id="action" options="folder"/> <radio label="File into:" id="action" options="folder"/>
<hbox> <hbox>
<taglist id="action_folder_text" width="40%" autocomplete_url="mail.mail_compose.ajax_searchFolder" autocomplete_params="" allowFreeEntries="false" maxSelection="1" onfocus="app.mail.sieve_focus_radioBtn" /> <taglist id="action_folder_text" width="40%" autocomplete_url="mail.mail_sieve.ajax_getFolders" autocomplete_params="" allowFreeEntries="false" maxSelection="1" onfocus="app.mail.sieve_focus_radioBtn" />
</hbox> </hbox>
</row> </row>
<row> <row>