Changeset 2703 for trunk/phpgwapi


Ignore:
Timestamp:
05/04/10 15:25:37 (14 years ago)
Author:
rodsouza
Message:

Ticket #1058 - Adicionando o javascript ExpressoLivre? e delegando ao mesmo o que é de seu dever.

Location:
trunk/phpgwapi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.common.inc.php

    r2677 r2703  
    392392                                                $webserver_url .= '/'; 
    393393 
     394                                        $expressolivre = CreateObject( 'phpgwapi.expressolivre' ); 
     395 
    394396                                        $GLOBALS['phpgw_info']['flags']['java_script_thirst'] .= '<script type="text/javascript">' 
    395397                                                . 'var URL_SERVER = window.location.protocol + "//" + window.location.host + "' . $webserver_url . '";' 
    396                                                 . 'var template = "' . $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ] . '";</script>'; 
     398                                                . 'var template = "' . $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ] . '";' 
     399                                                . 'var ExpressoLivre = function ExpressoLivre( ) { return String( \'' . $expressolivre -> configuration( ) . '\' ); };' 
     400                                                . '</script>'; 
    397401 
    398402                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'wz_dragdrop', 'wz_dragdrop', NULL, true ); 
    399403                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'expressoAjax', NULL, true ); 
    400404                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'dom', NULL, true ); 
     405                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressolivre','expressolivre', NULL, true ); 
    401406                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xlink', NULL, true ); 
    402407                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xscript', NULL, true ); 
  • trunk/phpgwapi/js/tools/xlink.js

    r2700 r2703  
    11( function( ) 
    22{ 
    3         if ( window.location.protocol + '//' + window.location.host + window.location.pathname != URL_SERVER ) 
    4                 window.location.href = URL_SERVER + ( 
    5                         ( window.location.hash ) ? 
    6                                 window.location.hash : '#' + String( window.location.protocol + '//' + window.location.host + window.location.pathname ).substr( URL_SERVER.length ) 
    7                 ); 
     3        var _path = null; 
     4        var _last_request = null; 
    85 
    9         var _connector = new XConnector; 
    10         var _script = null; 
     6        var _connector = null; 
     7        var _script = new XScript; 
    118 
    129        var _container = null; 
    1310        var _divAppboxHeader = null; 
     11 
    1412        var _loading = new Image( ); 
    15         _loading.src = URL_SERVER + 'phpgwapi/images/loading.gif'; 
    16  
    17         var _last_request = null; 
    1813 
    1914        function _click( _action, _cache ) 
     
    4742 
    4843                window.location = '#' + ( 
    49                         ( _action.indexOf( URL_SERVER ) < 0 ) ? 
    50                                 _action : _action.substr( _action.indexOf( URL_SERVER ) + URL_SERVER.length ) 
     44                        ( _action.indexOf( _path ) < 0 ) ? 
     45                                _action : _action.substr( _action.indexOf( _path ) + URL_SERVER.length ) 
    5146                ); 
    5247        } 
     
    116111                                _script.add( 
    117112                                        _new_scripts[ _count ][ 2 ].substr( 
    118                                                 URL_SERVER.length - 1, 
    119                                                 _new_scripts[ _count ][ 2 ].length - URL_SERVER.length + 1 - ( 
     113                                                _path.length - 1, 
     114                                                _new_scripts[ _count ][ 2 ].length - _path.length + 1 - ( 
    120115                                                        ( _new_scripts[ _count ][ 2 ].indexOf( '?' ) < 0 ) ? 
    121116                                                                0 : ( _new_scripts[ _count ][ 2 ].length - _new_scripts[ _count ][ 2 ].indexOf( '?' ) ) 
     
    137132        function Link( ) 
    138133        { 
     134                _path = ( arguments.length && arguments[ 0 ].constructor == String ) ? arguments[ 0 ] : '/'; 
     135 
     136                if ( window.location.protocol + '//' + window.location.host + window.location.pathname != _path ) 
     137                        window.location.href = _path + ( 
     138                                ( window.location.hash ) ? 
     139                                        window.location.hash : '#' + String( window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search ).substr( _path.length ) 
     140                        ); 
     141 
     142                _loading.src = _path + 'phpgwapi/images/loading.gif'; 
     143                _connector = new XConnector; 
     144        } 
     145 
     146        Link.prototype.click = function( ) 
     147        { 
    139148                _click( arguments[ 0 ], 
    140149                        ( 
     
    143152                        ) 
    144153                ); 
    145         } 
     154        }; 
     155        Link.prototype.intercept = _intercept; 
    146156 
    147157        window.XLink = Link; 
     
    149159        XEvents.add( window, 'onload', function( ) 
    150160        { 
    151                 var _scripts = document.getElementsByTagName( 'head' ).item( 0 ).getElementsByTagName( 'script' ); 
    152                 var _loaded = [ ]; 
    153  
    154                 for ( var i = 0; i < _scripts.length; i++ ) 
    155                         if ( _scripts.item( i ).getAttribute( 'src' ) != null ) 
    156                                 _loaded[ _loaded.length ] = _scripts.item( i ).getAttribute( 'src' ).substr( 
    157                                         URL_SERVER.length - 1, 
    158                                         _scripts.item( i ).getAttribute( 'src' ).indexOf( '?' ) - URL_SERVER.length + 1 
    159                                 ); 
    160  
    161                 _script = new XScript( _loaded ); 
    162  
    163161                _divAppboxHeader = document.getElementById( 'divAppboxHeader' ); 
    164162                _divAppboxHeader.innerHTML = ''; 
    165163 
    166164                _container = document.getElementById( 'divAppbox' ); 
    167  
    168                 document.getElementsByTagName( 'body' ).item( 0 ).style.overflowY = 'scroll'; 
    169  
    170                 var _links = document.getElementsByTagName( 'a' ); 
    171                 for ( var i = 0; i < _links.length; i++ ) 
    172                         _intercept( _links.item( i ) ); 
    173165        } ); 
    174166} )( ); 
  • trunk/phpgwapi/js/tools/xscript.js

    r2642 r2703  
    11( function( ) 
    22{ 
    3         var _connector = null; 
     3        var _connector = new XConnector; 
    44        var _loaded = [ ]; 
    55        var _new = [ ]; 
     
    6565 
    6666        window.XScript = Script; 
    67  
    68         XEvents.add( window, 'onload', function( ) 
    69         { 
    70                 _connector = new XConnector; 
    71         } ); 
    7267} )( ); 
Note: See TracChangeset for help on using the changeset viewer.