Changeset 2507


Ignore:
Timestamp:
04/13/10 15:56:10 (14 years ago)
Author:
rodsouza
Message:

Ticket #1009 - Habilitando cache das requisições.

Location:
trunk/phpgwapi/js/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/js/tools/xconnector.js

    r2420 r2507  
    105105                                                                        try 
    106106                                                                        { 
     107                                                                                if ( this._cache ) 
     108                                                                                { 
     109                                                                                        this._CACHED[ _ID ] = _data; 
     110                                                                                        this._cache = false; 
     111                                                                                } 
     112 
    107113                                                                                _request( _data ); 
    108114                                                                        } 
     
    135141 
    136142                var _ACTION = 'act=' + _ID; 
    137                 //var _TARGET = this._PATH + _THREADS[ _ID ]._ACCESS; 
    138143                var _TARGET = _THREADS[ _ID ]._ACCESS; 
    139144 
    140145                var _SEND = null; 
    141  
    142                 //_TARGET += ( this._CONTROLLER ) ? 
    143                 //      this._CONTROLLER  : 'controller.php'; 
    144146 
    145147                //if ( _THREADS[_ID]._METHOD == 'GET' ) 
     
    161163                        if ( this._CONTROLLER_KEY && typeof _SEND.documentElement == 'object' ) 
    162164                                _SEND.documentElement.setAttribute( 'ControllerKey', this._CONTROLLER_KEY ); 
    163  
    164165                } 
    165166 
     
    255256                        } 
    256257 
    257                 if ( ! ( _THREADS[ _ID ]._XHR = _xhr( ) ) ) 
    258                 { 
    259                         delete _THREADS[_ID]; 
    260                         return { 'error' : "#3 it cannot make a xhr object" }; 
    261                 } 
    262  
    263                 _execute.call(this, _ID); 
     258                if ( this._cache && this._CACHED[ _ID ] ) 
     259                { 
     260                        if ( _THREADS[ _ID ]._HANDLER.request ) 
     261                                _THREADS[ _ID ]._HANDLER.request( this._CACHED[ _ID ] ); 
     262                } 
     263                else 
     264                { 
     265                        if ( ! ( _THREADS[ _ID ]._XHR = _xhr( ) ) ) 
     266                        { 
     267                                delete _THREADS[_ID]; 
     268                                return { 'error' : "#3 it cannot make a xhr object" }; 
     269                        } 
     270 
     271                        _execute.call( this, _ID ); 
     272                } 
    264273 
    265274                return { 'success' : "your thread is running and the response will be manipulated by the handler" }; 
     
    288297                var _argv = arguments; 
    289298 
     299                this._PATH = ''; 
     300 
     301                this._CONTROLLER  = ''; 
     302 
     303                this._cache = false; 
     304 
     305                this._CACHED = [ ]; 
     306 
    290307                if ( ( _argv.length == 1 ) && ( typeof _argv[0] == 'object' ) ) 
    291308                { 
    292309                        _argv = _argv[ 0 ]; 
    293  
    294                         this._PATH = ''; 
    295310 
    296311                        if ( _argv.path && ( typeof _argv.path == 'string' ) && this._PATH.length ) 
     
    305320                        } 
    306321 
    307                         this._CONTROLLER = ( _argv.controller ) ? 
    308                                 _argv.controller : false; 
     322                        if ( _argv.controller ) 
     323                                this._CONTROLLER = _argv.controller; 
    309324 
    310325                        this._CONTROLLER_KEY = ( _argv.key ) ? 
     
    315330        Connector.prototype.go = go; 
    316331        Connector.prototype.abort = _abort; 
     332        Connector.prototype.cache = function( ) 
     333        { 
     334                this._cache = true; 
     335        }; 
    317336        window.XConnector = Connector; 
    318337 
  • trunk/phpgwapi/js/tools/xlink.js

    r2495 r2507  
    2929                                _container.innerHTML = ''; 
    3030                                _container.appendChild( _loading ); 
     31                                _connector.cache( ); 
    3132                                var request = _connector.go( { 
    3233                                        'access' : action, 
Note: See TracChangeset for help on using the changeset viewer.