Changeset 2712 for trunk/phpgwapi


Ignore:
Timestamp:
05/05/10 15:52:35 (14 years ago)
Author:
rodsouza
Message:

Ticket #1058 - Adaptando todo o expressoAdmin1_2 para não realizar reload.

Location:
trunk/phpgwapi
Files:
5 edited

Legend:

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

    r2704 r2712  
    2727                ); 
    2828        } 
     29 
     30        function lang( $param ) 
     31        { 
     32                $lang = ( array_key_exists( 'lang', $param ) ) ? $param[ 'lang' ] : false; 
     33                $module = ( array_key_exists( 'module', $param ) ) ? $param[ 'module' ] : false; 
     34 
     35                if ( ! ( $lang && $module ) ) 
     36                        return '{}'; 
     37 
     38                $array_keys = array( ); 
     39                $fn = dirname( __FILE__ ) . "/../../{$module}/setup/phpgw_{$lang}.lang"; 
     40                $lang = array( ); 
     41 
     42                if ( file_exists( $fn ) ) 
     43                { 
     44                        $fp = fopen( $fn, 'r' ); 
     45                        while ( $data = fgets( $fp, 16000 ) ) 
     46                        { 
     47                                list( $message_id, $app_name, $null, $content ) = explode( "\t", substr( $data, 0, -1 ) ); 
     48                                $lang[ ] = '"' . str_replace( '"', '\"', strtolower( $message_id ) ) . '" : "' . str_replace( '"', '\"', $content ) . '"'; 
     49                        } 
     50                        fclose( $fp ); 
     51                } 
     52 
     53                return '{' . implode( ",\n", $lang ) . '}'; 
     54        } 
    2955} 
    3056 
  • trunk/phpgwapi/js/expressolivre/expressolivre.js

    r2707 r2712  
    66        var _xlink = null; 
    77 
     8        window.array_lang = [ ]; 
     9 
     10        var _language = [ ] 
     11 
    812        function _go( ) 
    913        { 
    1014                _xconnector.go.apply( _xconnector, arguments ); 
     15        } 
     16 
     17        function _lang( ) 
     18        { 
     19                if ( ! ( arguments.length && arguments[ 0 ].constructor == String ) ) 
     20                        return false; 
     21 
     22                var module = arguments[ 0 ]; 
     23                var lang = document.getElementsByTagName( 'html' ).item( 0 ).getAttribute( 'xml:lang' ); 
     24 
     25                _xconnector.go( { 
     26                        'access' : 'phpgwapi.expressolivre.lang&lang=' + lang + '&module=' + module, 
     27                        'handler' : function( data ) 
     28                        { 
     29                                data = data.JSON( ); 
     30                                for ( var key in data ) 
     31                                        window.array_lang[ key ] = _language[ key ] = data[ key ]; 
     32                        } 
     33                } ); 
    1134        } 
    1235 
     
    3154        } 
    3255 
     56        function _translate( ) 
     57        { 
     58                if ( ! ( arguments.length && arguments[ 0 ].constructor == String ) ) 
     59                        return false; 
     60 
     61                var _phrase = arguments[ 0 ]; 
     62 
     63                if ( _language[ _phrase.toLowerCase( ) ] ) 
     64                        return _language[ _phrase.toLowerCase( ) ]; 
     65                else 
     66                        return _phrase + '*'; 
     67        } 
     68 
    3369        function _ExpressoLivre( ) 
    3470        { 
     
    3672                { 
    3773                        this.go = _go; 
     74                        this.lang = _lang; 
    3875                        this.link = _link; 
    3976                        this.path = _path; 
    4077                        this.theme = _theme; 
    4178                        this.template = _template; 
     79                        this.translate = _translate; 
    4280                } ); 
    4381        } 
  • trunk/phpgwapi/js/tools/xconnector.js

    r2685 r2712  
    218218                        '_ACCESS'       : _argv.access, 
    219219                        '_HANDLER'      : { }, 
    220                         '_POST'         : ( ( _argv.post ) ? _argv.post : false ),  // [GET | POST] 
     220                        '_POST'         : ( ( _argv.post && _argv.post != null ) ? _argv.post : false ),  // [GET | POST] 
    221221                        '_MODE'         : 'TEXT', // [XML | TEXT] 
    222222                        '_TYPE'         : null, // [4 for request | 3 for stream] 
  • trunk/phpgwapi/js/tools/xlink.js

    r2710 r2712  
    1717                        _action = window.location.protocol + '//' + window.location.host + _action; 
    1818 
    19                 if ( _action == _last_request ) 
     19                var _post = ( arguments.length == 3 && arguments[ 2 ] && arguments[ 2 ].constructor == String ) ? arguments[ 2 ] : null; 
     20 
     21                if ( _post == null && _action == _last_request ) 
    2022                        return false; 
    2123 
     
    3638                        'access' : _action, 
    3739                        'cache' : _cache, 
    38                         'handler' : _handler 
     40                        'handler' : _handler, 
     41                        'post' : _post 
    3942                } ); 
    4043 
     
    148151                _click( arguments[ 0 ], 
    149152                        ( 
    150                                 ( arguments.length > 1 && arguments[ 1 ].constructor == Boolean ) ? 
     153                                ( arguments.length > 1 && arguments[ 1 ] && arguments[ 1 ].constructor == Boolean ) ? 
    151154                                        arguments[ 1 ] : false 
     155                        ), 
     156                        ( 
     157                                ( arguments.length > 2 && arguments[ 2 ] && arguments[ 2 ].constructor == String ) ? 
     158                                        arguments[ 2 ] : null 
    152159                        ) 
    153160                ); 
  • trunk/phpgwapi/js/tools/xobject.js

    r2665 r2712  
    2121        String.prototype.trim = function( ) 
    2222        { 
    23                 return this.replace( /^ +| +$/g, '' ); 
     23                return this.replace( /^\s+|\s+$/g, '' ); 
    2424        }; 
    2525 
Note: See TracChangeset for help on using the changeset viewer.