Bug #9334: Cc/Bcc display fixes
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 22 Oct 2010 17:16:33 +0000 (11:16 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 22 Oct 2010 17:17:28 +0000 (11:17 -0600)
Based on patch from Gonçalo Queirós <goncalo.queiros@portugalmail.net>

imp/js/compose-dimp.js
imp/js/dimpbase.js
imp/lib/Ajax/Application.php
imp/lib/Views/ShowMessage.php
imp/templates/dimp/index.inc

index 67a5996..edd404e 100644 (file)
@@ -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);
index 73ff6f9..3420024 100644 (file)
@@ -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)));
index d26adbc..b3a9132 100644 (file)
@@ -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);
     }
index a28e333..cc6c376 100644 (file)
@@ -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;
index 637da7b..f342fc7 100644 (file)
@@ -292,6 +292,10 @@ function _simpleButton($id, $text, $image, $nodisplay = false)
             <td class="label"><?php echo _("Cc") ?>:</td>
             <td class="cc"></td>
            </tr>
+           <tr id="msgHeaderBcc">
+            <td class="label"><?php echo _("Bcc") ?>:</td>
+            <td class="bcc"></td>
+           </tr>
            <tr id="msgAtc" style="display:none">
             <td class="label" id="partlist_toggle">
              <span class="iconImg attachmentImg attachmentImage"></span>