Merge pull request #2390 from dlobo/CRM-14085
[civicrm-core.git] / CRM / Contact / Form / Search.php
index 01b48d2aa5f7582eb7c6f1c19cc616f717ebc4ce..0e3a69abcb37c7580b201fb514dd16253dbb85cd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -324,6 +324,15 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
           'resultContext' => NULL,
           'taskClassName' => 'CRM_Contact_Task',
         ),
+        8 => array(
+          'selectorName' => 'CRM_Mailing_Selector_Search',
+          'selectorLabel' => ts('Mailings'),
+          'taskFile' => "CRM/common/searchResultTasks.tpl",
+          'taskContext' => NULL,
+          'resultFile' => 'CRM/Mailing/Form/Selector.tpl',
+          'resultContext' => 'Search',
+          'taskClassName' => 'CRM_Mailing_Task',
+        ),
       );
     }
   }
@@ -370,6 +379,11 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
    * @return void
    */
   function buildQuickForm() {
+    CRM_Core_Resources::singleton()
+      ->addScriptFile('civicrm', 'js/crm.livePage.js')
+      // jsTree is needed for tags popup
+      ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)
+      ->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header');
     $permission = CRM_Core_Permission::getPermission();
     // some tasks.. what do we want to do with the selected contacts ?
     $tasks = array('' => ts('- actions -'));
@@ -515,9 +529,9 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
     $this->assign('ts_all_id', $allRowsRadio->_attributes['id']);
 
     /*
-         * add form checkboxes for each row. This is needed out here to conform to QF protocol
-         * of all elements being declared in builQuickForm
-         */
+     * add form checkboxes for each row. This is needed out here to conform to QF protocol
+     * of all elements being declared in builQuickForm
+     */
 
     $rows = $this->get('rows');
 
@@ -548,14 +562,6 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
       )
     );
 
-    $this->add('submit', $this->_printButtonName, ts('Print'),
-      array(
-        'class' => 'form-submit',
-        'id' => 'Print',
-        'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1, 1);",
-      )
-    );
-
     $this->setDefaultAction('refresh');
   }
 
@@ -924,15 +930,11 @@ class CRM_Contact_Form_Search extends CRM_Core_Form {
       $selector->setKey($this->controller->_key);
 
       // added the sorting  character to the form array
-      // lets recompute the aToZ bar without the sortByCharacter
-      // we need this in most cases except when just pager or sort values change, which
-      // we'll ignore for now
       $config = CRM_Core_Config::singleton();
       // do this only for contact search
       if ($setDynamic && $config->includeAlphabeticalPager) {
-        if ($this->_reset ||
-          ($this->_sortByCharacter === NULL || $this->_sortByCharacter == '')
-        ) {
+        // Don't recompute if we are just paging/sorting
+        if ($this->_reset || (empty($_GET['crmPID']) && empty($_GET['crmSID']) && !$this->_sortByCharacter)) {
           $aToZBar = CRM_Utils_PagerAToZ::getAToZBar($selector, $this->_sortByCharacter);
           $this->set('AToZBar', $aToZBar);
         }