OpenLayers OpenLayers

Changeset 7064

Show
Ignore:
Timestamp:
05/05/08 17:58:28 (7 months ago)
Author:
sbenthall
Message:

Improvements to WFS Protocol. Read and commit both work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/vector-behavior/lib/OpenLayers/Protocol/WFS/v1_0_0.js

    r7056 r7064  
    3535                    }, 
    3636 
     37    /**   
     38     * Property: params 
     39     * {Object} Hashtable of key/value parameters 
     40     */ 
     41    params: null, 
     42 
    3743    /** 
    3844     * Property: defaultPrefix 
     
    116122        OpenLayers.Util.applyDefaults(params, this.params); 
    117123         
    118  
    119124        var callback = function(request) { 
    120125            var features = null; 
     
    168173     */ 
    169174    commit: function(features) { 
     175 
     176        if(!features){ 
     177            features = this.layer.features; 
     178        } 
     179         
    170180        var root = this.parser.createElementNSPlus("wfs:Transaction", { 
    171             attributes: {version: this.VERSION, service: this.service
     181            attributes: {version: this.params.VERSION, service: this.params.SERVICE
    172182        }); 
    173183        var method, node; 
    174184        for(var i=0; i < features.length; i++) { 
    175             method = this.getMethod(feature[i]); 
     185            method = this.getMethod(features[i]); 
    176186            if(method) { 
     187                node = method.apply(this,[features[i]]); 
    177188                root.appendChild(node); 
    178189            } 
    179190        } 
    180         return this.parser.write(root); 
     191         
     192        var data = this.parser.write(root); 
     193         
     194        new OpenLayers.Ajax.Request(this.url, 
     195                                  {method: 'post',  
     196                                   postBody: data, 
     197                                   onComplete: OpenLayers.Console.log //quick fix 
     198                                   }); 
    181199    }, 
    182200     
     
    220238 
    221239        // TODO: this should deal with alt formats 
    222         node.appendChild(this.layer.format.createFeatureXML(feature)); 
     240        node.appendChild(this.layer.format.createFeatureXML(feature).firstChild); 
    223241 
    224242        return node; 
     
    280298    "delete": function(feature) { 
    281299        var node = this.parser.createElementNSPlus("wfs:Delete", { 
    282             attributes: {typename: this.featureName} 
     300            attributes: {typename: this.params.typename} 
    283301        }); 
    284302        var filter = this.parser.createElementNSPlus("ogc:Filter");