Avatar y00them3user asked

Widgetkit Maps Popup - Breaks map when popup contains code

Hello,

The map widget breaks ('scrambled' code replaces working map) when I place HTML in the popup of a Widgetkit map.

eg:

<img style="float: left;" alt="Alt Image Title" src="images/image.png" height="86" width="43" /><span style="font-size: 10pt;"><strong>Location Name</strong></span><br /><strong><span style="font-size: 8pt;">Firstname Lastname</span></strong><br /><span style="font-size: 8pt;">12345 Address<br />City, State 12345</span><br /><span style="font-size: 8pt;">p.(222) 333-4444</span><br /><a href="mailto:contact@domain.tld"><span style="font-size: 6pt;">contact@domain.tld</span></a> 

I've tried placing the code in a table, div and p tags ...nothing remedies the bug.

Help!

  • Widgetkit
  • Bug Report

Edited

9 Answers

0

Avatar alexis.marks answered

I have upgraded my "band-aid fix" to a "duct-tape fix," although if anyone can tell me the right way to fix it, I would appreciate it.

For this fix, you must turn on the labels for the fields in Zoo for the Map layout you are using. I am using the normal name field as the first one and then have additional fields for Website Address and Telephone number. You have to put the exact label in the first two variables I am using, $label1 and $label2

IN media/widgetkit/widgets/map/styles/default/template.php

LN 15:
$item['popup'] = strlen(trim($item['popup'])) ? '<div class="wk-content">'.$item['popup'].'</div>': '';

replace with

$label1 = 'Web:';  
$label2 = 'Tel:';  
        $item['popup'] = strip_tags($item['popup']);  
        $label1Pos = strpos($item['popup'],$label1);  
        $label2Pos = strpos($item['popup'],$label2);  
             $field1 = substr($item['popup'],0,$label1Pos);   
             $label1Label = substr($item['popup'],$label1Pos,5);      
                  $label1Link = substr($item['popup'],$label1Pos+5,($label2Pos-$label1Pos-5));    
             $label2Label = substr($item['popup'],$label2Pos,5);  
             $label2Value = substr($item['popup'],$label2Pos+5,($label2Pos-5));       
        $item['popup'] = '<strong>'.$field1.'</strong><br/><strong>'.$label1Label.'<a href="'.$label1Link.'" target="_blank">'.$label1Link.'</a></strong><br/><strong>'.$label2Label.'</strong>'.$label2Value;  

Edited

0

Avatar alexis.marks answered

I also had the problem where the popup would not appear when it had text in it and would break the whole map (using Zoo items)

I isolated the problem down to media/widgetkit/widgets/map/styles/default/template.php

LN 15:
$item['popup'] = strlen(trim($item['popup'])) ? '<div class="wk-content">'.$item['popup'].'</div>': '';

and found that if I replaced it with:
$item['popup'] = 'Hello World!';

that the map would work and show the "Hello World!" in the popup of each item.

I am sure someone that is a better programmer than I can figure out the correct solution, but my band-aid fix was to just change the line to:
$item['popup'] = strip_tags($item['popup']);

which gives me a plain text popup.

0

Avatar chris.mahon answered

Same Problem here, I put a simple two cell table with text within <p> tage and an image and it breaks the whole map.... This needs a fix ASAP!

1

Avatar y00them3user answered

Update:

From what I can determine, you can't insert images or <span> elements/styles in your Widgetkit Map location popup. I am able to use <br> and tables.

Is this a permanent limitation of Widgetkit Maps or is this being addressed in the next release?

0

Avatar starostwo.powiatowe.w.zurominie answered

I have the same problem. I have six locations and in four of them even pure text it doesn't want to appear. If I save changes after I set popup fields I have empty popup fields after that operation. In some popup fields widgetkit saves changes.

1

Avatar y00them3user answered

Update:

I've tried updating Widgetkit to the 1.01 release. I'm still getting the error. Is this a known bug? Is there a workaround?

Kindest Regards,

0

Avatar y00them3user answered

I'm getting the error on a fresh j2.5 site with widgetkit_j25 installed. ...not sure that's the answer here.

0

Avatar robbert answered

Hi!

Please upgrade your Widgetkit to the latest version. This is a known issue in the earlier beta's, but has been fixed in the 1.0 stable release.

Regards,
Robbert

Know someone who can answer? Share a link to this question via email or twitter.