<commit_before>/**
 * Created by jmcmahon on 1/12/16.
 */
//= require jquery.js
//= require OpenLayersLite-formats.js
//= require_self

'use strict';
OGC.WMS = OGC.WMS || {};

OGC.WMS.Client = OpenLayers.Class({
    initialize: function ( wmsServer, version ){
        this.wmsServer = wmsServer;
        this.version = version; 
    },
    getLayers: function (cb){
        var localLayers = [];
        var isAsync = (cb instanceof Function);

        // TODO: Step through this and see if we actually need this
        if ( this.wmsLocalLayers === undefined ){
            var formatter = new ol.format.WMSCapabilities();
            var that = this;

            var params = {
                service: 'WMS',
                version: this.version,
                request: 'GetCapabilities'
            };

            OpenLayers.Request.GET( {
                url: this.wmsServer,
                async: isAsync,
                params: params,
               /* headers: {
                	"Access-Control-Request-Method": "GET",
                    "Access-Control-Request-Headers": "origin, content-type, accept"
                },*/
                success: function ( request )
                {
                    console.log('request########', request)
                    var doc = request.responseXML;
                    if ( !doc || !doc.documentElement )
                    {
                        doc = request.responseText;
                    }

                    // use the tool to parse the data
                    var response = (formatter.read( doc ));

                    for ( var i = 0; i < response.Capability.Layer.Layer.length; i++ )
                    {
                        var layer = response.Capability.Layer.Layer[i];

                        console.log( 'layer', layer );

                        localLayers.push( layer );

                        console.log(formatter);

                    }<commit_msg>Attempting to fix WMS proxy<commit_after>/**
 * Created by jmcmahon on 1/12/16.
 */
//= require jquery.js
//= require OpenLayersLite-formats.js
//= require_self

'use strict';
OGC.WMS = OGC.WMS || {};

OGC.WMS.Client = OpenLayers.Class({
    initialize: function ( wmsServer, version ){
        this.wmsServer = wmsServer;
        this.version = version; 
    },
    getLayers: function (cb){
        var localLayers = [];
        var isAsync = (cb instanceof Function);

        // TODO: Step through this and see if we actually need this
        if ( this.wmsLocalLayers === undefined ){
            var formatter = new ol.format.WMSCapabilities();
            var that = this;

            var params = {
                service: 'WMS',
                version: this.version,
                request: 'GetCapabilities'
            };

            var url = this.wmsServer + "?service=WMS&version=" + this.version + "request=GetCapabilities";

            OpenLayers.Request.GET( {
                url: url,
                async: isAsync,
               /* headers: {
                	"Access-Control-Request-Method": "GET",
                    "Access-Control-Request-Headers": "origin, content-type, accept"
                },*/
                success: function ( request )
                {
                    console.log('request########', request)
                    var doc = request.responseXML;
                    if ( !doc || !doc.documentElement )
                    {
                        doc = request.responseText;
                    }

                    // use the tool to parse the data
                    var response = (formatter.read( doc ));

                    for ( var i = 0; i < response.Capability.Layer.Layer.length; i++ )
                    {
                        var layer = response.Capability.Layer.Layer[i];

                        console.log( 'layer', layer );

                        localLayers.push( layer );

                        console.log(formatter);

                    }
{'fraction_non_alphanumeric': 0.11088861076345431, 'fraction_numerical': 0.003003754693366708, 'mean_word_length': 1.2691652470187393, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6315561', 'n_tokens_mistral': 1080, 'n_tokens_neox': 981, 'n_words': 244}