update to use xslt *** HEAD IS CURRENTLY BROKEN ***

This commit is contained in:
ceb 2002-10-25 03:04:28 +00:00
parent 2ffd81fc1a
commit d94b0a9ffe
9 changed files with 376 additions and 300 deletions

View File

@ -205,4 +205,6 @@
}
$GLOBALS['phpgw']->preferences->save_repository();
}
$GLOBALS['phpgw']->xslttpl->pp();
?>

View File

@ -262,7 +262,7 @@
if($GLOBALS['phpgw_info']['flags']['msgbox_data'])
{
$data['login_standard']['msgbox_data'] = $GLOBALS['phpgw']->common->msgbox('',False,True);
$data['login_standard']['msgbox_data'] = $GLOBALS['phpgw']->common->msgbox('',False);
}
$data['login_standard']['website_title'] = $GLOBALS['phpgw_info']['server']['site_title'];

View File

@ -422,10 +422,10 @@
return $lid;
break;
case 1:
return '<' . $lid . '> ' . $a[0];
return '<' . $lid . '> ' . $a[0];
break;
case 2:
return '&lt;' . $lid . '&gt; ' . implode(', ',$a);
return '<' . $lid . '> ' . implode(', ',$a);
break;
}
}
@ -697,9 +697,9 @@
/******** start temporarily code **************************************/
/* this just makes sure the template set is updated to the new format */
if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set'].'/parts.inc.php'))
if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set'].'/phpgw.xsl'))
{
$GLOBALS['phpgw_info']['server']['template_set'] = 'default';
$GLOBALS['phpgw_info']['server']['template_set'] = 'idsociety';
}
/******** end temporarily code **************************************/
@ -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,$xslt=False)
function msgbox($text = '', $type = True, $base = '')
{
if ($text=='' && @isset($GLOBALS['phpgw_info']['flags']['msgbox_data']))
{
@ -1005,7 +1005,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
return;
}
$GLOBALS['phpgw']->xslttpl->add_file($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'msgbox');
$GLOBALS['phpgw']->xslttpl->add_file($this->get_tpl_dir('phpgwapi','default') . SEP . 'msgbox');
$prev_helper = $GLOBALS['phpgw']->translation->translator_helper;
$GLOBALS['phpgw']->translation->translator_helper = '';
@ -1060,113 +1060,125 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$GLOBALS['phpgw']->translation->translator_helper = $prev_helper;
if ($xslt)
if ($base)
{
return $data;
$GLOBALS['phpgw']->xslttpl->set_var($base,array('msgbox_data' => $data),True);
}
else
{
$parse_data['msgbox_data'] = $data;
$GLOBALS['phpgw']->xslttpl->set_var('msgbox',$parse_data);
return $GLOBALS['phpgw']->xslttpl->parse();
return $data;
}
}
function framework()
{
if (!$GLOBALS['phpgw_info']['flags']['nonavbar'])
{
$GLOBALS['phpgw']->xslttpl->add_file('phpgw');
}
$this->navbar();
$css = $this->get_css_url();
$var = array
(
'img_root' => PHPGW_IMAGES_DIR
'charset' => lang('charset'),
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'],
'phpgw_css_file' => $css[0],
'theme_css_file' => $css[1],
'phpgw_body' => $phpgw_body
);
$find_single = strrpos($GLOBALS['phpgw_info']['server']['webserver_url'],'/');
$find_double = strpos(strrev($GLOBALS['phpgw_info']['server']['webserver_url'].' '),'//');
if($find_double)
{
$find_double = strlen($GLOBALS['phpgw_info']['server']['webserver_url']) - $find_double - 1;
}
if($find_double)
{
if($find_single == $find_double + 1)
{
$GLOBALS['strip_portion'] = $GLOBALS['phpgw_info']['server']['webserver_url'];
}
else
{
$GLOBALS['strip_portion'] = substr($GLOBALS['phpgw_info']['server']['webserver_url'],0,$find_double + 1);
}
}
else
{
$GLOBALS['strip_portion'] = $GLOBALS['phpgw_info']['server']['webserver_url'].'/';
}
$GLOBALS['phpgw']->xslttpl->add_file($this->get_tpl_dir('phpgwapi') . SEP . 'phpgw');
$var['home_link'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
$var['preferences_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
$var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
$var['about_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = 'idsociety';
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home')
switch ($GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'])
{
$var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','welcome2');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw']->common->image_on('phpgwapi','welcome2','_over');
}
else
{
$var['welcome_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','welcome2','_over');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw']->common->image('phpgwapi','welcome2');
}
$var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','welcome2','_over');
case 'idsociety':
$find_single = strrpos($GLOBALS['phpgw_info']['server']['webserver_url'],'/');
$find_double = strpos(strrev($GLOBALS['phpgw_info']['server']['webserver_url'].' '),'//');
if($find_double)
{
$find_double = strlen($GLOBALS['phpgw_info']['server']['webserver_url']) - $find_double - 1;
}
if($find_double)
{
if($find_single == $find_double + 1)
{
$GLOBALS['strip_portion'] = $GLOBALS['phpgw_info']['server']['webserver_url'];
}
else
{
$GLOBALS['strip_portion'] = substr($GLOBALS['phpgw_info']['server']['webserver_url'],0,$find_double + 1);
}
}
else
{
$GLOBALS['strip_portion'] = $GLOBALS['phpgw_info']['server']['webserver_url'].'/';
}
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences')
{
$var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','preferences2');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw']->common->image_on('phpgwapi','preferences2','_over');
}
else
{
$var['preferences_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','preferences2','_over');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw']->common->image('phpgwapi','preferences2');
}
$var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','preferences2','_over');
$var['home_link'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
$var['prefs_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
$var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
$var['about_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
$var['home_title'] = $GLOBALS['phpgw_info']['navbar']['home']['title'];
$var['prefs_title'] = $GLOBALS['phpgw_info']['navbar']['preferences']['title'];
$var['logout_title'] = $GLOBALS['phpgw_info']['navbar']['logout']['title'];
$var['about_title'] = $GLOBALS['phpgw_info']['navbar']['about']['title'];
$var['logout_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','log_out2');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw']->common->image_on('phpgwapi','log_out2','_over');
$var['logout_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','log_out2','_over');
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home')
{
$var['home_img'] = $this->image('phpgwapi','welcome2');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $this->image_on('phpgwapi','welcome2','_over');
}
else
{
$var['home_img'] = $this->image_on('phpgwapi','welcome2','_over');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $this->image('phpgwapi','welcome2');
}
$var['home_img_hover'] = $this->image_on('phpgwapi','welcome2','_over');
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
{
$var['about_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','question_mark2');
$var['about_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','question_mark2','_over');
}
else
{
$var['about_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi','question_mark2','_over');
$var['about_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi','question_mark2');
}
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences')
{
$var['prefs_img'] = $this->image('phpgwapi','preferences2');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $this->image_on('phpgwapi','preferences2','_over');
}
else
{
$var['prefs_img'] = $this->image_on('phpgwapi','preferences2','_over');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $this->image('phpgwapi','preferences2');
}
$var['prefs_img_hover'] = $this->image_on('phpgwapi','preferences2','_over');
$var['logo_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','logo2');
$var['logout_img'] = $this->image('phpgwapi','log_out2');
$GLOBALS['phpgw_info']['flags']['preload_images'][] = $this->image_on('phpgwapi','log_out2','_over');
$var['logout_img_hover'] = $this->image_on('phpgwapi','log_out2','_over');
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
{
$var['about_img'] = $this->image('phpgwapi','question_mark2');
$var['about_img_hover'] = $this->image_on('phpgwapi','question_mark2','_over');
}
else
{
$var['about_img'] = $this->image_on('phpgwapi','question_mark2','_over');
$var['about_img_hover'] = $this->image('phpgwapi','question_mark2');
}
$var['logo_img'] = $this->image('phpgwapi','logo2');
$var['nav_bar_left_top_bg_img'] = $this->image('phpgwapi','nav_bar_left_top_bg');
break;
}
if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']))
{
$db = $GLOBALS['phpgw']->db;
$db->query('select count(session_id) from phpgw_sessions');
$db->next_record();
$var['current_users'] = lang('Current users') . ': ' . $db->f(0);
$var['url_current_users'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions');
$GLOBALS['phpgw']->db->query('select count(session_id) from phpgw_sessions');
$GLOBALS['phpgw']->db->next_record();
$var['current_users'] = lang('Current users') . ': ' . $GLOBALS['phpgw']->db->f(0);
$var['url_current_users'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions');
}
$var['user_info_name'] = $GLOBALS['phpgw']->common->display_fullname();
$var['user_info_name'] = $this->display_fullname();
$now = time();
$var['user_info_date'] =
lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' '
. $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
$var['user_info_date'] = lang($this->show_date($now,'l')) . ' '
. $this->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
$var['user_info'] = $var['user_info_name'] .' - ' .$var['user_info_date'];
while ($app = each($GLOBALS['phpgw_info']['navbar']))
@ -1189,7 +1201,19 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
}
}
$var['nav_bar_left_top_bg_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','nav_bar_left_top_bg');
$var['onload'] = $this->load_preload_images_data();
if($GLOBALS['phpgw_info']['flags']['msgbox_data'])
{
$this->msgbox('',False,'phpgw');
}
switch($GLOBALS['phpgw_info']['flags']['currentapp'])
{
case 'home':
$var['home'] = True;
break;
}
$var['lang_powered_by'] = lang('powered by');
$var['lang_version'] = lang('version');
@ -1197,7 +1221,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$var['lang_phpgw_statustext'] = lang('phpGroupWare --> homepage');
$var['top_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi','top_spacer_middle');
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',$var);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',$var,True);
}
/*!
@ -1258,6 +1282,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
}
}
$GLOBALS['phpgw_info']['navbar']['preferences']['title'] = lang('preferences');
$GLOBALS['phpgw_info']['navbar']['preferences']['url'] = $GLOBALS['phpgw']->link('/preferences/index.php');
$GLOBALS['phpgw_info']['navbar']['preferences']['icon'] = $this->image('preferences',Array('navbar','nonav'));
$GLOBALS['phpgw_info']['navbar']['preferences']['icon_hover'] = $this->image_on('preferences',Array('navbar','nonav'),'-over');
@ -1278,12 +1303,8 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$GLOBALS['phpgw_info']['navbar']['about']['icon'] = $this->image('phpgwapi',Array('about','nonav'));
$GLOBALS['phpgw_info']['navbar']['about']['icon_hover'] = $this->image_on('phpgwapi',Array('about','nonav'),'-over');
$GLOBALS['phpgw_info']['navbar']['logout']['title'] = 'Logout';
$GLOBALS['phpgw_info']['navbar']['logout']['title'] = lang('logout');
$GLOBALS['phpgw_info']['navbar']['logout']['url'] = $GLOBALS['phpgw']->link('/logout.php');
if(PHPGW_USE_FRAMES)
{
$GLOBALS['phpgw_info']['navbar']['logout']['url'] .= '" target="_parent"';
}
$GLOBALS['phpgw_info']['navbar']['logout']['icon'] = $this->image('phpgwapi',Array('logout','nonav'));
$GLOBALS['phpgw_info']['navbar']['logout']['icon_hover'] = $this->image_on('phpgwapi',Array('logout','nonav'),'-over');
}
@ -1340,15 +1361,11 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
}
$phpgw_css_file = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'phpgwapi' . SEP . 'templates' . SEP . $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']
. SEP . 'css' . SEP . 'phpgw.css';
$GLOBALS['phpgw']->template->set_var('phpgw_css','<link rel="stylesheet" type="text/css" href="' . $phpgw_css_file . '">' . "\n"
. '<link rel="stylesheet" type="text/css" href="' . $css_file . '">');
return array($phpgw_css_file,$css_file);
}
function load_preload_images_data()
{
//$GLOBALS['phpgw_info']['flags']['preload_images'][] = $GLOBALS['phpgw_info']['navbar']['logout']['icon'];
if(@is_array($GLOBALS['phpgw_info']['flags']['preload_images']))
{
$preload_image_string = '';

View File

@ -93,10 +93,10 @@
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
);
}
$this->output['listbox'] = $var;
$this->output[]['listbox'] = $var;
}
$this->set_internal($extra_data);
return $this->draw_box();
$this->draw_box();
}
function xdraw($extra_data='')
@ -121,10 +121,10 @@
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
);
}
$this->output['listbox'] = $var;
$this->output[]['listbox'] = $var;
}
$this->set_xinternal($extra_data);
return $this->draw_box();
$this->draw_box();
}
}
?>

View File

@ -41,6 +41,14 @@
// Textual variables
var $title;
/* This is the constructor for the object. */
function portalbox($title = '')
{
$this->setvar('title',$title);
// echo 'After SetVar Title = '.$this->getvar('title')."<br>\n";
}
/*
Use these functions to get and set the values of this
object's variables. This is good OO practice, as it means
@ -70,16 +78,6 @@
return $this->$var;
}
/*
This is the constructor for the object.
*/
function portalbox($title = '')
{
$this->setvar('title',$title);
// echo 'After SetVar Title = '.$this->getvar('title')."<br>\n";
}
function start_template($extra = '')
{
if ($extra && $this->getvar('app_name'))
@ -88,14 +86,11 @@
}
else
{
$GLOBALS['phpgw']->xslttpl->add_file(array('portal'));
$GLOBALS['phpgw']->xslttpl->add_file('portal');
}
$this->output = array
(
'title' => $this->getvar('title'),
'space' => '&nbsp;'
);
$this->output[]['title'] = $this->getvar('title');
$this->output[]['space'] = '&nbsp;';
}
function set_controls($control='',$control_param='')
@ -112,7 +107,7 @@
{
if($extra_data !='')
{
$this->output['extrabox'] = $extra_data;
$this->output[]['extrabox'] = $extra_data;
}
}
@ -120,7 +115,7 @@
{
if($extra_data !='')
{
$this->output['xextrabox'] = $extra_data;
$this->output[]['xextrabox'] = $extra_data;
}
}
@ -158,9 +153,9 @@
}
}
$this->output['control_link'] = $control_link;
$this->output[]['control_link'] = $control_link;
}
$GLOBALS['phpgw']->xslttpl->set_var('portal',$this->output);
return $GLOBALS['phpgw']->xslttpl->parse();
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('portal_data' => $this->output),True);
//return $GLOBALS['phpgw']->xslttpl->parse();
}
}

