From b38b5adc95e8a973ac7676348bc6b214a0b66f92 Mon Sep 17 00:00:00 2001 From: Tom Smedley Date: Mon, 25 Jan 2016 16:29:20 +0000 Subject: [PATCH 1/4] Updated map loading from hidden --- InputfieldMapMarker.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/InputfieldMapMarker.js b/InputfieldMapMarker.js index f83910a..c7f9efc 100644 --- a/InputfieldMapMarker.js +++ b/InputfieldMapMarker.js @@ -101,14 +101,13 @@ var InputfieldMapMarker = { return true; }); - // added by diogo to solve the problem of maps not rendering correctly in hidden elements + // added by diogo(updated by Tom) 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')); + var $tab = $('#_'+ $map.closest('.InputfieldWrapper').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); + var $inputFields = $map.closest('.Inputfield').find('.InputfieldHeader').add($tab); $inputFields.on('click',function(){ // give it time to open From c931288be4935afedede6743cb1ba64c89b01ea7 Mon Sep 17 00:00:00 2001 From: Tom Smedley Date: Mon, 25 Jan 2016 16:34:17 +0000 Subject: [PATCH 2/4] Removed depreciated sensor input value --- InputfieldMapMarker.module | 2 +- MapMarker.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/InputfieldMapMarker.module b/InputfieldMapMarker.module index 0e29c36..facdad5 100644 --- a/InputfieldMapMarker.module +++ b/InputfieldMapMarker.module @@ -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(); } diff --git a/MapMarker.php b/MapMarker.php index 9c063ff..5bcaf84 100644 --- a/MapMarker.php +++ b/MapMarker.php @@ -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); From 1c50b4d1ad64559b6e581b402311f254468945fc Mon Sep 17 00:00:00 2001 From: Tom Smedley Date: Mon, 25 Jan 2016 16:36:03 +0000 Subject: [PATCH 3/4] Attempt at updating for 3.0 --- FieldtypeMapMarker.module | 4 ++-- InputfieldMapMarker.module | 2 +- MapMarker.php | 4 ++-- MarkupGoogleMap.module | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FieldtypeMapMarker.module b/FieldtypeMapMarker.module index ac30386..4d66a6f 100644 --- a/FieldtypeMapMarker.module +++ b/FieldtypeMapMarker.module @@ -1,4 +1,4 @@ -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); diff --git a/InputfieldMapMarker.module b/InputfieldMapMarker.module index facdad5..83710bd 100644 --- a/InputfieldMapMarker.module +++ b/InputfieldMapMarker.module @@ -1,4 +1,4 @@ -text($value); + $value = $this->wire('sanitizer')->text($value); } else if($key == 'status') { $value = (int) $value; diff --git a/MarkupGoogleMap.module b/MarkupGoogleMap.module index 8cdd906..572792f 100644 --- a/MarkupGoogleMap.module +++ b/MarkupGoogleMap.module @@ -1,4 +1,4 @@ - Date: Fri, 12 Feb 2016 11:03:10 +0000 Subject: [PATCH 4/4] Support for conditional logic Added support for conditional logic (Visible If) --- InputfieldMapMarker.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/InputfieldMapMarker.js b/InputfieldMapMarker.js index c7f9efc..a248520 100644 --- a/InputfieldMapMarker.js +++ b/InputfieldMapMarker.js @@ -101,16 +101,11 @@ var InputfieldMapMarker = { return true; }); - // added by diogo(updated by Tom) 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 $tab = $('#_'+ $map.closest('.InputfieldWrapper').attr('id')); - // get the inputfield where this map is integrated and add the tab to the stack - var $inputFields = $map.closest('.Inputfield').find('.InputfieldHeader').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);