From 59a861cd78d3c6df9cdbd405731572d614964a4f Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 22 Oct 2010 11:16:33 -0600 Subject: [PATCH] Bug #9334: Cc/Bcc display fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Based on patch from Gonçalo Queirós --- imp/js/compose-dimp.js | 4 ++-- imp/js/dimpbase.js | 4 ++-- imp/lib/Ajax/Application.php | 18 +++++++++++------- imp/lib/Views/ShowMessage.php | 4 ++-- imp/templates/dimp/index.inc | 4 ++++ 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/imp/js/compose-dimp.js b/imp/js/compose-dimp.js index 67a59964b..edd404e5f 100644 --- a/imp/js/compose-dimp.js +++ b/imp/js/compose-dimp.js @@ -526,7 +526,7 @@ var DimpCompose = { if (header.cc) { $('cc').setValue(header.cc); } - if (DIMP.conf_compose.cc) { + if (DIMP.conf_compose.cc || header.cc) { this.toggleCC('cc', true); } this.setPopdownLabel('sm', identity.id.smf_name, identity.id.smf_display); @@ -541,7 +541,7 @@ var DimpCompose = { } $('bcc').setValue(bcc_add + identity.id.bcc); } - if (DIMP.conf_compose.bcc) { + if (DIMP.conf_compose.bcc || header.bcc) { this.toggleCC('bcc', true); } $('subject').setValue(header.subject); diff --git a/imp/js/dimpbase.js b/imp/js/dimpbase.js index 73ff6f9b3..342002473 100644 --- a/imp/js/dimpbase.js +++ b/imp/js/dimpbase.js @@ -1261,8 +1261,8 @@ var DimpBase = { // Add date [ $('msgHeadersColl').select('.date'), $('msgHeaderDate').select('.date') ].flatten().invoke('update', r.localdate); - // Add from/to/cc headers - [ 'from', 'to', 'cc' ].each(function(a) { + // Add from/to/cc/bcc headers + [ 'from', 'to', 'cc', 'bcc' ].each(function(a) { if (r[a]) { (a == 'from' ? pm.select('.' + a) : [ t.down('.' + a) ]).each(function(elt) { elt.replace(DimpCore.buildAddressLinks(r[a], elt.clone(false))); diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index d26adbca7..b3a913203 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -1772,14 +1772,16 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application */ protected function _dimpComposeSetup() { + global $injector, $notification, $prefs; + $result = new stdClass; $result->action = $this->_action; $result->success = 1; /* Set up identity. */ - $identity = $GLOBALS['injector']->getInstance('IMP_Identity'); + $identity = $injector->getInstance('IMP_Identity'); if (isset($this->_vars->identity) && - !$GLOBALS['prefs']->isLocked('default_identity')) { + !$prefs->isLocked('default_identity')) { $identity->setDefault($this->_vars->identity); } @@ -1788,22 +1790,24 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application try { $headers['from'] = $identity->getFromLine(null, $this->_vars->from); } catch (Horde_Exception $e) { - $GLOBALS['notification']->push($e); + $notification->push($e); $result->success = 0; return array($result); } - $imp_ui = $GLOBALS['injector']->getInstance('IMP_Ui_Compose'); + $imp_ui = $injector->getInstance('IMP_Ui_Compose'); $headers['to'] = $imp_ui->getAddressList($this->_vars->to); - if ($GLOBALS['prefs']->getValue('compose_cc')) { + if ($prefs->getValue('compose_cc') || + !$prefs->isLocked('compose_cc')) { $headers['cc'] = $imp_ui->getAddressList($this->_vars->cc); } - if ($GLOBALS['prefs']->getValue('compose_bcc')) { + if ($prefs->getValue('compose_bcc') || + !$prefs->isLocked('compose_bcc')) { $headers['bcc'] = $imp_ui->getAddressList($this->_vars->bcc); } $headers['subject'] = $this->_vars->subject; - $imp_compose = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Compose')->create($this->_vars->composeCache); + $imp_compose = $injector->getInstance('IMP_Injector_Factory_Compose')->create($this->_vars->composeCache); return array($result, $imp_compose, $headers, $identity); } diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index a28e333d3..cc6c37652 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -149,7 +149,7 @@ class IMP_Views_ShowMessage * done to them. */ $basic_headers = $imp_ui->basicHeaders(); if (empty($args['headers'])) { - $args['headers'] = array('from', 'date', 'to', 'cc'); + $args['headers'] = array('from', 'date', 'to', 'cc', 'bcc'); } $headers_list = array_intersect_key($basic_headers, array_flip($args['headers'])); @@ -157,7 +157,7 @@ class IMP_Views_ShowMessage /* Build From/To/Cc/Bcc/Reply-To links. */ foreach (array('from', 'to', 'cc', 'bcc', 'reply-to') as $val) { if (isset($headers_list[$val]) && - (!$preview || !in_array($val, array('bcc', 'reply-to')))) { + (!$preview || ($val != 'reply-to'))) { $tmp = $this->_buildAddressList($envelope[$val]); if (!empty($tmp)) { $result[$val] = $tmp; diff --git a/imp/templates/dimp/index.inc b/imp/templates/dimp/index.inc index 637da7bd0..f342fc7b4 100644 --- a/imp/templates/dimp/index.inc +++ b/imp/templates/dimp/index.inc @@ -292,6 +292,10 @@ function _simpleButton($id, $text, $image, $nodisplay = false) : + + : + + -- 2.11.0