Ignore:
Timestamp:
05/30/12 11:34:56 (12 years ago)
Author:
gustavo
Message:

Ticket #2768 - Melhorias na inserção de destinatários na criacao de mensagem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.1-3/prototype/api/datalayer.js

    r6008 r6351  
    1 internalUrl = /^([A-z0-9-_]+)(:[A-z0-9-_]+)?$/; 
     1   internalUrl = /^([A-z0-9-_]+)(:[A-z0-9-_]+)?$/; 
    22internalUri = /^([a-zA-Z0-9-_]+)\(([a-zA-Z0-9-_]+)\):\/\/(.*)|([a-zA-Z0-9-_]+):\/\/(.*)$/; 
    33isGeneratedId = /^\d+\(javascript\)$/; 
     
    213213 
    214214                }, 
     215              'error': function( dt, textStatus, jqXHR ){ 
     216 
     217                    if( callback ) 
     218                    { 
     219                        fired = true; 
     220                        result = callback( $.parseJSON(dt.responseText), textStatus, jqXHR ); 
     221                    } 
     222                    else 
     223                        result = $.parseJSON(dt.responseText); 
     224 
     225                }, 
    215226              'complete': function( jqXHR, textStatus ){ 
    216227 
     
    234245       
    235246          return( result ); 
     247    }, 
     248     
     249    /** 
     250    * This method is used to read resources from the server. 
     251    *  
     252    * @param uri Uri of the resource that gonna be readed. 
     253    * @param callback A function that is called when the resource is loaded successfully. When the parameter is ignored the request is made synchrounsly. 
     254    * @param accept The attribute accept that is used to ask the target format to the server 
     255    * @return The target resource when the callback is ommitted ( made it synchronous ) 
     256    */ 
     257 
     258    read: function( uri, data, callback, accept ){ 
     259        //return this.send( this.dispatchPath + 'rest' + uri, [ 'get', accept || 'json' ], false, callback ); 
     260        //http://expressodev.prognus.com.br/cristiano/expresso-api/rest/maillast 
     261        return this.send( ('rest' + uri), [ 'get', accept || 'json' ], data, callback, !!!callback,  
     262        {'beforeSend' : function (xhr){  
     263            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     264        }); 
     265       
     266    }, 
     267 
     268    /** 
     269    * This method is used to create resources from the server. 
     270    *  
     271    * @param uri Uri of the resource that gonna be readed. 
     272    * @param callback A function that is called when the resource is created on the server successfully. When the parameter is ignored the request is made synchrounsly. 
     273    * @param accept The attribute accept that is used to ask the target format to the server. 
     274    * @return The result response of the create from the server when the callback is ommitted ( made it synchronous ) 
     275    */ 
     276     
     277    create: function( uri, data, callback, accept ){ 
     278       
     279        return this.send( 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback,  
     280        {'beforeSend' : function (xhr){  
     281            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     282        }); 
     283       
     284    }, 
     285 
     286    /** 
     287    * This method is used to update resources from the server. 
     288    *  
     289    * @param uri Uri of the resource that gonna be readed. 
     290    * @param callback A function that is called when the resource is update on the server successfully. When the parameter is ignored the request is made synchrounsly. 
     291    * @param accept The attribute accept that is used to ask the target format to the server 
     292    * @return The result response of the update from the server when the callback is ommitted ( made it synchronous ) 
     293    */ 
     294 
     295    update: function( uri, data, callback, accept ){ 
     296       
     297        return this.send( 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback,  
     298        {'beforeSend' : function (xhr){  
     299            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     300        }); 
     301       
     302    }, 
     303 
     304    /** 
     305    * This method is used to delete resources from the server. 
     306    *  
     307    * @param uri Uri of the resource that gonna be readed. 
     308    * @param callback A function that is called when the resource is deleted successfully in the server. When the parameter is ignored the request is made synchrounsly. 
     309    * @param accept The attribute accept that is used to ask the target format to the server 
     310    * @return The result response of the delete from the server when the callback is ommitted ( made it synchronous ) 
     311    */ 
     312 
     313    "delete": function( uri, callback, accept ){ 
     314       
     315        return this.send( 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback,  
     316        {'beforeSend' : function (xhr){  
     317            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     318        }); 
     319       
    236320    }, 
    237321     
     
    20392123 
    20402124        if( !this.dispatchPath ) 
    2041             this.dispatchPath = "../../"; 
     2125            this.dispatchPath = "prototype/"; 
    20422126 
    20432127        if( !this.templatePath ) 
     
    20542138 
    20552139        this.start(); 
     2140        this.me = this.dispatch( "me" ); 
    20562141    } 
    20572142} 
Note: See TracChangeset for help on using the changeset viewer.