From 14755ad51769d4630cff2e962d5a0531aa89480f Mon Sep 17 00:00:00 2001 From: Pim Snel Date: Tue, 12 Jul 2005 20:57:00 +0000 Subject: [PATCH] - 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 --- phpgwapi/templates/idots2/head.inc.php | 194 +++++++++--------- .../templates/idots2/images/close_sidebox.png | Bin 0 -> 484 bytes .../templates/idots2/images/open_sidebox.png | Bin 0 -> 590 bytes phpgwapi/templates/idots2/navbar.inc.php | 151 +++++++------- phpgwapi/templates/idots2/navbar.tpl | 14 +- phpgwapi/templates/idots2/setup/setup.inc.php | 3 +- 6 files changed, 189 insertions(+), 173 deletions(-) create mode 100644 phpgwapi/templates/idots2/images/close_sidebox.png create mode 100644 phpgwapi/templates/idots2/images/open_sidebox.png diff --git a/phpgwapi/templates/idots2/head.inc.php b/phpgwapi/templates/idots2/head.inc.php index a37b83bf22..42b17bad74 100755 --- a/phpgwapi/templates/idots2/head.inc.php +++ b/phpgwapi/templates/idots2/head.inc.php @@ -1,105 +1,105 @@ '; - $theme_css .= ''; - - $cbe_core = ''; - $cbe_event = ''; - $cbe_slide = ''; - $skin_idots2 = ''; - $x_core = ''; - $x_events = ''; - $x_shortcuts = ''; - $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 = ''; - $theme_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 = ''; + $theme_css .= ''; + + $cbe_core = ''; + $cbe_event = ''; + $cbe_slide = ''; + $skin_idots2 = ''; + $x_core = ''; + $x_events = ''; + $x_shortcuts = ''; + $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 = ''; + $theme_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); ?> diff --git a/phpgwapi/templates/idots2/images/close_sidebox.png b/phpgwapi/templates/idots2/images/close_sidebox.png new file mode 100644 index 0000000000000000000000000000000000000000..b4eb6c7c9605b0e03addc3fbf871f5f56761858d GIT binary patch literal 484 zcmVxCO7@wxrE{c>08Y zt_TqkxL0cyoW5&lk?siVH$3~IRp?G|1t&Ogukl|CNLm!Qz5_`l{hRJqUOF%6Iem*(4MqRDa^n%R)MRfAR9{(*-sfmJJ(A^+&@;qvRU9Ib56f=dYRn aUcUhL*Ya$QfFggGL0ozGL zK~y-)rIO8R6j2a`zwYTwhEXQmoW6BoKr(1jrS3O<1^;wy;TfNK}7+~^Ys5kbfU z$Us12a1<2dOlG?8PgS|N>FJJUXTha@s8jcxTQ__7{OjEdtDSX=N~i>13BHWUJHagi z-kq&SCx|bR>iB1|c5&s^#(IA%IHN3$s#MCku~;bO!dPTVo++w^4~pi77K)hzH~v%% z`rWOKL7%FEc^Aqq%sVhIl3&T7$RIaB00rp+5~$o{tJuC|JlX~ohyo%Yv57-G%_I0= z#Av7(5|tOPbBaL^ZjM-*PWE|!a*YQ!hO|x9P*p^dk5SqCkdb2sK()I`wY!N;4>|b0 zI0tM?a1$H3shw%ghS$#pCtwX$L{eVV1NLvfWHy^|%MXE6Gqcu!zmH;O6m}}%{!Sl) zlC7-(9!M}No9=!u&+1P-sRZDqda4I3|4WNGo%U7}1tJlqK zUq7aqQPf-bcIPS1IYy(a@MYSfepW^!!7!uQLakZVxVLk;1^5@Ns?@mR*Gb@DGDkZ@ ztfx$l6&26;bCuQ=rCFO9riNPjiN8+*#oov1v+?1S=p)fZq7Nzd5%H1WQZ7;I?Jn); chvUEP4<2#@($kGgvj6}907*qoM6N<$g5i<`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'); } } diff --git a/phpgwapi/templates/idots2/navbar.tpl b/phpgwapi/templates/idots2/navbar.tpl index a52996cc98..0e93b814d7 100755 --- a/phpgwapi/templates/idots2/navbar.tpl +++ b/phpgwapi/templates/idots2/navbar.tpl @@ -1,6 +1,6 @@ @@ -132,13 +130,13 @@ function start() { - + - +
@@ -236,6 +234,12 @@ sidebox_open(); +
  • {lang_title}
      diff --git a/phpgwapi/templates/idots2/setup/setup.inc.php b/phpgwapi/templates/idots2/setup/setup.inc.php index 4c32b1a2b9..62dfb9c548 100755 --- a/phpgwapi/templates/idots2/setup/setup.inc.php +++ b/phpgwapi/templates/idots2/setup/setup.inc.php @@ -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'] = "