From 71610c3297358472c0edf44ee15e0ec64a6cae45 Mon Sep 17 00:00:00 2001 From: ceb Date: Fri, 27 Sep 2002 00:14:18 +0000 Subject: [PATCH] changed functions to use css files --- phpgwapi/inc/class.common.inc.php | 92 +++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 6ee66b59e9..cd9ead884e 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -1244,8 +1244,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' */ function load_css_data() { - - /* Make sure some of the defaults are set */ + //Make sure some of the defaults are set if (!isset($GLOBALS['phpgw_info']['theme']['css']['A'])) { $GLOBALS['phpgw_info']['theme']['css']['A'] = 'text-decoration:none;'; @@ -1270,7 +1269,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' $GLOBALS['phpgw_info']['theme']['css']['A:hover'] = 'text-decoration:none; color: '.$GLOBALS['phpgw_info']['theme']['hovlink'].';'; } - /* now put the css data into the template class */ + // now put the css data into the template class if(@is_array($GLOBALS['phpgw_info']['theme']['css'])) { $css_string = ''; @@ -1286,6 +1285,55 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' } } + function load_css_url() + { + if (! $GLOBALS['phpgw_info']['user']['preferences']['common']['theme']) + { + if ($GLOBALS['phpgw_info']['server']['template_set'] == 'user_choice') + { + $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = 'default'; + } + else + { + $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $GLOBALS['phpgw_info']['server']['template_set']; + } + } + if ($GLOBALS['phpgw_info']['server']['force_theme'] == 'user_choice') + { + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])) + { + $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = 'default'; + } + } + else + { + if (isset($GLOBALS['phpgw_info']['server']['force_theme'])) + { + $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $GLOBALS['phpgw_info']['server']['force_theme']; + } + } + + if(@file_exists(PHPGW_SERVER_ROOT . SEP . 'phpgwapi' . SEP . 'templates' . SEP . $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] + . SEP . 'css' . SEP . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . '.css')) + { + $css_file = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'phpgwapi' . SEP . 'templates' . SEP . $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] + . SEP . 'css' . SEP . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . '.css'; + } + elseif(@file_exists(PHPGW_SERVER_ROOT . SEP . 'phpgwapi' . SEP . 'templates' . SEP . 'default' . SEP . 'css' . SEP . 'submarine.css')) + { + $css_file = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'phpgwapi' . SEP . 'templates' . SEP . 'default' . SEP . 'css' . SEP . 'submarine.css'; + } + + else + { + /* Hope we don't get to this point. Better then the user seeing a */ + /* complety back screen and not know whats going on */ + $GLOBALS['phpgw_info']['theme']['bg_color'] = 'FFFFFF'; + $GLOBALS['phpgw']->log->write(array('text'=>'F-Abort, No themes found')); + } + $GLOBALS['phpgw']->template->set_var('phpgw_css',''); + } + function load_preload_images_data() { //$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw_info']['navbar']['logout']['icon']; @@ -1311,7 +1359,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' } - function load_phpgw_body_tags() + /*function load_phpgw_body_tags() { $GLOBALS['phpgw_info']['flags']['body_tags']['bgcolor'] = $GLOBALS['phpgw_info']['theme']['bg_color']; $GLOBALS['phpgw_info']['flags']['body_tags']['alink'] = $GLOBALS['phpgw_info']['theme']['alink']; @@ -1332,6 +1380,25 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' $GLOBALS['phpgw_info']['flags']['body_tags']['onLoad'] .= $this->load_preload_images_data(); + if(@is_array($GLOBALS['phpgw_info']['flags']['body_tags'])) + { + $body_tags_string = ''; + reset($GLOBALS['phpgw_info']['flags']['body_tags']); + while(list($key,$value) = each($GLOBALS['phpgw_info']['flags']['body_tags'])) + { + if($value != '') + { + $body_tags_string .= " $key=\"$value\""; + } + } + $GLOBALS['phpgw']->template->set_var('phpgw_body_tags',$body_tags_string); + } + }*/ + + function load_phpgw_body_tags() + { + $GLOBALS['phpgw_info']['flags']['body_tags']['onLoad'] .= $this->load_preload_images_data(); + if(@is_array($GLOBALS['phpgw_info']['flags']['body_tags'])) { $body_tags_string = ''; @@ -1351,6 +1418,21 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' @function phpgw_header @abstract load the phpgw header */ + /*function phpgw_header($forceheader = True, $forcenavbar = True) + { + // So far I dont have use for $forceheader and $forcenavbar + // I only allow this to be run once by using the constant + if(!defined('PHPGW_HEADER_RAN')) + { + define('PHPGW_HEADER_RAN',True); + $this->msgbox('',False,'phpgw_msgbox'); + $this->load_css_data(); + $this->load_phpgw_body_tags(); + $GLOBALS['phpgw']->template->set_block('phpgw','phpgw_head_javascript'); + $GLOBALS['phpgw']->template->pfp('out','phpgw_main_start'); + } + }*/ + function phpgw_header($forceheader = True, $forcenavbar = True) { /* So far I dont have use for $forceheader and $forcenavbar */ @@ -1359,7 +1441,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' { define('PHPGW_HEADER_RAN',True); $this->msgbox('',False,'phpgw_msgbox'); - $this->load_css_data(); + $this->load_css_url(); $this->load_phpgw_body_tags(); $GLOBALS['phpgw']->template->set_block('phpgw','phpgw_head_javascript'); $GLOBALS['phpgw']->template->pfp('out','phpgw_main_start');