CRM-15524 - Move static js resources to the html-header region so they don't reload...
authorColeman Watts <coleman@civicrm.org>
Mon, 3 Nov 2014 00:48:07 +0000 (19:48 -0500)
committerColeman Watts <coleman@civicrm.org>
Mon, 3 Nov 2014 00:48:07 +0000 (19:48 -0500)
20 files changed:
CRM/Admin/Page/APIExplorer.php
CRM/Badge/Form/Layout.php
CRM/Batch/Form/Entry.php
CRM/Campaign/Form/Survey/TabHeader.php
CRM/Campaign/Page/DashBoard.php
CRM/Campaign/Page/Vote.php
CRM/Case/Form/CaseView.php
CRM/Contact/Form/Search/Builder.php
CRM/Contact/Page/View/Summary.php
CRM/Contribute/Form/ContributionPage/TabHeader.php
CRM/Contribute/Page/DashBoard.php
CRM/Core/Form.php
CRM/Core/Form/Search.php
CRM/Core/Page.php
CRM/Core/Page/QUnit.php
CRM/Custom/Page/Field.php
CRM/Event/Form/ManageEvent/TabHeader.php
CRM/Price/Page/Field.php
CRM/Profile/Form.php
CRM/UF/Page/Field.php

index 809fb95f84a72e5e7cc303a44e7813d670f0b96b..f53532aae3c89a118b379c9a25de39b536c47065 100644 (file)
@@ -44,9 +44,9 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page {
   function run() {
     CRM_Utils_System::setTitle(ts('API explorer and generator'));
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/Admin/Page/APIExplorer.js')
-      ->addScriptUrl('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js', 99)
-      ->addStyleUrl('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css', 99);
+      ->addScriptFile('civicrm', 'templates/CRM/Admin/Page/APIExplorer.js', 1, 'html-header')
+      ->addScriptUrl('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js', 99, 'html-header')
+      ->addStyleUrl('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css', 99, 'html-header');
     $this->assign('operators', CRM_Core_DAO::acceptedSQLOperators());
     return parent::run();
   }
index 707ada6bff429d49784a179f69d48546eba18c21..7acaea478360df5f1575e6538233c2cd903d37f8 100644 (file)
@@ -58,7 +58,7 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
         'kcfinderPath' => $config->userFrameworkResourceURL .'packages' .DIRECTORY_SEPARATOR
       )
     );
-    $resources->addScriptFile('civicrm', 'templates/CRM/Badge/Form/Layout.js');
+    $resources->addScriptFile('civicrm', 'templates/CRM/Badge/Form/Layout.js', 1, 'html-header');
 
     $this->applyFilter('__ALL__', 'trim');
 
index 40540f4872ee9b01999c4d1d5571b57378b40f8a..5780c4a5638d2556801f28331047029f811f29c8 100644 (file)
@@ -107,7 +107,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
       $this->_profileId = CRM_Batch_BAO_Batch::getProfileId($this->_batchInfo['type_id']);
     }
     CRM_Core_Resources::singleton()
-    ->addScriptFile('civicrm', 'templates/CRM/Batch/Form/Entry.js')
+    ->addScriptFile('civicrm', 'templates/CRM/Batch/Form/Entry.js', 1, 'html-header')
     ->addSetting(array('batch' => array('type_id' => $this->_batchInfo['type_id'])))
     ->addSetting(array('setting' => array('monetaryThousandSeparator' => CRM_Core_Config::singleton()->monetaryThousandSeparator)))
     ->addSetting(array('setting' => array('monetaryDecimalPoint' => CRM_Core_Config::singleton()->monetaryDecimalPoint)));
index 0c7f4d7bdcf79cabde39ee5529077496782a6317..79574bcb8e522bdc67132dcf66da33c7bd856dfe 100644 (file)
@@ -51,7 +51,7 @@ class CRM_Campaign_Form_Survey_TabHeader {
     }
     $form->assign_by_ref('tabHeader', $tabs);
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')
+      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
       ->addSetting(array('tabSettings' => array(
         'active' => self::getCurrentTab($tabs),
       )));
