Maps Modification wanted, where to start?

Home Forums MapPress Support Maps Modification wanted, where to start?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #13549
    mk-weblog
    Participant

    Hi there,

    im using the MapPressPro Plugin on a blog. Ive drawn a few shapes over the map to cover some countries. When i click on a shape a popup comes up.
    What i want is to replace the popup with a link to a different site on my blog.

    I scrolled through the plugin files but dont know exactly where to start.

    My question is now, is it possible to edit the plugin files, so i can choose a site or simply add a link instead of the popup?

    I know HTML, PHP and jQuery (just in case..).

    TIA,
    best regards

    #13556
    Chris
    Keymaster

    Hi,

    If I understand: you want to redirect to other sites, not to other posts in the blog, is that correct?

    If so – that’s really not supported by the plugin. But you may be able to do it with an action ‘mappress_map_display’.

    You would need to display the map as a mashup in order to redirect clicks to a URL.

    You would also need to use an action to modify the target URL for the pois before they’re displayed. Action ‘mappress_map_display’ receives a single ‘map’ object just before the map is displayed. I haven’t tested it, but the code might look like this:

    
    function myaction($map) {
      if ($map->name == 'mymapname') {
        $map->pois[0]->url = 'url1';
        $map->pois[1]->url = 'url2';
      }
    }
    add_action('mappress_map_display', 'myaction');

    To display the map (if the post ID is #1234):
    [mashup query="p=1234" mashupclick='post' name='mymapname']

    #13559
    mk-weblog
    Participant

    Hi Chris,

    thanks for your reply! Ill try to figure it out with your code above, i will post my results here.

    If I understand: you want to redirect to other sites, not to other posts in the blog, is that correct?

    …Almost, i want to redirect inside the blog to another page, not a post.

    > I got this map which shows europe, on another page i got a list with different staffs of almost each country. If sb clicks on the shape in the map i want a redirect + (jquery) highlight of the staff.

    Thank you very much so far…

    Update:

    Well, i got a weird tweak now. I created a map with my country-shapes on the targetpage. The mapinclude
    [mashup query="p=xx" mashupclick='post' name='xx']
    has been pasted on another page.

    The click action works now ~ im still searching for any anchor in the php files, because i dont think that the shapes are called via ‘pois’. Im watching a print_r of the $map > there are no pois 🙁

    Any ideas where to find and edit/control the shapes?

    TIA

    #13562
    Chris
    Keymaster

    If you’re redirecting within the same site, you might be able to do this without any special code:

    1. Create 1 page per country.
    2. For each country page, create a map with 1 shape (just that country).
    2. Display all of the country maps together using a mashup.

    Now when users click a country shape, it will take them to the corresponding country page (you can set that in the MapPress settings).

    If that’s not going to work, then to answer your other question, shapes are pois (like markers). But I should’ve mentioned: the map won’t have any pois until the AJAX call to fetch them is made (mashups are displayed using AJAX).

    #13564
    mk-weblog
    Participant

    Thanks for your reply, ill try your steps tomorrow and give some feedback here!

    #13576
    mk-weblog
    Participant

    Hi there,

    im using a mashup now. This works fine!

    Now i got another questions:

    – Is it possible to set the opacity of the map to 0%, but let the shapes stay on 100% opc?

    – Is it possible to “clone”/copy an existing map?

    – Is there a possibilty to use the POI-MouseOver-Tooltip also for shapes? I activated it in the settings, but it only works with the POIs :/

    TIA again

    #13583
    Chris
    Keymaster

    Hi,

    Here’s some answers for your questions. I’m afraid they won’t be very helpful:

    1. The Google Maps API doesn’t support setting opacity for the map. You could try setting an opacity on the containing div, but I don’t think it would work.

    2. Sorry, but no – there’s no copy function yet. You could copy the map at the database level by copying its row in table mappress_maps and mappress_posts.

    3. No, Google doesn’t support tooltips for shapes, only for markers.

    #13584
    Chris
    Keymaster

    Update for #1: I tried setting opacity on the container and it does seem to work. Use something like this in your styles.css:

    .mapp-layout {
      opacity: .4;
    }

    That will affect all maps. If you just want to change one map try wrapping the map in a container div in the WordPress post editor (on the text tab):

    <div style='opacity: .4'>
    ...map ...
    </div>
    
    #13739
    mk-weblog
    Participant

    Alright im back again, sorry for the long time.
    I tried your tips with the opacity, it works for the whole include but not for the map in the background. This would help if i could control the shapes to stay at 100% opacity.

    I got other thoughts:
    Now im using a big mashup for my shapes (of each country of europe)in one map, on one site. If i click on a shape im redirected to one page with a list of contact persons.

    Question:
    Is there a possibility to set something like an ‘anchor’ which i can call with f.e. jquery to highlight the specific contact person? I Thought about sth easy, like a link extension: f.e. “http://domain.com/contact-persons/#swiss&#8221;.

    TIA for your thoughts.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.