( function( ) { var _connector = new XConnector; var _script = null; var _container = null; var _divAppboxHeader = null; var _loading = new Image( ); _loading.src = URL_SERVER + 'phpgwapi/images/loading.gif'; function _handler( data ) { var js = data.match( /]*>.*?<\/script>/g ); var _new_scripts = [ ]; if ( js ) { var tag = /]* src="(\S+)"|[^>]*)>(.*?)<\/script>/; for ( var i = 0; i < js.length; i++ ) { var type = tag.exec( js[ i ] ); data = data.replace( "\n\t\t" + type[ 0 ], '' ); _new_scripts[ _new_scripts.length ] = type; } } var el = document.createElement( 'div' ); el.innerHTML = data; var _links = el.getElementsByTagName( 'a' ); for ( var i = 0; i < _links.length; i++ ) handler( _links.item( i ) ); _container.innerHTML = ''; while ( el.hasChildNodes( ) ) _container.appendChild( el.firstChild ); var _count = 0; function _scripts( ) { if ( _new_scripts[ _count ][ 2 ] == undefined || _new_scripts[ _count ][ 2 ].length == 0 ) _script.load( function( ) { if ( ++_count < _new_scripts.length ) _scripts( ); }, _new_scripts[ _count ][ 3 ] ); else { _script.add( _new_scripts[ _count ][ 2 ].substr( URL_SERVER.length - 1, _new_scripts[ _count ][ 2 ].indexOf( '?' ) - URL_SERVER.length + 1 ) ); if ( ++_count < _new_scripts.length ) _scripts( ); } } if ( _new_scripts.length ) { _scripts( ); _script.load( ); } } function handler( pLink ) { var action = pLink.href; if ( action == '' ) return false; var a = ( action.indexOf( 'javascript:' ) === 0 ); a = ( a || ( action.indexOf( '#' ) === 0 ) ); a = ( a || ( action.indexOf( window.location + '#' ) === 0 ) ); a = ( a || ! ( action.indexOf( 'workflow' ) < 0 ) ); if ( ! a ) pLink.onclick = function( ) { _divAppboxHeader.innerHTML = ''; var _center = document.createElement( 'center' ); _center.appendChild( _loading ); _container.innerHTML = ''; _container.appendChild( _center ); var _cacheit = true;//( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false ); _connector.go( { 'access' : action, 'cache' : _cacheit, 'handler' : _handler } ); return false; }; } function Link( ) { var _cacheit = false; if ( arguments.length > 1 && arguments[ 1 ].constructor == Boolean ) _cacheit = arguments[ 1 ]; _connector.go( { "access" : arguments[ 0 ], "cache" : _cacheit, "handler" : _handler } ); } window.XLink = Link; XEvents.add( window, 'onload', function( ) { var _scripts = document.getElementsByTagName( 'head' ).item( 0 ).getElementsByTagName( 'script' ); var _loaded = [ ]; for ( var i = 0; i < _scripts.length; i++ ) if ( _scripts.item( i ).getAttribute( 'src' ) != null ) _loaded[ _loaded.length ] = _scripts.item( i ).getAttribute( 'src' ).substr( URL_SERVER.length - 1, _scripts.item( i ).getAttribute( 'src' ).indexOf( '?' ) - URL_SERVER.length + 1 ); _script = new XScript( _loaded ); _divAppboxHeader = document.getElementById( 'divAppboxHeader' ); _divAppboxHeader.innerHTML = ''; _container = document.getElementById( 'divAppbox' ); document.getElementsByTagName( 'body' ).item( 0 ).style.overflowY = 'scroll'; var _links = document.getElementsByTagName( 'a' ); for ( var i = 0; i < _links.length; i++ ) handler( _links.item( i ) ); } ); } )( );