index ee197aecf867ab883acb08f8661ba33e1d8c59fb..d60a7a77902f32f3522bb688aefdf579d91ba5d7 100644 (file)
@@ -467,7 +467,7 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page {
       $this->buildTabs();
     }
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')
+      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
       ->addSetting(array('tabSettings' => array(
         'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')),
       )));
index d0a4e676522abba786c0c752354c29c5d8f8cee1..ea6d15e33b0e13b2f5a49d4c022ef68db1aeaf39 100644 (file)
@@ -93,7 +93,7 @@ class CRM_Campaign_Page_Vote extends CRM_Core_Page {
     $this->assign('subPageType', $subPageType);
 
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')
+      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
       ->addSetting(array('tabSettings' => array(
         'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'reserve')),
       )));
index 3b3d08eba9a9d2fc0d0e42919cbcad0b436a81b5..2080bd08eeaf7bc1882d0e55efd3a489ec43a780 100644 (file)
@@ -218,8 +218,8 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
     }
 
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'js/crm.livePage.js')
-      ->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js');
+      ->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header')
+      ->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js', 2, 'html-header');
 
     $xmlProcessor = new CRM_Case_XMLProcessor_Process();
     $caseRoles    = $xmlProcessor->get($this->_caseType, 'CaseRoles');
