[2] | 1 | <?php |
---|
[2529] | 2 | /**************************************************************************\ |
---|
| 3 | * phpGroupWare * |
---|
| 4 | * http://www.phpgroupware.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 | \**************************************************************************/ |
---|
[2] | 11 | |
---|
| 12 | |
---|
[2529] | 13 | function parse_navbar($force = False) |
---|
| 14 | { |
---|
| 15 | $GLOBALS['celepar_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); |
---|
[2] | 16 | |
---|
[2529] | 17 | $GLOBALS['celepar_tpl']->set_file( |
---|
| 18 | array( |
---|
| 19 | 'navbar' => 'navbar.tpl' |
---|
| 20 | ) |
---|
| 21 | ); |
---|
[2] | 22 | |
---|
[2529] | 23 | $GLOBALS['celepar_tpl']->set_block('navbar','navbar_header','navbar_header'); |
---|
| 24 | $GLOBALS['celepar_tpl']->set_block('navbar','extra_blocks_header','extra_block_header'); |
---|
| 25 | $GLOBALS['celepar_tpl']->set_block('navbar','extra_block_row','extra_block_row'); |
---|
| 26 | $GLOBALS['celepar_tpl']->set_block('navbar','extra_block_spacer','extra_block_spacer'); |
---|
| 27 | $GLOBALS['celepar_tpl']->set_block('navbar','extra_blocks_footer','extra_blocks_footer'); |
---|
| 28 | $GLOBALS['celepar_tpl']->set_block('navbar','sidebox_hide_header','sidebox_hide_header'); |
---|
| 29 | $GLOBALS['celepar_tpl']->set_block('navbar','sidebox_hide_footer','sidebox_hide_footer'); |
---|
| 30 | $GLOBALS['celepar_tpl']->set_block('navbar','appbox','appbox'); |
---|
| 31 | $GLOBALS['celepar_tpl']->set_block('navbar','navbar_footer','navbar_footer'); |
---|
[2] | 32 | |
---|
[2529] | 33 | $GLOBALS['celepar_tpl']->set_var('my_preferences', lang("My Preferences")); |
---|
| 34 | $GLOBALS['celepar_tpl']->set_var('title_my_preferences', lang("Click here to change your Expresso password and other preferences")); |
---|
| 35 | $GLOBALS['celepar_tpl']->set_var('title_suggestions', lang("Send your critics, doubts or suggestions")); |
---|
| 36 | $GLOBALS['celepar_tpl']->set_var('suggestions', lang("Suggestions")); |
---|
| 37 | $GLOBALS['celepar_tpl']->set_var('help', lang("Help")); |
---|
| 38 | $GLOBALS['celepar_tpl']->set_var('title_help', lang("Click here for help")); |
---|
| 39 | $GLOBALS['celepar_tpl']->set_var('template',$GLOBALS['phpgw_info']['server']['template_set']); |
---|
[1247] | 40 | |
---|
[2529] | 41 | $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images'; |
---|
| 42 | $var['dir_root'] = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
| 43 | $var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg']; |
---|
[2] | 44 | |
---|
[2623] | 45 | if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'click_or_onmouseover' ] == 'onmouseover' ) |
---|
[2991] | 46 | $show_menu_event = 'onmouseover'; |
---|
[2529] | 47 | else |
---|
[2991] | 48 | $show_menu_event = 'onclick'; |
---|
[1247] | 49 | |
---|
[2529] | 50 | $applications = ''; |
---|
[1247] | 51 | |
---|
[2529] | 52 | // == 'icons_and_text') |
---|
| 53 | |
---|
[2623] | 54 | $max_icons = $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'max_icons' ]; |
---|
[2529] | 55 | |
---|
[2623] | 56 | if ( ! $max_icons ) |
---|
| 57 | $max_icons = 200; |
---|
[2529] | 58 | |
---|
[2623] | 59 | $indent = "\n\t\t\t\t\t\t"; |
---|
[2578] | 60 | $curr_app = NULL; |
---|
[2529] | 61 | $i = 0; |
---|
[2623] | 62 | $cacheit = array( 'admin', 'expressoAdmin1_2', 'expressoMail1_2', 'contactcenter', 'jabberit_messenger', 'filemanager' ); |
---|
| 63 | foreach ( $GLOBALS[ 'phpgw_info' ][ 'navbar' ] as $app => $app_data ) |
---|
[2529] | 64 | { |
---|
[2623] | 65 | $current_app = false; |
---|
| 66 | if ( $app != 'preferences' && $app != 'about' && $app != 'logout' ) |
---|
[1247] | 67 | { |
---|
[2623] | 68 | $icon = "{$indent}\t\t\t" . '<a href="' . $app_data[ 'url' ] . '" cacheit="' |
---|
| 69 | . ( in_array( $app, $cacheit ) ? 'true' : 'false' ) |
---|
[2529] | 70 | . '">'; |
---|
[2505] | 71 | |
---|
[2623] | 72 | $title = $GLOBALS[ 'phpgw_info' ][ 'apps' ][ $app ][ 'title' ]; |
---|
| 73 | |
---|
| 74 | if ( $app == 'home' ) |
---|
| 75 | $title = lang( 'Home' ); |
---|
| 76 | |
---|
| 77 | if ( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ] == $app ) |
---|
[2529] | 78 | { |
---|
[2623] | 79 | $current_app = true; |
---|
[2578] | 80 | $curr_app = $app; |
---|
[2529] | 81 | } |
---|
[1247] | 82 | |
---|
[2623] | 83 | $icon .= "{$indent}\t\t\t\t" . '<img id="'.str_replace('_','',$app).'id" src="' . $app_data['icon'] . '" alt="' . $title . '" title="'. $title |
---|
[2991] | 84 | . '" border="0" width="' . ( $current_app ? 35 : 24 ) . '" height="' . ( $current_app ? 35 : 24 ) . '"/>' |
---|
[2623] | 85 | . "{$indent}\t\t\t</a>"; |
---|
[2505] | 86 | |
---|
[2623] | 87 | if ( $app == 'home' ) |
---|
| 88 | if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'start_and_logout_icons' ] == 'no' ) |
---|
[2529] | 89 | continue; |
---|
[1247] | 90 | |
---|
[2623] | 91 | if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']=='icons' ) |
---|
| 92 | { |
---|
[2529] | 93 | $title_extra = $title; |
---|
| 94 | $title = ''; |
---|
| 95 | } |
---|
[2623] | 96 | else |
---|
| 97 | if( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] == 'text' ) |
---|
| 98 | $icon = ''; |
---|
[1247] | 99 | |
---|
[2623] | 100 | if ( $i < $max_icons ) |
---|
| 101 | { |
---|
| 102 | if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'start_and_logout_icons' ] == 'no' ) |
---|
| 103 | $tdwidth = 100 / ( $max_icons ); |
---|
[2529] | 104 | else |
---|
[2623] | 105 | $tdwidth = 100 / ( $max_icons + 2 ); |
---|
[1247] | 106 | |
---|
[2991] | 107 | $app_icons .= "{$indent}\t\t" . '<td nowrap="nowrap" class="navbar_but' . ( $current_app ? 'Out' : '' ) . '">'; |
---|
[1247] | 108 | |
---|
[2623] | 109 | if ( isset( $GLOBALS['phpgw_info']['flags']['navbar_target'] ) && $GLOBALS['phpgw_info']['flags']['navbar_target'] ) |
---|
[2529] | 110 | $app_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; |
---|
[2623] | 111 | |
---|
[2529] | 112 | $app_icons .= $icon; |
---|
[2623] | 113 | $app_icons .= "{$indent}\t\t</td>"; |
---|
[2529] | 114 | } |
---|
[1247] | 115 | |
---|
| 116 | |
---|
[2991] | 117 | $icon = "{$indent}\t\t\t" . '<img align="middle" src="' . $app_data['icon'] . '" alt="' . $title . '" width="16" title="'. $title . '" border="0" />'; |
---|
[1247] | 118 | |
---|
[2623] | 119 | $app_extra_icons .= "{$indent}<tr>"; |
---|
[1247] | 120 | |
---|
[2623] | 121 | if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] != 'text' ) |
---|
[2529] | 122 | { |
---|
[2623] | 123 | $app_extra_icons .= "{$indent}\t" . '<td class="extraIconsRow">' |
---|
| 124 | . "{$indent}\t" . ' <a href="' . $app_data['url'] . '"'; |
---|
[1247] | 125 | |
---|
[2623] | 126 | if ( isset( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'navbar_target' ] ) && $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'navbar_target' ] ) |
---|
| 127 | $app_extra_icons .= ' target="' . $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'navbar_target' ] . '"'; |
---|
[2529] | 128 | |
---|
[2623] | 129 | $app_extra_icons .= " >{$icon}{$indent}\t\t</a>{$indent}\t</td>"; |
---|
[1247] | 130 | } |
---|
[2529] | 131 | |
---|
| 132 | |
---|
[2623] | 133 | $app_extra_icons .= "{$indent}\t" . '<td align="left" class="extraIconsRow" style="">' |
---|
| 134 | . "{$indent}\t\t" . '<a href="'.$app_data['url'] . '"'; |
---|
[2529] | 135 | |
---|
[2623] | 136 | if ( isset( $GLOBALS['phpgw_info']['flags']['navbar_target'] ) && $GLOBALS['phpgw_info']['flags']['navbar_target'] ) |
---|
[2529] | 137 | $app_extra_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; |
---|
[1247] | 138 | |
---|
[2623] | 139 | $app_extra_icons .= '>' . $title_extra . '</a>' |
---|
| 140 | . "{$indent}\t</td>" |
---|
| 141 | . "{$indent}</tr>"; |
---|
[1247] | 142 | |
---|
[2623] | 143 | unset( $icon ); |
---|
| 144 | unset( $title ); |
---|
| 145 | $i++; |
---|
[2529] | 146 | } |
---|
| 147 | } |
---|
| 148 | |
---|
[2991] | 149 | $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "\n\t\t<script type=\"text/javascript\">\n\t\t\t" |
---|
[2623] | 150 | . 'var curr_app = "' . ( ( $curr_app ) ? str_replace( '_','',$curr_app ) . 'id' : '' ) . '";' . "\n\t\t" |
---|
| 151 | . '</script>'; |
---|
[2578] | 152 | |
---|
[2623] | 153 | if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no' ) |
---|
[2529] | 154 | { |
---|
| 155 | |
---|
[2623] | 156 | $hint = $GLOBALS[ 'phpgw_info' ][ 'navbar' ][ 'logout' ][ 'title' ]; |
---|
| 157 | $icon = '<img id="logout_id" width="24" height="24" src="' |
---|
| 158 | . $GLOBALS[ 'phpgw_info' ][ 'navbar' ][ 'logout' ][ 'icon' ] |
---|
[2991] | 159 | . '" alt="' . $hint . '" title="' . $hint . '"/>'; |
---|
[2529] | 160 | |
---|
[2623] | 161 | if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] == 'icons' ) |
---|
[2529] | 162 | $title = ''; |
---|
[2623] | 163 | else if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] == 'text' ) |
---|
[2529] | 164 | $icon = ''; |
---|
| 165 | |
---|
[2991] | 166 | $app_icons .= '<td nowrap="nowrap" class="navbar_but"><a onclick="location.href=\'' |
---|
| 167 | . $GLOBALS[ 'phpgw_info' ][ 'navbar' ][ 'logout' ][ 'url' ] . '\'">' . $icon . '</a></td>'; |
---|
[2623] | 168 | } |
---|
[2529] | 169 | |
---|
[2623] | 170 | $var[ 'app_icons' ] = $app_icons; |
---|
| 171 | |
---|
[2529] | 172 | $hint = $GLOBALS['phpgw_info']['navbar']['logout']['title']; |
---|
[2991] | 173 | $icon = "{$indent}\t\t\t" . '<img src="'.$GLOBALS['phpgw_info']['navbar']['logout']['icon'].'" alt="'.$hint.'" title="'.$hint.'"/>'; |
---|
[2529] | 174 | $title = $GLOBALS['phpgw_info']['navbar']['logout']['title']; |
---|
| 175 | |
---|
[2623] | 176 | $app_extra_icons .= "{$indent}<tr>{$indent}\t" . '<td class="extraIconsRow">' |
---|
| 177 | . "{$indent}\t\t" . '<a href="'.$GLOBALS['phpgw_info']['navbar']['logout']['url'].'">'. "{$icon}{$indent}\t\t</a>" |
---|
| 178 | . "{$indent}\t</td>" |
---|
| 179 | . "{$indent}\t" . '<td class="extraIconsRow">' |
---|
| 180 | . "{$indent}\t\t" . '<a href="'.$GLOBALS['phpgw_info']['navbar']['logout']['url'].'">'.$title.'</a>' |
---|
| 181 | . "{$indent}\t</td>{$indent}</tr>"; |
---|
[2529] | 182 | |
---|
[2991] | 183 | $app_extra_icons_div = '<script type="text/javascript">' . "\n\t\t" |
---|
[2623] | 184 | . ' new ypSlideOutMenu( "menu1", "down", 5, 24, 160, 200, "left" );' . "\n\t\t" |
---|
| 185 | . '</script>' . "\n\t\t" |
---|
| 186 | . '<div id="menu1Container">' . "\n\t\t" |
---|
| 187 | . ' <div id="menu1Content" style="position: relative; left: 0; text-align: left;">' . "\n\t\t" |
---|
| 188 | . ' <div id="extraIcons">' . "\n\t\t" |
---|
| 189 | . ' <table cellspacing="0" cellpadding="0" border="0" width="100%">' . "\n\t\t" |
---|
| 190 | . ' <tr>' . "\n\t\t" |
---|
| 191 | . ' <td colspan="2" nowrap="nowrap" align="right" style="background-color:#dddddd;padding:1px;">' . "\n\t\t" |
---|
| 192 | . ' <a ' . $show_menu_event . '="ypSlideOutMenu.hide(\'menu1\')" title="' . lang('close') . '">' . "\n\t\t" |
---|
[2991] | 193 | . ' <img style="" alt="close" border="0" src="' . $var[ 'img_root' ] . '/close.png"/>' . "\n\t\t" |
---|
[2623] | 194 | . ' </a>' . "\n\t\t" |
---|
| 195 | . ' </td>' . "\n\t\t" |
---|
| 196 | . ' </tr>' . "\n\t\t" |
---|
| 197 | . ' <tr>' . "\n\t\t" |
---|
| 198 | . ' <td colspan="1" valign="top" nowrap="nowrap" align="left" style="background-color:#dddddd;padding:1px;">' . "\n\t\t" |
---|
| 199 | . ' <a href="javascript:ypSlideOutMenu.hide(\'menu1\');showBar()" title="'.lang('Expand Menu').'">' . "\n\t\t" |
---|
[2991] | 200 | . ' <img src="' . $var[ 'img_root' ] . '/down.button.png" alt="down"/></a>' . "\n\t\t" |
---|
[2623] | 201 | . ' </td>' . "\n\t\t" |
---|
| 202 | . ' <td colspan="1" valign="top" nowrap="nowrap" align="left" style="background-color:#dddddd;padding:1px;">' . "\n\t\t" |
---|
| 203 | . ' <a href="javascript:ypSlideOutMenu.hide(\'menu1\');showBar()" title="'.lang('Expand Menu').'">' . "\n\t\t" |
---|
| 204 | . ' <b>' . lang('Expand Menu') . '</b>' . "\n\t\t" |
---|
| 205 | . ' </a>' . "\n\t\t" |
---|
| 206 | . ' </td>' . "\n\t\t" |
---|
| 207 | . " </tr>{$app_extra_icons}\n\t\t" |
---|
| 208 | . ' </table>' . "\n\t\t" |
---|
| 209 | . ' </div>' . "\n\t\t" |
---|
| 210 | . ' </div>' . "\n\t\t" |
---|
| 211 | . '</div>'; |
---|
[2529] | 212 | |
---|
[2623] | 213 | $var['app_extra_icons_div'] = $app_extra_icons_div; |
---|
[3087] | 214 | $var['app_extra_icons_icon'] = '<span style="zIndex:10000;padding-right:3px;padding-top:10px;">' |
---|
[2623] | 215 | . $indent . '<a title="' . lang( 'show_more_apps' ) . '" ' . $show_menu_event . '="ypSlideOutMenu.showMenu(\'menu1\')">' |
---|
[3081] | 216 | . "{$indent}\t" . '<img src="' . $var[ 'img_root' ] . '/down.button.png" alt="'. lang( 'show_more_apps' ) .'" border="0" />' |
---|
[2623] | 217 | . "{$indent}</a>\n\t\t\t\t\t" |
---|
[3087] | 218 | . '</span>'; |
---|
[2529] | 219 | |
---|
[1247] | 220 | |
---|
| 221 | if(isset($GLOBALS['phpgw_info']['flags']['app_header'])) |
---|
| 222 | { |
---|
| 223 | $var['current_app_title'] = $GLOBALS['phpgw_info']['flags']['app_header']; |
---|
[2] | 224 | } |
---|
| 225 | else |
---|
| 226 | { |
---|
[1247] | 227 | $var['current_app_title']=$GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title']; |
---|
| 228 | } |
---|
[2] | 229 | |
---|
[1247] | 230 | if(isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) |
---|
| 231 | { |
---|
| 232 | $var['current_users'] = '<a href="' |
---|
| 233 | . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">' |
---|
| 234 | . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; |
---|
[2] | 235 | } |
---|
[1247] | 236 | $now = time(); |
---|
| 237 | $var['user_info'] = '<b>'.$GLOBALS['phpgw']->common->display_fullname() .'</b>'. ' - ' |
---|
| 238 | . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' ' |
---|
| 239 | . $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); |
---|
[2529] | 240 | |
---|
[1247] | 241 | if($GLOBALS['phpgw_info']['server']['use_frontend_name']) |
---|
| 242 | $var['frontend_name'] = " - ".$GLOBALS['phpgw_info']['server']['use_frontend_name']; |
---|
[2] | 243 | |
---|
[1247] | 244 | /* |
---|
| 245 | * Forçar termo de aceite por parte do usuário |
---|
| 246 | */ |
---|
[2] | 247 | |
---|
[1247] | 248 | if(($GLOBALS['phpgw_info']['user']['agree_terms'] != 1) && ($GLOBALS['phpgw_info']['server']['use_agree_term']=='True')) //Ele deverá confirmar o termo de aceite. |
---|
| 249 | { |
---|
| 250 | $agreeterm_url = $_SERVER['HTTP_HOST'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . '/preferences/termo_aceite.php'; |
---|
[2529] | 251 | |
---|
[1247] | 252 | if ($GLOBALS['phpgw_info']['server']['use_https'] == 2) |
---|
| 253 | $agreeterm_url = 'https://' . $agreeterm_url; |
---|
| 254 | else |
---|
| 255 | $agreeterm_url = 'http://' . $agreeterm_url; |
---|
[2529] | 256 | |
---|
[2991] | 257 | echo '<script type="text/javascript">' . |
---|
[2529] | 258 | 'if(location.href.indexOf("termo_aceite.php") == -1){' . |
---|
| 259 | 'location.href = "' . $agreeterm_url . '"' . |
---|
| 260 | '}' . |
---|
| 261 | '</script>'; |
---|
[1247] | 262 | } |
---|
| 263 | |
---|
[2529] | 264 | |
---|
[1247] | 265 | if(($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == '0') && (($GLOBALS['phpgw_info']['user']['agree_terms'] == 1) || ($GLOBALS['phpgw_info']['server']['use_agree_term']!='True'))) |
---|
| 266 | { |
---|
| 267 | $changepasswd_url = $_SERVER['HTTP_HOST'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . '/preferences/changepassword.php?cd=1'; |
---|
[2529] | 268 | |
---|
[1247] | 269 | if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) |
---|
| 270 | $changepasswd_url = 'https://' . $changepasswd_url; |
---|
| 271 | else |
---|
| 272 | $changepasswd_url = 'http://' . $changepasswd_url; |
---|
[2529] | 273 | |
---|
[2991] | 274 | echo '<script type="text/javascript">' . |
---|
[2529] | 275 | 'if(location.href.indexOf("changepassword.php") == -1){' . |
---|
| 276 | 'location.href = "' . $changepasswd_url . '"' . |
---|
| 277 | '}' . |
---|
| 278 | '</script>'; |
---|
| 279 | |
---|
[1247] | 280 | /* |
---|
[2529] | 281 | $api_messages = lang('You are required to change your password during your first login') |
---|
[2] | 282 | . '<br> Click this image on the navbar: <img src="' |
---|
| 283 | . $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">'; |
---|
[2529] | 284 | */ |
---|
[1247] | 285 | } |
---|
| 286 | /* |
---|
| 287 | elseif($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30)) |
---|
| 288 | { |
---|
| 289 | $api_messages = lang('it has been more then %1 days since you changed your password',30); |
---|
| 290 | } |
---|
[2529] | 291 | */ |
---|
[1247] | 292 | /* |
---|
| 293 | // This is gonna change |
---|
| 294 | if(isset($cd)) |
---|
| 295 | { |
---|
| 296 | $var['messages'] = $api_messages . '<br>' . checkcode($cd); |
---|
| 297 | }*/ |
---|
| 298 | |
---|
| 299 | $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi',$GLOBALS['phpgw_info']['server']['login_logo_file']?$GLOBALS['phpgw_info']['server']['login_logo_file']:'logo'); |
---|
| 300 | $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url']?$GLOBALS['phpgw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; |
---|
| 301 | $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title']?$GLOBALS['phpgw_info']['server']['login_logo_title']:'www.eGroupWare.org'; |
---|
| 302 | $var['hide_bar_txt'] = lang("Hide header and toolbar"); |
---|
| 303 | $var['show_bar_txt'] = lang("Show header and toolbar"); |
---|
| 304 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 305 | $GLOBALS['celepar_tpl']->pfp('out','navbar_header'); |
---|
| 306 | |
---|
| 307 | /******************************************************\ |
---|
[2529] | 308 | * The sidebox menu's * |
---|
| 309 | \******************************************************/ |
---|
[1247] | 310 | |
---|
| 311 | $menu_title = lang('General Menu'); |
---|
| 312 | |
---|
| 313 | $file['Home'] = $GLOBALS['phpgw_info']['navbar']['home']['url']; |
---|
| 314 | if($GLOBALS['phpgw_info']['user']['apps']['preferences']) |
---|
| 315 | { |
---|
| 316 | $file['Preferences'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url']; |
---|
| 317 | } |
---|
| 318 | $file += array( |
---|
| 319 | array( |
---|
| 320 | 'text' => lang('About %1',$GLOBALS['phpgw_info']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title']), |
---|
| 321 | 'no_lang' => True, |
---|
| 322 | 'link' => $GLOBALS['phpgw_info']['navbar']['about']['url'] |
---|
| 323 | ), |
---|
| 324 | 'Logout'=>$GLOBALS['phpgw_info']['navbar']['logout']['url'] |
---|
| 325 | ); |
---|
| 326 | |
---|
| 327 | if($GLOBALS['phpgw_info']['user']['preferences']['common']['auto_hide_sidebox']==1) |
---|
| 328 | { |
---|
| 329 | $GLOBALS['celepar_tpl']->set_var('show_menu_event',$show_menu_event); |
---|
| 330 | $GLOBALS['celepar_tpl']->set_var('lang_show_menu',lang('show menu')); |
---|
| 331 | $GLOBALS['celepar_tpl']->pparse('out','sidebox_hide_header'); |
---|
| 332 | |
---|
| 333 | display_sidebox('',$menu_title,$file); |
---|
| 334 | $GLOBALS['phpgw']->hooks->single('sidebox_menu',$GLOBALS['phpgw_info']['flags']['currentapp']); |
---|
| 335 | |
---|
| 336 | $GLOBALS['celepar_tpl']->pparse('out','sidebox_hide_footer'); |
---|
| 337 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 338 | $GLOBALS['celepar_tpl']->pparse('out','appbox'); |
---|
| 339 | $var['remove_padding'] = 'style="padding-left:0px;"'; |
---|
| 340 | } |
---|
| 341 | else |
---|
| 342 | { |
---|
| 343 | $var['menu_link'] = ''; |
---|
| 344 | $var['remove_padding'] = ''; |
---|
| 345 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 346 | $GLOBALS['celepar_tpl']->pparse('out','appbox'); |
---|
| 347 | |
---|
| 348 | display_sidebox('',$menu_title,$file); |
---|
| 349 | $GLOBALS['phpgw']->hooks->single('sidebox_menu',$GLOBALS['phpgw_info']['flags']['currentapp']); |
---|
| 350 | } |
---|
| 351 | |
---|
| 352 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 353 | $GLOBALS['celepar_tpl']->pparse('out','navbar_footer'); |
---|
| 354 | |
---|
| 355 | // If the application has a header include, we now include it |
---|
| 356 | if(!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) |
---|
| 357 | { |
---|
| 358 | list($app,$class,$method) = explode('.',$_GET['menuaction']); |
---|
| 359 | if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) |
---|
| 360 | { |
---|
| 361 | $GLOBALS[$class]->header(); |
---|
| 362 | } |
---|
| 363 | } |
---|
| 364 | $GLOBALS['phpgw']->hooks->process('after_navbar'); |
---|
| 365 | return; |
---|
[2529] | 366 | } |
---|
[1247] | 367 | |
---|
[2529] | 368 | function display_sidebox($appname,$menu_title,$file) |
---|
| 369 | { |
---|
| 370 | if(!$appname || ($appname==$GLOBALS['phpgw_info']['flags']['currentapp'] && $file)) |
---|
| 371 | { |
---|
| 372 | $var['lang_title']=$menu_title;//$appname.' '.lang('Menu'); |
---|
| 373 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 374 | $GLOBALS['celepar_tpl']->pfp('out','extra_blocks_header'); |
---|
| 375 | |
---|
| 376 | foreach($file as $text => $url) |
---|
[2] | 377 | { |
---|
[2529] | 378 | sidebox_menu_item($url,$text); |
---|
| 379 | } |
---|
[2] | 380 | |
---|
[2529] | 381 | $GLOBALS['celepar_tpl']->pparse('out','extra_blocks_footer'); |
---|
| 382 | } |
---|
| 383 | } |
---|
[1247] | 384 | |
---|
[2529] | 385 | function sidebox_menu_item($item_link='',$item_text='') |
---|
| 386 | { |
---|
| 387 | if($item_text === '_NewLine_' || $item_link === '_NewLine_') |
---|
| 388 | { |
---|
| 389 | $GLOBALS['celepar_tpl']->pparse('out','extra_block_spacer'); |
---|
| 390 | } |
---|
| 391 | else |
---|
| 392 | { |
---|
| 393 | $var['icon_or_star']='<img src="'.$GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images'.'/orange-ball.png" width="9" height="9" alt="ball"/>'; |
---|
| 394 | $var['target'] = ''; |
---|
| 395 | if(is_array($item_link)) |
---|
[2] | 396 | { |
---|
[2529] | 397 | if(isset($item_link['icon'])) |
---|
[2] | 398 | { |
---|
[2529] | 399 | $app = isset($item_link['app']) ? $item_link['app'] : $GLOBALS['phpgw_info']['flags']['currentapp']; |
---|
| 400 | $var['icon_or_star'] = '<img src="'.$GLOBALS['phpgw']->common->image($app,$item_link['icon']).'"/>'; |
---|
[2] | 401 | } |
---|
[2529] | 402 | $var['lang_item'] = isset($item_link['no_lang']) && $item_link['no_lang'] ? $item_link['text'] : lang($item_link['text']); |
---|
| 403 | $var['item_link'] = $item_link['link']; |
---|
| 404 | if ($item_link['target']) |
---|
[1247] | 405 | { |
---|
[2529] | 406 | $var['target'] = ' target="' . $item_link['target'] . '"'; |
---|
[1247] | 407 | } |
---|
[2] | 408 | } |
---|
[2529] | 409 | else |
---|
[2] | 410 | { |
---|
[2529] | 411 | $var['lang_item'] = lang($item_text); |
---|
| 412 | $var['item_link'] = $item_link; |
---|
| 413 | } |
---|
| 414 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 415 | $GLOBALS['celepar_tpl']->pparse('out','extra_block_row'); |
---|
| 416 | } |
---|
| 417 | } |
---|
[1247] | 418 | |
---|
[2529] | 419 | function parse_navbar_end() |
---|
| 420 | { |
---|
| 421 | $GLOBALS['celepar_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); |
---|
[1247] | 422 | |
---|
[2529] | 423 | $GLOBALS['celepar_tpl']->set_file( |
---|
| 424 | array( |
---|
| 425 | 'footer' => 'footer.tpl' |
---|
| 426 | ) |
---|
| 427 | ); |
---|
[1247] | 428 | |
---|
[2529] | 429 | $var = Array( |
---|
| 430 | 'img_root' => $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images', |
---|
| 431 | 'table_bg_color' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], |
---|
| 432 | 'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi'] |
---|
| 433 | ); |
---|
| 434 | $GLOBALS['phpgw']->hooks->process('navbar_end'); |
---|
[1247] | 435 | |
---|
[2529] | 436 | |
---|
| 437 | if($GLOBALS['phpgw_info']['user']['preferences']['common']['show_generation_time']) |
---|
| 438 | { |
---|
| 439 | $mtime = microtime(); |
---|
| 440 | $mtime = explode(' ',$mtime); |
---|
| 441 | $mtime = $mtime[1] + $mtime[0]; |
---|
| 442 | $tend = $mtime; |
---|
| 443 | $totaltime = ($tend - $GLOBALS['page_start_time']); |
---|
| 444 | |
---|
| 445 | $var['page_generation_time'] = '<div id="divGenTime"><br/><span>'.lang('Page was generated in %1 seconds',$totaltime).'</span></div>'; |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | $var['powered_by'] = lang('Powered by phpGroupWare version %1',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); |
---|
| 449 | $GLOBALS['celepar_tpl']->set_var($var); |
---|
| 450 | $GLOBALS['celepar_tpl']->pfp('out','footer'); |
---|
| 451 | } |
---|