Changeset 6230


Ignore:
Timestamp:
05/18/12 11:12:43 (12 years ago)
Author:
acoutinho
Message:

Ticket #2758 - Implementacao dos recursos de contatos dinamicos no modelo de rest

Location:
sandbox/2.4-expresso-api/prototype
Files:
18 added
7 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4-expresso-api/prototype/api/datalayer.js

    r5888 r6230  
    198198                    else 
    199199                        result = dt; 
     200 
     201                }, 
     202              'error': function( dt, textStatus, jqXHR ){ 
     203 
     204                    if( callback ) 
     205                    { 
     206                        fired = true; 
     207                        result = callback( $.parseJSON(dt.responseText), textStatus, jqXHR ); 
     208                    } 
     209                    else 
     210                        result = $.parseJSON(dt.responseText); 
    200211 
    201212                }, 
     
    254265    create: function( uri, data, callback, accept ){ 
    255266       
    256         return this.send( this.dispatchPath + 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback,  
     267        return this.send( 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback,  
    257268        {'beforeSend' : function (xhr){  
    258269            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     
    272283    update: function( uri, data, callback, accept ){ 
    273284       
    274         return this.send( this.dispatchPath + 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback,  
     285        return this.send( 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback,  
    275286        {'beforeSend' : function (xhr){  
    276287            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
     
    290301    "delete": function( uri, callback, accept ){ 
    291302       
    292         return this.send( this.dispatchPath + 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback,  
     303        return this.send( 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback,  
    293304        {'beforeSend' : function (xhr){  
    294305            xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)}  
  • sandbox/2.4-expresso-api/prototype/config/PostgreSQL.srv

    r5888 r6230  
    33[config] 
    44port = 5432 
    5 dbname= expresso24cristianoAPI 
     5dbname= expressoApiCoutinho 
    66user=postgres 
    77host = /tmp 
  • sandbox/2.4-expresso-api/prototype/config/Tonic.srv

    r5888 r6230  
    99NewsLastResource = /news/NewsLastResource.php 
    1010 
     11[/dynamiccontacts] 
     12DynamicContactsResource = /contact/DynamicContactsResource.php 
     13 
     14[/oi] 
     15DynamicContactDeleteResource = /contact/DynamicContactDeleteResource.php 
     16 
     17[/dynamiccontacts/:id] 
     18DynamicContactResource = /contact/DynamicContactResource.php 
     19 
    1120[/token] 
    1221TokenResource = /oauth/TokenResource.php 
  • sandbox/2.4-expresso-api/prototype/library/oauth2/lib/OAuth2.php

    r5888 r6230  
    459459                session_write_close(); //Fecha session anterior 
    460460                session_id($token['refresh_token']); //Define o id da session o mesmo do resfresh token 
    461                 session_start(); 
    462                  
     461                @session_start(); 
     462                 
     463                /* TODO - Verificar melhor solução para verificação de tratamento para sessions já startadas 
     464                if(!isset($_SESSION)) 
     465                    session_start(); 
     466                */ 
    463467                return $token; 
    464468        } 
  • sandbox/2.4-expresso-api/prototype/library/tonic/lib/tonic.php

    r5888 r6230  
    126126     
    127127    /** 
     128     * Body data of incoming request 
     129     * @var array 
     130     */ 
     131    public $dataDecoded; 
     132     
     133    /** 
    128134     * Array of if-match etags 
    129135     * @var str[] 
     
    298304        $this->method = strtoupper($this->getConfig($config, 'method', 'REQUEST_METHOD', $this->method)); 
    299305         
    300         // get HTTP request data 
    301         $this->data = $this->getConfig($config, 'data', NULL, file_get_contents("php://input")); 
    302          
     306        // get HTTP request data 
     307        $this->data = $this->getConfig($config, 'data', NULL, file_get_contents("php://input")); 
     308 
     309        // get HTTP request dataDecode into array 
     310        $this->dataDecoded  = $this->__decodeData( $this->data ); 
     311         
    303312        // conditional requests 
    304313        if ($config['ifMatch']) { 
     
    415424     
    416425    } 
    417      
     426 
     427     /** 
     428     * Convert the string data into a array data 
     429     * @return array 
     430     * @codeCoverageIgnore 
     431     */ 
     432    function __decodeData($data) { 
     433        $arrayData = array(); 
     434        if($data){ 
     435            $arrayIndex = explode('&', $data); 
     436            foreach($arrayIndex as $key => $value){ 
     437                list($i,$val) = explode ('=', $value); 
     438                $arrayData[$i] = $val; 
     439            } 
     440        } 
     441        return $arrayData; 
     442    } 
     443 
    418444    /** 
    419445     * Convert the object into a string suitable for printing 
  • sandbox/2.4-expresso-api/prototype/rest/calendar/CalendarLastResource.php

    r5888 r6230  
    1616    function GET($request){ 
    1717        $this->secured(); 
    18          
     18 
    1919        $calendar = Controller::find( array( 'concept' => 'calendarSignature' ), array('calendar'), array( 'filter' => array( '=', 'user',  Config::me("uidNumber") ) ) ); 
    2020 
  • sandbox/2.4-expresso-api/prototype/rest/dispatch.php

    r5888 r6230  
    3737// handle request, passing the current env baseUri and autoload mapping; 
    3838$request = new Request(array( 
    39         'baseUri'=> '/cristiano/expresso-api/rest', 
     39        'baseUri'=> '/acoutinho/expressoAPI/rest', 
    4040        'autoload' => $autoload, 
    4141)); 
Note: See TracChangeset for help on using the changeset viewer.