index 380d04a2696cb1f24b6df0a52a7de8fc0b65c6ce..c11efbd956cdd3beab188d56c52bcecd9eddc401 100644 (file)
@@ -105,7 +105,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
     }
     // Add javascript
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Search/Builder.js')
+      ->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Search/Builder.js', 1, 'html-header')
       ->addSetting(array(
         'searchBuilder' => array(
           // Index of newly added/expanded block (1-based index)
index e4efbcfa0fb1170c82e307494a409b07b8034fa8..2b56d3c3cec8e20aafe0134289b53e61634e4a4e 100644 (file)
@@ -134,10 +134,10 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
   function view() {
     // Add js for tabs, in-place editing, and jstree for tags
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/Contact/Page/View/Summary.js')
+      ->addScriptFile('civicrm', 'templates/CRM/Contact/Page/View/Summary.js', 2, 'html-header')
       ->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')
-      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')
+      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
       ->addSetting(array(
         'summaryPrint' => array('mode' => $this->_print),
         'tabSettings' => array('active' => CRM_Utils_Request::retrieve('selectedChild', 'String', $this, FALSE, 'summary')),
index 8aa89253dc605ea0b22e92016a983012f8913d2f..5c6924a5694222b612ccb040200631afd490e29a 100644 (file)
@@ -50,7 +50,7 @@ class CRM_Contribute_Form_ContributionPage_TabHeader {
     }
     $form->assign_by_ref('tabHeader', $tabs);
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')
+      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
       ->addSetting(array('tabSettings' => array(
         'active' => self::getCurrentTab($tabs),
       )));
index 81335a7fe7d545a93404e7dca7bae5a4eac7f9fa..74332aba85b5ffb31aa48dec22aa1e4fb92ffbc0 100644 (file)
@@ -127,7 +127,7 @@ class CRM_Contribute_Page_DashBoard extends CRM_Core_Page {
     $chartForm->setEmbedded(TRUE);
     $chartForm->process();
     $chartForm->run();
-    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js');
+    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js', 1, 'html-header');
 
     return parent::run();
   }
index f328e17fe74f6e756763d6d6a4b7adb35a2e1e94..c3c811cf772e0fc4a928e65cbd7928d62fa93496 100644 (file)
@@ -1620,7 +1620,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $this->assign('selectable', $autoCompleteField['id_field']);
       $this->addEntityRef($autoCompleteField['id_field'], NULL, array('placeholder' => $autoCompleteField['placeholder'], 'api' => $autoCompleteField['api']));
 
-      CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/AlternateContactSelector.js')
+      CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/AlternateContactSelector.js', 1, 'html-header')
       ->addSetting(array(
       'form' => array('autocompletes' => $autoCompleteField),
       'ids' => array('profile' => $profiles),
index d593639c3e4eae03d5e79948f156b3113350c579..9b9cbc0f7eea6948d29c3e2238c25e342d634455 100644 (file)
@@ -88,7 +88,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
       $this->assign('includeWysiwygEditor', TRUE);
     }
 
-    $resources->addScriptFile('civicrm', 'js/crm.searchForm.js');
+    $resources->addScriptFile('civicrm', 'js/crm.searchForm.js', 1, 'html-header');
 
     $this->addButtons(array(
       array(
index 291c7d6297c437ab19086144b540f92bd20ad435..5b93c196c3502694f10b2a67f2ba18d303f18c3a 100644 (file)
@@ -228,7 +228,7 @@ class CRM_Core_Page {
     if ($this->useLivePageJS &&
       CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE))
     {
-      CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
+      CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
       $this->assign('includeWysiwygEditor', TRUE);
     }
 
index 975ae8b8b0f1141e7d47140518c3605ca9433c18..c0b0538ffe982c92991be5f55e171cc4c1d8c29e 100644 (file)
@@ -35,13 +35,13 @@ class CRM_Core_Page_QUnit extends CRM_Core_Page {
       $this->assign('qunitTpl', "qunit/$suite/test.tpl");
     }
     if (file_exists("$path/tests/qunit/$suite/test.js")) {
-      CRM_Core_Resources::singleton()->addScriptFile($ext, "tests/qunit/$suite/test.js", 1000);
+      CRM_Core_Resources::singleton()->addScriptFile($ext, "tests/qunit/$suite/test.js", 1000, 'html-header');
     }
 
     CRM_Utils_System::setTitle(ts('QUnit: %2 (%1)', array(1 => $ext, 2 => $suite)));
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'packages/qunit/qunit.js')
-      ->addStyleFile('civicrm', 'packages/qunit/qunit.css');
+      ->addScriptFile('civicrm', 'packages/qunit/qunit.js', 1, 'html-header')
+      ->addStyleFile('civicrm', 'packages/qunit/qunit.css', 1, 'html-header');
     parent::run();
   }
 
index 2428bc80fdd0170144cde503ba2d55c5f8bd9f27..25a42d0accf1ceda4f552c5df5077235e19095ed 100644 (file)
@@ -129,7 +129,7 @@ class CRM_Custom_Page_Field extends CRM_Core_Page {
   function browse() {
     $resourceManager = CRM_Core_Resources::singleton();
     if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
-      $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999);
+      $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
     }
 
     $customField = array();
index e488114b651be0e604f9710791b213b76c82b8f7..0d512b99cd6a23efb5799c66742b4df6879978b9 100644 (file)
@@ -51,7 +51,7 @@ class CRM_Event_Form_ManageEvent_TabHeader {
     }
     $form->assign_by_ref('tabHeader', $tabs);
     CRM_Core_Resources::singleton()
-      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')
+      ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
       ->addSetting(array('tabSettings' => array(
         'active' => self::getCurrentTab($tabs),
       )));
index 60287d91da75e1e6f8a2829bdce5288d7aaf4fc0..19f42b06fcd12e15863e76f47cb460856f0e59e2 100644 (file)
@@ -123,7 +123,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page {
   function browse() {
     $resourceManager = CRM_Core_Resources::singleton();
     if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
-      $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999);
+      $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
     }
 
     $priceField    = array();
index c8b0633ce1ac76bde34e1a66cc477e662ed6d909..4d28d2e0440dca9e8a1f9862f0d59b9428687158 100644 (file)
@@ -357,7 +357,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
 
         } elseif (!empty($this->_multiRecordFields)
            && (!$this->_multiRecord || !in_array($this->_multiRecord, array(CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE)) )) {
-          CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
+          CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
           //multirecord listing page
           $multiRecordFieldListing = TRUE;
           $page = new CRM_Profile_Page_MultipleRecordFieldsListing();
index ae3bdf8e95c7f9071842eeb69d03b1309aaae760..4fcdf874f969a3780388711033ec7cf0b48d7231 100644 (file)
@@ -112,7 +112,7 @@ class CRM_UF_Page_Field extends CRM_Core_Page {
   function browse() {
     $resourceManager = CRM_Core_Resources::singleton();
     if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
-      $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999);
+      $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
     }
 
     $ufField = array();