From 96f50de2fbac29dcbfa0423af882c756901c7f9c Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 14 Mar 2014 10:38:07 -0400 Subject: [PATCH] CRM-13863 - Consolidate livePage.js handling in parent page class --- CRM/ACL/Page/ACL.php | 8 ++---- CRM/ACL/Page/EntityRole.php | 8 ++---- CRM/Admin/Page/ContactType.php | 5 ++-- CRM/Admin/Page/LabelFormats.php | 5 ++-- CRM/Admin/Page/LocationType.php | 5 ++-- CRM/Admin/Page/MailSettings.php | 2 ++ CRM/Admin/Page/MessageTemplates.php | 5 ++-- CRM/Admin/Page/Options.php | 5 ++-- CRM/Admin/Page/ParticipantStatus.php | 5 ++-- CRM/Admin/Page/PdfFormats.php | 5 ++-- CRM/Admin/Page/RelationshipType.php | 5 ++-- CRM/Admin/Page/ScheduleReminders.php | 5 ++-- CRM/Admin/Page/Tag.php | 5 ++-- CRM/Campaign/Page/Campaign.php | 5 ++-- CRM/Campaign/Page/Survey.php | 5 ++-- CRM/Campaign/Page/SurveyType.php | 5 ++-- CRM/Contribute/Page/ManagePremiums.php | 5 ++-- CRM/Contribute/Page/Tab.php | 4 --- CRM/Core/Page.php | 29 ++++++++++++++-------- CRM/Custom/Page/Field.php | 5 ++-- CRM/Custom/Page/Option.php | 5 ++-- CRM/Event/Form/Participant.php | 5 ++-- CRM/Event/Form/ParticipantFeeSelection.php | 5 ++-- CRM/Event/Form/ParticipantView.php | 5 ++-- CRM/Financial/Page/FinancialAccount.php | 5 ++-- CRM/Financial/Page/FinancialType.php | 5 ++-- CRM/Member/Page/MembershipStatus.php | 5 ++-- CRM/Member/Page/MembershipType.php | 5 ++-- CRM/Price/Page/Field.php | 5 ++-- CRM/Price/Page/Option.php | 5 ++-- CRM/Report/Page/Options.php | 5 ++-- CRM/SMS/Page/Provider.php | 5 ++-- CRM/UF/Page/Field.php | 5 ++-- 33 files changed, 81 insertions(+), 110 deletions(-) diff --git a/CRM/ACL/Page/ACL.php b/CRM/ACL/Page/ACL.php index e4ff23d7be..7517d2460d 100644 --- a/CRM/ACL/Page/ACL.php +++ b/CRM/ACL/Page/ACL.php @@ -42,6 +42,8 @@ */ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -156,12 +158,6 @@ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } - } - // get all acl's sorted by weight $acl = array(); $query = " diff --git a/CRM/ACL/Page/EntityRole.php b/CRM/ACL/Page/EntityRole.php index 4acc15923a..0b8cde61e4 100644 --- a/CRM/ACL/Page/EntityRole.php +++ b/CRM/ACL/Page/EntityRole.php @@ -42,6 +42,8 @@ */ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -139,9 +141,6 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic { // finally browse the acl's if ($action & CRM_Core_Action::BROWSE) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } } // parent run @@ -156,9 +155,6 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // get all acl's sorted by weight $entityRoles = array(); diff --git a/CRM/Admin/Page/ContactType.php b/CRM/Admin/Page/ContactType.php index 622a527471..d07e35373b 100644 --- a/CRM/Admin/Page/ContactType.php +++ b/CRM/Admin/Page/ContactType.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -105,9 +107,6 @@ class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic { } function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $rows = CRM_Contact_BAO_ContactType::contactTypeInfo(TRUE); foreach ($rows as $key => $value) { $mask = NULL; diff --git a/CRM/Admin/Page/LabelFormats.php b/CRM/Admin/Page/LabelFormats.php index 3fc46604a5..04f7fb65eb 100644 --- a/CRM/Admin/Page/LabelFormats.php +++ b/CRM/Admin/Page/LabelFormats.php @@ -39,6 +39,8 @@ */ class CRM_Admin_Page_LabelFormats extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -124,9 +126,6 @@ class CRM_Admin_Page_LabelFormats extends CRM_Core_Page_Basic { * @static */ function browse($action = NULL) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // Get list of configured Label Formats $labelFormatList= CRM_Core_BAO_LabelFormat::getList(); $nameFormatList= CRM_Core_BAO_LabelFormat::getList(false, 'name_badge'); diff --git a/CRM/Admin/Page/LocationType.php b/CRM/Admin/Page/LocationType.php index 61739f2f1c..ea2947a0f6 100644 --- a/CRM/Admin/Page/LocationType.php +++ b/CRM/Admin/Page/LocationType.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_LocationType extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -61,9 +63,6 @@ class CRM_Admin_Page_LocationType extends CRM_Core_Page_Basic { * @return array (reference) of action links */ function &links() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } if (!(self::$_links)) { self::$_links = array( CRM_Core_Action::UPDATE => array( diff --git a/CRM/Admin/Page/MailSettings.php b/CRM/Admin/Page/MailSettings.php index 37dcf2b549..43b4533211 100644 --- a/CRM/Admin/Page/MailSettings.php +++ b/CRM/Admin/Page/MailSettings.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_MailSettings extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * diff --git a/CRM/Admin/Page/MessageTemplates.php b/CRM/Admin/Page/MessageTemplates.php index 36f2fa671a..ef326cb11b 100644 --- a/CRM/Admin/Page/MessageTemplates.php +++ b/CRM/Admin/Page/MessageTemplates.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -223,9 +225,6 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { * @access public */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $action = func_num_args() ? func_get_arg(0) : NULL; if ($this->_action & CRM_Core_Action::ADD) { return; diff --git a/CRM/Admin/Page/Options.php b/CRM/Admin/Page/Options.php index 8699526772..0096055c98 100644 --- a/CRM/Admin/Page/Options.php +++ b/CRM/Admin/Page/Options.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -228,9 +230,6 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic { if (!self::$_gName) { return parent::browse(); } - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $groupParams = array('name' => self::$_gName); $optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight'); $gName = self::$_gName; diff --git a/CRM/Admin/Page/ParticipantStatus.php b/CRM/Admin/Page/ParticipantStatus.php index 6eeefd2b05..1d1e833ad1 100644 --- a/CRM/Admin/Page/ParticipantStatus.php +++ b/CRM/Admin/Page/ParticipantStatus.php @@ -33,6 +33,8 @@ * */ class CRM_Admin_Page_ParticipantStatus extends CRM_Core_Page_Basic { + + public $useLivePageJS = TRUE; function getBAOName() { return 'CRM_Event_BAO_ParticipantStatusType'; } @@ -69,9 +71,6 @@ class CRM_Admin_Page_ParticipantStatus extends CRM_Core_Page_Basic { } function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $statusTypes = array(); $dao = new CRM_Event_DAO_ParticipantStatusType; diff --git a/CRM/Admin/Page/PdfFormats.php b/CRM/Admin/Page/PdfFormats.php index d8b0cea4e8..9689b06e13 100644 --- a/CRM/Admin/Page/PdfFormats.php +++ b/CRM/Admin/Page/PdfFormats.php @@ -39,6 +39,8 @@ */ class CRM_Admin_Page_PdfFormats extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -118,9 +120,6 @@ class CRM_Admin_Page_PdfFormats extends CRM_Core_Page_Basic { * @static */ function browse($action = NULL) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // Get list of configured PDF Page Formats $pdfFormatList = CRM_Core_BAO_PdfFormat::getList(); diff --git a/CRM/Admin/Page/RelationshipType.php b/CRM/Admin/Page/RelationshipType.php index fb9a5d9aa8..cc255a25a6 100644 --- a/CRM/Admin/Page/RelationshipType.php +++ b/CRM/Admin/Page/RelationshipType.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_RelationshipType extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -61,9 +63,6 @@ class CRM_Admin_Page_RelationshipType extends CRM_Core_Page_Basic { * @return array (reference) of action links */ function &links() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } if (!(self::$_links)) { self::$_links = array( CRM_Core_Action::VIEW => array( diff --git a/CRM/Admin/Page/ScheduleReminders.php b/CRM/Admin/Page/ScheduleReminders.php index 1e88f71f8b..30867d664b 100644 --- a/CRM/Admin/Page/ScheduleReminders.php +++ b/CRM/Admin/Page/ScheduleReminders.php @@ -39,6 +39,8 @@ */ class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -128,9 +130,6 @@ class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic { * @static */ function browse($action = NULL) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // Get list of configured reminders $reminderList = CRM_Core_BAO_ActionSchedule::getList(); diff --git a/CRM/Admin/Page/Tag.php b/CRM/Admin/Page/Tag.php index f3bc45e733..483f2f7e3e 100644 --- a/CRM/Admin/Page/Tag.php +++ b/CRM/Admin/Page/Tag.php @@ -38,6 +38,8 @@ */ class CRM_Admin_Page_Tag extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -134,9 +136,6 @@ class CRM_Admin_Page_Tag extends CRM_Core_Page_Basic { * override function browse() */ function browse($action = NULL, $sort = NULL) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $adminTagSet = FALSE; if (CRM_Core_Permission::check('administer Tagsets')) { $adminTagSet = TRUE; diff --git a/CRM/Campaign/Page/Campaign.php b/CRM/Campaign/Page/Campaign.php index 693faea46b..1a57c4d3ca 100644 --- a/CRM/Campaign/Page/Campaign.php +++ b/CRM/Campaign/Page/Campaign.php @@ -38,6 +38,8 @@ */ class CRM_Campaign_Page_Campaign extends CRM_Core_Page { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -84,9 +86,6 @@ class CRM_Campaign_Page_Campaign extends CRM_Core_Page { } function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary(); diff --git a/CRM/Campaign/Page/Survey.php b/CRM/Campaign/Page/Survey.php index 9dea4ea65f..6974cd6a53 100644 --- a/CRM/Campaign/Page/Survey.php +++ b/CRM/Campaign/Page/Survey.php @@ -38,6 +38,8 @@ */ class CRM_Campaign_Page_Survey extends CRM_Core_Page { + public $useLivePageJS = TRUE; + private static $_actionLinks; function &actionLinks() { @@ -73,9 +75,6 @@ class CRM_Campaign_Page_Survey extends CRM_Core_Page { } function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $surveys = CRM_Campaign_BAO_Survey::getSurveySummary(); diff --git a/CRM/Campaign/Page/SurveyType.php b/CRM/Campaign/Page/SurveyType.php index 2c4cda344b..2fe8db425d 100644 --- a/CRM/Campaign/Page/SurveyType.php +++ b/CRM/Campaign/Page/SurveyType.php @@ -38,6 +38,8 @@ */ class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -155,9 +157,6 @@ class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $this->assign('includeWysiwygEditor', TRUE); $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign'); diff --git a/CRM/Contribute/Page/ManagePremiums.php b/CRM/Contribute/Page/ManagePremiums.php index b6bdffd2b7..6f68dfca34 100644 --- a/CRM/Contribute/Page/ManagePremiums.php +++ b/CRM/Contribute/Page/ManagePremiums.php @@ -38,6 +38,8 @@ */ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -141,9 +143,6 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // get all custom groups sorted by weight $premiums = array(); $dao = new CRM_Contribute_DAO_Product(); diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index 19b5e572bf..1fe52f33d7 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -109,10 +109,6 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { * @access public */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } - // add annual contribution $annual = array(); list($annual['count'], diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index c16e33a84f..4973d594fd 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -118,6 +118,12 @@ class CRM_Core_Page { */ public $urlPath = array(); + /** + * Should crm.livePage.js be added to the page? + * @var bool + */ + public $useLivePageJS; + /** * class constructor * @@ -215,17 +221,20 @@ class CRM_Core_Page { $config = CRM_Core_Config::singleton(); - // TODO: Is there a better way to ensure these actions don't happen during AJAX requests? - if (empty($_GET['snippet'])) { - // Version check and intermittent alert to admins - CRM_Utils_VersionCheck::singleton()->versionAlert(); - CRM_Utils_Check_Security::singleton()->showPeriodicAlerts(); + // Version check and intermittent alert to admins + CRM_Utils_VersionCheck::singleton()->versionAlert(); + CRM_Utils_Check_Security::singleton()->showPeriodicAlerts(); - // Debug msg once per hour - if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) { - $msg = ts('Warning: Debug is enabled in system settings. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))); - CRM_Core_Session::setStatus($msg, ts('Debug Mode')); - } + // Debug msg once per hour + if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) { + $msg = ts('Warning: Debug is enabled in system settings. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))); + CRM_Core_Session::setStatus($msg, ts('Debug Mode')); + } + + if ($this->useLivePageJS && + CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) + { + CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); } $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl'); diff --git a/CRM/Custom/Page/Field.php b/CRM/Custom/Page/Field.php index d91fe415bb..7c3730425f 100644 --- a/CRM/Custom/Page/Field.php +++ b/CRM/Custom/Page/Field.php @@ -43,6 +43,8 @@ */ class CRM_Custom_Page_Field extends CRM_Core_Page { + public $useLivePageJS = TRUE; + /** * The group id of the field * @@ -124,9 +126,6 @@ class CRM_Custom_Page_Field extends CRM_Core_Page { * @access public */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $customField = array(); $customFieldBAO = new CRM_Core_BAO_CustomField(); diff --git a/CRM/Custom/Page/Option.php b/CRM/Custom/Page/Option.php index e3664f4466..c08794b35e 100644 --- a/CRM/Custom/Page/Option.php +++ b/CRM/Custom/Page/Option.php @@ -43,6 +43,8 @@ */ class CRM_Custom_Page_Option extends CRM_Core_Page { + public $useLivePageJS = TRUE; + /** * The Group id of the option * @@ -120,9 +122,6 @@ class CRM_Custom_Page_Option extends CRM_Core_Page { * @access public */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } //get the default value from custom fields $customFieldBAO = new CRM_Core_BAO_CustomField(); $customFieldBAO->id = $this->_fid; diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index d2d94eabda..6fc9e598bf 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -40,6 +40,8 @@ */ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { + public $useLivePageJS = TRUE; + /** * the values for the contribution db object * @@ -671,9 +673,6 @@ SELECT civicrm_custom_group.name as name, * @access public */ public function buildQuickForm() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); $partiallyPaidStatusId = array_search('Partially paid', $participantStatuses); $this->assign('partiallyPaidStatusId', $partiallyPaidStatusId); diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index f5eddbd107..f2cd3ad319 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -40,6 +40,8 @@ */ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { + public $useLivePageJS = TRUE; + protected $_contactId = NULL; protected $_contributorDisplayName = NULL; @@ -125,9 +127,6 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { } public function buildQuickForm() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $statuses = CRM_Event_PseudoConstant::participantStatus(); $this->assign('partiallyPaid', array_search('Partially paid', $statuses)); diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 3f4e1e125a..408780ca9e 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -39,6 +39,8 @@ */ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { + public $useLivePageJS = TRUE; + /** * Function to set variables up before form is built * @@ -208,9 +210,6 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { * @access public */ public function buildQuickForm() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $this->addButtons(array( array( 'type' => 'cancel', diff --git a/CRM/Financial/Page/FinancialAccount.php b/CRM/Financial/Page/FinancialAccount.php index 572bee71a8..e4c8b62d7d 100644 --- a/CRM/Financial/Page/FinancialAccount.php +++ b/CRM/Financial/Page/FinancialAccount.php @@ -37,6 +37,8 @@ * Page for displaying list of financial types */ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { + + public $useLivePageJS = TRUE; /** * The action links that we need to display for the browse screen * @@ -126,9 +128,6 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // get all custom groups sorted by weight $contributionType = array(); $dao = new CRM_Financial_DAO_FinancialAccount(); diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php index af77fdfcd1..55d93e7d66 100644 --- a/CRM/Financial/Page/FinancialType.php +++ b/CRM/Financial/Page/FinancialType.php @@ -37,6 +37,8 @@ * Page for displaying list of financial types */ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { + + public $useLivePageJS = TRUE; /** * The action links that we need to display for the browse screen * @@ -132,9 +134,6 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // get all financial types sorted by weight $financialType = array(); $dao = new CRM_Financial_DAO_FinancialType(); diff --git a/CRM/Member/Page/MembershipStatus.php b/CRM/Member/Page/MembershipStatus.php index 6f519d0b2d..9e19cfe3fd 100644 --- a/CRM/Member/Page/MembershipStatus.php +++ b/CRM/Member/Page/MembershipStatus.php @@ -38,6 +38,8 @@ */ class CRM_Member_Page_MembershipStatus extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -134,9 +136,6 @@ class CRM_Member_Page_MembershipStatus extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // get all custom groups sorted by weight $membershipStatus = array(); $dao = new CRM_Member_DAO_MembershipStatus(); diff --git a/CRM/Member/Page/MembershipType.php b/CRM/Member/Page/MembershipType.php index 559308baed..f8bda91dae 100644 --- a/CRM/Member/Page/MembershipType.php +++ b/CRM/Member/Page/MembershipType.php @@ -46,6 +46,8 @@ class CRM_Member_Page_MembershipType extends CRM_Core_Page { */ static $_links = NULL; + public $useLivePageJS = TRUE; + /** * Get action Links * @@ -108,9 +110,6 @@ class CRM_Member_Page_MembershipType extends CRM_Core_Page { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } // get all membership types sorted by weight $membershipType = array(); $dao = new CRM_Member_DAO_MembershipType(); diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index e5cd3b43ca..9965540225 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -43,6 +43,8 @@ */ class CRM_Price_Page_Field extends CRM_Core_Page { + public $useLivePageJS = TRUE; + /** * The price set group id of the field * @@ -122,9 +124,6 @@ class CRM_Price_Page_Field extends CRM_Core_Page { * @access public */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $priceField = array(); $priceFieldBAO = new CRM_Price_BAO_PriceField(); diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index a837c74d78..59b1379bc5 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -43,6 +43,8 @@ */ class CRM_Price_Page_Option extends CRM_Core_Page { + public $useLivePageJS = TRUE; + /** * The field id of the option * @@ -127,9 +129,6 @@ class CRM_Price_Page_Option extends CRM_Core_Page { * @access public */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $customOption = array(); CRM_Price_BAO_PriceFieldValue::getValues($this->_fid, $customOption); $config = CRM_Core_Config::singleton(); diff --git a/CRM/Report/Page/Options.php b/CRM/Report/Page/Options.php index a7d54373f0..04d32e86cd 100644 --- a/CRM/Report/Page/Options.php +++ b/CRM/Report/Page/Options.php @@ -39,6 +39,8 @@ */ class CRM_Report_Page_Options extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -165,9 +167,6 @@ class CRM_Report_Page_Options extends CRM_Core_Page_Basic { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $groupParams = array('name' => self::$_gName); $optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'weight'); $gName = self::$_gName; diff --git a/CRM/SMS/Page/Provider.php b/CRM/SMS/Page/Provider.php index cc925a0a64..9098abad03 100644 --- a/CRM/SMS/Page/Provider.php +++ b/CRM/SMS/Page/Provider.php @@ -38,6 +38,8 @@ */ class CRM_SMS_Page_Provider extends CRM_Core_Page_Basic { + public $useLivePageJS = TRUE; + /** * The action links that we need to display for the browse screen * @@ -129,9 +131,6 @@ class CRM_SMS_Page_Provider extends CRM_Core_Page_Basic { * @static */ function browse($action = NULL) { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $providers = CRM_SMS_BAO_Provider::getProviders(); $rows = array(); foreach ($providers as $provider) { diff --git a/CRM/UF/Page/Field.php b/CRM/UF/Page/Field.php index 723e1f343b..50263c39a4 100644 --- a/CRM/UF/Page/Field.php +++ b/CRM/UF/Page/Field.php @@ -43,6 +43,8 @@ */ class CRM_UF_Page_Field extends CRM_Core_Page { + public $useLivePageJS = TRUE; + /** * The group id of the field * @@ -108,9 +110,6 @@ class CRM_UF_Page_Field extends CRM_Core_Page { * @static */ function browse() { - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); - } $ufField = array(); $ufFieldBAO = new CRM_Core_BAO_UFField(); -- 2.25.1