Changeset 3213 for contribs

Show
Ignore:
Timestamp:
11/04/09 03:21:06 (3 years ago)
Author:
cmoullet
Message:

Openlayers needs a ? in the url to work correctly

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • contribs/mapfish-api/trunk/MapFishApi/js/Permalink.js

    r2968 r3213  
    4848    draw: function() { 
    4949        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    50      
     50 
    5151        this.map.events.on({ 
    5252            'moveend': this.updateLink, 
     
    5959        // moved yet. 
    6060        this.updateLink(); 
    61      
     61 
    6262        return this.div; 
    63     },   
    64     
    65     /**  
     63    }, 
     64 
     65    /** 
    6666     * Method: updateLink() 
    6767     * 
     
    7171        var href = this.base; 
    7272        if (href.indexOf('?') != -1) { 
    73             href = href.substring( 0, href.indexOf('?') ); 
     73            href = href.substring(0, href.indexOf('?')); 
    7474        } 
    7575 
    7676        href += '?' + OpenLayers.Util.getParameterString(this.createParams()); 
    7777        if (this.element) { 
    78            this.element.value = href; // FIXME: only OK for input fields 
     78            this.element.value = href; // FIXME: only OK for input fields 
    7979        } 
    8080    }, 
     
    9292    createParams: function(center, zoom, layers) { 
    9393        if (this.map) { 
    94            center = center || this.map.getCenter(); 
     94            center = center || this.map.getCenter(); 
    9595        } else { 
    9696            return ''; 
    9797        } 
     98        ; 
     99 
     100        if (OpenLayers.String.contains(this.base, '?')) { 
     101        } else { 
     102            this.base = this.base + "?"; 
     103        } 
     104        ; 
    98105 
    99106        var params = OpenLayers.Util.getParameters(this.base); 
     
    113120            if (this.displayProjection) { 
    114121                var mapPosition = OpenLayers.Projection.transform( 
    115                   { x: lon, y: lat }, 
    116                   this.map.getProjectionObject(), 
    117                   this.displayProjection ); 
     122                { x: lon, y: lat }, 
     123                        this.map.getProjectionObject(), 
     124                        this.displayProjection); 
    118125                lon = mapPosition.x; 
    119126                lat = mapPosition.y; 
    120127            } 
    121             params[this.coordsParams.lat] = Math.round(lat*100000)/100000; 
    122             params[this.coordsParams.lon] = Math.round(lon*100000)/100000; 
     128            params[this.coordsParams.lat] = Math.round(lat * 100000) / 100000; 
     129            params[this.coordsParams.lon] = Math.round(lon * 100000) / 100000; 
    123130 
    124131            // layers selection 
     
    126133            var layertree = this.api.tree; 
    127134            if (layertree) { 
    128                 var nodes = [];  
     135                var nodes = []; 
    129136                var checkedNodes = layertree.getChecked(); 
    130137                for (var i = 0, len = checkedNodes.length; i < len; i++) {