From 62aa256eaf41aacd77e56856e40f9925699be875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Wed, 7 Jun 2006 07:32:58 +0000 Subject: [PATCH] add autologin for anonymous user as we need to have on community.egroupware.org --- phpgwapi/templates/idots/navbar.inc.php | 418 ++++++++++++++++++++++++ phpgwapi/templates/idots/navbar.tpl | 135 ++++++++ 2 files changed, 553 insertions(+) create mode 100644 phpgwapi/templates/idots/navbar.inc.php create mode 100644 phpgwapi/templates/idots/navbar.tpl diff --git a/phpgwapi/templates/idots/navbar.inc.php b/phpgwapi/templates/idots/navbar.inc.php new file mode 100644 index 0000000000..78e214e5d5 --- /dev/null +++ b/phpgwapi/templates/idots/navbar.inc.php @@ -0,0 +1,418 @@ +set_file( + array( + 'navbar' => 'navbar.tpl' + ) + ); + + $GLOBALS['idots_tpl']->set_block('navbar','navbar_header','navbar_header'); + $GLOBALS['idots_tpl']->set_block('navbar','extra_blocks_header','extra_block_header'); + $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row','extra_block_row'); + $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row_raw','extra_block_row_raw'); + $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row_no_link','extra_block_row_no_link'); + $GLOBALS['idots_tpl']->set_block('navbar','extra_block_spacer','extra_block_spacer'); + $GLOBALS['idots_tpl']->set_block('navbar','extra_blocks_footer','extra_blocks_footer'); + $GLOBALS['idots_tpl']->set_block('navbar','sidebox_hide_header','sidebox_hide_header'); + $GLOBALS['idots_tpl']->set_block('navbar','sidebox_hide_footer','sidebox_hide_footer'); + $GLOBALS['idots_tpl']->set_block('navbar','appbox','appbox'); + $GLOBALS['idots_tpl']->set_block('navbar','navbar_footer','navbar_footer'); + + $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images'; + $var['table_bg_color'] = $GLOBALS['egw_info']['theme']['navbar_bg']; + + if($GLOBALS['egw_info']['user']['preferences']['common']['click_or_onmouseover']=='onmouseover') + { + $show_menu_event = 'onMouseOver'; + } + else + { + $show_menu_event = 'onClick'; + } + + if($GLOBALS['egw_info']['user']['userid'] == 'anonymous') + { + $cnf_reg =& CreateObject('phpgwapi.config','registration'); + $cnf_reg->read_repository(); + $config_reg = $cnf_reg->config_data; + + $GLOBALS['idots_tpl']->set_var('upper_tabs',' + + '); + } + + $applications = ''; + + // == 'icons_and_text') + + $max_icons=$GLOBALS['egw_info']['user']['preferences']['common']['max_icons']; + if(!$max_icons) + { + $max_icons=200; + } + + foreach($GLOBALS['egw_info']['navbar'] as $app => $app_data) + { + if($app != 'preferences' && $app != 'about' && $app != 'logout') + { + $title = $GLOBALS['egw_info']['apps'][$app]['title']; + $icon = '' . $title . ''; + + + if($app=='home') + { + $title = lang('home'); + $icon = '' . lang('home') . ''; + } + + if($i<$max_icons) + { + if($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons']=='no') + { + $tdwidth = 100/($max_icons); + } + else + { + $tdwidth = 100/($max_icons+2); + } + $tdwidth=round($tdwidth); + + $app_icons .= '' . $icon . ''; + + $app_titles .= '' . $title . ''; + } + // else // generate extra icon layer | always shows icons and text + else // generate extra icon layer shows icons and/or text + { + // check for small icon version else use default and let the browser resize + $icon = '' . $title . ''; + + $app_extra_icons .= ''; + + if($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format']!='text') + { + $app_extra_icons .= '' . $icon . ''; + } + + + + // $app_extra_icons .= ''; + + $app_extra_icons .= '' . $title . ''; + } + + unset($icon); + unset($title); + $i++; + } + } + + if($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons']!='no' && $GLOBALS['egw_info']['user']['userid'] != 'anonymous') + { + $app_icons .= ''.$GLOBALS['egw_info']['navbar']['logout']['title'].''; + $app_titles .= ''.$GLOBALS['egw_info']['navbar']['logout']['title'].''; + + } +// $var['app_icons'] = $app_icons; + if($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format']!='text') + { + $var['app_icons'] = $app_icons; + } + + if($i > $max_icons) + { +// table width=100% fixed layout bug (ndee130204) + $app_extra_icons_div = ' + + + '; + + $var['app_extra_icons_div']= $app_extra_icons_div; + // $var['app_extra_icons_icon']= ''; + $var['app_extra_icons_icon']= ''; + } + + if($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format']!='icons') + { + $var['app_titles'] = $app_titles; + } + else + { + $var['app_titles'] = ' '; + } + if(isset($GLOBALS['egw_info']['flags']['app_header'])) + { + $var['current_app_title'] = $GLOBALS['egw_info']['flags']['app_header']; + } + else + { + $var['current_app_title']=$GLOBALS['egw_info']['navbar'][$GLOBALS['egw_info']['flags']['currentapp']]['title']; + } + + if(isset($GLOBALS['egw_info']['navbar']['admin']) && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) + { + $var['current_users'] = '' + . lang('Current users') . ': ' . $GLOBALS['egw']->session->total() . ''; + } + $now = time(); + $var['user_info'] = ''.$GLOBALS['egw']->common->display_fullname() .''. ' - ' + . lang($GLOBALS['egw']->common->show_date($now,'l')) . ' ' + . $GLOBALS['egw']->common->show_date($now,$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']); + + if($GLOBALS['egw_info']['user']['lastpasswd_change'] == 0) + { + $api_messages = lang('You are required to change your password during your first login') + . '
Click this image on the navbar: '; + } + elseif($GLOBALS['egw_info']['user']['lastpasswd_change'] < time() - (86400*30)) + { + $api_messages = lang('it has been more then %1 days since you changed your password',30); + } + + // This is gonna change + if(isset($cd)) + { + $var['messages'] = $api_messages . '
' . checkcode($cd); + } + + if (substr($GLOBALS['egw_info']['server']['login_logo_file'],0,4) == 'http') + { + $var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file']; + } + else + { + $var['logo_file'] = $GLOBALS['egw']->common->image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo'); + } + $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; + if (substr($var['logo_url'],0,4) != 'http') + { + $var['logo_url'] = 'http://'.$var['logo_url']; + } + $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; + + $GLOBALS['idots_tpl']->set_var($var); + $GLOBALS['idots_tpl']->pfp('out','navbar_header'); + + /******************************************************\ + * The sidebox menu's * + \******************************************************/ + + $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'] + ), + $GLOBALS['egw_info']['user']['userid'] != 'anonymous' ? 'Logout' : 'Login' =>$GLOBALS['egw_info']['navbar']['logout']['url'] + ); + + if($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']==1) + { + $GLOBALS['idots_tpl']->set_var('show_menu_event',$show_menu_event); + $GLOBALS['idots_tpl']->set_var('lang_show_menu',lang('show menu')); + $GLOBALS['idots_tpl']->pparse('out','sidebox_hide_header'); + + display_sidebox('',$menu_title,$file); + $GLOBALS['egw']->hooks->single('sidebox_menu',$GLOBALS['egw_info']['flags']['currentapp']); + + $GLOBALS['idots_tpl']->pparse('out','sidebox_hide_footer'); + + $var['sideboxcolstart']=''; + + $GLOBALS['idots_tpl']->set_var($var); + $GLOBALS['idots_tpl']->pparse('out','appbox'); + $var['remove_padding'] = 'style="padding-left:0px;"'; + $var['sideboxcolend'] = ''; + } + else + { + $var['menu_link'] = ''; + $var['sideboxcolstart'] = ''; + $var['remove_padding'] = ''; + $GLOBALS['idots_tpl']->set_var($var); + $GLOBALS['idots_tpl']->pparse('out','appbox'); + + display_sidebox('',$menu_title,$file); + $GLOBALS['egw']->hooks->single('sidebox_menu',$GLOBALS['egw_info']['flags']['currentapp']); + + $var['sideboxcolend'] = ''; + } + + $GLOBALS['idots_tpl']->set_var($var); + $GLOBALS['idots_tpl']->pparse('out','navbar_footer'); + + // If the application has a header include, we now include it + if(!@$GLOBALS['egw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) + { + list($app,$class,$method) = explode('.',$_GET['menuaction']); + if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) + { + $GLOBALS[$class]->header(); + } + } + $GLOBALS['egw']->hooks->process('after_navbar'); + return; + } + + function display_sidebox($appname,$menu_title,$file) + { + if(!$appname || ($appname==$GLOBALS['egw_info']['flags']['currentapp'] && $file)) + { + $var['lang_title']=$menu_title;//$appname.' '.lang('Menu'); + $GLOBALS['idots_tpl']->set_var($var); + $GLOBALS['idots_tpl']->pfp('out','extra_blocks_header'); + + foreach($file as $text => $url) + { + sidebox_menu_item($url,$text); + } + + $GLOBALS['idots_tpl']->pparse('out','extra_blocks_footer'); + } + } + + function sidebox_menu_item($item_link='',$item_text='') + { + if($item_text === '_NewLine_' || $item_link === '_NewLine_') + { + $GLOBALS['idots_tpl']->pparse('out','extra_block_spacer'); + } + else + { + $var['icon_or_star']='ball'; + $var['target'] = ''; + if(is_array($item_link)) + { + if(isset($item_link['icon'])) + { + $app = isset($item_link['app']) ? $item_link['app'] : $GLOBALS['egw_info']['flags']['currentapp']; + $var['icon_or_star'] = $item_link['icon'] ? '' : False; + } + $var['lang_item'] = isset($item_link['no_lang']) && $item_link['no_lang'] ? $item_link['text'] : lang($item_link['text']); + $var['item_link'] = $item_link['link']; + if ($item_link['target']) + { + $var['target'] = ' target="' . $item_link['target'] . '"'; + } + } + else + { + $var['lang_item'] = lang($item_text); + $var['item_link'] = $item_link; + } + $GLOBALS['idots_tpl']->set_var($var); + + $block = 'extra_block_row'; + if ($var['item_link'] === False) + { + $block .= $var['icon_or_star'] === False ? '_raw' : '_no_link'; + } + $GLOBALS['idots_tpl']->pparse('out',$block); + } + } + + function parse_navbar_end() + { + $GLOBALS['idots_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); + + $GLOBALS['idots_tpl']->set_file( + array( + 'footer' => 'footer.tpl' + ) + ); + $var = Array( + 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images', + 'table_bg_color' => $GLOBALS['egw_info']['theme']['navbar_bg'], + 'version' => $GLOBALS['egw_info']['server']['versions']['phpgwapi'] + ); + $GLOBALS['egw']->hooks->process('navbar_end'); + + if($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) + { + $totaltime = sprintf('%4.2lf',perfgetmicrotime() - $GLOBALS['egw_info']['flags']['page_start_time']); + + $var['page_generation_time'] = '

'.lang('Page was generated in %1 seconds',$totaltime).'
'; + } + + $var['powered_by'] = lang('Powered by eGroupWare version %1',$GLOBALS['egw_info']['server']['versions']['phpgwapi']); + $var['activate_tooltips'] = ''; + $GLOBALS['idots_tpl']->set_var($var); + $GLOBALS['idots_tpl']->pfp('out','footer'); + } diff --git a/phpgwapi/templates/idots/navbar.tpl b/phpgwapi/templates/idots/navbar.tpl new file mode 100644 index 0000000000..3b9b1407bb --- /dev/null +++ b/phpgwapi/templates/idots/navbar.tpl @@ -0,0 +1,135 @@ + + + +{app_extra_icons_div} + + +
+
+ {upper_tabs} +
+
+ + + + + + {app_extra_icons_icon} + +
+ + + {app_icons} + + + {app_titles} + +
+ +
+
+
{user_info}{current_users}
+ + + + + + + +
+ + + + {sideboxcolstart} + + + + + + + + +
+ +
+ +
+
+ +
+ + + + + +
+
+ +
+
+
+ + + + + + + + + {sideboxcolend} + + + + +
{current_app_title}
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
{lang_title}
+
+ + + + + +
+
+
+ +
+ + + + + +
{icon_or_star}{lang_item}
{lang_item}
{icon_or_star}{lang_item}