From 7389a7a2cb2b1ed7f9b0f4f614dd5c95e4a6fe69 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 17 Dec 2006 13:14:16 +0000 Subject: [PATCH] some more refracturing of the template code --- phpgwapi/inc/class.egw_framework.inc.php | 87 +++++++-------- phpgwapi/templates/default/css.tpl | 23 ---- phpgwapi/templates/default/head.tpl | 7 +- phpgwapi/templates/default/navbar.tpl | 102 ++++++++---------- .../idots/class.idots_framework.inc.php | 36 ++++--- phpgwapi/templates/idots/css/idots.css | 83 +++++++------- phpgwapi/templates/jerryr/css/jerryr.css | 82 +++++++------- 7 files changed, 187 insertions(+), 233 deletions(-) delete mode 100755 phpgwapi/templates/default/css.tpl diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index bca0878ffa..c54e442b47 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -140,7 +140,6 @@ class egw_framework { $var = Array( 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/images', - 'table_bg_color' => $GLOBALS['egw_info']['theme']['navbar_bg'], 'version' => $GLOBALS['egw_info']['server']['versions']['phpgwapi'] ); if($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) @@ -200,24 +199,6 @@ class egw_framework // get used language code $lang_code = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; - $bodyheader = ' bgcolor="' . $GLOBALS['egw_info']['theme']['bg_color'] . '" alink="' - . $GLOBALS['egw_info']['theme']['alink'] . '" link="' . $GLOBALS['egw_info']['theme']['link'] . '" vlink="' - . $GLOBALS['egw_info']['theme']['vlink'] . '"'; - - if(!$GLOBALS['egw_info']['server']['htmlcompliant']) - { - $bodyheader .= ''; - } - - #_debug_array($GLOBALS['egw_info']['user']['preferences']['common']); - $theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; - if(!file_exists(EGW_SERVER_ROOT.$theme_css)) - { - $theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$this->template.'.css'; - } - $theme_css = $GLOBALS['egw_info']['server']['webserver_url'] . $theme_css; - $print_css = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/print.css'; - //pngfix defaults to yes if(!$GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix']) { @@ -254,7 +235,7 @@ class egw_framework if($app!='wiki') $robots =''; - return array( + return $this->_get_css()+array( 'img_icon' => EGW_IMAGES_DIR . '/favicon.ico', 'img_shortcut' => EGW_IMAGES_DIR . '/favicon.ico', 'pngfix' => $pngfix, @@ -262,13 +243,9 @@ class egw_framework 'simple_show_hide' => $simple_show_hide, 'lang_code' => $lang_code, 'charset' => $GLOBALS['egw']->translation->charset(), - 'font_family' => $GLOBALS['egw_info']['theme']['font'], 'website_title' => strip_tags($GLOBALS['egw_info']['server']['site_title']. ($app ? " [$app]" : '')), - 'body_tags' => $bodyheader .' '. $GLOBALS['egw']->common->get_body_attribs(), - 'theme_css' => $theme_css, - 'print_css' => $print_css, - 'css' => $GLOBALS['egw']->common->get_css(), - 'java_script' => $GLOBALS['egw']->common->get_java_script(), + 'body_tags' => $this->_get_body_attribs(), + 'java_script' => $this->_get_js(), 'meta_robots' => $robots, 'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"', ); @@ -284,7 +261,6 @@ class egw_framework function _get_navbar($apps) { $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/images'; - $var['table_bg_color'] = $GLOBALS['egw_info']['theme']['navbar_bg']; if(isset($GLOBALS['egw_info']['flags']['app_header'])) { @@ -491,18 +467,17 @@ class egw_framework /** * Used by template headers for including CSS in the header * - * This first loads up the basic global CSS definitions, which support - * the selected user theme colors. Next we load up the app CSS. This is - * all merged into the selected theme's css.tpl file. - * + * 'app_css' - css styles from a) the menuaction's css-method and b) the $GLOBALS['egw_info']['flags']['css'] + * 'file_css' - link tag of the app.css file of the current app + * 'theme_css' - url of the theme css file + * 'print_css' - url of the print css file + * * @internal PHP5 protected * @author Dave Hall (*based* on verdilak? css inclusion code) + * @return array with keys 'app_css' from the css method of the menuaction-class and 'file_css' (app.css file of the application) */ function _get_css() { - $tpl =& CreateObject('phpgwapi.Template', common::get_tpl_dir('phpgwapi')); - $tpl->set_file('css', 'css.tpl'); - $tpl->set_var($GLOBALS['egw_info']['theme']); $app_css = ''; if(isset($_GET['menuaction'])) { @@ -517,32 +492,46 @@ class egw_framework { $app_css .= $GLOBALS['egw_info']['flags']['css']; } - $tpl->set_var('app_css', $app_css); // search for app specific css file if(@isset($GLOBALS['egw_info']['flags']['currentapp'])) { $appname = $GLOBALS['egw_info']['flags']['currentapp']; - if(file_exists(EGW_SERVER_ROOT . SEP . $appname . SEP - . 'templates' . SEP . $GLOBALS['egw_info']['server']['template_set'] - . SEP . 'app.css') - ) + $css_file = '/'.$appname.'/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/app.css'; + if (!file_exists(EGW_SERVER_ROOT.$css_file)) { - $tpl->set_var('css_file', ''); + $css_file = '/'.$appname.'/templates/default/app.css'; + + if (!file_exists(EGW_SERVER_ROOT.$css_file)) $css_file = ''; } - elseif(file_exists(EGW_SERVER_ROOT . SEP . $appname . SEP - . 'templates' . SEP . 'default' - . SEP . 'app.css') - ) + if($css_file) { - $tpl->set_var('css_file', ''); + $css_file = ''; } } - return $tpl->subst('css'); + #_debug_array($GLOBALS['egw_info']['user']['preferences']['common']); + $theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; + if(!file_exists(EGW_SERVER_ROOT.$theme_css)) + { + $theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$this->template.'.css'; + } + $theme_css = $GLOBALS['egw_info']['server']['webserver_url'] . $theme_css .'?'.filemtime(EGW_SERVER_ROOT.$theme_css); + + $print_css = '/phpgwapi/templates/'.$this->template.'/print.css'; + if(!file_exists(EGW_SERVER_ROOT.$theme_css)) + { + $print_css = '/phpgwapi/templates/idots/print.css'; + } + $print_css = $GLOBALS['egw_info']['server']['webserver_url'] . $print_css .'?'.filemtime(EGW_SERVER_ROOT.$print_css); + + return array( + 'app_css' => $app_css, + 'css_file' => $css_file, + 'theme_css' => $theme_css, + 'print_css' => $print_css, + ); } /** diff --git a/phpgwapi/templates/default/css.tpl b/phpgwapi/templates/default/css.tpl deleted file mode 100755 index dbb71e3e23..0000000000 --- a/phpgwapi/templates/default/css.tpl +++ /dev/null @@ -1,23 +0,0 @@ - -{css_file} diff --git a/phpgwapi/templates/default/head.tpl b/phpgwapi/templates/default/head.tpl index 84d5cfd643..245714deb3 100644 --- a/phpgwapi/templates/default/head.tpl +++ b/phpgwapi/templates/default/head.tpl @@ -4,7 +4,7 @@ {website_title} - + @@ -17,7 +17,10 @@ {slider_effects} {simple_show_hide} {pngfix} - {css} + + {css_file} {java_script} diff --git a/phpgwapi/templates/default/navbar.tpl b/phpgwapi/templates/default/navbar.tpl index 0d55fcbefb..9eee576df5 100644 --- a/phpgwapi/templates/default/navbar.tpl +++ b/phpgwapi/templates/default/navbar.tpl @@ -1,12 +1,37 @@ -{app_extra_icons_div} + + + +
@@ -16,14 +41,22 @@ -{app_icons} + + + + + + -{app_titles} + + +
{title} + +
{title}
-{app_extra_icons_icon}
@@ -35,21 +68,6 @@ - -
  • {title}
  • - - - - - {title} - - - - - {title} - - -
    @@ -108,15 +126,6 @@ - -
    -
    -
    - -
    - - - {icon_or_star}{lang_item} @@ -145,37 +154,16 @@ - - - - + +
    + + + - - - {title} - {title} - - - - - - - diff --git a/phpgwapi/templates/idots/class.idots_framework.inc.php b/phpgwapi/templates/idots/class.idots_framework.inc.php index 425021d652..17a7f524b0 100644 --- a/phpgwapi/templates/idots/class.idots_framework.inc.php +++ b/phpgwapi/templates/idots/class.idots_framework.inc.php @@ -69,9 +69,11 @@ class idots_framework extends egw_framework $this->tpl->set_block('_head','head'); $this->tpl->set_var($this->_get_header()); - + $content .= $this->tpl->fp('out','head'); + $this->sidebox_content = ''; // need to be emptied here, as the object get's stored in the session + return $content; } @@ -85,7 +87,6 @@ class idots_framework extends egw_framework // the navbar $this->tpl->set_file(array('navbar' => 'navbar.tpl')); - $this->tpl->set_block('navbar','navbar_header','navbar_header'); $this->tpl->set_block('navbar','extra_blocks_header','extra_block_header'); $this->tpl->set_block('navbar','extra_block_row','extra_block_row'); $this->tpl->set_block('navbar','extra_block_row_raw','extra_block_row_raw'); @@ -96,10 +97,15 @@ class idots_framework extends egw_framework $this->tpl->set_block('navbar','sidebox_hide_footer','sidebox_hide_footer'); $this->tpl->set_block('navbar','appbox','appbox'); $this->tpl->set_block('navbar','navbar_footer','navbar_footer'); - $this->tpl->set_block('navbar','app_icon_block','app_icon_block'); - $this->tpl->set_block('navbar','app_title_block','app_title_block'); - $this->tpl->set_block('navbar','app_extra_block','app_extra_block'); - $this->tpl->set_block('navbar','upper_tab_block','upper_tab_block'); + + $this->tpl->set_block('navbar','upper_tab_block','upper_tabs'); + $this->tpl->set_block('navbar','app_icon_block','app_icons'); + $this->tpl->set_block('navbar','app_title_block','app_titles'); + $this->tpl->set_block('navbar','app_extra_block','app_extra_icons'); + $this->tpl->set_block('navbar','app_extra_icons_div'); + $this->tpl->set_block('navbar','app_extra_icons_icon'); + + $this->tpl->set_block('navbar','navbar_header','navbar_header'); $apps = $this->_get_navbar_apps(); $vars = $this->_get_navbar($apps); @@ -262,18 +268,22 @@ class idots_framework extends egw_framework } else // generate extra icon layer shows icons and/or text { - if($i == $max_icons) - { - $var['lang_close'] = lang('Close'); - $var['lang_show_more_apps'] = lang('show_more_apps'); - $this->tpl->set_block('navbar','app_extra_icons_div','app_extra_icons_div'); - $this->tpl->set_block('navbar','app_extra_icons_icon','app_extra_icons_icon'); - } $this->tpl->fp('app_extra_icons','app_extra_block',true); } $i++; } } + // settings for the extra icons dif + if ($i < $max_icons) // no extra icon div + { + $this->tpl->set_var('app_extra_icons_div',''); + $this->tpl->set_var('app_extra_icons_icon',''); + } + else + { + $var['lang_close'] = lang('Close'); + $var['lang_show_more_apps'] = lang('show_more_apps'); + } if ($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no' && $GLOBALS['egw_info']['user']['userid'] != 'anonymous') { diff --git a/phpgwapi/templates/idots/css/idots.css b/phpgwapi/templates/idots/css/idots.css index dfb0497743..cf716c91cf 100755 --- a/phpgwapi/templates/idots/css/idots.css +++ b/phpgwapi/templates/idots/css/idots.css @@ -332,54 +332,47 @@ body { border-right:solid 1px #9c9c9c; } - - -/* - this must move to the filemanager app -*/ - -#fmStatusBar -{ - margin-left:4px; - margin-bottom:3px; -} - -.fmButton -{ - background-repeat: no-repeat; - background-image:url(../images/buttonbackground.png); - width:28px; - height:28px; -} - -#fmLocation -{ - position:relative; - margin-bottom:3px; - height:27px; -} - -#fmMenu -{ - position:relative; -} - -#fmFileWindow -{ - background-color:#ffffff; - margin-left:4px; - padding:5px; - position:relative; - border-right: #cccccc 1px solid; - border-top: #9c9c9c 2px solid; - border-left: #9c9c9c 2px solid; - border-bottom: #cccccc 1px solid -} - #divGenTime,#divPoweredBy - { bottom:4px; text-align:center; width:99%; } + +/* + Table formatting +*/ +.th { + color: black; background-color: #D3DCE3; +} +.row_on { + color: black; + background-color: #F1F1F1; +} +.row_off { + color: black; + background-color: #ffffff; +} +.narrow_column { width: 1%; white-space: nowrap; } + +/* + Printing +*/ +@media screen { .onlyPrint { display: none; } } +@media print { .noPrint { display: none; } } + +/* + Portal_box as used in home +*/ +.portal_box { + border: #9c9c9c 1px solid; +} + +.portal_box table { + border: 1px solid black; +} + +.portal_box_header { + height: 15px; + padding-top: 0px; +} \ No newline at end of file diff --git a/phpgwapi/templates/jerryr/css/jerryr.css b/phpgwapi/templates/jerryr/css/jerryr.css index 17ac3d09c6..038674a6e0 100644 --- a/phpgwapi/templates/jerryr/css/jerryr.css +++ b/phpgwapi/templates/jerryr/css/jerryr.css @@ -431,50 +431,6 @@ body { border-right:solid 1px #17202b; } - - -/* - this must move to the filemanager app -*/ - -#fmStatusBar -{ - margin-left:4px; - margin-bottom:3px; -} - -.fmButton -{ - background-repeat: no-repeat; - background-image:url(../images/buttonbackground.png); - width:28px; - height:28px; -} - -#fmLocation -{ - position:relative; - margin-bottom:3px; - height:27px; -} - -#fmMenu -{ - position:relative; -} - -#fmFileWindow -{ - background-color:#ffffff; - margin-left:4px; - padding:5px; - position:relative; - border-right: #cccccc 1px solid; - border-top: #9c9c9c 2px solid; - border-left: #9c9c9c 2px solid; - border-bottom: #cccccc 1px solid -} - #admin_info { position:relative; @@ -488,3 +444,41 @@ body { text-align:center; width:99%; } + +/* + Table formatting +*/ +.th { + color: black; background-color: #D3DCE3; +} +.row_on { + color: black; + background-color: #F1F1F1; +} +.row_off { + color: black; + background-color: #ffffff; +} +.narrow_column { width: 1%; white-space: nowrap; } + +/* + Printing +*/ +@media screen { .onlyPrint { display: none; } } +@media print { .noPrint { display: none; } } + +/* + Portal_box as used in home +*/ +.portal_box { + border: #9c9c9c 1px solid; +} + +.portal_box table { + border: 1px solid black; +} + +.portal_box_header { + height: 15px; + padding-top: 0px; +} \ No newline at end of file