mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-29 01:09:10 +01:00
attempt to fix getMailboxes / getMailboxesRecursive
This commit is contained in:
parent
0a23e69fdf
commit
1dd472f567
@ -1195,6 +1195,16 @@ class mail_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(is_array($headerObject['CC']) && $headerObject['CC'][0]) {
|
||||||
|
$ki=0;
|
||||||
|
foreach($headerObject['CC'] as $k => $add)
|
||||||
|
{
|
||||||
|
//error_log(__METHOD__.__LINE__."-> $k:".array2string($add));
|
||||||
|
$retValue['header'][$sortOrder[$uid]]['cc_addresses'][$ki]['address'] = self::decode_header($add);
|
||||||
|
//error_log(__METHOD__.__LINE__.array2string($retValue['header'][$sortOrder[$uid]]['additional_to_addresses'][$ki]));
|
||||||
|
$ki++;
|
||||||
|
}
|
||||||
|
}
|
||||||
//error_log(__METHOD__.__LINE__.array2string($retValue['header'][$sortOrder[$uid]]));
|
//error_log(__METHOD__.__LINE__.array2string($retValue['header'][$sortOrder[$uid]]));
|
||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
@ -1886,7 +1896,7 @@ class mail_bo
|
|||||||
$allMailboxes = array();
|
$allMailboxes = array();
|
||||||
foreach ((array)$allMailBoxesExtSorted as $mbx) {
|
foreach ((array)$allMailBoxesExtSorted as $mbx) {
|
||||||
//echo $mbx['MAILBOX']."<br>";
|
//echo $mbx['MAILBOX']."<br>";
|
||||||
if (in_array('\HasChildren',$mbx["ATTRIBUTES"]) || in_array('\Haschildren',$mbx["ATTRIBUTES"])) {
|
if (in_array('\HasChildren',$mbx["ATTRIBUTES"]) || in_array('\Haschildren',$mbx["ATTRIBUTES"]) || in_array('\haschildren',$mbx["ATTRIBUTES"])) {
|
||||||
unset($buff);
|
unset($buff);
|
||||||
//$buff = $this->icServer->getMailboxes($mbx['MAILBOX'].$delimiter,0,false);
|
//$buff = $this->icServer->getMailboxes($mbx['MAILBOX'].$delimiter,0,false);
|
||||||
if (!in_array($mbx['MAILBOX'],$allMailboxes)) $buff = self::getMailBoxesRecursive($mbx['MAILBOX'],$delimiter,$foldersNameSpace[$type]['prefix'],1);
|
if (!in_array($mbx['MAILBOX'],$allMailboxes)) $buff = self::getMailBoxesRecursive($mbx['MAILBOX'],$delimiter,$foldersNameSpace[$type]['prefix'],1);
|
||||||
@ -2180,26 +2190,27 @@ class mail_bo
|
|||||||
//get that mailbox in question
|
//get that mailbox in question
|
||||||
$mbx = $this->icServer->getMailboxes($_mailbox,1,true);
|
$mbx = $this->icServer->getMailboxes($_mailbox,1,true);
|
||||||
#_debug_array($mbx);
|
#_debug_array($mbx);
|
||||||
if (is_array($mbx[0]["ATTRIBUTES"]) && (in_array('\HasChildren',$mbx[0]["ATTRIBUTES"]) || in_array('\Haschildren',$mbx[0]["ATTRIBUTES"]))) {
|
//error_log(__METHOD__.__LINE__.' Delimiter:'.array2string($delimiter));
|
||||||
|
//error_log(__METHOD__.__LINE__.array2string($mbx));
|
||||||
|
if (is_array($mbx[0]["ATTRIBUTES"]) && (in_array('\HasChildren',$mbx[0]["ATTRIBUTES"]) || in_array('\Haschildren',$mbx[0]["ATTRIBUTES"]) || in_array('\haschildren',$mbx[0]["ATTRIBUTES"]))) {
|
||||||
// if there are children fetch them
|
// if there are children fetch them
|
||||||
//echo $mbx[0]['MAILBOX']."<br>";
|
//echo $mbx[0]['MAILBOX']."<br>";
|
||||||
unset($buff);
|
unset($buff);
|
||||||
$buff = $this->icServer->getMailboxes($mbx[0]['MAILBOX'].($mbx[0]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
|
$buff = $this->icServer->getMailboxes($mbx[0]['MAILBOX'].($mbx[0]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
|
||||||
//$buff = $this->icServer->getMailboxes($mbx[0]['MAILBOX'],2,false);
|
//$buff = $this->icServer->getMailboxes($mbx[0]['MAILBOX'],2,false);
|
||||||
//_debug_array($buff);
|
//_debug_array($buff);
|
||||||
if( PEAR::isError($buff) ) {
|
$allMailboxes = array();
|
||||||
if (self::$debug) error_log(__METHOD__." Error while retrieving Mailboxes for:".$mbx[0]['MAILBOX'].$delimiter.".");
|
foreach ($buff as $mbxname) {
|
||||||
return array();
|
//error_log(__METHOD__.__LINE__.array2string($mbxname));
|
||||||
} else {
|
$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']);
|
||||||
$allMailboxes = array();
|
#echo "About to recur in level $reclevel:".$mbxname."<br>";
|
||||||
foreach ($buff as $mbxname) {
|
if ( $mbxname != $mbx[0]['MAILBOX'] && $mbxname != $prefix && $mbxname != $mbx[0]['MAILBOX'].$delimiter)
|
||||||
$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname);
|
{
|
||||||
#echo "About to recur in level $reclevel:".$mbxname."<br>";
|
$allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
|
||||||
if ( $mbxname != $mbx[0]['MAILBOX'] && $mbxname != $prefix && $mbxname != $mbx[0]['MAILBOX'].$delimiter) $allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
|
|
||||||
}
|
}
|
||||||
if (!(in_array('\NoSelect',$mbx[0]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[0]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[0]['MAILBOX'];
|
|
||||||
return $allMailboxes;
|
|
||||||
}
|
}
|
||||||
|
if (!(in_array('\NoSelect',$mbx[0]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[0]["ATTRIBUTES"]) || in_array('\noselect',$mbx[0]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[0]['MAILBOX'];
|
||||||
|
return $allMailboxes;
|
||||||
} else {
|
} else {
|
||||||
return array($_mailbox);
|
return array($_mailbox);
|
||||||
}
|
}
|
||||||
|
@ -1111,6 +1111,7 @@ class mail_compose
|
|||||||
$value = htmlspecialchars_decode($value,ENT_COMPAT);
|
$value = htmlspecialchars_decode($value,ENT_COMPAT);
|
||||||
$value = str_replace("\"\"",'"',$value);
|
$value = str_replace("\"\"",'"',$value);
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($value):$value), '');
|
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($value):$value), '');
|
||||||
|
unset($content[strtolower($destination)]);
|
||||||
foreach((array)$address_array as $addressObject) {
|
foreach((array)$address_array as $addressObject) {
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
||||||
$address = imap_rfc822_write_address($addressObject->mailbox,$addressObject->host,$addressObject->personal);
|
$address = imap_rfc822_write_address($addressObject->mailbox,$addressObject->host,$addressObject->personal);
|
||||||
|
@ -142,6 +142,7 @@ class mail_ui
|
|||||||
'msg' => $e->getMessage()//.' ('.get_class($e).': '.$e->getCode().')',
|
'msg' => $e->getMessage()//.' ('.get_class($e).': '.$e->getCode().')',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['egw']->session->commit_session();
|
$GLOBALS['egw']->session->commit_session();
|
||||||
//_debug_array($this->mail_bo->mailPreferences);
|
//_debug_array($this->mail_bo->mailPreferences);
|
||||||
//$endtime = microtime(true) - $starttime;
|
//$endtime = microtime(true) - $starttime;
|
||||||
@ -186,9 +187,11 @@ class mail_ui
|
|||||||
$starttime = microtime (true);
|
$starttime = microtime (true);
|
||||||
$this->mail_bo->restoreSessionData();
|
$this->mail_bo->restoreSessionData();
|
||||||
$sessionFolder = $this->mail_bo->sessionData['mailbox'];
|
$sessionFolder = $this->mail_bo->sessionData['mailbox'];
|
||||||
|
$toSchema = false;//decides to select list schema with column to selected (if false fromaddress is default)
|
||||||
if ($this->mail_bo->folderExists($sessionFolder))
|
if ($this->mail_bo->folderExists($sessionFolder))
|
||||||
{
|
{
|
||||||
$this->mail_bo->reopen($sessionFolder); // needed to fetch full set of capabilities
|
$this->mail_bo->reopen($sessionFolder); // needed to fetch full set of capabilities
|
||||||
|
$toSchema = $this->mail_bo->isDraftFolder($sessionFolder)||$this->mail_bo->isSentFolder($sessionFolder)||$this->mail_bo->isTemplateFolder($sessionFolder);
|
||||||
}
|
}
|
||||||
//_debug_array($content);
|
//_debug_array($content);
|
||||||
if (!is_array($content))
|
if (!is_array($content))
|
||||||
@ -209,7 +212,7 @@ class mail_ui
|
|||||||
'start' => 0, // IO position in list
|
'start' => 0, // IO position in list
|
||||||
'order' => 'date', // IO name of the column to sort after (optional for the sortheaders)
|
'order' => 'date', // IO name of the column to sort after (optional for the sortheaders)
|
||||||
'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC'
|
'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC'
|
||||||
'default_cols' => 'status,attachments,subject,fromaddress,date,size', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
|
'default_cols' => 'status,attachments,subject,'.($toSchema?'toaddress':'fromaddress').',date,size', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
|
||||||
'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames,
|
'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames,
|
||||||
//or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type)
|
//or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type)
|
||||||
'actions' => self::get_actions(),
|
'actions' => self::get_actions(),
|
||||||
@ -1211,7 +1214,7 @@ unset($query['actions']);
|
|||||||
if (empty($rowsFetched['messages'])) $rowsFetched['messages'] = $rowsFetched['rowsFetched'];
|
if (empty($rowsFetched['messages'])) $rowsFetched['messages'] = $rowsFetched['rowsFetched'];
|
||||||
|
|
||||||
//error_log(__METHOD__.__LINE__.' Rows fetched:'.$rowsFetched.' Data:'.array2string($sortResult));
|
//error_log(__METHOD__.__LINE__.' Rows fetched:'.$rowsFetched.' Data:'.array2string($sortResult));
|
||||||
$cols = array('row_id','uid','status','attachments','subject','toaddress','fromaddress','date','size','modified');
|
$cols = array('row_id','uid','status','attachments','subject','toaddress','fromaddress','ccaddress','additionaltoaddress','date','size','modified');
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['common']['select_mode']=='EGW_SELECTMODE_TOGGLE') unset($cols[0]);
|
if ($GLOBALS['egw_info']['user']['preferences']['common']['select_mode']=='EGW_SELECTMODE_TOGGLE') unset($cols[0]);
|
||||||
$rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType,$previewMessage);
|
$rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType,$previewMessage);
|
||||||
//error_log(__METHOD__.__LINE__.array2string($rows));
|
//error_log(__METHOD__.__LINE__.array2string($rows));
|
||||||
@ -1482,11 +1485,19 @@ unset($query['actions']);
|
|||||||
$data["toaddress"] = $header['to_address'];//mail_bo::htmlentities($header['to_address'],$this->charset);
|
$data["toaddress"] = $header['to_address'];//mail_bo::htmlentities($header['to_address'],$this->charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_array("additionaltoaddress", $cols))
|
||||||
|
{
|
||||||
|
$data['additionaltoaddress'] = json_encode($header['additional_to_addresses']);
|
||||||
|
}
|
||||||
//fromaddress
|
//fromaddress
|
||||||
if (in_array("fromaddress", $cols))
|
if (in_array("fromaddress", $cols))
|
||||||
{
|
{
|
||||||
$data["fromaddress"] = $header['sender_address'];//mail_bo::htmlentities($header['sender_address'],$this->charset);
|
$data["fromaddress"] = $header['sender_address'];//mail_bo::htmlentities($header['sender_address'],$this->charset);
|
||||||
}
|
}
|
||||||
|
if (in_array("ccaddress", $cols))
|
||||||
|
{
|
||||||
|
$data['ccaddress'] = json_encode($header['cc_addresses']);
|
||||||
|
}
|
||||||
if (in_array("date", $cols))
|
if (in_array("date", $cols))
|
||||||
{
|
{
|
||||||
$data["date"] = $header['date'];//$dateShort;//'<nobr><span style="font-size:10px" title="'.$dateLong.'">'.$dateShort.'</span></nobr>';
|
$data["date"] = $header['date'];//$dateShort;//'<nobr><span style="font-size:10px" title="'.$dateLong.'">'.$dateShort.'</span></nobr>';
|
||||||
@ -3240,6 +3251,11 @@ blockquote[type=cite] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($folderName==$this->mail_bo->sessionData['mailbox'])
|
||||||
|
{
|
||||||
|
$this->mail_bo->sessionData['mailbox']=$newFolderName;
|
||||||
|
$this->mail_bo->saveSessionData();
|
||||||
|
}
|
||||||
//error_log(__METHOD__.__LINE__.array2string($oA));
|
//error_log(__METHOD__.__LINE__.array2string($oA));
|
||||||
if ($oA)
|
if ($oA)
|
||||||
{
|
{
|
||||||
|
@ -495,6 +495,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
this.et2.getWidgetById('previewToAddress').set_value("");
|
this.et2.getWidgetById('previewToAddress').set_value("");
|
||||||
this.et2.getWidgetById('previewDate').set_value("");
|
this.et2.getWidgetById('previewDate').set_value("");
|
||||||
this.et2.getWidgetById('previewSubject').set_value("");
|
this.et2.getWidgetById('previewSubject').set_value("");
|
||||||
|
this.et2.getWidgetById('button[showAllAddresses]').set_class('et2_button ui-button mail_DisplayNone');
|
||||||
this.et2.getWidgetById('previewAttachmentArea').set_value({content:[]});
|
this.et2.getWidgetById('previewAttachmentArea').set_value({content:[]});
|
||||||
this.et2.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent mail_DisplayNone');
|
this.et2.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent mail_DisplayNone');
|
||||||
var IframeHandle = this.et2.getWidgetById('messageIFRAME');
|
var IframeHandle = this.et2.getWidgetById('messageIFRAME');
|
||||||
@ -510,6 +511,16 @@ app.classes.mail = AppJS.extend(
|
|||||||
this.et2.getWidgetById('previewToAddress').set_value(dataElem.data.toaddress);
|
this.et2.getWidgetById('previewToAddress').set_value(dataElem.data.toaddress);
|
||||||
this.et2.getWidgetById('previewDate').set_value(dataElem.data.date);
|
this.et2.getWidgetById('previewDate').set_value(dataElem.data.date);
|
||||||
this.et2.getWidgetById('previewSubject').set_value(subject);
|
this.et2.getWidgetById('previewSubject').set_value(subject);
|
||||||
|
if (dataElem.data.additionaltoaddress=="null") dataElem.data.additionaltoaddress='';
|
||||||
|
if (dataElem.data.ccaddress=='null') dataElem.data.ccaddress='';
|
||||||
|
if ((dataElem.data.additionaltoaddress.length+dataElem.data.ccaddress.length)<1)
|
||||||
|
{
|
||||||
|
this.et2.getWidgetById('button[showAllAddresses]').set_class('et2_button ui-button mail_DisplayNone');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.et2.getWidgetById('button[showAllAddresses]').set_class('et2_button ui-button');
|
||||||
|
}
|
||||||
if (dataElem.data.attachmentsBlock.length<1)
|
if (dataElem.data.attachmentsBlock.length<1)
|
||||||
{
|
{
|
||||||
this.et2.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent mail_DisplayNone');
|
this.et2.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent mail_DisplayNone');
|
||||||
@ -529,6 +540,29 @@ app.classes.mail = AppJS.extend(
|
|||||||
// request.sendRequest(false);
|
// request.sendRequest(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mail_showAllAddresses
|
||||||
|
* requires: mainWindow, one mail selected for preview
|
||||||
|
*/
|
||||||
|
mail_showAllAddresses: function(_id) {
|
||||||
|
var dataElem = {data:{subject:"",fromaddress:"",toaddress:"",additionaltoaddress:"",ccaddress:"",date:"",subject:""}};
|
||||||
|
dataElem = egw.dataGetUIDdata(_id);
|
||||||
|
console.log(_id,dataElem);
|
||||||
|
var buttons = [
|
||||||
|
{text: this.egw.lang("Close"), id:"close"}
|
||||||
|
];
|
||||||
|
et2_dialog.show_dialog(function(_button_id)
|
||||||
|
{
|
||||||
|
switch(_button_id)
|
||||||
|
{
|
||||||
|
case 'close':
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},this.egw.lang("text one"),
|
||||||
|
dataElem.data.subject, {}, buttons, et2_dialog.WARNING_MESSAGE);
|
||||||
|
},
|
||||||
|
|
||||||
mail_setMailBody: function(content) {
|
mail_setMailBody: function(content) {
|
||||||
//console.log('mail_setMailBody',content);
|
//console.log('mail_setMailBody',content);
|
||||||
var IframeHandle = this.et2.getWidgetById('messageIFRAME');
|
var IframeHandle = this.et2.getWidgetById('messageIFRAME');
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
<hbox width="100%" id="mailPreviewHeadersTo" class="mailPreviewHeaders">
|
<hbox width="100%" id="mailPreviewHeadersTo" class="mailPreviewHeaders">
|
||||||
<description value="To"/>
|
<description value="To"/>
|
||||||
<url-email id="previewToAddress" readonly="true"/>
|
<url-email id="previewToAddress" readonly="true"/>
|
||||||
|
<buttononly class="et2_button ui-button mail_DisplayNone" label="Show all Adresses ..." value="showAllAddresses" id="button[showAllAddresses]" image="foldertree_nolines_plus" onclick="app.mail.mail_showAllAddresses(app.mail.mail_currentlyFocussed)"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<hbox width="100%" id="mailPreviewHeadersDate" class="mailPreviewHeaders">
|
<hbox width="100%" id="mailPreviewHeadersDate" class="mailPreviewHeaders">
|
||||||
<description value="Date"/>
|
<description value="Date"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user