View File

@ -133,9 +133,16 @@
function set_var($name, $value, $append = False)
{
if(!is_array($value) && $append)
if($append)
{
$this->vars[$name] .= $value;
//_debug_array($value);
if (is_array($value))
{
while(list($key,$val) = each($value))
{
$this->vars[$name][$key] = $val;
}
}
}
else
{
@ -221,7 +228,7 @@
$this->xmldata = var2xml('PHPGW',$xmldata);
return $this->xmldata;
}
function list_lineno($xml)
{
$xml = explode("\n",$xml);

View File

@ -4,8 +4,8 @@
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
* and Joseph Engo <jengo@phpgroupware.org> *
* Has a few functions, but primary role is to load the phpgwapi *
* Copyright (C) 2000, 2001, 2002 Dan Kuykendall *
* -------------------------------------------------------------------------*
* Copyright (C) 2000 - 2002 Dan Kuykendall *
* ------------------------------------------------------------------------ *
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
@ -21,13 +21,12 @@
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
/****************************************************************************\
* If running in PHP3, then load up the support functions file for *
* transparent support. *
\****************************************************************************/
/***************************************************************************\
* If running in PHP3, then load up the support functions file for *
* transparent support. *
\***************************************************************************/
if (floor(phpversion()) == 3)
{
@ -35,7 +34,7 @@
}
include(PHPGW_API_INC.'/common_functions.inc.php');
/*!
@function lang
@abstract function to handle multilanguage support
@ -271,8 +270,8 @@
/****************************************************************************\
* Forcing the footer to run when the rest of the script is done. *
\****************************************************************************/
$footer_common = &$GLOBALS['phpgw']->common;
register_shutdown_function(array(&$footer_common, 'phpgw_footer'));
//$footer_common = &$GLOBALS['phpgw']->common;
//register_shutdown_function(array(&$footer_common, 'phpgw_footer'));
/****************************************************************************\
* Stuff to use if logging in or logging out *
@ -334,12 +333,101 @@
$GLOBALS['phpgw']->xslttpl = CreateObject('phpgwapi.xslttemplates',PHPGW_TEMPLATE_DIR);
/* load required tpl files */
/******* Define the GLOBALS['MENUACTION'] *******/
define('MENUACTION',get_var('menuaction',Array('GET')));
/********* This sets the user variables (this should be moved to somewhere else [Seek3r])*********/
$GLOBALS['phpgw_info']['user']['private_dir'] = $GLOBALS['phpgw_info']['server']['files_dir']
. '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
/* This will make sure that a user has the basic default prefs. If not it will add them */
$GLOBALS['phpgw']->preferences->verify_basic_settings();
/********* Optional classes, which can be disabled for performance increases *********/
while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags']))
{
if (ereg('enable_',$phpgw_class_name[0]))
{
$enable_class = str_replace('enable_','',$phpgw_class_name[0]);
$enable_class = str_replace('_class','',$enable_class);
eval('$GLOBALS["phpgw"]->' . $enable_class . ' = createobject(\'phpgwapi.' . $enable_class . '\');');
}
}
unset($enable_class);
reset($GLOBALS['phpgw_info']['flags']);
//$GLOBALS['phpgw']->common->navbar();
$GLOBALS['phpgw']->common->framework();
/* Verify that user has rights to the currentapp */
$continue_app_data = True;
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
{
// This will need to use ACL in the future
if (! $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']] ||
(@$GLOBALS['phpgw_info']['flags']['admin_only'] &&
! $GLOBALS['phpgw_info']['user']['apps']['admin']))
{
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access %1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Access not permitted']=False;
$continue_app_data = False;
//$GLOBALS['phpgw']->template->set_var('phpgw_body',"user has no rights to this app!!!<br>\n");
exit;
}
}
if($continue_app_data)
{
/* Make sure user is keeping his password in order */
/* Maybe we should create a common function in the phpgw_accounts_shared.inc.php file */
/* to get rid of duplicate code. */
if (isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0)
{
$message = lang('You are required to change your password during your first login')
. '<br> Click this image on the navbar: <img src="'
. $GLOBALS['phpgw']->common->image('preferences','navbar').'">';
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$message]=False;
}
elseif (isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30))
{
$message = lang('it has been more then x days since you changed your password',30);
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$message]=False;
}
/* I want to phase this out over time. App apps should put their data into the templates phpgw_body var*/
if (!@$GLOBALS['phpgw_info']['flags']['noheader'])
{
//$GLOBALS['phpgw']->common->framework();
}
$GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->xslttpl->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->template->halt_on_error = 'report';
if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && file_exists(PHPGW_APP_INC . '/functions.inc.php') && !MENUACTION)
{
include(PHPGW_APP_INC . '/functions.inc.php');
}
}
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
/*
These lines load up the templates class and set some default values
$GLOBALS['phpgw']->template = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$GLOBALS['phpgw']->xslttpl = CreateObject('phpgwapi.xslttemplates',PHPGW_TEMPLATE_DIR);
load required tpl files
$GLOBALS['phpgw']->template->set_file('common', 'common.tpl');
$GLOBALS['phpgw']->template->set_file('phpgw', 'phpgw.tpl');
//$GLOBALS['phpgw']->template->set_file('msgbox', 'msgbox.tpl');
$GLOBALS['phpgw']->template->set_file('msgbox', 'msgbox.tpl');
/* These default values will be overridden and appended to as needed by template sets */
These default values will be overridden and appended to as needed by template sets
$GLOBALS['phpgw']->template->set_var('phpgw_top_table_height','0');
$GLOBALS['phpgw']->template->set_var('phpgw_top_frame_height','0');
$GLOBALS['phpgw']->template->set_var('phpgw_top_scrolling','AUTO');
@ -369,17 +457,17 @@
$GLOBALS['phpgw']->template->set_var('phpgw_head_browser_ico','favicon.ico');
$GLOBALS['phpgw']->template->set_var('phpgw_head_website_title', $GLOBALS['phpgw_info']['server']['site_title']);
/* This will bring in the template sets parts definitions */
/* We do this so early to allow the template to overwrite */
/* and append to the previous defaults as needed for frames support to work */
This will bring in the template sets parts definitions
We do this so early to allow the template to overwrite
and append to the previous defaults as needed for frames support to work
if (file_exists(PHPGW_TEMPLATE_DIR . '/parts.inc.php'))
{
include(PHPGW_TEMPLATE_DIR . '/parts.inc.php');
}
/*************************************************************************\
* If they are using frames, we need to set the PHPGW_FRAME_PART safely *
\*************************************************************************/
if(@isset($GLOBALS['HTTP_GET_VARS']['framepart']) &&
( $GLOBALS['HTTP_GET_VARS']['framepart'] == 'unsupported' ||
$GLOBALS['HTTP_GET_VARS']['framepart'] == 'top' ||
@ -406,7 +494,7 @@
define('PHPGW_NAVBAR_TARGET','body');
if (PHPGW_FRAME_PART == 'start')
{
/* if just starting up, then we intialize the frameset with the appropriate block */
if just starting up, then we intialize the frameset with the appropriate block
$GLOBALS['phpgw']->template->set_var('phpgw_top_link',$GLOBALS['phpgw']->session->link('home.php','framepart=top'));
$GLOBALS['phpgw']->template->set_var('phpgw_right_link',$GLOBALS['phpgw']->session->link('home.php','framepart=right'));
$GLOBALS['phpgw']->template->set_var('phpgw_body_link',$GLOBALS['phpgw']->session->link('home.php','framepart=body'));
@ -418,14 +506,14 @@
}
else
{
/* if we are using frames and not starting then we use the basic block to keep each part in a nice clean html format */
if we are using frames and not starting then we use the basic block to keep each part in a nice clean html format
$GLOBALS['phpgw']->template->set_block('phpgw','phpgw_main_basic_start','phpgw_main_start');
$GLOBALS['phpgw']->template->set_block('phpgw','phpgw_main_basic_end','phpgw_main_end');
}
}
else
{
/* Not using frames, so we default to tables */
Not using frames, so we default to tables
define('PHPGW_USE_FRAMES',False);
define('PHPGW_NAVBAR_TARGET','_self');
$GLOBALS['phpgw']->template->set_block('phpgw','phpgw_main_tables_start','phpgw_main_start');
@ -433,17 +521,17 @@
}
$GLOBALS['phpgw']->template->set_var('phpgw_head_target',PHPGW_NAVBAR_TARGET);
/******* Define the GLOBALS['MENUACTION'] *******/
Define the GLOBALS['MENUACTION']
define('MENUACTION',get_var('menuaction',Array('GET')));
/********* This sets the user variables (this should be moved to somewhere else [Seek3r])*********/
This sets the user variables (this should be moved to somewhere else [Seek3r])
$GLOBALS['phpgw_info']['user']['private_dir'] = $GLOBALS['phpgw_info']['server']['files_dir']
. '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
/* This will make sure that a user has the basic default prefs. If not it will add them */
This will make sure that a user has the basic default prefs. If not it will add them
$GLOBALS['phpgw']->preferences->verify_basic_settings();
/********* Optional classes, which can be disabled for performance increases *********/
Optional classes, which can be disabled for performance increases
while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags']))
{
if (ereg('enable_',$phpgw_class_name[0]))
@ -456,9 +544,8 @@
unset($enable_class);
reset($GLOBALS['phpgw_info']['flags']);
/***************************************************************************\
* These lines load up the themes data and put them into the templates class *
\***************************************************************************/
//$GLOBALS['phpgw']->common->load_theme_data();
if(!PHPGW_USE_FRAMES || (PHPGW_USE_FRAMES && PHPGW_FRAME_PART != 'body'))
@ -466,9 +553,9 @@
$GLOBALS['phpgw']->common->navbar();
}
/*************************************************************************\
* load up top part if appropriate *
\*************************************************************************/
if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'top')
{
if(!PHPGW_USE_FRAMES)
@ -488,9 +575,9 @@
exit;
}
}
/*************************************************************************\
* load up left part if appropriate *
\*************************************************************************/
if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'left')
{
if(!PHPGW_USE_FRAMES)
@ -510,9 +597,9 @@
exit;
}
}
/*************************************************************************\
* load up right part if appropriate *
\*************************************************************************/
if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'right')
{
if(!PHPGW_USE_FRAMES)
@ -532,9 +619,9 @@
exit;
}
}
/*************************************************************************\
* load up bottom part if appropriate *
\*************************************************************************/
if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'bottom')
{
if(!PHPGW_USE_FRAMES)
@ -555,74 +642,16 @@
}
}
/*************************************************************************\
* load up body/appspace if appropriate *
\*************************************************************************/
if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'body')
{
/* parse_bodypart() should not output anything. This is here for them to set body tags and such */
// parse_bodypart() should not output anything. This is here for them to set body tags and such
if(function_exists('parse_bodypart'))
{
parse_bodypart();
}
/* Verify that user has rights to the currentapp */
$continue_app_data = True;
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
{
// This will need to use ACL in the future
if (! $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']] ||
(@$GLOBALS['phpgw_info']['flags']['admin_only'] &&
! $GLOBALS['phpgw_info']['user']['apps']['admin']))
{
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access %1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Access not permitted']=False;
$continue_app_data = False;
$GLOBALS['phpgw']->template->set_var('phpgw_body',"user has no rights to this app!!!<br>\n");
exit;
}
}
if($continue_app_data)
{
/* I want to phase this out over time. App apps should put their data into the templates phpgw_body var*/
if (!@$GLOBALS['phpgw_info']['flags']['noheader'])
{
$GLOBALS['phpgw']->common->phpgw_header();
}
if(!PHPGW_USE_FRAMES)
{
// echo '<div style="width: 100%; height: 100%; overflow: auto;">';
}
*/
/* Make sure user is keeping his password in order */
/* Maybe we should create a common function in the phpgw_accounts_shared.inc.php file */
/* to get rid of duplicate code. */
if (isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0)
{
$message = lang('You are required to change your password during your first login')
. '<br> Click this image on the navbar: <img src="'
. $GLOBALS['phpgw']->common->image('preferences','navbar').'">';
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$message]=False;
}
elseif (isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30))
{
$message = lang('it has been more then x days since you changed your password',30);
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$message]=False;
}
$GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->xslttpl->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->template->halt_on_error = 'report';
if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && file_exists(PHPGW_APP_INC . '/functions.inc.php') && !MENUACTION)
{
include(PHPGW_APP_INC . '/functions.inc.php');
}
}
}
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
?>

