OpenLayers OpenLayers

Changeset 4237

Show
Ignore:
Timestamp:
09/12/07 09:40:28 (1 year ago)
Author:
crschmidt
Message:

FredJ reviewed my work here and said it solved the problem that he reopened
103 for (specifically, that baselayer changes always resulted in a null
attribution string), and fixes spelling. This commit makes the attribution
control work and stuff. (Closes #103)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/Attribution.js

    r4231 r4237  
    1717     * {String} String used to seperate layers. 
    1818     */ 
    19     seperator: ", ", 
     19    separator: ", ", 
    2020        
    2121    /** 
     
    3737        this.map.events.unregister("addlayer", this, this.updateAttribution); 
    3838        this.map.events.unregister("changelayer", this, this.updateAttribution); 
     39        this.map.events.unregister("changebaselayer", this, this.updateAttribution); 
    3940         
    4041        OpenLayers.Control.prototype.destroy.apply(this, arguments); 
     
    5152        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    5253         
     54        this.map.events.register('changebaselayer', this, this.updateAttribution); 
    5355        this.map.events.register('changelayer', this, this.updateAttribution); 
    5456        this.map.events.register('addlayer', this, this.updateAttribution); 
     
    7173            } 
    7274        }   
    73         this.div.innerHTML = attributions.join(this.seperator); 
     75        this.div.innerHTML = attributions.join(this.separator); 
    7476    }, 
    7577 
  • trunk/openlayers/tests/Control/test_Attribution.html

    r4231 r4237  
    1111        t.eq( control.displayClass,  "olControlAttribution", "displayClass is correct" ); 
    1212    } 
     13    function test_Control_Attribution_setBaseLayer (t) { 
     14        t.plan(1); 
     15        map = new OpenLayers.Map("map"); 
     16        map.addControl(control); 
     17        map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer!', isBaseLayer: true})); 
     18        map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer 2!', isBaseLayer: true})); 
     19        map.setBaseLayer(map.layers[1]); 
     20        t.eq(control.div.innerHTML, 'My layer 2!', "Attribution correct with changed base layer"); 
     21 
     22    } 
    1323    function test_Control_Attribution_draw (t) { 
    1424        t.plan(3); 
     
    2030        map.addLayer(new OpenLayers.Layer("name", {'attribution':'My layer 2!'})); 
    2131        t.eq(control.div.innerHTML, 'My layer!, My layer 2!', "Attribution correct with two layers."); 
    22         control.seperator = '|'; 
     32        control.separator = '|'; 
    2333        map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer 3!'})); 
    2434        t.eq(control.div.innerHTML, 'My layer!|My layer 2!|My layer 3!', "Attribution correct with three layers and diff seperator."); 
     35 
     36 
    2537    }     
    2638  // -->