Changeset 2628 for trunk/phpgwapi
- Timestamp:
- 04/26/10 16:03:33 (14 years ago)
- Location:
- trunk/phpgwapi
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.common.inc.php
r2623 r2628 394 394 $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'dom', NULL, true ); 395 395 $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xlink', NULL, true ); 396 $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xscript', NULL, true ); 396 397 $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xconnector', NULL, true ); 397 398 $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'tools','xevent', NULL, true ); -
trunk/phpgwapi/inc/class.javascript.inc.php
r2623 r2628 145 145 else 146 146 { 147 $_script = '<script type="text/javascript" src="%s/%s/js/%s/%s.js?%d"> </script>';148 $links .= "\n\t\t" . sprintf( $_script, $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ], $app, $pkg, $file, filemtime( $jsFilePath ) );147 $_script = '<script type="text/javascript" src="%s/%s/js/%s/%s.js?%d">/* %s */</script>'; 148 $links .= "\n\t\t" . sprintf( $_script, $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ], $app, $pkg, $file, filemtime( $jsFilePath ), $file ); 149 149 } 150 150 … … 262 262 return true; 263 263 } 264 error_log( $_file . "\n\n", 3, '/tmp/log' );265 264 return false; 265 } 266 267 function get_source( $param ) 268 { 269 $source = ''; 270 foreach( explode( ';', $param[ 'source' ] ) as $script ) 271 $source .= file_get_contents( realpath( dirname( __FILE__ ) . '/../..' ) . $script ); 272 273 echo $source; 274 exit; 266 275 } 267 276 } -
trunk/phpgwapi/js/tools/xconnector.js
r2601 r2628 100 100 } 101 101 102 if ( _THREADS[ _ID ]._CACHE ) 103 this._CACHED[ _ID ] = _data; 104 102 105 delete _THREADS[ _ID ]; 103 106 … … 105 108 try 106 109 { 107 if ( this._cache )108 {109 this._CACHED[ _ID ] = _data;110 this._cache = false;111 }112 113 110 _request( _data ); 114 111 } … … 228 225 '_MODE' : 'TEXT', // [XML | TEXT] 229 226 '_TYPE' : null, // [4 for request | 3 for stream] 230 '_XHR' : null // [4 for request | 3 for stream] 227 '_XHR' : null, // [4 for request | 3 for stream] 228 '_CACHE' : ( ( _argv.cache && _argv.cache === true ) ? true : false ) 231 229 }; 232 230 233 231 if ( _argv.mode && ( _argv.mode == 'XML' || _argv.mode == 'TEXT' ) ) 234 _THREADS[ _ID ] = _argv.mode;232 _THREADS[ _ID ]._MODE = _argv.mode; 235 233 236 234 if ( _argv.handler ) … … 256 254 } 257 255 258 if ( this._cache && this._CACHED[ _ID ] ) 259 { 260 this._cache = false; 256 if ( _THREADS[ _ID ]._CACHE && this._CACHED[ _ID ] ) 257 { 261 258 if ( _THREADS[ _ID ]._HANDLER.request ) 262 259 _THREADS[ _ID ]._HANDLER.request( this._CACHED[ _ID ] ); … … 302 299 this._CONTROLLER = ''; 303 300 304 this._cache = false;305 306 301 this._CACHED = [ ]; 307 302 … … 333 328 Connector.prototype.cache = function( ) 334 329 { 335 _cache = true;336 337 if ( arguments.length == 1 && arguments[ 0 ].constructor == Boolean )338 _cache = arguments[ 0 ];339 340 this._cache = _cache;341 342 330 return this; 343 331 }; -
trunk/phpgwapi/js/tools/xlink.js
r2601 r2628 1 1 ( function( ) 2 2 { 3 var _connector = new XConnector; 3 var _connector = null; 4 var _script = null; 5 4 6 var _container = null; 5 7 var _divAppboxHeader = null; … … 23 25 _divAppboxHeader.innerHTML = ''; 24 26 27 var _center = document.createElement( 'center' ); 28 _center.appendChild( _loading ); 29 25 30 _container.innerHTML = ''; 26 _container.appendChild( _ loading);31 _container.appendChild( _center ); 27 32 28 var _cacheit = ( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false );33 var _cacheit = true;//( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false ); 29 34 30 var request = _connector. cache( _cacheit ).go( {35 var request = _connector.go( { 31 36 'access' : action, 37 'cache' : _cacheit, 32 38 'handler' : function( data ) 33 39 { 40 var js = data.match( /<script[^>]*>.*?<\/script>/g ); 41 var _new_scripts = [ ]; 42 if ( js ) 43 { 44 var tag = /<script([^>]* src="(\S+)"|[^>]*)>(.*?)<\/script>/; 45 for ( var i = 0; i < js.length; i++ ) 46 { 47 var type = tag.exec( js[ i ] ); 48 data = data.replace( "\n\t\t" + type[ 0 ], '' ); 49 _new_scripts[ _new_scripts.length ] = type; 50 } 51 } 52 34 53 var el = document.createElement( 'div' ); 35 54 el.innerHTML = data; … … 39 58 handler( _links.item( i ) ); 40 59 41 var _head = document.getElementsByTagName( 'head' ).item( 0 );42 var _loaded = _head.getElementsByTagName( 'script' );43 var _scripts = el.getElementsByTagName( 'script' );44 var _new_scripts = [ ];45 46 while ( _scripts.length )47 _new_scripts[ _new_scripts.length ] = el.removeChild( _scripts.item( 0 ) );48 49 60 _container.innerHTML = ''; 50 61 while ( el.hasChildNodes( ) ) 51 62 _container.appendChild( el.firstChild ); 52 63 53 fix : for ( var i = 0; i < _new_scripts.length; i++ ) 64 var _inline = [ ]; 65 for ( var i = 0; i < _new_scripts.length; i++ ) 66 if ( _new_scripts[ i ][ 2 ] == undefined || _new_scripts[ i ][ 2 ].length == 0 ) 67 _inline[ _inline.length ] = _new_scripts[ i ][ 3 ]; 68 else 69 _script.add( _new_scripts[ i ][ 2 ].substr( 70 URL_SERVER.length, 71 _new_scripts[ i ][ 2 ].indexOf( '?' ) - URL_SERVER.length 72 ) ); 73 74 var _it_has_loaded = _script.load( function( ) 54 75 { 55 var _script = _new_scripts[ i ]; 56 if ( _script.getAttribute( 'src' ) == null ) 57 { 58 _container.appendChild( _script ); 59 continue; 60 } 61 else 62 { 63 for ( var j = 0; j < _loaded.length; j++ ) 64 if ( _script.getAttribute( 'src' ) === _loaded.item( j ).getAttribute( 'src' ) ) 65 continue fix; 76 if ( _inline.length ) 77 window.eval( _inline.join( '' ) ); 78 } ); 66 79 67 _head.appendChild( _script ); 68 } 69 } 80 if ( ! _it_has_loaded && _inline.length ) 81 window.eval( _inline.join( '' ) ); 70 82 } 71 83 } ); … … 76 88 XEvents.add( window, 'onload', function( ) 77 89 { 78 var _center = document.createElement( 'center' ); 79 _center.appendChild( _loading ); 90 var _scripts = document.getElementsByTagName( 'head' ).item( 0 ).getElementsByTagName( 'script' ); 91 var _loaded = [ ]; 92 93 for ( var i = 0; i < _scripts.length; i++ ) 94 if ( _scripts.item( i ).getAttribute( 'src' ) != null ) 95 _loaded[ _loaded.length ] = _scripts.item( i ).getAttribute( 'src' ).substr( 96 URL_SERVER.length, 97 _scripts.item( i ).getAttribute( 'src' ).indexOf( '?' ) - URL_SERVER.length 98 ); 99 100 _connector = new XConnector; 101 _script = new XScript( _loaded ); 80 102 81 103 _divAppboxHeader = document.getElementById( 'divAppboxHeader' ); … … 83 105 84 106 _container = document.getElementById( 'divAppbox' ); 85 _loading = _center;86 107 87 108 document.getElementsByTagName( 'body' ).item( 0 ).style.overflowY = 'scroll'; -
trunk/phpgwapi/templates/default/head.inc.php
r2623 r2628 28 28 . "<![endif]-->\n"; 29 29 30 error_log( var_export($GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode',30 $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 31 31 ( ( ! $GLOBALS['phpgw_info']['user']['preferences']['common']['disable_slider_effects'] ) ? 'slidereffects' : 'simple_show_hide' ), 32 'phpgwapi/templates/' . $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ], true ) , true ) . "\n\n" , 3, '/tmp/log' );32 'phpgwapi/templates/' . $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ], true ); 33 33 34 34 $bodyheader = ' bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color']
Note: See TracChangeset
for help on using the changeset viewer.