Changeset 2729 for trunk/phpgwapi


Ignore:
Timestamp:
05/06/10 17:30:43 (14 years ago)
Author:
rodsouza
Message:

Ticket #1058 - Corrigindo problema do caregamento do contactcenter.

Location:
trunk/phpgwapi/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/js/expressolivre/expressolivre.js

    r2712 r2729  
    2525                _xconnector.go( { 
    2626                        'access' : 'phpgwapi.expressolivre.lang&lang=' + lang + '&module=' + module, 
     27                        'cache' : true, 
    2728                        'handler' : function( data ) 
    2829                        { 
  • trunk/phpgwapi/js/tools/xlink.js

    r2712 r2729  
    7878                if ( js ) 
    7979                { 
    80                         var tag = /<script([^>]* src="(\S+)"|[^>]*)>(.*?)<\/script>/; 
     80                        var tag = /<script([^>]*src="(\S+)"[^>]*|[^>]*)>(.*?)<\/script>/; 
    8181                        for ( var i = 0; i < js.length; i++ ) 
    8282                        { 
    8383                                var type = tag.exec( js[ i ] ); 
    84                                 data = data.replace( "\n\t\t" + type[ 0 ], '' ); 
     84                                data = data.replace( type[ 0 ], '' ); 
    8585                                _new_scripts[ _new_scripts.length ] = type; 
    8686                        } 
     
    9898                        _container.appendChild( el.firstChild ); 
    9999 
    100                 var _count = 0; 
    101                 function _scripts( ) 
     100                for ( var i = 0; i < _new_scripts.length; i++ ) 
    102101                { 
    103                         if ( _new_scripts[ _count ][ 2 ] == undefined || _new_scripts[ _count ][ 2 ].length == 0 ) 
    104                                 _script.load( function( ) 
    105                                 { 
    106                                         if ( ++_count < _new_scripts.length ) 
    107                                                 _scripts( ); 
    108                                 }, _new_scripts[ _count ][ 3 ] ); 
     102                        if ( _new_scripts[ i ][ 2 ] == undefined || _new_scripts[ i ][ 2 ].length == 0 ) 
     103                                _script.inline( _new_scripts[ i ][ 3 ] ); 
    109104                        else 
    110105                        { 
    111                                 if ( _new_scripts[ _count ][ 2 ].indexOf( window.location.host ) < 0 ) 
    112                                         _new_scripts[ _count ][ 2 ] = window.location.protocol + '//' + window.location.host + _new_scripts[ _count ][ 2 ]; 
     106                                if ( _new_scripts[ i ][ 2 ].indexOf( window.location.host ) < 0 ) 
     107                                        _new_scripts[ i ][ 2 ] = window.location.protocol + '//' + window.location.host + _new_scripts[ i ][ 2 ]; 
    113108 
    114                                 _script.add( 
    115                                         _new_scripts[ _count ][ 2 ].substr( 
     109                                _script.external( 
     110                                        _new_scripts[ i ][ 2 ].substr( 
    116111                                                _path.length - 1, 
    117                                                 _new_scripts[ _count ][ 2 ].length - _path.length + 1 - ( 
    118                                                         ( _new_scripts[ _count ][ 2 ].indexOf( '?' ) < 0 ) ? 
    119                                                                 0 : ( _new_scripts[ _count ][ 2 ].length - _new_scripts[ _count ][ 2 ].indexOf( '?' ) ) 
     112                                                _new_scripts[ i ][ 2 ].length - _path.length + 1 - ( 
     113                                                        ( _new_scripts[ i ][ 2 ].indexOf( '?' ) < 0 ) ? 
     114                                                                0 : ( _new_scripts[ i ][ 2 ].length - _new_scripts[ i ][ 2 ].indexOf( '?' ) ) 
    120115                                                ) 
    121116                                        ) 
    122117                                ); 
    123                                 if ( ++_count < _new_scripts.length ) 
    124                                         _scripts( ); 
    125118                        } 
    126119                } 
    127120 
    128                 if ( _new_scripts.length ) 
    129                 { 
    130                         _scripts( ); 
    131                         _script.load( ); 
    132                 } 
     121                _script.load( ); 
    133122        } 
    134123 
  • trunk/phpgwapi/js/tools/xscript.js

    r2703 r2729  
    55        var _new = [ ]; 
    66 
    7         function _add( pURL ) 
     7        function _inline( ) 
    88        { 
    9                 for ( var i = 0; i < _loaded.length; i++ ) 
    10                         if ( _loaded[ i ] == pURL ) 
    11                                 return false; 
     9                _new[ _new.length ] = { 
     10                        "type" : "inline", 
     11                        "content" : arguments[ 0 ] 
     12                }; 
     13        } 
    1214 
    13                 _new[ _new.length ] = pURL; 
    14  
    15                 return true; 
     15        function _external( ) 
     16        { 
     17                _new[ _new.length ] = { 
     18                        "type" : "external", 
     19                        "content" : arguments[ 0 ] 
     20                }; 
    1621        } 
    1722 
    1823        function _load( ) 
    1924        { 
    20                 var _handler = null; 
    21                 if ( arguments.length && typeof arguments[ 0 ] == 'function' ) 
    22                         _handler = arguments[ 0 ]; 
     25                var _count = 0; 
     26                function _handler( ) 
     27                { 
     28                        var _scripts = [ ]; 
     29                        _script : while ( _count < _new.length && _new[ _count ].type != 'inline' ) 
     30                        { 
     31                                for ( var i = 0; i < _loaded.length; i++ ) 
     32                                        if ( _loaded[ i ] == _new[ _count ].content ) 
     33                                        { 
     34                                                _count++; 
     35                                                continue _script; 
     36                                        } 
    2337 
    24                 var _inline = ''; 
    25                 if ( arguments.length && typeof arguments[ 1 ] == 'string' ) 
    26                         _inline = arguments[ 1 ]; 
     38                                _scripts[ _scripts.length ] = _loaded[ _loaded.length ] = _new[ _count ].content; 
     39                                _count++; 
     40                        } 
    2741 
    28                 if ( ! _new.length ) 
    29                 { 
    30                         window.eval( _inline); 
    31                         if ( _handler ) 
    32                                 _handler( ); 
     42                        _scripts = _scripts.join( ';' ); 
     43 
     44                        if ( _scripts.length ) 
     45                                _connector.go( { 
     46                                        "access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _scripts, 
     47                                        "handler" : function( data ) 
     48                                        { 
     49                                                window.eval( data ); 
     50                                                if ( _count < _new.length && _new[ _count ].type == 'inline' ) 
     51                                                { 
     52                                                        window.eval( _new[ _count ].content ); 
     53                                                        _count++; 
     54                                                        _handler( ); 
     55                                                } 
     56                                                else 
     57                                                { 
     58                                                        _count++; 
     59                                                        _handler( ); 
     60                                                } 
     61                                        } 
     62                                } ); 
     63                        else 
     64                                if ( _count < _new.length && _new[ _count ].type == 'inline' ) 
     65                                { 
     66                                        window.eval( _new[ _count ].content ); 
     67                                        _count++; 
     68                                        _handler( ); 
     69                                } 
     70 
     71                        if ( _count == _new.length ) 
     72                                _new = [ ]; 
    3373                } 
    34                 else 
    35                 { 
    36                         var _scripts = _new.join( ';' ); 
    37  
    38                         for ( var i = 0; i < _new.length; i++ ) 
    39                                 _loaded[ _loaded.length ] = _new[ i ]; 
    40  
    41                         _new = [ ]; 
    42  
    43                         _connector.go( { 
    44                                 "access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _scripts, 
    45                                 "handler" : function( data ) 
    46                                 { 
    47                                         window.eval( data + _inline); 
    48  
    49                                         if ( _handler ) 
    50                                                 _handler( ); 
    51                                 } 
    52                         } ); 
    53                 } 
     74                _handler( ); 
    5475        } 
    5576 
     
    6182        } 
    6283 
    63         Script.prototype.add = _add; 
     84        Script.prototype.external = _external; 
     85        Script.prototype.inline = _inline; 
    6486        Script.prototype.load = _load; 
    6587 
Note: See TracChangeset for help on using the changeset viewer.