From fed918c353af672dfecf0bf6682381424ca4d3a9 Mon Sep 17 00:00:00 2001 From: ceb Date: Sun, 20 Oct 2002 00:34:12 +0000 Subject: [PATCH] update msgbox --- login.php | 13 ++++++++++--- phpgwapi/inc/class.common.inc.php | 26 +++++++++++++++----------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/login.php b/login.php index db0b894733..c2f47f4e97 100755 --- a/login.php +++ b/login.php @@ -38,8 +38,10 @@ $GLOBALS['phpgw_info']['login_theme'] = 'submarine'; } + $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); + $GLOBALS['phpgw']->xslttpl = CreateObject('phpgwapi.xslttemplates',$GLOBALS['phpgw_info']['server']['template_dir']); - $GLOBALS['phpgw']->xslttpl->add_file(array('login')); + $GLOBALS['phpgw']->xslttpl->add_file('login'); $data = array ( @@ -76,7 +78,6 @@ function check_logoutcode() { - $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); switch($GLOBALS['HTTP_GET_VARS']['code']) { case 1: @@ -259,8 +260,12 @@ /*$GLOBALS['phpgw']->template->set_var('phpgw_head_base',$GLOBALS['phpgw_info']['server']['webserver_url'].'/'); $GLOBALS['phpgw']->template->set_var('registration_url','registration/');*/ + if($GLOBALS['phpgw_info']['flags']['msgbox_data']) + { + $data['login_standard']['msgbox_data'] = $GLOBALS['phpgw']->common->msgbox('',False,True); + } + $data['login_standard']['website_title'] = $GLOBALS['phpgw_info']['server']['site_title']; - $data['login_standard']['msgbox'] = $GLOBALS['phpgw']->common->msgbox('',False); $data['login_standard']['login_url'] = 'login.php' . $extra_vars; $data['login_standard']['cookie'] = show_cookie(); $data['login_standard']['lang_username'] = lang('username'); @@ -270,6 +275,8 @@ $data['login_standard']['lang_password'] = lang('password'); $data['login_standard']['lang_login'] = lang('login'); + //_debug_array($data); + $GLOBALS['phpgw']->xslttpl->set_var('login',$data); $GLOBALS['phpgw']->xslttpl->pp(); ?> diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index a6d2cd5dba..fed245d827 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -993,7 +993,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' @discussion makes it easier and more consistant to generate message boxes */ - function msgbox($text='',$type=True) + function msgbox($text='',$type=True,$xslt=False) { if ($text=='' && @isset($GLOBALS['phpgw_info']['flags']['msgbox_data'])) { @@ -1005,8 +1005,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' return; } - // $GLOBALS['phpgw']->xslttpl->add_file(array('msgbox')); - $GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'msgbox')); + $GLOBALS['phpgw']->xslttpl->add_file($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'msgbox'); $prev_helper = $GLOBALS['phpgw']->translation->translator_helper; $GLOBALS['phpgw']->translation->translator_helper = ''; @@ -1015,7 +1014,6 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' { reset($text); - //_debug_array($text); while (list($key,$value) = each($text)) { if ($value == True) @@ -1029,7 +1027,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' $alt = lang('ERROR'); } - $data['msgbox_data'][] = array + $data[] = array ( 'msgbox_text' => lang($key), 'msgbox_img' => $img, @@ -1037,9 +1035,6 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' 'lang_msgbox_statustext' => $alt ); } - - //_debug_array($data); - } else { @@ -1054,7 +1049,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' $alt = lang('ERROR'); } - $data['msgbox_data'] = array + $data = array ( 'msgbox_text' => lang($text), 'msgbox_img' => $img, @@ -1064,9 +1059,18 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info' } $GLOBALS['phpgw']->translation->translator_helper = $prev_helper; - $GLOBALS['phpgw']->xslttpl->set_var('msgbox',$data); - return $GLOBALS['phpgw']->xslttpl->parse(); + if ($xslt) + { + return $data; + } + else + { + $parse_data['msgbox_data'] = $data; + + $GLOBALS['phpgw']->xslttpl->set_var('msgbox',$parse_data); + return $GLOBALS['phpgw']->xslttpl->parse(); + } } /*function msgbox($text='',$type=True,$output='return')