Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FieldtypeMapMarker.module
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

/**
* ProcessWire Map Marker Fieldtype
Expand Down Expand Up @@ -204,7 +204,7 @@ class FieldtypeMapMarker extends Fieldtype {
*/
public function getMatchQuery($query, $table, $subfield, $operator, $value) {
if(!$subfield || $subfield == 'address') $subfield = 'data';
if($subfield != 'data' || wire('db')->isOperator($operator)) {
if($subfield != 'data' || $this->wire('db')->isOperator($operator)) {
// if dealing with something other than address, or operator is native to SQL,
// then let Fieldtype::getMatchQuery handle it instead
return parent::getMatchQuery($query, $table, $subfield, $operator, $value);
Expand Down
16 changes: 5 additions & 11 deletions InputfieldMapMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,11 @@ var InputfieldMapMarker = {
return true;
});

// added by diogo to solve the problem of maps not rendering correctly in hidden elements
// trigger a resize on the map when either the tab button or the toggle field bar are pressed

// get the tab element where this map is integrated
var $map = $('#' + mapId);
var $tab = $('#_' + $map.closest('.InputfieldFieldsetTabOpen').attr('id'));
// get the inputfield where this map is integrated and add the tab to the stack
var $inputFields = $map.closest('.Inputfield').find('.InputfieldStateToggle').add($tab);

$inputFields.on('click',function(){
// give it time to open
// added by diogo to solve the problem of maps not rendering correctly in hidden elements - updated by Tom
// trigger a resize on the map when either the tab or toggle state is clicked
$.fn.attrChange=function(t,r,a){return this.each(function(){var e=this,n=new MutationObserver(function(e){e.forEach(function(e){var n=$(e.target).prop(e.attributeName);e.attributeName===t&&(n=n.split(" "),-1===$.inArray(r,n)&&a())})});n.observe(e,{attributes:!0})})};

$map.closest('.Inputfield').attrChange("class", "InputfieldStateHidden", function(){
window.setTimeout(function(){
google.maps.event.trigger(map,'resize');
map.setCenter(options.center);
Expand Down
4 changes: 2 additions & 2 deletions InputfieldMapMarker.module
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

/**
* ProcessWire Map Marker Inputfield
Expand Down Expand Up @@ -52,7 +52,7 @@ class InputfieldMapMarker extends Inputfield {
*
*/
public function init() {
$this->config->scripts->add(($this->config->https ? 'https' : 'http') . '://maps.google.com/maps/api/js?sensor=false');
$this->config->scripts->add(($this->config->https ? 'https' : 'http') . '://maps.google.com/maps/api/js');
return parent::init();
}

Expand Down
6 changes: 3 additions & 3 deletions MapMarker.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

/**
* Class to hold an address and geocode it to latitude/longitude
Expand Down Expand Up @@ -47,7 +47,7 @@ public function set($key, $value) {
if(!is_numeric($value)) $value = '';

} else if($key == 'address') {
$value = wire('sanitizer')->text($value);
$value = $this->wire('sanitizer')->text($value);

} else if($key == 'status') {
$value = (int) $value;
Expand Down Expand Up @@ -76,7 +76,7 @@ public function geocode() {
return 0;
}

$url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=" . urlencode($this->address);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=" . urlencode($this->address);
$json = file_get_contents($url);
$json = json_decode($json, true);

Expand Down
2 changes: 1 addition & 1 deletion MarkupGoogleMap.module
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

/**
* ProcessWire Map Markup
Expand Down