View File

@ -1,50 +1,54 @@
<!-- $Id$ -->
<xsl:template match="portal">
<table cellpadding="0" cellspacing="0" class="portal">
<tr>
<td class="portal_text">
<xsl:value-of disable-output-escaping="yes" select="space"/>
<xsl:value-of select="title"/>
</td>
<td valign="middle" align="right" class="portal_text">
<xsl:apply-templates select="control_link"/>
</td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="3" cellspacing="0" class="portal">
<xsl:choose>
<xsl:when test="listbox">
<tr>
<td>
<ul>
<xsl:apply-templates select="listbox"/>
</ul>
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="extrabox">
<tr>
<td>
<xsl:value-of disable-output-escaping="yes" select="extrabox"/>
</td>
</tr>
</xsl:when>
<xsl:when test="xextrabox">
<tr>
<td>
<xsl:call-template name="extrabox"/>
</td>
</tr>
</xsl:when>
</xsl:choose>
</table>
</td>
</tr>
</table>
<xsl:template name="portal">
<xsl:apply-templates select="portal_data"/>
</xsl:template>
<xsl:template match="portal_data">
<table cellpadding="0" cellspacing="0" class="portal">
<tr>
<td class="portal_text">
<xsl:value-of disable-output-escaping="yes" select="space"/>
<xsl:value-of select="title"/>
</td>
<td valign="middle" align="right" class="portal_text">
<xsl:apply-templates select="control_link"/>
</td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="3" cellspacing="0" class="portal">
<xsl:choose>
<xsl:when test="listbox">
<tr>
<td>
<ul>
<xsl:apply-templates select="listbox"/>
</ul>
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="extrabox">
<tr>
<td>
<xsl:value-of disable-output-escaping="yes" select="extrabox"/>
</td>
</tr>
</xsl:when>
<xsl:when test="xextrabox">
<tr>
<td>
<xsl:call-template name="extrabox"/>
</td>
</tr>
</xsl:when>
</xsl:choose>
</table>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="control_link">

