[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 /* $Id: navbar.inc.php 21737 2006-06-07 07:32:58Z nelius_weiss $ */ 13 14 function parse_navbar($force = False) 15 { 16 $GLOBALS['idots_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); 17 18 $GLOBALS['idots_tpl']->set_file( 19 array( 20 'navbar' => 'navbar.tpl' 21 ) 22 ); 23 24 $GLOBALS['idots_tpl']->set_block('navbar','navbar_header','navbar_header'); 25 $GLOBALS['idots_tpl']->set_block('navbar','extra_blocks_header','extra_block_header'); 26 $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row','extra_block_row'); 27 $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row_raw','extra_block_row_raw'); 28 $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row_no_link','extra_block_row_no_link'); 29 $GLOBALS['idots_tpl']->set_block('navbar','extra_block_spacer','extra_block_spacer'); 30 $GLOBALS['idots_tpl']->set_block('navbar','extra_blocks_footer','extra_blocks_footer'); 31 $GLOBALS['idots_tpl']->set_block('navbar','sidebox_hide_header','sidebox_hide_header'); 32 $GLOBALS['idots_tpl']->set_block('navbar','sidebox_hide_footer','sidebox_hide_footer'); 33 $GLOBALS['idots_tpl']->set_block('navbar','appbox','appbox'); 34 $GLOBALS['idots_tpl']->set_block('navbar','navbar_footer','navbar_footer'); 35 36 $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images'; 37 $var['table_bg_color'] = $GLOBALS['egw_info']['theme']['navbar_bg']; 38 39 if($GLOBALS['egw_info']['user']['preferences']['common']['click_or_onmouseover']=='onmouseover') 40 { 41 $show_menu_event = 'onMouseOver'; 42 } 43 else 44 { 45 $show_menu_event = 'onClick'; 46 } 47 48 if($GLOBALS['egw_info']['user']['userid'] == 'anonymous') 49 { 50 $cnf_reg =& CreateObject('phpgwapi.config','registration'); 51 $cnf_reg->read_repository(); 52 $config_reg = $cnf_reg->config_data; 53 54 $GLOBALS['idots_tpl']->set_var('upper_tabs',' 55 <ul> 56 <li><a href="'.$GLOBALS['egw']->link('/logout.php').'">'.lang('Login').'</a></li>'. 57 ( ($config_reg[enable_registration]=='True' && $config_reg[register_link]=='True') ? '<li><a href="'.$GLOBALS['egw']->link('/registration/index.php').'">'.lang('Register').'</a></li>' : '').' 58 </ul> 59 '); 60 } 61 62 $applications = ''; 63 64 // == 'icons_and_text') 65 66 $max_icons=$GLOBALS['egw_info']['user']['preferences']['common']['max_icons']; 67 if(!$max_icons) 68 { 69 $max_icons=200; 70 } 71 72 foreach($GLOBALS['egw_info']['navbar'] as $app => $app_data) 73 { 74 if($app != 'preferences' && $app != 'about' && $app != 'logout') 75 { 76 $title = $GLOBALS['egw_info']['apps'][$app]['title']; 77 $icon = '<img src="' . $app_data['icon'] . '" alt="' . $title . '" title="'. $title . '" border="0" />'; 78 79 80 if($app=='home') 81 { 82 $title = lang('home'); 83 $icon = '<img src="' . $app_data['icon'] . '" alt="' . lang('home') . '" title="' . lang('home') . '" border="0" />'; 84 } 85 86 if($i<$max_icons) 87 { 88 if($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons']=='no') 89 { 90 $tdwidth = 100/($max_icons); 91 } 92 else 93 { 94 $tdwidth = 100/($max_icons+2); 95 } 96 $tdwidth=round($tdwidth); 97 98 $app_icons .= '<td width="'.$tdwidth.'%" align="center" style="text-align:center"><a href="' . $app_data['url'] . '"'; 99 100 if(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) 101 { 102 $app_icons .= ' target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; 103 } 104 105 $app_icons .= $app_data['target'].'>' . $icon . '</a></td>'; 106 107 $app_titles .= '<td align="center" valign="top" class="appTitles" style="text-align:center"><a href="'.$app_data['url'] . '"'; 108 109 if(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) 110 { 111 $app_titles .= ' target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; 112 } 113 114 $app_titles .= $app_data['target'].'>' . $title . '</a></td>'; 115 } 116 // else // generate extra icon layer | always shows icons and text 117 else // generate extra icon layer shows icons and/or text 118 { 119 // check for small icon version else use default and let the browser resize 120 $icon = '<img src="' . $app_data['icon'] . '" alt="' . $title . '" width="16" title="'. $title . '" border="0" />'; 121 122 $app_extra_icons .= '<tr>'; 123 124 if($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format']!='text') 125 { 126 $app_extra_icons .= '<td class="extraIconsRow"><a href="' . $app_data['url'] . '"'; 127 128 if(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) 129 { 130 $app_extra_icons .= ' target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; 131 } 132 133 $app_extra_icons .= $app_data['target'].' >' . $icon . '</a></td>'; 134 } 135 136 137 138 // $app_extra_icons .= '<tr><td><a href="' . $app_data['url'] . '"'; 139 140 // if(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) 141 // { 142 // $app_extra_icons .= ' target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; 143 // } 144 145 // $app_extra_icons .= '>' . $icon . '</a></td>'; 146 147 $app_extra_icons .= '<td align="left" class="extraIconsRow" style=""><a href="'.$app_data['url'] . '"'; 148 149 if(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) 150 { 151 $app_extra_icons .= ' target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; 152 } 153 154 $app_extra_icons .= $app_data['target'].'>' . $title . '</a></td></tr>'; 155 } 156 157 unset($icon); 158 unset($title); 159 $i++; 160 } 161 } 162 163 if($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons']!='no' && $GLOBALS['egw_info']['user']['userid'] != 'anonymous') 164 { 165 $app_icons .= '<td width="'.$tdwidth.'%" height="32" valign="bottom" align="center" style="text-align:center"><a href="'.$GLOBALS['egw_info']['navbar']['logout']['url'].'"><img src="'.$GLOBALS['egw_info']['navbar']['logout']['icon'].'" title="'.$GLOBALS['egw_info']['navbar']['logout']['title'].'" alt="'.$GLOBALS['egw_info']['navbar']['logout']['title'].'"></a></td>'; 166 $app_titles .= '<td align="center" valign="top" class="appTitles" style="text-align:center"><a href="'.$GLOBALS['egw_info']['navbar']['logout']['url'].'">'.$GLOBALS['egw_info']['navbar']['logout']['title'].'</a></td>'; 167 168 } 169 // $var['app_icons'] = $app_icons; 170 if($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format']!='text') 171 { 172 $var['app_icons'] = $app_icons; 173 } 174 175 if($i > $max_icons) 176 { 177 // table width=100% fixed layout bug (ndee130204) 178 $app_extra_icons_div = ' 179 <script language="javascript"> 180 new ypSlideOutMenu("menu1", "down", 10, 114, 160, 200,\'right\') 181 </script> 182 <div id="menu1Container"> 183 <div id="menu1Content" style="position: relative; left: 0; text-align: left;"> 184 185 <div id="extraIcons"> 186 187 <table cellspacing="0" cellpadding="0" border="0" width="100%"> 188 <tr><td colspan="2" nowrap="nowrap" align="right" style="background-color:#dddddd;padding:1px;"> 189 <a href="#" '.$show_menu_event.'="ypSlideOutMenu.hide(\'menu1\')" title="'.lang('close').'"> 190 <img style="" border="0" src="'.$var['img_root'].'/close.png"/></a></td></tr> 191 '.$app_extra_icons.'</table> 192 </div> 193 194 </div> 195 </div> 196 '; 197 198 $var['app_extra_icons_div']= $app_extra_icons_div; 199 // $var['app_extra_icons_icon']= '<td width="26" valign="top" align="right" style="padding-right:3px;padding-top:50px;"><a title="'.lang('show_more_apps').'" href="javascript:void(0);" onClick="HideShow(\'extraIcons\');"><img src="'.$var['img_root'].'/extra_icons.png" border="0" /></a></td>'; 200 $var['app_extra_icons_icon']= '<td width="26" valign="top" align="right" style="padding-right:3px;padding-top:20px;"><a title="'.lang('show_more_apps').'" href="#" '.$show_menu_event.'="ypSlideOutMenu.showMenu(\'menu1\')"><img src="'.$var['img_root'].'/extra_icons.png" border="0" /></a></td>'; 201 } 202 203 if($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format']!='icons') 204 { 205 $var['app_titles'] = $app_titles; 206 } 207 else 208 { 209 $var['app_titles'] = '<td colspan="'.$max_icons.'"> </td>'; 210 } 211 if(isset($GLOBALS['egw_info']['flags']['app_header'])) 212 { 213 $var['current_app_title'] = $GLOBALS['egw_info']['flags']['app_header']; 214 } 215 else 216 { 217 $var['current_app_title']=$GLOBALS['egw_info']['navbar'][$GLOBALS['egw_info']['flags']['currentapp']]['title']; 218 } 219 220 if(isset($GLOBALS['egw_info']['navbar']['admin']) && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) 221 { 222 $var['current_users'] = '<a href="' 223 . $GLOBALS['egw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">' 224 . lang('Current users') . ': ' . $GLOBALS['egw']->session->total() . '</a>'; 225 } 226 $now = time(); 227 $var['user_info'] = '<b>'.$GLOBALS['egw']->common->display_fullname() .'</b>'. ' - ' 228 . lang($GLOBALS['egw']->common->show_date($now,'l')) . ' ' 229 . $GLOBALS['egw']->common->show_date($now,$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']); 230 231 if($GLOBALS['egw_info']['user']['lastpasswd_change'] == 0) 232 { 233 $api_messages = lang('You are required to change your password during your first login') 234 . '<br> Click this image on the navbar: <img src="' 235 . $GLOBALS['egw']->common->image('preferences','navbar.gif').'">'; 236 } 237 elseif($GLOBALS['egw_info']['user']['lastpasswd_change'] < time() - (86400*30)) 238 { 239 $api_messages = lang('it has been more then %1 days since you changed your password',30); 240 } 241 242 // This is gonna change 243 if(isset($cd)) 244 { 245 $var['messages'] = $api_messages . '<br>' . checkcode($cd); 246 } 247 248 if (substr($GLOBALS['egw_info']['server']['login_logo_file'],0,4) == 'http') 249 { 250 $var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file']; 251 } 252 else 253 { 254 $var['logo_file'] = $GLOBALS['egw']->common->image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo'); 255 } 256 $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; 257 if (substr($var['logo_url'],0,4) != 'http') 258 { 259 $var['logo_url'] = 'http://'.$var['logo_url']; 260 } 261 $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; 262 263 $GLOBALS['idots_tpl']->set_var($var); 264 $GLOBALS['idots_tpl']->pfp('out','navbar_header'); 265 266 /******************************************************\ 267 * The sidebox menu's * 268 \******************************************************/ 269 270 $menu_title = lang('General Menu'); 271 272 $file['Home'] = $GLOBALS['egw_info']['navbar']['home']['url']; 273 if($GLOBALS['egw_info']['user']['apps']['preferences']) 274 { 275 $file['Preferences'] = $GLOBALS['egw_info']['navbar']['preferences']['url']; 276 } 277 $file += array( 278 array( 279 'text' => lang('About %1',$GLOBALS['egw_info']['apps'][$GLOBALS['egw_info']['flags']['currentapp']]['title']), 280 'no_lang' => True, 281 'link' => $GLOBALS['egw_info']['navbar']['about']['url'] 282 ), 283 $GLOBALS['egw_info']['user']['userid'] != 'anonymous' ? 'Logout' : 'Login' =>$GLOBALS['egw_info']['navbar']['logout']['url'] 284 ); 285 286 if($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']==1) 287 { 288 $GLOBALS['idots_tpl']->set_var('show_menu_event',$show_menu_event); 289 $GLOBALS['idots_tpl']->set_var('lang_show_menu',lang('show menu')); 290 $GLOBALS['idots_tpl']->pparse('out','sidebox_hide_header'); 291 292 display_sidebox('',$menu_title,$file); 293 $GLOBALS['egw']->hooks->single('sidebox_menu',$GLOBALS['egw_info']['flags']['currentapp']); 294 295 $GLOBALS['idots_tpl']->pparse('out','sidebox_hide_footer'); 296 297 $var['sideboxcolstart']=''; 298 299 $GLOBALS['idots_tpl']->set_var($var); 300 $GLOBALS['idots_tpl']->pparse('out','appbox'); 301 $var['remove_padding'] = 'style="padding-left:0px;"'; 302 $var['sideboxcolend'] = ''; 303 } 304 else 305 { 306 $var['menu_link'] = ''; 307 $var['sideboxcolstart'] = '<td id="tdSidebox" valign="top">'; 308 $var['remove_padding'] = ''; 309 $GLOBALS['idots_tpl']->set_var($var); 310 $GLOBALS['idots_tpl']->pparse('out','appbox'); 311 312 display_sidebox('',$menu_title,$file); 313 $GLOBALS['egw']->hooks->single('sidebox_menu',$GLOBALS['egw_info']['flags']['currentapp']); 314 315 $var['sideboxcolend'] = '</td>'; 316 } 317 318 $GLOBALS['idots_tpl']->set_var($var); 319 $GLOBALS['idots_tpl']->pparse('out','navbar_footer'); 320 321 // If the application has a header include, we now include it 322 if(!@$GLOBALS['egw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) 323 { 324 list($app,$class,$method) = explode('.',$_GET['menuaction']); 325 if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) 326 { 327 $GLOBALS[$class]->header(); 328 } 329 } 330 $GLOBALS['egw']->hooks->process('after_navbar'); 331 return; 332 } 333 334 function display_sidebox($appname,$menu_title,$file) 335 { 336 if(!$appname || ($appname==$GLOBALS['egw_info']['flags']['currentapp'] && $file)) 337 { 338 $var['lang_title']=$menu_title;//$appname.' '.lang('Menu'); 339 $GLOBALS['idots_tpl']->set_var($var); 340 $GLOBALS['idots_tpl']->pfp('out','extra_blocks_header'); 341 342 foreach($file as $text => $url) 343 { 344 sidebox_menu_item($url,$text); 345 } 346 347 $GLOBALS['idots_tpl']->pparse('out','extra_blocks_footer'); 348 } 349 } 350 351 function sidebox_menu_item($item_link='',$item_text='') 352 { 353 if($item_text === '_NewLine_' || $item_link === '_NewLine_') 354 { 355 $GLOBALS['idots_tpl']->pparse('out','extra_block_spacer'); 356 } 357 else 358 { 359 $var['icon_or_star']='<img src="'.$GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images'.'/orange-ball.png" width="9" height="9" alt="ball"/>'; 360 $var['target'] = ''; 361 if(is_array($item_link)) 362 { 363 if(isset($item_link['icon'])) 364 { 365 $app = isset($item_link['app']) ? $item_link['app'] : $GLOBALS['egw_info']['flags']['currentapp']; 366 $var['icon_or_star'] = $item_link['icon'] ? '<img style="margin:0px 2px 0px 2px" src="'.$GLOBALS['egw']->common->image($app,$item_link['icon']).'"/>' : False; 367 } 368 $var['lang_item'] = isset($item_link['no_lang']) && $item_link['no_lang'] ? $item_link['text'] : lang($item_link['text']); 369 $var['item_link'] = $item_link['link']; 370 if ($item_link['target']) 371 { 372 $var['target'] = ' target="' . $item_link['target'] . '"'; 373 } 374 } 375 else 376 { 377 $var['lang_item'] = lang($item_text); 378 $var['item_link'] = $item_link; 379 } 380 $GLOBALS['idots_tpl']->set_var($var); 381 382 $block = 'extra_block_row'; 383 if ($var['item_link'] === False) 384 { 385 $block .= $var['icon_or_star'] === False ? '_raw' : '_no_link'; 386 } 387 $GLOBALS['idots_tpl']->pparse('out',$block); 388 } 389 } 390 391 function parse_navbar_end() 392 { 393 $GLOBALS['idots_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); 394 395 $GLOBALS['idots_tpl']->set_file( 396 array( 397 'footer' => 'footer.tpl' 398 ) 399 ); 400 $var = Array( 401 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images', 402 'table_bg_color' => $GLOBALS['egw_info']['theme']['navbar_bg'], 403 'version' => $GLOBALS['egw_info']['server']['versions']['phpgwapi'] 404 ); 405 $GLOBALS['egw']->hooks->process('navbar_end'); 406 407 if($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) 408 { 409 $totaltime = sprintf('%4.2lf',perfgetmicrotime() - $GLOBALS['egw_info']['flags']['page_start_time']); 410 411 $var['page_generation_time'] = '<div id="divGenTime"><br/><span>'.lang('Page was generated in %1 seconds',$totaltime).'</span></div>'; 412 } 413 414 $var['powered_by'] = lang('Powered by eGroupWare version %1',$GLOBALS['egw_info']['server']['versions']['phpgwapi']); 415 $var['activate_tooltips'] = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_tooltip/wz_tooltip.js" type="text/javascript"></script>'; 416 $GLOBALS['idots_tpl']->set_var($var); 417 $GLOBALS['idots_tpl']->pfp('out','footer'); 418 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |