Bug - Google Maps Visualization

Status
Not open for further replies.

davez

Member
Hi,

Haven't posted in a long time. But been using Fabrik continuously. I found a bug that's a bit obscure.

I use media-relative icons for many of my Google maps visualizations. I noticed the recent changes in regards to how one specifies where the icons reside on the server, which breaks my maps.

So, I use both the icon displayed on the details view (the element is set to display an icon in the list view parameter with icon hover text set to yes also) AND the Google Map uses that field to display the icon on the map visualization. What happens is that the Google Map visualization loads the entire string that contains the icon and tooltip for the details view icon.

As a crutch, I've made this change to /plugins/fabrik_visualization/googlemap/models/googlemap.php (starts around line 427)
Code:
							$iconImgPath = FArrayHelper::getValue($markerImagesPath, $c, 'media');
							
							$iconImg = FArrayHelper::getValue($rowdata, $iconImg.'_raw', ''); //changed to the _raw form and addeed the slash at the beginning

							// Normalize the $iconimg so it is either a file path relative to J! root, or a non-local URL
							switch ($iconImgPath) {
								case 'media':
								default:
									$iconImg = 'media/com_fabrik/images' . $iconImg; 
									break;
								case 'jroot':

One of the problems with my solution is if people have used a databasejoin for their element, then it's going to load the numerical entry rather than the actual word. But I'm not sure how that would can be resolved.

Thanks for the fix!
 
I found a potentially better solution: /plugins/fabrik_visualization/googlemap/models/googlemap.php (starts around line 427)
I'm sure you can do something better. Basically, it strips the url from the existing string, then pulls out the filename. I guess this one would might cause it to choke on other people's maps. But it works best for me, because my elements have icons set to show.
Code:
						$iconImg = FArrayHelper::getValue($rowdata, $iconImg, '');
						preg_match_all('/\b(([\w-]+:\/\/?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/',$iconImg ,$icon_url);
						$iconImg = '/'.basename($icon_url[0][0]);
 
It may be that I was the only one using element icons with Google Map icons, but it seems logical. I think this should work globally:
(/plugins/fabrik_visualization/googlemap/models/googlemap.php line 4xx)
Code:
switch ($iconImgPath) {
                 case 'media':
                 default:
                   if (strpos($iconImg,'http') !== false) {
                     preg_match_all('/\b(([\w-]+:\/\/?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/',$iconImg ,$icon_url);//pulls out just the url
                     $iconImg = 'media/com_fabrik/images/'.basename($icon_url[0][0]);
                   } else {
                     $iconImg = 'media/com_fabrik/images/'.$iconImg;
                   }                   
                   break;
 
Resolved. I just noticed that you added Data Icon Path = IMG tag. So, all I needed to do was change all my maps to that select. And it works fine. No code updates necessary. What I did above was essentially what you did with case = IMG.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top