OpenLayers OpenLayers

Ticket #1677: patch-1677-r7754-A0.diff

File patch-1677-r7754-A0.diff, 4.6 kB (added by elemoine, 4 months ago)
  • lib/OpenLayers/Protocol.js

    old new  
    3838     *     instance. 
    3939     */ 
    4040    initialize: function(options) { 
     41        options = options || {}; 
    4142        OpenLayers.Util.extend(this, options); 
    4243        this.options = options; 
    4344    }, 
     
    5758     * 
    5859     * Parameters: 
    5960     * options - {Object} Optional object for configuring the request. 
     61     * 
     62     * Returns: 
     63     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response> 
     64     * object, the same object will be passed to the callback function passed 
     65     * if one exists in the options object. 
    6066     */ 
    6167    read: function() { 
    6268    }, 
     
    7076     * features - {Array({<OpenLayers.Feature.Vector>})} or 
    7177     *            {<OpenLayers.Feature.Vector>} 
    7278     * options - {Object} Optional object for configuring the request. 
     79     * 
     80     * Returns: 
     81     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response> 
     82     * object, the same object will be passed to the callback function passed 
     83     * if one exists in the options object. 
    7384     */ 
    7485    create: function() { 
    7586    }, 
     
    8293     * features - {Array({<OpenLayers.Feature.Vector>})} or 
    8394     *            {<OpenLayers.Feature.Vector>} 
    8495     * options - {Object} Optional object for configuring the request. 
     96     * 
     97     * Returns: 
     98     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response> 
     99     * object, the same object will be passed to the callback function passed 
     100     * if one exists in the options object. 
    85101     */ 
    86102    update: function() { 
    87103    }, 
     
    93109     * Parameters: 
    94110     * feature - {<OpenLayers.Feature.Vector>} 
    95111     * options - {Object} Optional object for configuring the request. 
     112     * 
     113     * Returns: 
     114     * {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response> 
     115     * object, the same object will be passed to the callback function passed 
     116     * if one exists in the options object. 
    96117     */ 
    97118    "delete": function() { 
    98119    }, 
     
    105126     * 
    106127     * Parameters: 
    107128     * features - {Array({<OpenLayers.Feature.Vector>})} 
    108      * options - {Object} Map of options, the keys of the map are 
    109      *           'create', 'update', and 'delete' 
     129     * options - {Object} Object whose possible keys are "create", "update", 
     130     *      "delete", "callback" and "scope", the values referenced by the 
     131     *      first three are objects as passed to the "create", "update", and 
     132     *      "delete" methods, the value referenced by the "callback" key is 
     133     *      a function which is called when the commit operation is complete 
     134     *      using the scope referenced by the "scope" key. 
     135     * 
     136     * Returns: 
     137     * {Array({<OpenLayers.Protocol.Response>})} An array of 
     138     * <OpenLayers.Protocol.Response> objects. 
    110139     */ 
    111140    commit: function() { 
    112141    }, 
     
    118147 * Class: OpenLayers.Protocol.Response 
    119148 * Protocols return Response objects to their users. 
    120149 */ 
    121 OpenLayers.Protocol.Response = new OpenLayers.Class({ 
     150OpenLayers.Protocol.Response = OpenLayers.Class({ 
    122151    /** 
    123152     * Property: code 
    124      * {Integer} - OpenLayers.Protocol.Response.SUCCESS or 
    125      *            OpenLayers.Protocol.Response.FAILURE 
     153     * {Number} - OpenLayers.Protocol.Response.SUCCESS or 
     154     *            OpenLayers.Protocol.Response.FAILURE 
    126155     */ 
    127156    code: null, 
    128157 
    129158    /** 
     159     * Property: requestType 
     160     * {String} The type of request this response corresponds to. Either 
     161     *      "create", "read", "update" or "delete". 
     162     */ 
     163    requestType: null, 
     164 
     165    /** 
     166     * Property: last 
     167     * {Boolean} - true if this is the last response expected in a commit, 
     168     * false otherwise, defaults to true. 
     169     */ 
     170    last: true, 
     171 
     172    /** 
    130173     * Property: features 
    131174     * {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>} 
    132175     * The features returned in the response by the server. 
     
    164207     * {Boolean} - true on success, false otherwise 
    165208     */ 
    166209    success: function() { 
    167         return !!(this.code & OpenLayers.Protocol.Response.SUCCESS_MASK)
     210        return this.code > 0
    168211    }, 
    169212 
    170213    CLASS_NAME: "OpenLayers.Protocol.Response" 
    171214}); 
    172215 
    173 OpenLayers.Protocol.Response.SUCCESS_MASK    = 0x000000ff; 
    174 OpenLayers.Protocol.Response.SUCCESS         = 0x00000001; 
    175  
    176 OpenLayers.Protocol.Response.FAILURE_MASK    = 0x0000ff00; 
    177 OpenLayers.Protocol.Response.FAILURE         = 0x00000100; 
     216OpenLayers.Protocol.Response.SUCCESS = 1; 
     217OpenLayers.Protocol.Response.FAILURE = 0;