View File

@ -1,23 +1,29 @@
<!-- $Id$ -->
<xsl:template match="phpgw">
<xsl:variable name="phpgw_css_path"><xsl:value-of select="phpgw_css_path"/></xsl:variable>
<xsl:variable name="theme_css_path"><xsl:value-of select="theme_css_path"/></xsl:variable>
<xsl:variable name="phpgw_css_file"><xsl:value-of select="phpgw_css_file"/></xsl:variable>
<xsl:variable name="theme_css_file"><xsl:value-of select="theme_css_file"/></xsl:variable>
<xsl:variable name="charset"><xsl:value-of select="charset"/></xsl:variable>
<xsl:variable name="onload"><xsl:value-of select="onload"/></xsl:variable>
<xsl:variable name="logo_img"><xsl:value-of select="logo_img"/></xsl:variable>
<xsl:variable name="nav_bar_left_top_bg_img"><xsl:value-of select="nav_bar_left_top_bg_img"/></xsl:variable>
<xsl:variable name="home_link"><xsl:value-of select="home_link"/></xsl:variable>
<xsl:variable name="preferences_link"><xsl:value-of select="preferences_link"/></xsl:variable>
<xsl:variable name="prefs_link"><xsl:value-of select="preferences_link"/></xsl:variable>
<xsl:variable name="logout_link"><xsl:value-of select="logout_link"/></xsl:variable>
<xsl:variable name="help_link"><xsl:value-of select="help_link"/></xsl:variable>
<xsl:variable name="welcome_img_hover"><xsl:value-of select="welcome_img_hover"/></xsl:variable>
<xsl:variable name="preferences_img_hover"><xsl:value-of select="preferences_img_hover"/></xsl:variable>
<xsl:variable name="about_link"><xsl:value-of select="about_link"/></xsl:variable>
<xsl:variable name="home_img_hover"><xsl:value-of select="home_img_hover"/></xsl:variable>
<xsl:variable name="prefs_img_hover"><xsl:value-of select="prefs_img_hover"/></xsl:variable>
<xsl:variable name="logout_img_hover"><xsl:value-of select="logout_img_hover"/></xsl:variable>
<xsl:variable name="about_img_hover"><xsl:value-of select="about_img_hover"/></xsl:variable>
<xsl:variable name="welcome_img"><xsl:value-of select="welcome_img"/></xsl:variable>
<xsl:variable name="preferences_img"><xsl:value-of select="preferences_img"/></xsl:variable>
<xsl:variable name="home_img"><xsl:value-of select="home_img"/></xsl:variable>
<xsl:variable name="prefs_img"><xsl:value-of select="prefs_img"/></xsl:variable>
<xsl:variable name="logout_img"><xsl:value-of select="logout_img"/></xsl:variable>
<xsl:variable name="about_img"><xsl:value-of select="about_img"/></xsl:variable>
<xsl:variable name="home_title"><xsl:value-of select="home_title"/></xsl:variable>
<xsl:variable name="prefs_title"><xsl:value-of select="prefs_title"/></xsl:variable>
<xsl:variable name="logout_title"><xsl:value-of select="logout_title"/></xsl:variable>
<xsl:variable name="about_title"><xsl:value-of select="about_title"/></xsl:variable>
<xsl:variable name="phpgw_body"><xsl:value-of select="phpgw_body"/></xsl:variable>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$charset}"/>
@ -27,11 +33,11 @@
<meta name="robots" content="noindex"/>
<link rel="icon" href="favicon.ico" type="image/x-ico"/>
<link rel="shortcut icon" href="favicon.ico"/>
<title><xsl:value-of select="phpgw_website_title"/></title>
<title><xsl:value-of select="website_title"/></title>
<script language="JavaScript" type="text/javascript">
<xsl:text>
function MM_swapImgRestore()
<!-- function MM_swapImgRestore()
{ //v3.0
var i,x,a=document.MM_sr;
for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
@ -72,23 +78,23 @@
if(body_doc != null){ parent.body.location.href=body_doc; }
if(right_doc != null){ parent.right.location.href=right_doc; }
if(bottom_doc != null){ parent.bottom.location.href=bottom_doc; }
}
} -->
</xsl:text>
</script>
<link rel="stylesheet" type="text/css" href="{$phpgw_css_path}">
<link rel="stylesheet" type="text/css" href="{$theme_css_path}">
<link rel="stylesheet" type="text/css" href="{$phpgw_css_file}"/>
<link rel="stylesheet" type="text/css" href="{$theme_css_file}"/>
</head>
<body onLoad="{$onload}">
<table width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<td colspan="2" valign="top">
<!-- BEGIN top_part -->
<table width="100%" height="73" cellspacing="0" cellpadding="0">
<tr class="top_top">
<tr class="top_top" height="58">
<!-- top row back images are 58px high, but the row may be smaller than that -->
<!-- row 2 images are 15 px high, so this table with these 2 rows is 58 plus 15 equals 73px high -->
<td width="154" valign="top">
<img src="{$logo_img}" border="0">
<img src="{$logo_img}" border="0"/>
</td>
<td valign="bottom">
<table width="100%" cellpadding="0" cellspacing="0">
@ -100,22 +106,22 @@
</xsl:when>
<xsl:otherwise>
<td></td>
</xsl:othwerwise>
</xsl:otherwise>
</xsl:choose>
<td width="33%" class="info" align="right"><xsl:value-of select="user_info_date"/></td>
</tr>
</table>
</td>
</tr>
<tr align="right" class="top_bottom">
<tr align="right" class="top_bottom" height="15">
<td colspan="2">
<!-- row 2 right nav buttons -->
<table cellpadding="0" cellspacing="0">
<tr>
<td><a href="{$home_link}" onMouseOver="nine.src='{$welcome_img_hover}'" onMouseOut="nine.src='{$welcome_img}'"><img src="{$welcome_img}" border="0" name="nine" alt="{$welcome_title}" title="{$welcome_title}"></a></td>
<td><a href="{$preferences_link}" onMouseOver="ten.src='{$preferences_img_hover}'" onMouseOut="ten.src='{$preferences_img}'"><img src="{$preferences_img}" border="0" name="ten" alt="{$prefs_title}" title="{$prefs_title}"></a></td>
<td><a href="{$logout_link}" onMouseOver="eleven.src='{$logout_img_hover}'" onMouseOut="eleven.src='{$logout_img}'"><img src="{$logout_img}" border="0" name="eleven" alt="{$logout_title}" title="{$logout_title}"></a></td>
<td><a href="{$help_link}" onMouseOver="help.src='{$about_img_hover}'" onMouseOut="help.src='{$about_img}'"><img src="{$about_img}" border="0" name="help" alt="{$about_title}" title="{$about_title}"></a></td>
<tr class="top_bottom">
<td><a href="{$home_link}" onMouseOver="nine.src='{$home_img_hover}'" onMouseOut="nine.src='{$home_img}'"><img src="{$home_img}" border="0" name="nine" alt="{$home_title}" title="{$home_title}"/></a></td>
<td><a href="{$prefs_link}" onMouseOver="ten.src='{$prefs_img_hover}'" onMouseOut="ten.src='{$prefs_img}'"><img src="{$prefs_img}" border="0" name="ten" alt="{$prefs_title}" title="{$prefs_title}"/></a></td>
<td><a href="{$logout_link}" onMouseOver="eleven.src='{$logout_img_hover}'" onMouseOut="eleven.src='{$logout_img}'"><img src="{$logout_img}" border="0" name="eleven" alt="{$logout_title}" title="{$logout_title}"/></a></td>
<td><a href="{$about_link}" onMouseOver="help.src='{$about_img_hover}'" onMouseOut="help.src='{$about_img}'"><img src="{$about_img}" border="0" name="help" alt="{$about_title}" title="{$about_title}"/></a></td>
</tr>
</table>
</td>
@ -130,18 +136,29 @@
<table cellspacing="0" cellpadding="0" valign="top" class="left">
<xsl:apply-templates select="applications"/>
<tr>
<td><img src="{$nav_bar_left_top_bg_img}"></td>
<td><img src="{$nav_bar_left_top_bg_img}"/></td>
</tr>
</table>
<!-- END left_part -->
</td>
<td width="85%" height="85%" valign="top" align="center">
<xsl:call-template name="msgbox"/>
<xsl:call-template name="phpgw_body"/>
<td width="100%" height="100%" valign="top" align="center">
<xsl:choose>
<xsl:when test="msgbox_data">
<xsl:call-template name="msgbox"/>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="home">
<xsl:call-template name="portal"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="body_data"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td colspan="2" align="center" valign="middle" class="info">
<td colspan="2" align="center" valign="middle" class="bottom">
<!-- BEGIN bottom_part -->
<xsl:value-of select="lang_powered_by"/>
<a href="http://www.phpgroupware.org" target="blank" onMouseout="window.status='';return true;">
@ -162,9 +179,14 @@
</xsl:template>
<xsl:template match="applications">
<xsl:variable name="url"><xsl:value-of select="url"/></xsl:variable>
<xsl:variable name="name"><xsl:value-of select="name"/></xsl:variable>
<xsl:variable name="img_src_over"><xsl:value-of select="img_src_over"/></xsl:variable>
<xsl:variable name="icon"><xsl:value-of select="icon"/></xsl:variable>
<xsl:variable name="title"><xsl:value-of select="title"/></xsl:variable>
<tr>
<td class="left">
<a href="{$url}" onMouseOver="{$name}.src='{$img_src_over}'" onMouseOut="{$name}.src='{$icon}'"><img src="{$icon}" border="0" alt="{$title}" title="{$title}" name="{$name}"></a>
<a href="{$url}" onMouseOver="{$name}.src='{$img_src_over}'" onMouseOut="{$name}.src='{$icon}'"><img src="{$icon}" border="0" alt="{$title}" title="{$title}" name="{$name}"/></a>
</td>
</tr>
</xsl:template>