some more refracturing of the template code

This commit is contained in:
Ralf Becker 2006-12-17 13:14:16 +00:00
parent c806924457
commit 7389a7a2cb
7 changed files with 187 additions and 233 deletions

View File

@ -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 ='<meta name="robots" content="none" />';
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', '<LINK href="'.$GLOBALS['egw_info']['server']['webserver_url']
. "/$appname/templates/".$GLOBALS['egw_info']['server']['template_set']
. "/app.css".'" type=text/css rel=StyleSheet>');
$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', '<LINK href="'.$GLOBALS['egw_info']['server']['webserver_url']
."/$appname/templates/default/app.css".'" type=text/css rel=StyleSheet>');
$css_file = '<LINK href="'.$GLOBALS['egw_info']['server']['webserver_url'].
$css_file.'?'.filemtime(EGW_SERVER_ROOT.$css_file).'" type=text/css rel=StyleSheet>';
}
}
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,
);
}
/**

View File

@ -1,23 +0,0 @@
<style type="text/css">
.row_on { color: {row_text}; background-color: #F1F1F1; }
.row_off { color: {row_text}; background-color: #ffffff; }
.th { color: {th_text}; background-color: {th_bg}; }
.narrow_column { width: 1%; white-space: nowrap; }
@media screen { .onlyPrint { display: none; } }
@media print { .noPrint { display: none; } }
{app_css}
#dhtmltooltip
{
position: absolute;
width: 150px;
border: 1px solid #ff7a0a;
padding: 2px;
background-color:#f9f400;
visibility: hidden;
z-index: 100;
}
</style>
{css_file}

View File

@ -4,7 +4,7 @@
<title>{website_title}</title>
<meta http-equiv="content-type" content="text/html; charset={charset}" />
<meta name="keywords" content="eGroupWare" />
<meta name="description" content="eGroupware" />
<meta name="description" content="eGroupWare" />
<meta name="keywords" content="eGroupWare" />
<meta name="copyright" content="eGroupWare http://www.egroupware.org (c) 2006" />
<meta name="language" content="{lang_code}" />
@ -17,7 +17,10 @@
{slider_effects}
{simple_show_hide}
{pngfix}
{css}
<style type="text/css">
{app_css}
</style>
{css_file}
{java_script}
</head>
<!-- we don't need body tags anymore, do we?) we do!!! onload!! LK -->

View File

@ -1,12 +1,37 @@
<!-- BEGIN navbar_header -->
<div id="divLogo"><a href="{logo_url}" target="_blank"><img src="{logo_file}" border="0" title="{logo_title}" alt="eGroupWare"/></a></div>
{app_extra_icons_div}
<!-- BEGIN app_extra_icons_div -->
<script language="javascript">
new ypSlideOutMenu("menu1", "down", 10, 114, 160, 200,'right');
</script>
<div id="menu1Container">
<div id="menu1Content" style="position: relative; left: 0; text-align: left;">
<div id="extraIcons">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="2" nowrap="nowrap" align="right" style="background-color:#dddddd; padding:1px;">
<a href="#" {show_menu_event}="ypSlideOutMenu.hide('menu1')" title="{lang_close}"><img style="" border="0" src="{img_root}/close.png"/></a>
</td>
</tr>
<!-- BEGIN app_extra_block -->
<tr>
<td class="extraIconsRow"><a href="{url}" {target}><img src="{icon}" alt="{title}" title="{title}" width="16" border="0" /></a></td>
<td align="left" class="extraIconsRow"><a href="{url}" {target}>{title}</a></td>
</tr>
<!-- END app_extra_block -->
</table>
</div>
</div>
</div>
<!-- END app_extra_icons_div -->
<div id="divMain">
<div id="divUpperTabs">
<ul>
{upper_tabs}
<!-- BEGIN upper_tab_block -->
<li><a href="{url}">{title}</a></li>
<!-- END upper_tab_block -->
</ul>
</div>
<div id="divAppIconBar">
@ -16,14 +41,22 @@
<td valign="bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
{app_icons}
<!-- BEGIN app_icon_block -->
<td width="{tdwidth}%" align="center" style="text-align:center"><a href="{url}" {target}><img src="{icon}" alt="{title}" title="{title}" border="0" /></a></td>
<!-- END app_icon_block -->
<!-- BEGIN app_extra_icons_icon -->
<td width="26" valign="top" align="right" style="padding-right:3px; padding-top:20px;">
<a title="{lang_show_more_apps}" href="#" {show_menu_event}="ypSlideOutMenu.showMenu('menu1')"><img src="{img_root}/extra_icons.png" border="0" /></a>
</td>
<!-- END app_extra_icons_icon -->
</tr>
<tr>
{app_titles}
<!-- BEGIN app_title_block -->
<td align="center" valign="top" class="appTitles" style="text-align:center"><a href="{url}" {target}>{title}</a></td>
<!-- END app_title_block -->
</tr>
</table>
</td>
{app_extra_icons_icon}
</tr>
</table>
</div>
@ -35,21 +68,6 @@
<!-- END navbar_header -->
<!-- BEGIN upper_tab_block -->
<li><a href="{url}">{title}</a></li>
<!-- END upper_tab_block -->
<!-- BEGIN app_icon_block -->
<td width="{tdwidth}%" align="center" style="text-align:center"><a href="{url}" {target}><img src="{icon}" alt="{title}" title="{title}" border="0" /></a></td>
<!-- END app_icon_block -->
<!-- BEGIN app_title_block -->
<td align="center" valign="top" class="appTitles" style="text-align:center"><a href="{url}" {target}>{title}</a></td>
<!-- END app_title_block -->
<!-- BEGIN appbox -->
<div id="divSubContainer">
<table width="100%" cellspacing="0" cellpadding="0">
@ -108,15 +126,6 @@
<!-- END extra_blocks_header -->
<!-- BEGIN extra_blocks_footer -->
</table>
</div>
</div>
<div class="sideboxSpace"></div>
<!-- END extra_blocks_footer -->
<!-- BEGIN extra_block_row -->
<tr class="divSideboxEntry">
<td width="20" align="center" valign="middle" class="textSidebox">{icon_or_star}</td><td class="textSidebox"><a class="textSidebox" href="{item_link}"{target}>{lang_item}</a></td>
@ -145,37 +154,16 @@
<!-- END extra_block_spacer -->
<!-- BEGIN app_extra_icons_div -->
<script language="javascript">
new ypSlideOutMenu("menu1", "down", 10, 114, 160, 200,'right');
</script>
<div id="menu1Container">
<div id="menu1Content" style="position: relative; left: 0; text-align: left;">
<div id="extraIcons">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="2" nowrap="nowrap" align="right" style="background-color:#dddddd; padding:1px;">
<a href="#" {show_menu_event}="ypSlideOutMenu.hide('menu1')" title="{lang_close}"><img style="" border="0" src="{img_root}/close.png"/></a>
</td>
</tr>
{app_extra_icons}
<!-- BEGIN extra_blocks_footer -->
</table>
</div>
</div>
</div>
<!-- END app_extra_icons_div -->
<div class="sideboxSpace"></div>
<!-- END extra_blocks_footer -->
<!-- BEGIN app_extra_block -->
<tr>
<td class="extraIconsRow"><a href="{url}" {target}><img src="{icon}" alt="{title}" title="{title}" width="16" border="0" /></a></td>
<td align="left" class="extraIconsRow"><a href="{url}" {target}>{title}</a></td>
</tr>
<!-- END app_extra_block -->
<!-- BEGIN app_extra_icons_icon -->
<td width="26" valign="top" align="right" style="padding-right:3px; padding-top:20px;">
<a title="{lang_show_more_apps}" href="#" {show_menu_event}="ypSlideOutMenu.showMenu('menu1')"><img src="{img_root}/extra_icons.png" border="0" /></a>
</td>
<!-- END app_extra_icons_icon -->

View File

@ -72,6 +72,8 @@ class idots_framework extends egw_framework
$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')
{

View File

@ -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;
}

View File

@ -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;
}