- fix bug with missing root desktop windows after template is set to idots2

- don't show sidebox when it is is not hooked for an application
- small improvements to idots2 toolbar
This commit is contained in:
Pim Snel 2005-07-12 20:57:00 +00:00
parent 73d74fa0f3
commit 14755ad517
6 changed files with 189 additions and 173 deletions

View File

@ -1,105 +1,105 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
if($GLOBALS['phpgw_info']['user']['preferences']['common']['show_generation_time'])
{
$mtime = microtime();
$mtime = explode(' ',$mtime);
$mtime = $mtime[1] + $mtime[0];
$GLOBALS['page_start_time'] = $mtime;
}
if($GLOBALS['phpgw_info']['user']['preferences']['common']['show_generation_time'])
{
$mtime = microtime();
$mtime = explode(' ',$mtime);
$mtime = $mtime[1] + $mtime[0];
$GLOBALS['page_start_time'] = $mtime;
}
// get used language code
$lang_code = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
/*
** Getting the correct directories for finding the resources
*/
$template_dir = $GLOBALS['phpgw_info']['server']['webserver_url'] . "/phpgwapi/templates/" . $GLOBALS['phpgw_info']['server']['template_set'];
$js_url = $template_dir.'/js/';
$css_url = $template_dir.'/css/';
if($GLOBALS['phpgw_info']['flags']['currentapp']=='eGroupWare')
{
//Initializing x-desktop
$bodyheader = ' id="xdesktop"';
$theme_css = '<link rel="stylesheet" type="text/css" href="'.$css_url.'idots2_skin.css">';
$theme_css .= '<link rel="stylesheet" type="text/css" href="'.$css_url.'taskbar_down.css">';
$cbe_core = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/cbe_core.js\'></script>';
$cbe_event = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/cbe_event.js\'></script>';
$cbe_slide = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/cbe_slide.js\'></script>';
$skin_idots2 = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/x-desktop_skin_IDOTS2.js\'></script>';
$x_core = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/x-desktop_core.js\'></script>';
$x_events = '<script type =\'text/javascript\' src=\''.$js_url.'x-desktop/events.js\'></script>';
$x_shortcuts = '<script type =\'text/javascript\' src=\''.$js_url.'x-desktop/shortcuts.js\'></script>';
$xdesktop .= $theme_css . $cbe_core . $cbe_event . $cbe_slide . $skin_idots2 . $x_core . $x_events . $x_shortcuts;
}
else
{
//Just a normal page
$bodyheader = ' id="xpage"';
$menu_js = '<script type=\'text/javascript\' src=\''.$js_url.'menu.js\'></script>';
$theme_css = '<link rel="stylesheet" type="text/css" href="'.$css_url.'idots2_page.css">';
// get used language code
$xdesktop = $theme_css . $menu_js;
}
/*
** Create/use the template
*/
$tpl = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove');
$tpl->set_file(array('_head' => 'head.tpl'));
$tpl->set_block('_head','head');
$lang_code = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
if ($GLOBALS['phpgw_info']['flags']['app_header'])
{
$app = $GLOBALS['phpgw_info']['flags']['app_header'];
}
else
{
$app = $GLOBALS['phpgw_info']['flags']['currentapp'];
$app = isset($GLOBALS['phpgw_info']['apps'][$app]) ? $GLOBALS['phpgw_info']['apps'][$app]['title'] : lang($app);
}
if($GLOBALS['phpgw_info']['flags']['currentapp']=='eGroupWare')
{
$app = "";
}
$var = Array(
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'slider_effects'=> $slider_effects,
'simple_show_hide'=> $simple_show_hide,
'lang_code' => $lang_code,
'charset' => $GLOBALS['phpgw']->translation->charset(),
'font_family' => $GLOBALS['phpgw_info']['theme']['font'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title']. ($app ? " [$app]" : ''),
'body_tags' => $bodyheader .' '. $GLOBALS['phpgw']->common->get_body_attribs(),
'xdesktop' => $xdesktop,
'css' => $GLOBALS['phpgw']->common->get_css(),
'bckGrnd' => $bckGrnd,
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$tpl->pfp('out','head');
unset($tpl);
/*
** Getting the correct directories for finding the resources
*/
$template_dir = $GLOBALS['phpgw_info']['server']['webserver_url'] . "/phpgwapi/templates/" . $GLOBALS['phpgw_info']['server']['template_set'];
$js_url = $template_dir.'/js/';
$css_url = $template_dir.'/css/';
if($GLOBALS['phpgw_info']['flags']['currentapp']=='eGroupWare')
{
//Initializing x-desktop
$bodyheader = ' id="xdesktop"';
$theme_css = '<link rel="stylesheet" type="text/css" href="'.$css_url.'idots2_skin.css">';
$theme_css .= '<link rel="stylesheet" type="text/css" href="'.$css_url.'taskbar_down.css">';
$cbe_core = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/cbe_core.js\'></script>';
$cbe_event = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/cbe_event.js\'></script>';
$cbe_slide = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/cbe_slide.js\'></script>';
$skin_idots2 = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/x-desktop_skin_IDOTS2.js\'></script>';
$x_core = '<script type=\'text/javascript\' src=\''.$js_url.'x-desktop/x-desktop_core.js\'></script>';
$x_events = '<script type =\'text/javascript\' src=\''.$js_url.'x-desktop/events.js\'></script>';
$x_shortcuts = '<script type =\'text/javascript\' src=\''.$js_url.'x-desktop/shortcuts.js\'></script>';
$xdesktop .= $theme_css . $cbe_core . $cbe_event . $cbe_slide . $skin_idots2 . $x_core . $x_events . $x_shortcuts;
}
else
{
//Just a normal page
$bodyheader = ' id="xpage"';
$menu_js = '<script type=\'text/javascript\' src=\''.$js_url.'menu.js\'></script>';
$theme_css = '<link rel="stylesheet" type="text/css" href="'.$css_url.'idots2_page.css">';
$xdesktop = $theme_css . $menu_js;
}
/*
** Create/use the template
*/
$tpl = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove');
$tpl->set_file(array('_head' => 'head.tpl'));
$tpl->set_block('_head','head');
if ($GLOBALS['phpgw_info']['flags']['app_header'])
{
$app = $GLOBALS['phpgw_info']['flags']['app_header'];
}
else
{
$app = $GLOBALS['phpgw_info']['flags']['currentapp'];
$app = isset($GLOBALS['phpgw_info']['apps'][$app]) ? $GLOBALS['phpgw_info']['apps'][$app]['title'] : lang($app);
}
if($GLOBALS['phpgw_info']['flags']['currentapp']=='eGroupWare')
{
$app = "";
}
$var = Array(
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'slider_effects'=> $slider_effects,
'simple_show_hide'=> $simple_show_hide,
'lang_code' => $lang_code,
'charset' => $GLOBALS['phpgw']->translation->charset(),
'font_family' => $GLOBALS['phpgw_info']['theme']['font'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title']. ($app ? " [$app]" : ''),
'body_tags' => $bodyheader .' '. $GLOBALS['phpgw']->common->get_body_attribs(),
'xdesktop' => $xdesktop,
'css' => $GLOBALS['phpgw']->common->get_css(),
'bckGrnd' => $bckGrnd,
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$tpl->pfp('out','head');
unset($tpl);
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

View File

@ -3,13 +3,12 @@
* eGroupWare *
* http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/*
* parse_navbar
*
@ -20,6 +19,8 @@
function parse_navbar($force = False)
{
$GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['idots2_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$GLOBALS['idots2_tpl']->set_file(
array(
@ -41,7 +42,7 @@
$GLOBALS['idots2_tpl']->set_block('navbar','show_clock','show_clock');
$GLOBALS['idots2_tpl']->set_block('navbar','no_clock','no_clock');
$GLOBALS['idots2_tpl']->set_block('navbar','sidebox_container','sidebox_container');
$GLOBALS['idots2_tpl']->set_block('navbar','sidebox_container_footer','sidebox_container_footer');
$GLOBALS['idots2_tpl']->set_block('navbar','sidebox_set_open','sidebox_set_open');
@ -53,7 +54,7 @@
$GLOBALS['idots2_tpl']->set_block('navbar','extra_sidebox_block_row_raw','extra_sidebox_block_row_raw');
$GLOBALS['idots2_tpl']->set_block('navbar','extra_sidebox_block_row_no_link','extra_sidebox_block_row_no_link');
$GLOBALS['idots2_tpl']->set_block('navbar','menu_header','menu_header');
$GLOBALS['idots2_tpl']->set_block('navbar','extra_block_row','extra_block_row');
$GLOBALS['idots2_tpl']->set_block('navbar','extra_block_row_raw','extra_block_row_raw');
@ -317,25 +318,26 @@
$GLOBALS['idots2_tpl']->pfp('out','navbar_header_end');
/******************************************************\
* The menu's *
\******************************************************/
}
// its an application, create a window
else
{
$GLOBALS['phpgw']->preferences->read_repository();
/* foreach($GLOBALS['phpgw_info']['user']['apps'] as $name => $data)
//this checks if the rootwindow exist
$var['rooturl'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/index.php?cd=yes';
//set some shortcut vars
$current_app= $GLOBALS['phpgw_info']['flags']['currentapp'];
$current_app_title= $GLOBALS['phpgw_info']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title'];
// _debug_array($GLOBALS['phpgw_info']['flags']['currentapp']);
// _debug_array($GLOBALS['egw']->hooks->found_hooks[$current_app]);
// die();
if($GLOBALS['egw']->hooks->found_hooks[$current_app]['sidebox_menu'])
{
if($data['title'] == $title) {
$state['name'] = $name;
$GLOBALS['phpgw']->preferences->change('phpgwapi','sidebox_state'.$name,$state);
$GLOBALS['phpgw']->preferences->save_repository(True);
break;
}
$sidebox_enabled=true;
}
*/
// build the menu
$menu=array();
$menu['Window'] = array(
@ -343,23 +345,27 @@
'text' => lang('%1 start',$GLOBALS['phpgw_info']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title']),
'no_lang' => True,
'link' => $GLOBALS['phpgw_info']['server']['webserver_url'] . '/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/index.php'
),
array(
),
array(
'text' => lang('Refresh'),
'no_lang' => True,
'link' => 'javascript:document.location=document.location'
),
array(
);
if($sidebox_enabled)
{
$menu['Window'][] = array(
'text' => lang('Open sidebox'),
'no_lang' => True,
'link' => 'javascript:sidebox_open()'
),
array(
);
$menu['Window'][] = array(
'text' => lang('Close sidebox'),
'no_lang' => True,
'link' => 'javascript:sidebox_close()'
),
);
);
}
$menu['Help'] = array(
array(
@ -374,7 +380,6 @@
array(
'text' => lang('About %1',$GLOBALS['phpgw_info']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title']),
'no_lang' => True,
//'link' => 'javascript:parent.openX(\'about\',\''.$GLOBALS['phpgw_info']['navbar']['about']['url'].'\')'
'link' => $GLOBALS['phpgw_info']['navbar']['about']['url']
),
array(
@ -395,28 +400,19 @@
$GLOBALS['idots2_tpl']->set_var($var);
$menu_from_app = $GLOBALS['phpgw']->hooks->single('menu',$GLOBALS['phpgw_info']['flags']['currentapp']);
//_debug_array($menu_new);
//die();
if(is_array($menu_from_app))
{
$menu = array_merge($menu_from_app,$menu);
$menu = array_merge($menu_from_app,$menu);
}
/* else
{
$GLOBALS['phpgw']->hooks->single('sidebox_menu',$GLOBALS['phpgw_info']['flags']['currentapp']);
display_sidebox('',$menu_title,$menu_help);
}
*/
foreach($menu as $menu_title =>$menu)
{
display_textmenu('',$menu_title,$menu);
display_textmenu('',$menu_title,$menu);
}
$GLOBALS['idots2_tpl']->pparse('out','end_appbox');
//build the toolbar
$toolbar = Array();
$toolbar['refresh'] = Array(
'title' => "Refresh",
@ -424,48 +420,63 @@
'url'=>'javascript:document.location=document.location'
);
if($sidebox_enabled)
{
$toolbar['opensidebox'] = Array(
'title' => "Open sidebox",
'image' => 'open_sidebox.png',
'url'=>'javascript:sidebox_open()'
);
$toolbar['closesidebox'] = Array(
'title' => "Open sidebox",
'image' => 'close_sidebox.png',
'url'=>'javascript:sidebox_close()'
);
}
//Is there a toolbar hooked in this application
$toolbar_from_app = $GLOBALS['phpgw']->hooks->single('toolbar',$GLOBALS['phpgw_info']['flags']['currentapp']);
if(is_array($toolbar_from_app) && count($toolbar_from_app) > 0)
{
$toolbar = array_merge($toolbar_from_app,$toolbar);
$toolbar['sep'] = '';
$toolbar = array_merge($toolbar,$toolbar_from_app);
}
display_toolbar($toolbar);
//build the sidebox
$menu_title = lang('General Menu');
$file['Home'] = $GLOBALS['egw_info']['navbar']['home']['url'];
if($GLOBALS['egw_info']['user']['apps']['preferences'])
if($sidebox_enabled)
{
$file['Preferences'] = $GLOBALS['egw_info']['navbar']['preferences']['url'];
$menu_title = lang('General Menu');
$file['Home'] = $GLOBALS['egw_info']['navbar']['home']['url'];
if($GLOBALS['egw_info']['user']['apps']['preferences'])
{
$file['Preferences'] = $GLOBALS['egw_info']['navbar']['preferences']['url'];
}
$file += array(
array(
'text' => lang('About %1',$GLOBALS['egw_info']['apps'][$GLOBALS['egw_info']['flags']['currentapp']]['title']),
'no_lang' => True,
'link' => $GLOBALS['egw_info']['navbar']['about']['url']
),
'Logout'=>$GLOBALS['egw_info']['navbar']['logout']['url']
);
$var['menu_link'] = '';
$var['remove_padding'] = '';
$var['current_app'] = $GLOBALS['egw_info']['flags']['currentapp'];
$GLOBALS['idots2_tpl']->set_var($var);
$GLOBALS['idots2_tpl']->pparse('out','sidebox_container');
$GLOBALS['egw']->hooks->single('sidebox_menu',$GLOBALS['egw_info']['flags']['currentapp']);
$GLOBALS['idots2_tpl']->pparse('out','sidebox_container_footer');
}
$file += array(
array(
'text' => lang('About %1',$GLOBALS['egw_info']['apps'][$GLOBALS['egw_info']['flags']['currentapp']]['title']),
'no_lang' => True,
'link' => $GLOBALS['egw_info']['navbar']['about']['url']
),
'Logout'=>$GLOBALS['egw_info']['navbar']['logout']['url']
);
$var['menu_link'] = '';
$var['remove_padding'] = '';
$var['current_app'] = $GLOBALS['egw_info']['flags']['currentapp'];
$GLOBALS['idots2_tpl']->set_var($var);
$GLOBALS['idots2_tpl']->pparse('out','sidebox_container');
$GLOBALS['egw']->hooks->single('sidebox_menu',$GLOBALS['egw_info']['flags']['currentapp']);
$GLOBALS['idots2_tpl']->pparse('out','sidebox_container_footer');
$GLOBALS['idots2_tpl']->pparse('out','navbar_footer');
// get sidebox state and set it with js
if($GLOBALS['phpgw_info']['user']['preferences']['phpgwapi']['sidebox_'.$GLOBALS['phpgw_info']['flags']['currentapp']]!='close')
if($sidebox_enabled && $GLOBALS['phpgw_info']['user']['preferences']['phpgwapi']['sidebox_'.$GLOBALS['phpgw_info']['flags']['currentapp']]!='close')
{
$GLOBALS['idots2_tpl']->pparse('out','sidebox_set_open');
}
@ -483,12 +494,11 @@
return;
}
/*
* display_toolbar
*
* The toolbar
*
* @todo toggle buttons, better lay-out hover and active
*/
function display_toolbar($toolbar) {
$GLOBALS['idots2_tpl']->pparse('out','begin_toolbar');
@ -499,7 +509,8 @@
$GLOBALS['idots2_tpl']->set_var($item);
$GLOBALS['idots2_tpl']->pfp('out','toolbar_item');
}
else {
else
{
$GLOBALS['idots2_tpl']->pparse('out','toolbar_seperator');
}
}

View File

@ -1,6 +1,6 @@
<!-- BEGIN xdesktop_header -->
<script type='text/javascript'>
var rootwindow=true;
var xDT = new xDesktop();
var clock_set = '{clock}';
var clock_show = '{clock_show}';
@ -21,7 +21,6 @@ var color_text_sc = '{color_text_sc}';
showShortcuts('{appTitles}', '{appUrls}', '{appImgs}','{appTop}','{appLeft}','{appType}','{appName}','{strXmlUrl}');
initSizes('{sizeTitles}', '{sizeWidth}', '{sizeHeight}');
function start() {
xDT.resPath('{template_dir}/js/x-desktop/xDT/');
xDT.desktop.init();
@ -33,7 +32,6 @@ function start() {
openX(default_title, default_app);
}
}
</script>
@ -132,13 +130,13 @@ function start() {
<!-- BEGIN toolbar_item -->
<a href="{url}" onmouseout="this.style.border='1px solid #e5e5e5';" onmouseover="'this.style.border=1px outset #FFF';" onmousedown="this.style.border='1px inset #FFF';" style="background-image: url({image})"></a>
<a href="{url}" onmouseout="this.style.border='1px solid #e5e5e5';" onmouseover="'this.style.border=1px outset #aaa';" onmousedown="this.style.border='1px inset #fff';" style="width:18px;height:18px;background-image: url({image})"></a>
<!-- END toolbar_item -->
<!-- BEGIN toolbar_seperator -->
<div style="float:left;width:1px;height:19px;margin-top:3px;margin-left:2px;margin-right:3px;border-right:solid 1px #aaaaaa"></div>
<!-- END toolbar_seperator -->
@ -236,6 +234,12 @@ sidebox_open();
<!-- BEGIN menu_header -->
<script type=text/javascript>
if(!parent.rootwindow)
{
parent.location.href='{rooturl}';
}
</script>
<li onclick="itemClick(event);" onmouseover="itemHover(event);"> <a href="javascript:void(0);">{lang_title}</a>
<ul>

View File

@ -20,7 +20,8 @@
$GLOBALS['egw_info']['template']['idots2']['icon'] = "phpgwapi/templates/idots2/images/logo-idots.png";
$GLOBALS['egw_info']['template']['idots2']['maintainer'] = array(
array('name' => 'Edo van Bruggen', 'email' => 'edovanbruggen@raketnet.nl'),
array('name' => 'Rob van Kraanen', 'email' => 'rvkraanen@gmail.com')
array('name' => 'Rob van Kraanen', 'email' => 'rvkraanen@gmail.com'),
array('name' => 'Pim Snel', 'email' => 'pim@lingewoud.nl')
);
$GLOBALS['egw_info']['template']['idots2']['description'] = "