Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Google Mapping questions

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 2779 Views
  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Google Mapping questions Link to this post

    Ofir, can you explain why you need to force dev mode and disable the content negotiator in the google maps _config.php?

    I'm going to remove devmode but perhaps leave contentneg in, for the preliminary 0.1 release... ?

    I'll also remove the API key so that much of the code is disabled until you actually enter in a key. Since the one you bundle will never work for anyone else. This makes the _config.php like this:

    <?php
    // Enter your free GoogleMaps API key from http://code.google.com/apis/maps/signup.html
    $GMaps_API_Key = '';
    /**
    * TODO: Need a better place to handle this. We should be able to set that from
    * the sites _config.php file rather than in here
    */

    ContentNegotiator::disable();
    Requirements::css("maps/css/Maps.css");
    Requirements::javascript("http://maps.google.com/maps?file=api&v=2.x&key=".$GMaps_API_Key);
    ?>

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Google Mapping questions Link to this post

    Seems to work for me, so I've uploaded. I then did the following to test the release was sweet. Please let me know if anyone finds a problem!

    Note that forum0.11 adds support for googlemaps, the 0.1 release will function as a forum but not show any google maps.

    wget http://www.silverstripe.com/assets/downloads/modules/forum-0.11.tar.gz
    wget http://www.silverstripe.com/assets/downloads/modules/maps-0.1.tar.gz
    wget http://www.silverstripe.com/assets/rc/silverstripe-v2.0.2-rc3.tar.gz

    tar xzf http://www.silverstripe.com/assets/rc/silverstripe-v2.0.2-rc3.tar.gz
    cd silverstripe-v2.0
    tar xzf ../maps-0.1.tar.gz
    tar xzf ../forum-0.11.tar.gz

    Add API to to maps/_config.php, get one from http://code.google.com/apis/maps/signup.html

    chmod g+w .htaccess tutorial mysite assets

    ( visit the installer )

    ( go into cms and add a "ForumMemberMap" page)

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Google Mapping questions Link to this post

    Ofir, you're requirement of:

    Requirements::css("maps/css/Maps.css");

    Stuffs up the CMS login page. This will be partly solved by only including it on pages where googlemaps are included. (This affects the version of the code that is now for public download, so please fix and commit to SVN )

    Secondly, I noticed that Requirements::javascript() needs to produce XML-safe code; as it stands if you remove your phrase "Requirements::javascript("http://maps.google.com/maps?file=api&v=2.x&key=".$GMaps_API_Key);" then you get an XML-not-well formed error on the equals sign.

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Google Mapping questions Link to this post

    See attached

  • elijahlofgren
    Avatar
    Google Summer of Code Hacker
    222 Posts

    Re: Google Mapping questions Link to this post

    Good job Ofir! Keep up the great work!

    I tested maps-0.1 with silverstripe-v2.0.2-rc3 and forum-0.11 on Apache 1.3.37 (Unix), MySQL 5.0.27-standard, and PHP version 5.2.3 and everything works great.

    It would be cool to be able to select a more specific location on the map by clicking on a specific point or by choosing a state. But I'm sure stuff like that is planned for later.

    Have a great weekend,

    Elijah

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Google Mapping questions Link to this post

    Instead of only dragging it, you mean? I just want to confirm that you were able to move your map point ....

  • elijahlofgren
    Avatar
    Google Summer of Code Hacker
    222 Posts

    Re: Google Mapping questions Link to this post

    > Instead of only dragging it, you mean? I just want to confirm that you were able to move your map point ....

    Ah, I didn't realize you could do that. I had only tried double-clicking where I wanted the point.

    Maybe instructions like "Drag and drop the marker to your location" should be added.

    Cheers,

    Elijah

  • xmedeko
    Avatar
    Community Member
    94 Posts

    Re: Google Mapping questions Link to this post

    for dblclick to set the location, try something like
    [code javascript/]
    GEvent.addListener(map, "dblclick", function(overlay, point) {
    marker.setPoint(point);
    document.getElementById("{$this->name}_latitude").value = point.lat();
    document.getElementById("{$this->name}_longitude").value = point.lng();
    });

    2779 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.