OpenLayers OpenLayers

Ticket #1452: ticket1452.patch

File ticket1452.patch, 2.0 kB (added by bartvde, 8 months ago)
  • lib/OpenLayers/Format/WMC/v1.js

    old new  
    376377    }, 
    377378 
    378379    /** 
     380     * Method: read_wmc_MetadataURL 
     381     */ 
     382    read_wmc_MetadataURL: function(layerInfo, node) { 
     383        var metadataURL = {}; 
     384        var links = node.getElementsByTagName("OnlineResource"); 
     385        if(links.length > 0) { 
     386            this.read_wmc_OnlineResource(metadataURL, links[0]); 
     387        } 
     388        layerInfo.options.metadataURL = metadataURL.href; 
     389 
     390    }, 
     391 
     392    /** 
    379393     * Method: read_wmc_Abstract 
    380394     */ 
    381395    read_wmc_Abstract: function(obj, node) { 
     
    603617    write_wmc_Layer: function(layer) { 
    604618        var node = this.createElementDefaultNS( 
    605619            "Layer", null, { 
    606                 queryable: "1", 
     620                queryable: layer.queryable ? "1" : "0", 
    607621                hidden: layer.visibility ? "0" : "1" 
    608622            } 
    609623        ); 
     
    620634        node.appendChild(this.createElementDefaultNS( 
    621635            "Title", layer.name 
    622636        )); 
     637 
     638        // optional MetadataURL element 
     639        if (layer.metadataURL) { 
     640            node.appendChild(this.write_wmc_MetadataURL(layer)); 
     641        } 
    623642         
    624643        // optional FormatList element 
    625644        node.appendChild(this.write_wmc_FormatList(layer)); 
     
    727746    }, 
    728747 
    729748    /** 
     749     * Method: write_wmc_MetadataURL 
     750     * Create a MetadataURL node given a layer object. 
     751     * 
     752     * Parameters: 
     753     * layer - {<OpenLayers.Layer.WMS>} Layer object. 
     754     * 
     755     * Returns: 
     756     * {Element} A WMC metadataURL element node. 
     757     */ 
     758    write_wmc_MetadataURL: function(layer) { 
     759        var node = this.createElementDefaultNS("MetadataURL"); 
     760 
     761        // required OnlineResource element 
     762        node.appendChild(this.write_wmc_OnlineResource(layer.metadataURL)); 
     763 
     764        return node; 
     765    }, 
     766 
     767    /** 
    730768     * Method: write_wmc_FormatList 
    731769     * Create a FormatList node given a layer. 
    732770     *