Changeset 2383 for branches/2.0


Ignore:
Timestamp:
03/30/10 12:02:44 (14 years ago)
Author:
rodsouza
Message:

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

Location:
branches/2.0/phpgwapi
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/phpgwapi/inc/class.common.inc.php

    r1414 r2383  
    12431243                * @author Dave Hall (*based* on verdilak? css inclusion code) 
    12441244                */ 
    1245                 function get_css() 
     1245                function get_css( ) 
    12461246                { 
    12471247                        $tpl = createObject('phpgwapi.Template', $this->get_tpl_dir('phpgwapi')); 
     
    12651265 
    12661266                        // search for app specific css file 
    1267                         if(@isset($GLOBALS['phpgw_info']['flags']['currentapp'])) 
    1268                         { 
    1269                                 $appname = $GLOBALS['phpgw_info']['flags']['currentapp']; 
    1270  
    1271                                 if(file_exists(PHPGW_SERVER_ROOT . SEP . $appname . SEP 
    1272                                         . 'templates' . SEP . $GLOBALS['phpgw_info']['server']['template_set'] 
    1273                                         . SEP . 'app.css') 
    1274                                 ) 
    1275                                 { 
    1276                                         $tpl->set_var('css_file', '<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'] 
    1277                                                 . "/$appname/templates/".$GLOBALS['phpgw_info']['server']['template_set'] 
    1278                                                 . "/app.css".'" type=text/css rel=StyleSheet>'); 
    1279                                 } 
    1280                                 elseif(file_exists(PHPGW_SERVER_ROOT . SEP . $appname . SEP 
    1281                                         . 'templates' . SEP . 'default' 
    1282                                         . SEP . 'app.css') 
    1283                                 ) 
    1284                                 { 
    1285                                         $tpl->set_var('css_file', '<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'] 
    1286                                         ."/$appname/templates/default/app.css".'" type=text/css rel=StyleSheet>'); 
    1287                                 } 
    1288                         } 
    1289  
    1290                         return $tpl->subst('css'); 
     1267                        if ( @ isset( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ] ) ) 
     1268                        { 
     1269                                $css = "/%s/templates/%s/%s.css"; 
     1270 
     1271                                global $path, $link, $template; 
     1272 
     1273                                $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css ); 
     1274 
     1275                                $link = '<LINK href="%s" type="text/css" rel="StyleSheet">'; 
     1276                                $link = sprintf( $link, 
     1277                                        "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}" 
     1278                                ); 
     1279 
     1280                                $template = $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'template_set' ]; 
     1281 
     1282                                function _css( $module, $css ) 
     1283                                { 
     1284                                        global $link, $path, $template; 
     1285 
     1286                                        if ( file_exists( sprintf( $path, $module, $template, str_replace( '/', SEP, $css ) ) ) ) 
     1287                                                return sprintf( $link, $module, $template, $css ); 
     1288 
     1289                                        if ( file_exists( sprintf( $path, $module, 'default', str_replace( '/', SEP, $css ) ) ) ) 
     1290                                                return sprintf( $link, $module, 'default', $css ); 
     1291 
     1292                                        return ''; 
     1293                                } 
     1294 
     1295                                $css = _css( 'phpgwapi', 'css/base' ); 
     1296                                $css .= _css( 'phpgwapi', "css/{$GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'theme' ]}" ); 
     1297                                $css .= _css( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ], "css/{$GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'theme' ]}" ); 
     1298                                $css .= _css( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ], 'app' ); 
     1299 
     1300                                if ( $css ) 
     1301                                        $tpl -> set_var( 'css_file', $css ); 
     1302                        } 
     1303 
     1304                        return $tpl -> subst('css'); 
    12911305                } 
    12921306 
  • branches/2.0/phpgwapi/templates/classic/head.tpl

    r1151 r2383  
    1313                <link rel="icon" href="{img_icon}" type="image/x-ico" /> 
    1414                <link rel="shortcut icon" href="{img_shortcut}" /> 
    15                 <link href="{theme_css}" title="eGroupWareStyle" type="text/css" rel="StyleSheet"/> 
    1615                <META http-equiv="Default-Style" content="eGroupWareStyle"> 
    1716                {slider_effects} 
  • branches/2.0/phpgwapi/templates/default/head.inc.php

    r890 r2383  
    3333 
    3434        #_debug_array($GLOBALS['phpgw_info']['user']['preferences']['common']); 
    35         $theme_css = ".".$GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'].'.css'; 
    36         if(!file_exists($theme_css)) 
    37         { 
    38                 $theme_css = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'].'.css'; 
    39         } 
    4035 
    4136        //pngfix defaults to yes 
     
    9489                'website_title' => $GLOBALS['phpgw_info']['server']['site_title'].$app, 
    9590                'body_tags'     => $bodyheader .' '. $GLOBALS['phpgw']->common->get_body_attribs(), 
    96                 'theme_css'     => $theme_css, 
    9791                'css'           => $GLOBALS['phpgw']->common->get_css(), 
    9892                'java_script'   => $GLOBALS['phpgw']->common->get_java_script(), 
  • branches/2.0/phpgwapi/templates/default/head.tpl

    r1247 r2383  
    1313                <link rel="icon" href="{img_icon}" type="image/x-ico" /> 
    1414                <link rel="shortcut icon" href="{img_shortcut}" /> 
    15                 <link href="{theme_css}" title="eGroupWareStyle" type="text/css" rel="StyleSheet"/> 
    1615                <META http-equiv="Default-Style" content="eGroupWareStyle"> 
    1716                {slider_effects} 
Note: See TracChangeset for help on using the changeset viewer.