Ignore:
Timestamp:
04/15/10 15:26:02 (14 years ago)
Author:
rodsouza
Message:

Ticket #1009 - Corrigindo problemas com a inclusão de javascript.

File:
1 edited

Legend:

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

    r2547 r2549  
    4949                * @var array list of validated files to be included in the head section of a page 
    5050                */ 
    51                 var $files; 
     51                private $files = array( ); 
    5252 
    5353                /** 
     
    153153                                                                                $links .= '<script type="text/javascript" src="' 
    154154                                                                                        . $GLOBALS['phpgw_info']['server']['webserver_url'] 
    155                                                                                         . "/$app/js/$pkg/$file" . '.js">' 
     155                                                                                        . "/$app/js/$pkg/$file" . '.js?' . microtime( true ) . '">' 
    156156                                                                                        . "</script>\n"; 
    157157                                                                        } 
     158 
     159                                                                        $this -> unset_script_link( $app, $pkg, $file ); 
    158160                                                                } 
    159161                                                        } 
     
    223225                * @returns bool was the file found? 
    224226                */ 
    225                 function validate_file($package, $file, $app='phpgwapi') 
    226                 { 
    227                         if(is_readable(PHPGW_INCLUDE_ROOT .SEP .$app .SEP .'js' .SEP . $package .SEP. $file . '.js')) 
    228                         { 
    229                                 $this->files[$app][$package][$file] = $file; 
    230                                 return True; 
    231                         } 
    232                         elseif($app != 'phpgwapi') 
    233                         { 
    234                                 if(is_readable(PHPGW_INCLUDE_ROOT .SEP .'phpgwapi' .SEP .'js' .SEP . $package .SEP . $file . '.js')) 
    235                                 { 
    236                                         $this->files['phpgwapi'][$package][$file] = $file; 
    237                                         return True; 
    238                                 } 
    239                                 return False; 
    240                         } 
     227                function validate_file( $package, $file, $app = NULL, $stack = false ) 
     228                { 
     229                        if ( $app == NULL ) 
     230                                $app = 'phpgwapi'; 
     231 
     232                        $_file = PHPGW_INCLUDE_ROOT . SEP . $app . SEP . 'js' . SEP . $package . SEP. $file . '.js'; 
     233                        if ( is_readable( $_file ) ) 
     234                        { 
     235                                unset( $_file ); 
     236 
     237                                if ( ! array_key_exists( $app, $this -> files ) ) 
     238                                        $this -> files[ $app ] = array( ); 
     239 
     240                                if ( ! array_key_exists( $package, $this -> files[ $app ] ) ) 
     241                                        $this -> files[ $app ][ $package ] = array( ); 
     242 
     243                                if ( $stack ) 
     244                                        $this -> files[ $app ][ $package ] = array_merge( array( $file => $file ), $this -> files[ $app ][ $package ] ); 
     245                                else 
     246                                        $this -> files[ $app ][ $package ][ $file ] = $file; 
     247 
     248                                return true; 
     249                        } 
     250                        return false; 
    241251                } 
    242252        } 
Note: See TracChangeset for help on using the changeset viewer.