Changeset 2269


Ignore:
Timestamp:
03/16/10 17:05:04 (14 years ago)
Author:
rodsouza
Message:

Ticket #987 - Carregar personalização de tema por módulo

File:
1 edited

Legend:

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

    r2169 r2269  
    12771277 
    12781278                        // search for app specific css file 
    1279                         if(@isset($GLOBALS['phpgw_info']['flags']['currentapp'])) 
    1280                         { 
    1281                                 $appname = $GLOBALS['phpgw_info']['flags']['currentapp']; 
    1282  
    1283                                 if(file_exists(PHPGW_SERVER_ROOT . SEP . $appname . SEP 
    1284                                         . 'templates' . SEP . $GLOBALS['phpgw_info']['server']['template_set'] 
    1285                                         . SEP . 'app.css') 
    1286                                 ) 
    1287                                 { 
    1288                                         $tpl->set_var('css_file', '<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'] 
    1289                                                 . "/$appname/templates/".$GLOBALS['phpgw_info']['server']['template_set'] 
    1290                                                 . "/app.css".'" type=text/css rel=StyleSheet>'); 
    1291                                 } 
    1292                                 elseif(file_exists(PHPGW_SERVER_ROOT . SEP . $appname . SEP 
    1293                                         . 'templates' . SEP . 'default' 
    1294                                         . SEP . 'app.css') 
    1295                                 ) 
    1296                                 { 
    1297                                         $tpl->set_var('css_file', '<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'] 
    1298                                         ."/$appname/templates/default/app.css".'" type=text/css rel=StyleSheet>'); 
    1299                                 } 
    1300                         } 
    1301  
    1302                         return $tpl->subst('css'); 
     1279                        if ( @ isset( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ] ) ) 
     1280                        { 
     1281                                $css = "/{$GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ]}/templates/%s/%s.css"; 
     1282 
     1283                                global $path, $link, $template; 
     1284 
     1285                                $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css ); 
     1286 
     1287                                $link = '<LINK href="%s" type="text/css" rel="StyleSheet">'; 
     1288                                $link = sprintf( $link, 
     1289                                        "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}" 
     1290                                ); 
     1291 
     1292                                $template = $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ]; 
     1293 
     1294                                function _css( $css ) 
     1295                                { 
     1296                                        global $link, $path, $template; 
     1297                                        if ( file_exists( sprintf( $path, $template, str_replace( '/', SEP, $css ) ) ) ) 
     1298                                                return sprintf( $link, $template, $css ); 
     1299 
     1300                                        if ( file_exists( sprintf( $path, 'default', str_replace( '/', SEP, $css ) ) ) ) 
     1301                                                return sprintf( $link, 'default', $css ); 
     1302 
     1303                                        return ''; 
     1304                                } 
     1305 
     1306                                $css = _css( 'app' ); 
     1307                                $css .= _css( "css/{$GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'theme' ]}" ); 
     1308 
     1309                                if ( $css ) 
     1310                                        $tpl -> set_var( 'css_file', $css ); 
     1311                        } 
     1312 
     1313                        return $tpl -> subst('css'); 
    13031314                } 
    13041315 
Note: See TracChangeset for help on using the changeset viewer.