From: Coleman Watts Date: Fri, 22 Aug 2014 15:09:57 +0000 (+0100) Subject: Cleanup and rearrange adv search location pane X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=12fbb7b3fa775b3d8ef62201e020c0e91629db90;p=civicrm-core.git Cleanup and rearrange adv search location pane --- diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 20e8ca637e..2513ee6460 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -271,9 +271,10 @@ class CRM_Contact_Form_Search_Criteria { /** - * @param $form + * @param CRM_Core_Form $form */ static function location(&$form) { + $config = CRM_Core_Config::singleton(); // Build location criteria based on _submitValues if // available; otherwise, use $form->_formValues. $formValues = $form->_submitValues; @@ -366,25 +367,24 @@ class CRM_Contact_Form_Search_Criteria { } if ($addressOptions['postal_code']) { - $form->addElement('text', 'postal_code_low', ts('Range-From'), - CRM_Utils_Array::value('postal_code', $attributes) - ); - $form->addElement('text', 'postal_code_high', ts('To'), - CRM_Utils_Array::value('postal_code', $attributes) - ); + $attr = array('class' => 'six') + (array) CRM_Utils_Array::value('postal_code', $attributes); + $form->addElement('text', 'postal_code_low', NULL, $attr + array('placeholder' => ts('From'))); + $form->addElement('text', 'postal_code_high', NULL, $attr + array('placeholder' => ts('To'))); } } CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap); // extend addresses with proximity search - $form->addElement('text', 'prox_distance', ts('Find contacts within'), array('class' => 'six')); - $form->addElement('select', 'prox_distance_unit', NULL, array('miles' => ts('Miles'), 'kilos' => ts('Kilometers'))); - - // is there another form rule that does decimals besides money ? ... - $form->addRule('prox_distance', ts('Please enter positive number as a distance'), 'numeric'); + if (!empty($config->geocodeMethod)) { + $form->addElement('text', 'prox_distance', ts('Find contacts within'), array('class' => 'six')); + $form->addElement('select', 'prox_distance_unit', NULL, array( + 'miles' => ts('Miles'), + 'kilos' => ts('Kilometers') + )); + $form->addRule('prox_distance', ts('Please enter positive number as a distance'), 'numeric'); + } - $worldRegions = array('' => '') + CRM_Core_PseudoConstant::worldRegion(); $form->addSelect('world_region', array('entity' => 'address', 'placeholder' => ts('- any -'), 'option_url' => NULL)); // select for location type diff --git a/css/civicrm.css b/css/civicrm.css index e3086ff71b..7063dfe077 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -414,6 +414,7 @@ input.crm-form-entityref { } .crm-container .crm-section, +.crm-container div.crm-field-wrapper, .crm-container-snippet .crm-section { margin-bottom: 1em; } @@ -3074,7 +3075,7 @@ div a.helpicon:focus { } /* Override Drupal .2em margin-bottom on forms (we don't want to give up that space) */ -div#crm-container form { +div.crm-container form { margin-bottom: 0em; } diff --git a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl index 6b302739c5..c4cf066313 100644 --- a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl +++ b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl @@ -69,31 +69,29 @@ {/if} {if $form.group} -
+
{$form.group.html}
- + {$form.group_type.html} {literal} + {/if} + {if $form.prox_distance.html} +
+ {$form.prox_distance.label}
+ {$form.prox_distance.html} {$form.prox_distance_unit.html} +
+ {/if} + {if $addressGroupTree} @@ -113,36 +132,28 @@
-{if $parseStreetAddress eq 1} +{if $parseStreetAddress} {literal} {/literal}