From 1ec598f360e5fc8e89deb4662cf9a28f359d96d9 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 7 Sep 2015 18:09:25 -0700 Subject: [PATCH] CRM-16373 - Migrate Map/Geocode settings --- CRM/Admin/Form/Setting/Mapping.php | 15 +++++++-------- CRM/Core/BAO/Setting.php | 1 + CRM/Core/SelectValues.php | 4 ++-- settings/Map.setting.php | 16 +++++++++------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CRM/Admin/Form/Setting/Mapping.php b/CRM/Admin/Form/Setting/Mapping.php index 4eb31dd7d9..e041e4b362 100644 --- a/CRM/Admin/Form/Setting/Mapping.php +++ b/CRM/Admin/Form/Setting/Mapping.php @@ -36,19 +36,18 @@ */ class CRM_Admin_Form_Setting_Mapping extends CRM_Admin_Form_Setting { + protected $_settings = array( + 'mapAPIKey' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME, + 'mapProvider' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME, + 'geoAPIKey' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME, + 'geoProvider' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME, + ); + /** * Build the form object. */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - Mapping and Geocoding Providers')); - - $map = CRM_Core_SelectValues::mapProvider(); - $geo = CRM_Core_SelectValues::geoProvider(); - $this->addElement('select', 'mapProvider', ts('Mapping Provider'), array('' => '- select -') + $map, array('class' => 'crm-select2')); - $this->add('text', 'mapAPIKey', ts('Map Provider Key'), NULL); - $this->addElement('select', 'geoProvider', ts('Geocoding Provider'), array('' => '- select -') + $geo, array('class' => 'crm-select2')); - $this->add('text', 'geoAPIKey', ts('Geo Provider Key'), NULL); - parent::buildQuickForm(); } diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index 4f0b8f7838..d8eeadfc81 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -50,6 +50,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { DIRECTORY_PREFERENCES_NAME = 'Directory Preferences', EVENT_PREFERENCES_NAME = 'Event Preferences', MAILING_PREFERENCES_NAME = 'Mailing Preferences', + MAP_PREFERENCES_NAME = 'Map Preferences', CONTRIBUTE_PREFERENCES_NAME = 'Contribute Preferences', MEMBER_PREFERENCES_NAME = 'Member Preferences', MULTISITE_PREFERENCES_NAME = 'Multi Site Preferences', diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 5041c925a1..9b8056952c 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -427,7 +427,7 @@ class CRM_Core_SelectValues { public static function mapProvider() { static $map = NULL; if (!$map) { - $map = CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl"); + $map = array('' => '- select -') + CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl"); } return $map; } @@ -441,7 +441,7 @@ class CRM_Core_SelectValues { public static function geoProvider() { static $geo = NULL; if (!$geo) { - $geo = CRM_Utils_System::getPluginList('CRM/Utils/Geocode'); + $geo = array('' => '- select -') + CRM_Utils_System::getPluginList('CRM/Utils/Geocode'); } return $geo; } diff --git a/settings/Map.setting.php b/settings/Map.setting.php index 83a2be2e8e..21dc6c51db 100644 --- a/settings/Map.setting.php +++ b/settings/Map.setting.php @@ -37,7 +37,6 @@ return array( 'geoAPIKey' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, @@ -58,7 +57,6 @@ return array( 'geoProvider' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, @@ -66,8 +64,11 @@ return array( 'group' => 'map', 'name' => 'geoProvider', 'type' => 'String', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'Select', 'html_type' => 'Select', + 'html_attributes' => array( + 'class' => 'crm-select2', + ), 'pseudoconstant' => array( 'callback' => 'CRM_Core_SelectValues::geoProvider', ), @@ -78,7 +79,6 @@ return array( 'mapAPIKey' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, @@ -99,7 +99,6 @@ return array( 'mapProvider' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, @@ -107,8 +106,11 @@ return array( 'group' => 'map', 'name' => 'mapProvider', 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Select ', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => array( + 'class' => 'crm-select2', + ), 'pseudoconstant' => array( 'callback' => 'CRM_Core_SelectValues::mapProvider', ), -- 2.25.1