A note to all those who can't get Gmap to show maps and get a white space instead - try disabling the Javascript tools module.

I upgraded from jstools-5.x-0.3 to jstools-5.x-0.4 and lost all my maps. Reverting the module gets the maps back.

Further information - this is for Firefox 2 only. On IE 7 Javascript tools causes a Jscript error and maps are not displayed unless the Jscript module is disabled.

Mark

Comments

hanief84’s picture

I'm using the dev vesion of Jstool. Works find tho.
Jstool 5.X.4 sucks.

I'm currently waiting for the Localizer to be fixed with GMap.

michelle’s picture

Using version 5.x-06 of javascript tools still doesn't work. I'm using the tabs module from it and want to put a map on one of the tabs. the map box and controls show up but the map is only a tiny bit in the upper left corner. This issue I'm replying to is quite old... I'm hoping someone has found a solution in the mean time.

Thanks,

Michelle

bdragon’s picture

Status: Active » Fixed

Michelle, I helped you fix this issue in IRC, right?

michelle’s picture

Yes, you did, thanks. :)

Michelle

sliiiiiide’s picture

I'd be interested in putting a gmap inside a jstools tab, do you have any tips to share?

michelle’s picture

This is the code I use. The reason tab2 is before tab1 is that a recent update of jstools caused the first two tabs to switch places for some unknown reason. The easiest fix for me was to go in and change the tab contents to get it back how I want.

Michelle

<script type="text/javascript">
//This makes the map work right in tabs
  Drupal.gmap.addHandler('gmap',function(elem) {
    var obj = this;
    obj.bind('checkresize',function() {
      obj.map.checkResize();
      obj.change('move',-1);
      });
   });
</script>

    <div class="bottomtabs">

      <?php
      // TAB 1 - MAP
      $map = array();
      $map[zoom] = 15;
      $map[width] = '400px';
      $map[height] = '400px';
      $map[id] = 'macro_map';
      $map[control] = 'Large';
      $map[maptype] = 'Map';
      $map[longitude] = $node->locations[0]['longitude'];
      $map[latitude] = $node->locations[0]['latitude'];
      
      foreach ($node->locations as $location) {
        $map['markers'][] = array(
          'longitude' => $location['longitude'],
          'latitude' => $location['latitude'],
          'markername' => 'route',
          'offset' => 1,
        );
      }

      
      // Add location(s) to tab
      $tab1 = '';
      $tab1 .= '<table><tr><td valign="top"><h3>Locations:</h3>';

      $cnt=0;
      foreach ($node->locations as $location) {
        $tab1 .= '<p>' . $node->locations[$cnt]['name']  . '<br />';
        if (!empty($node->locations[$cnt]['street'])) {
         $tab1 .= $node->locations[$cnt]['street'] . "<br />";
        }
        if (!empty($node->locations[$cnt]['additional'])) {
         $tab1 .= $node->locations[$cnt]['additional'] . "<br />";
        }
        $tab1 .= $node->locations[$cnt]['city']  . ','; 
        $tab1 .= $node->locations[$cnt]['province'] . '<br />';
        $tab1 .= 'Phone: ' . $node->locations[$cnt]['phone'] . '<br />';
        $tab1 .= 'Fax: ' . $node->locations[$cnt]['fax'] . '</p>';
        
        $cnt = $cnt + 1;
      }

      $tab1 .= "</td><td>";
      
      // Add map to tab
      $tab1 .= theme('gmap', array('#settings' => $map));
      $tab1 .= "</td></tr></table>";

      // TAB 2 - REVIEWS
//SNIPPED
      
      // TAB 3 - Photos
//SNIPPED

      // SET UP THE FORM ARRAY
      $form = array();
      $form['tab_display'] = array(
        '#type' => 'tabset',
      );
  
      $form['tab_display']['tab2'] = array(
        '#type' => 'tabpage',
        '#title' => t('Reviews'),
        '#content' => $tab2,
      );
  
      $form['tab_display']['tab1'] = array(
        '#type' => 'tabpage',
        '#title' => t('Map'),
        '#content' => $tab1,
      );
  
      $form['tab_display']['tab3'] = array(
        '#type' => 'tabpage',
        '#title' => t('Photos'),
        '#content' => $tab3,
      );
  
      // PRINT IT OUT
      print tabs_render($form);

      ?>
    </div>
Anonymous’s picture

Status: Fixed » Closed (fixed)
afagioli’s picture

Thanks a lot, Michelle,

one year later, on latest 5.x, your code still works fine!

wasay’s picture

May I know this code how to fix it in D6 ?