Changeset 2677 for trunk/phpgwapi


Ignore:
Timestamp:
04/30/10 17:08:28 (14 years ago)
Author:
rodsouza
Message:

Ticket #1009 - Corrigindo problema de contexto.

Location:
trunk/phpgwapi
Files:
2 edited

Legend:

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

    r2648 r2677  
    393393 
    394394                                        $GLOBALS['phpgw_info']['flags']['java_script_thirst'] .= '<script type="text/javascript">' 
    395                                                 . 'var URL_SERVER = "' . $webserver_url . '";' 
     395                                                . 'var URL_SERVER = window.location.protocol + "//" + window.location.host + "' . $webserver_url . '";' 
    396396                                                . 'var template = "' . $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ] . '";</script>'; 
    397397 
     
    402402                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xscript', NULL, true ); 
    403403                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xconnector', NULL, true ); 
     404                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xml', NULL, true ); 
    404405                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xevent', NULL, true ); 
    405406                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xobject', NULL, true ); 
  • trunk/phpgwapi/js/tools/xlink.js

    r2674 r2677  
    88        var _loading = new Image( ); 
    99        _loading.src = URL_SERVER + 'phpgwapi/images/loading.gif'; 
     10 
     11        function _click( _action, _cache ) 
     12        { 
     13 
     14                if ( _action.indexOf( window.location.host ) < 0 ) 
     15                        _action = window.location.protocol + '//' + window.location.host + _action; 
     16 
     17                _divAppboxHeader.innerHTML = ''; 
     18 
     19                var _center = document.createElement( 'center' ); 
     20                _center.appendChild( _loading ); 
     21 
     22                _container.innerHTML = ''; 
     23                _container.appendChild( _center ); 
     24 
     25                _connector.go( 
     26                { 
     27                        'access' : _action, 
     28                        'cache' : _cache, 
     29                        'handler' : _handler 
     30                } ); 
     31 
     32                window.location = '#' + ( 
     33                        ( _action.indexOf( URL_SERVER ) < 0 ) ? 
     34                                _action : _action.substr( _action.indexOf( URL_SERVER ) + URL_SERVER.length ) 
     35                ); 
     36        } 
     37 
     38        function _intercept( pLink ) 
     39        { 
     40                var action = pLink.href; 
     41                if ( action == '' ) 
     42                        return false; 
     43 
     44                var a = ( action.indexOf( 'javascript:' ) === 0 ); 
     45                a = ( a || ( action.indexOf( '#' ) === 0 ) ); 
     46                a = ( a || ( action.indexOf( window.location + '#' ) === 0 ) ); 
     47                a = ( a || ! ( action.indexOf( 'workflow' ) < 0 ) ); 
     48 
     49                if ( ! a ) 
     50                        pLink.onclick = function( ) 
     51                        { 
     52                                var _cacheit = false;//( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false ); 
     53 
     54                                _click( action, _cacheit ); 
     55 
     56                                return false; 
     57                        }; 
     58        } 
    1059 
    1160        function _handler( data ) 
     
    2978                var _links = el.getElementsByTagName( 'a' ); 
    3079                for ( var i = 0; i < _links.length; i++ ) 
    31                         handler( _links.item( i ) ); 
     80                        _intercept( _links.item( i ) ); 
    3281 
    3382                _container.innerHTML = ''; 
     
    67116        } 
    68117 
    69         function handler( pLink ) 
    70         { 
    71                 var action = pLink.href; 
    72                 if ( action == '' ) 
    73                         return false; 
    74  
    75                 var a = ( action.indexOf( 'javascript:' ) === 0 ); 
    76                 a = ( a || ( action.indexOf( '#' ) === 0 ) ); 
    77                 a = ( a || ( action.indexOf( window.location + '#' ) === 0 ) ); 
    78                 a = ( a || ! ( action.indexOf( 'workflow' ) < 0 ) ); 
    79  
    80                 if ( ! a ) 
    81                         pLink.onclick = function( ) 
    82                         { 
    83                                 _divAppboxHeader.innerHTML = ''; 
    84  
    85                                 var _center = document.createElement( 'center' ); 
    86                                 _center.appendChild( _loading ); 
    87  
    88                                 _container.innerHTML = ''; 
    89                                 _container.appendChild( _center ); 
    90  
    91                                 var _cacheit = false;//( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false ); 
    92  
    93                                 _connector.go( 
    94                                 { 
    95                                         'access' : action, 
    96                                         'cache' : _cacheit, 
    97                                         'handler' : _handler 
    98                                 } ); 
    99  
    100                                 window.location = '#' + ( 
    101                                         ( action.indexOf( URL_SERVER ) < 0 ) ? 
    102                                                 action : action.substr( action.indexOf( URL_SERVER ) + URL_SERVER.length ) 
    103                                 ); 
    104  
    105                                 return false; 
    106                         }; 
    107         } 
    108  
    109118        function Link( ) 
    110119        { 
    111                 var _cacheit = false; 
    112                 if ( arguments.length > 1 && arguments[ 1 ].constructor == Boolean ) 
    113                         _cacheit = arguments[ 1 ]; 
    114  
    115                 _connector.go( 
    116                 { 
    117                         "access" : arguments[ 0 ], 
    118                         "cache" : _cacheit, 
    119                         "handler" : _handler 
    120                 } ); 
     120                _click( arguments[ 0 ], 
     121                        ( 
     122                                ( arguments.length > 1 && arguments[ 1 ].constructor == Boolean ) ? 
     123                                        arguments[ 1 ] : false 
     124                        ) 
     125                ); 
    121126        } 
    122127 
     
    146151                var _links = document.getElementsByTagName( 'a' ); 
    147152                for ( var i = 0; i < _links.length; i++ ) 
    148                         handler( _links.item( i ) ); 
     153                        _intercept( _links.item( i ) ); 
    149154        } ); 
    150155} )( ); 
Note: See TracChangeset for help on using the changeset viewer.