OpenLayers OpenLayers

Ticket #725: customizing_labels_layerswitcher.patch

File customizing_labels_layerswitcher.patch, 2.7 kB (added by penyaskito, 2 years ago)
  • lib/OpenLayers/Control/LayerSwitcher.js

    old new  
    2626 
    2727    /** @type Array */ 
    2828    baseLayers: null, 
     29 
     30    /** @type DOMElement */ 
     31    baseLbl: null, 
     32     
     33    /**@type String */ 
     34    baseLblTitle:null, 
    2935     
    3036     
    3137    /** @type DOMElement */ 
    3238    dataLbl: null, 
    33      
     39     
     40    /**@type String */ 
     41    dataLblTitle:null, 
     42     
    3443    /** @type DOMElement */ 
    3544    dataLayersDiv: null, 
    3645 
     
    373382        this.layersDiv.style.height = "100%"; 
    374383 
    375384 
    376         var baseLbl = document.createElement("div"); 
    377         baseLbl.innerHTML = "<u>Base Layer</u>"; 
    378         baseLbl.style.marginTop = "3px"; 
    379         baseLbl.style.marginLeft = "3px"; 
    380         baseLbl.style.marginBottom = "3px"; 
     385        this.baseLbl = document.createElement("div"); 
     386        this.baseLbl.innerHTML = "<u>"+this.getBaseLayersTitle()+"</u>"; 
     387        this.baseLbl.style.marginTop = "3px"; 
     388        this.baseLbl.style.marginLeft = "3px"; 
     389        this.baseLbl.style.marginBottom = "3px"; 
    381390         
    382391        this.baseLayersDiv = document.createElement("div"); 
    383392        this.baseLayersDiv.style.paddingLeft = "10px"; 
     
    387396                      
    388397 
    389398        this.dataLbl = document.createElement("div"); 
    390         this.dataLbl.innerHTML = "<u>Overlays</u>"; 
     399        this.dataLbl.innerHTML = "<u>"+this.getOverlaysTitle()+"</u>"; 
    391400        this.dataLbl.style.marginTop = "3px"; 
    392401        this.dataLbl.style.marginLeft = "3px"; 
    393402        this.dataLbl.style.marginBottom = "3px"; 
     
    396405        this.dataLayersDiv.style.paddingLeft = "10px"; 
    397406 
    398407        if (this.ascending) { 
    399             this.layersDiv.appendChild(baseLbl); 
     408            this.layersDiv.appendChild(this.baseLbl); 
    400409            this.layersDiv.appendChild(this.baseLayersDiv); 
    401410            this.layersDiv.appendChild(this.dataLbl); 
    402411            this.layersDiv.appendChild(this.dataLayersDiv); 
    403412        } else { 
    404413            this.layersDiv.appendChild(this.dataLbl); 
    405414            this.layersDiv.appendChild(this.dataLayersDiv); 
    406             this.layersDiv.appendChild(baseLbl); 
     415            this.layersDiv.appendChild(this.baseLbl); 
    407416            this.layersDiv.appendChild(this.baseLayersDiv); 
    408417        }     
    409418  
     
    456465 
    457466        this.div.appendChild(this.minimizeDiv); 
    458467    }, 
    459      
     468    getOverlaysTitle:function(){ 
     469        return this.dataLblTitle==null ? "Overlays":this.dataLblTitle; 
     470    }, 
     471    getBaseLayersTitle:function(){ 
     472        return this.baseLblTitle == null ? "Base Layers" : this.baseLblTitle; 
     473    }, 
    460474    /**  
    461475     * @private 
    462476     *