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