CRM-16373 - Migrate Map/Geocode settings
authorTim Otten <totten@civicrm.org>
Tue, 8 Sep 2015 01:09:25 +0000 (18:09 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 17 Sep 2015 22:49:28 +0000 (15:49 -0700)
CRM/Admin/Form/Setting/Mapping.php
CRM/Core/BAO/Setting.php
CRM/Core/SelectValues.php
settings/Map.setting.php

index 4eb31dd7d9a59fa4602ffa71018f3204ffb3746c..e041e4b362af26d5a686006524e426a665400f8d 100644 (file)
  */
 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();
   }
 
index 4f0b8f7838353a8326f5ff7ac88a868516802dab..d8eeadfc81e24744b764057b7810dffa5a4b958f 100644 (file)
@@ -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',
index 5041c925a16591bb10e19111ae8b9040b8e784a7..9b8056952c5ad9c0fae98251d992c34066bfd4fa 100644 (file)
@@ -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;
   }
index 83a2be2e8e282afbe678a40f9d01d9cff4c68fa4..21dc6c51db92e5a93514e4a3209ce7305a83b75f 100644 (file)
@@ -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',
     ),