Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I solved my problem Problems getting openlayers permalink working on how to get the maps view permalink but now I want to put the permalink in the toolbar instead of reloading the page with the permalink. I would like a popup like the one here on stackexchange when you click the "Link" under the post. That pops up a box with the URL selected.

Here is my map: http://babkart.no/ and the toolbar is like this now:

var setToolbarContent = function() {

toolbar.addControl(
        new OpenLayers.Control.ZoomToMaxExtent({
            map: map,
            title: 'Zoom til kartets maksimumsvisning'
        }), {
    iconCls: 'zoomfull',
    toggleGroup: 'map'
}
        );

addSeparator();

toolbar.addControl(
        new OpenLayers.Control.ZoomBox({
            title: 'Zoom inn: klikk i kartet eller bruk venstre museknapp for å tegne en rektangel'
        }), {
    iconCls: 'zoomin',
    toggleGroup: 'map'
}
        );
toolbar.addControl(
        new OpenLayers.Control.ZoomBox({
            out: true,
            title: 'Zoom ut: klikk i kartet eller bruk venstre museknapp for å tegne en rektangel'
        }), {
    iconCls: 'zoomout',
    toggleGroup: 'map'
}
        );
toolbar.addControl(
        new OpenLayers.Control.DragPan({
            isDefault: true,
            title: 'Pan kartet: hold venstre museknapp inne og dra i kartet'
        }), {
    iconCls: 'pan',
    toggleGroup: 'map'
}
        );
toolbar.addControl(
        new OpenLayers.Control.DragPan({
            title: 'Vis info: klikk på et ikon for å vise mere informasjon'
        }), {
    iconCls: 'info',
    toggleGroup: 'map'
}
        );
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

i dont know whether this works for you or not, but you can try something to add permalink info to a button tooltip as another DragPan. in the following code you should change iconcls and togglegroup for new button...

     toolbar.addControl(
     var con = map.controls;
     var permalinkInfo;

     for(var a = 0; a< con.length; a++){
        if(con[a].CLASS_NAME == "OpenLayers.Control.Permalink"){
            permalinkInfo = con[a].base
           }
         }

    new OpenLayers.Control.DragPan({
    title: permalinkInfo
    }), {
    iconCls: 'permalink',
    toggleGroup: 'other'
     }
    );

i hope it helps you...

share|improve this answer
    
Thanks but I get this error: Syntax error var con = map.controls; –  asle May 24 '12 at 13:57
    
What I would really like is to use an Ext messagebox like the "prompt" example her: dev.sencha.com/deploy/ext-4.0.0/examples/message-box/… But I am using ExtJS 2.2. If I could open a box like the the div that opens when you click on "link" under a message here on the forum that would be nice. –  asle May 24 '12 at 14:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.