Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-02-05-17-16-30
[civicrm-core.git] / CRM / Mailing / Form / Group.php
index 7169819dc90bd649f7823cb0437ce2d7ba5556c0..788ee89e32d2bde1c1d9aa5a22c2e6d55c3492e4 100644 (file)
@@ -236,12 +236,19 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
       );
     }
 
+    if (count($groups) <= 10) {
+      // setting minimum height to 2 since widget looks strange when size (height) is 1
+      $groupSize = max(count($groups), 2);
+    }
+    else {
+      $groupSize = 10;
+    }
     $inG = &$this->addElement('advmultiselect', 'includeGroups',
       ts('Include Group(s)') . ' ',
       $groups,
       array(
-        'size' => 5,
-        'style' => 'width:240px',
+        'size' => $groupSize,
+        'style' => 'width:auto; min-width:240px;',
         'class' => 'advmultiselect',
       )
     );
@@ -255,8 +262,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
       ts('Exclude Group(s)') . ' ',
       $groups,
       array(
-        'size' => 5,
-        'style' => 'width:240px',
+        'size' => $groupSize,
+        'style' => 'width:auto; min-width:240px;',
         'class' => 'advmultiselect',
       )
     );
@@ -266,12 +273,19 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
 
+    if (count($mailings) <= 10) {
+      // setting minimum height to 2 since widget looks strange when size (height) is 1
+      $mailingSize = max(count($mailings), 2);
+    }
+    else {
+      $mailingSize = 10;
+    }
     $inM = &$this->addElement('advmultiselect', 'includeMailings',
       ts('INCLUDE Recipients of These Mailing(s)') . ' ',
       $mailings,
       array(
-        'size' => 5,
-        'style' => 'width:240px',
+        'size' => $mailingSize,
+        'style' => 'width:auto; min-width:240px;',
         'class' => 'advmultiselect',
       )
     );
@@ -279,8 +293,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
       ts('EXCLUDE Recipients of These Mailing(s)') . ' ',
       $mailings,
       array(
-        'size' => 5,
-        'style' => 'width:240px',
+        'size' => $mailingSize,
+        'style' => 'width:auto; min-width:240px;',
         'class' => 'advmultiselect',
       )
     );