Skip to content

Commit

Permalink
BUGFIX: Locator - remove autoGeocode references
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirish committed Apr 17, 2017
1 parent 496c9bd commit 428c974
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions code/pages/Locator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class Locator extends Page
* @var array
*/
private static $db = array(
'AutoGeocode' => 'Boolean',
'ModalWindow' => 'Boolean',
'Unit' => 'Enum("m,km","m")',
);

Expand All @@ -27,13 +25,6 @@ class Locator extends Page
'Categories' => 'LocationCategory',
);

/**
* @var array
*/
private static $defaults = array(
'AutoGeocode' => true,
);

/**
* @var string
*/
Expand Down Expand Up @@ -63,9 +54,6 @@ public function getCMSFields()
$fields->addFieldsToTab('Root.Settings', array(
HeaderField::create('DisplayOptions', 'Display Options', 3),
OptionsetField::create('Unit', 'Unit of measure', array('m' => 'Miles', 'km' => 'Kilometers')),
//CheckboxField::create('AutoGeocode', 'Auto Geocode - Automatically filter map results based on user location')
// ->setDescription('Note: if any locations are set as featured, the auto geocode is automatically disabled.'),
//CheckboxField::create('ModalWindow', 'Modal Window - Show Map results in a modal window'),
));

// Filter categories
Expand Down Expand Up @@ -253,30 +241,19 @@ public function init()

$featuredInList = ($locations->filter('Featured', true)->count() > 0);
$defaultCoords = $this->getAddressSearchCoords() ? $this->getAddressSearchCoords() : '';
$isChrome = (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE);

$featured = $featuredInList
? 'featuredLocations: true'
: 'featuredLocations: false';

// map config based on user input in Settings tab
// AutoGeocode or Full Map
$limit = Config::inst()->get('Locator_Controller', 'limit');
if ($limit < 1) $limit = -1;
if ($this->data()->AutoGeocode) {
$load = $featuredInList || $defaultCoords != '' || $isChrome
? 'autoGeocode: false, fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,'
: 'autoGeocode: true, fullMapStart: false,';
} else {
$load = 'autoGeocode: false, fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,';
}
$load = 'fullMapStart: true, storeLimit: ' . $limit . ', maxDistance: true,';

$listTemplatePath = Config::inst()->get('Locator_Controller', 'list_template_path');
$infowindowTemplatePath = Config::inst()->get('Locator_Controller', 'info_window_template_path');

// in page or modal
$modal = ($this->data()->ModalWindow) ? 'modalWindow: true' : 'modalWindow: false';

$kilometer = ($this->data()->Unit == 'km') ? "lengthUnit: 'km'" : "lengthUnit: 'm'";

// pass GET variables to xml action
Expand All @@ -286,7 +263,6 @@ public function init()
if (count($vars)) {
$url .= '?' . http_build_query($vars);
}
$link = Controller::join_links($this->AbsoluteLink(), 'xml.xml', $url);
$link = Controller::join_links($this->Link(), 'xml.xml', $url);

// containers
Expand All @@ -302,7 +278,6 @@ public function init()
listTemplatePath: '" . $listTemplatePath . "',
infowindowTemplatePath: '" . $infowindowTemplatePath . "',
originMarker: true,
//" . $modal . ",
" . $featured . ",
slideMap: false,
distanceAlert: -1,
Expand Down

0 comments on commit 428c974

Please sign in to comment.