Ignore:
Timestamp:
04/23/10 10:41:56 (14 years ago)
Author:
rodsouza
Message:

Ticket #1009 - Organizando o HTML do template default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/templates/default/navbar.inc.php

    r2578 r2623  
    4343        $var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg']; 
    4444 
    45         if($GLOBALS['phpgw_info']['user']['preferences']['common']['click_or_onmouseover']=='onmouseover') 
    46         { 
     45        if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'click_or_onmouseover' ] == 'onmouseover' ) 
    4746                $show_menu_event = 'onMouseOver'; 
    48         } 
    4947        else 
    50         { 
    5148                $show_menu_event = 'onClick'; 
    52         } 
    53  
    5449 
    5550        $applications = ''; 
     
    5752        //      == 'icons_and_text') 
    5853 
    59         $max_icons=$GLOBALS['phpgw_info']['user']['preferences']['common']['max_icons']; 
    60  
    61         if(!$max_icons) 
    62         { 
    63                 $max_icons=200; 
    64         } 
    65  
     54        $max_icons = $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'max_icons' ]; 
     55 
     56        if ( ! $max_icons ) 
     57                $max_icons = 200; 
     58 
     59        $indent = "\n\t\t\t\t\t\t"; 
    6660        $curr_app = NULL; 
    6761        $i = 0; 
    68         foreach($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) 
    69         { 
    70                 $current_app = False; 
    71                 if($app != 'preferences' && $app != 'about' && $app != 'logout') 
     62        $cacheit = array( 'admin', 'expressoAdmin1_2', 'expressoMail1_2', 'contactcenter', 'jabberit_messenger', 'filemanager' ); 
     63        foreach ( $GLOBALS[ 'phpgw_info' ][ 'navbar' ] as $app => $app_data ) 
     64        { 
     65                $current_app = false; 
     66                if ( $app != 'preferences' && $app != 'about' && $app != 'logout' ) 
    7267                { 
    73                         $icon = '<a href="'.$app_data['url'].'" cacheit="' 
    74                                 . ( ( $app == 'admin' || $app == 'expressoAdmin1_2' || $app == 'expressoMail1_2' || $app == 'contactcenter' || $app == 'jabberit_messenger' || $app == 'filemanager'  ) ? 'true' : 'false') 
     68                        $icon = "{$indent}\t\t\t" . '<a href="' . $app_data[ 'url' ] . '" cacheit="' 
     69                                . ( in_array( $app, $cacheit ) ? 'true' : 'false' ) 
    7570                                . '">'; 
    76                         $title = $GLOBALS['phpgw_info']['apps'][$app]['title']; 
    77                         if($app == 'home') $title = lang('Home'); 
    78  
    79                         if ($GLOBALS['phpgw_info']['flags']['currentapp'] == $app) 
    80                         { 
    81                                 $current_app = True; 
     71 
     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 ) 
     78                        { 
     79                                $current_app = true; 
    8280                                $curr_app = $app; 
    8381                        } 
    8482 
    85                         $icon .= '<img id="'.str_replace('_','',$app).'id" src="' . $app_data['icon'] . '" alt="' . $title . '" title="'. $title 
    86                                 . '" border="0" width="'.($current_app ? 35 : 24 ).'" height="'.($current_app ? 35 : 24 ).'" nowrap="nowrap"/></a>'; 
    87  
    88                         if($app=='home') 
    89                         { 
    90                                 if($GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons']=='no') 
    91                                 { 
     83                        $icon .= "{$indent}\t\t\t\t" . '<img id="'.str_replace('_','',$app).'id" src="' . $app_data['icon'] . '" alt="' . $title . '" title="'. $title 
     84                                . '" border="0" width="' . ( $current_app ? 35 : 24 ) . '" height="' . ( $current_app ? 35 : 24 ) . '" nowrap="nowrap"/>' 
     85                                . "{$indent}\t\t\t</a>"; 
     86 
     87                        if ( $app == 'home' ) 
     88                                if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'start_and_logout_icons' ] == 'no' ) 
    9289                                        continue; 
    93                                 } 
    94                         } 
    95  
    96                         // Verifica qual o formato da Barra de navegação:  
    97                         // Icone ou Texto, ou Icone e Texto 
    98  
    99  
    100                         if($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']=='icons') { 
     90 
     91                        if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']=='icons' ) 
     92                        { 
    10193                                $title_extra = $title; 
    10294                                $title = ''; 
    10395                        } 
    104                         else if($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']=='text'){ 
    105                                 $icon = ''; 
    106                         } 
    107  
    108                         if($i< $max_icons) { 
    109  
    110                                 if($GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons']=='no') 
    111                                 { 
    112                                         $tdwidth = 100/($max_icons); 
    113                                 } 
     96                        else 
     97                                if( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] == 'text' ) 
     98                                        $icon = ''; 
     99 
     100                        if ( $i < $max_icons ) 
     101                        { 
     102                                if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'start_and_logout_icons' ] == 'no' ) 
     103                                        $tdwidth = 100 / ( $max_icons ); 
    114104                                else 
    115                                 { 
    116                                         $tdwidth = 100/($max_icons+2); 
    117                                 } 
    118  
    119                                 $app_icons .= '<td nowrap' 
    120                                         . ' onmouseover="if ( this.className != \'navbar_butOut\'){this.className=\'navbar_butOver\'; zoom_in(this.firstChild.firstChild.id);}"' 
    121                                         . ' onmouseout="if ( this.className != \'navbar_butOut\'){this.className=\'navbar_but\'; zoom_out(this.firstChild.firstChild.id);}"' 
    122                                         . ' onclick="if ( this.className != \'navbar_butOut\'){this.className=\'navbar_butOut\'; zoom_out(curr_app);' 
    123                                         . 'var app = document.getElementById(curr_app); if ( app ) app.parentNode.parentNode.className=\'navbar_but\';curr_app=\'' . str_replace('_','',$app) . 'id\'}"' 
    124                                         . ' class="navbar_but'.($current_app?'Out':'').'">'; 
    125  
    126                                 if(isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) 
    127                                 { 
     105                                        $tdwidth = 100 / ( $max_icons + 2 ); 
     106 
     107                                $app_icons .= "{$indent}\t\t" . '<td nowrap class="navbar_but' . ( $current_app ? 'Out' : '' ) . '">'; 
     108 
     109                                if ( isset( $GLOBALS['phpgw_info']['flags']['navbar_target'] ) && $GLOBALS['phpgw_info']['flags']['navbar_target'] ) 
    128110                                        $app_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; 
    129                                 }                                                
     111 
    130112                                $app_icons .=  $icon; 
    131                         } 
    132  
    133  
    134                         $icon = '<img align="center" src="' . $app_data['icon'] . '" alt="' . $title . '" width="16" title="'. $title . '" border="0" />'; 
    135  
    136                         $app_extra_icons .= '<tr>'; 
    137  
    138                         if($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']!='text') 
    139                         { 
    140                                 $app_extra_icons .= '<td class="extraIconsRow"><a href="' . $app_data['url'] . '"'; 
    141  
    142                                 if(isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) 
    143                                 { 
    144                                         $app_extra_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; 
    145                                 } 
    146  
    147                                 $app_extra_icons .= ' >' . $icon . '</a></td>'; 
    148                         } 
    149  
    150  
    151                         $app_extra_icons .= '<td align="left" class="extraIconsRow" style=""><a href="'.$app_data['url'] . '"'; 
    152  
    153                         if(isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) 
    154                         { 
     113                                $app_icons .=  "{$indent}\t\t</td>"; 
     114                        } 
     115 
     116 
     117                        $icon = "{$indent}\t\t\t" . '<img align="center" src="' . $app_data['icon'] . '" alt="' . $title . '" width="16" title="'. $title . '" border="0" />'; 
     118 
     119                        $app_extra_icons .= "{$indent}<tr>"; 
     120 
     121                        if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] != 'text' ) 
     122                        { 
     123                                $app_extra_icons .= "{$indent}\t" . '<td class="extraIconsRow">' 
     124                                        . "{$indent}\t" . '     <a href="' . $app_data['url'] . '"'; 
     125 
     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' ] . '"'; 
     128 
     129                                $app_extra_icons .= " >{$icon}{$indent}\t\t</a>{$indent}\t</td>"; 
     130                        } 
     131 
     132 
     133                        $app_extra_icons .= "{$indent}\t" . '<td align="left" class="extraIconsRow" style="">' 
     134                                . "{$indent}\t\t" . '<a href="'.$app_data['url'] . '"'; 
     135 
     136                        if ( isset( $GLOBALS['phpgw_info']['flags']['navbar_target'] ) && $GLOBALS['phpgw_info']['flags']['navbar_target'] ) 
    155137                                $app_extra_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; 
    156                         } 
    157  
    158                         $app_extra_icons .= '>' . $title_extra . '</a></td></tr>'; 
    159  
    160                         unset($icon); 
    161                         unset($title); 
    162                         $i++;                            
     138 
     139                        $app_extra_icons .= '>' . $title_extra . '</a>' 
     140                                . "{$indent}\t</td>" 
     141                                . "{$indent}</tr>"; 
     142 
     143                        unset( $icon ); 
     144                        unset( $title ); 
     145                        $i++; 
    163146                } 
    164147        } 
    165148 
    166         echo '<script>var curr_app = "' . ( ( $curr_app ) ? str_replace( '_','',$curr_app ) . 'id' : '' ) . '";</script>'; 
    167  
    168         if($GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons']!='no')      
    169         { 
    170  
    171                 $hint = $GLOBALS['phpgw_info']['navbar']['logout']['title']; 
    172                 $icon = '<img id="logout_id" width="24" height="24" src="'.$GLOBALS['phpgw_info']['navbar']['logout']['icon'].'"  alt="'.$hint.'" title="'.$hint.'">'; 
    173  
    174                 if($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']=='icons') { 
    175  
     149        $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "\n\t\t<script>\n\t\t\t" 
     150                . 'var curr_app = "' . ( ( $curr_app ) ? str_replace( '_','',$curr_app ) . 'id' : '' ) . '";' . "\n\t\t" 
     151                . '</script>'; 
     152 
     153        if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no' ) 
     154        { 
     155 
     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' ] 
     159                        . '" alt="' . $hint . '" title="' . $hint . '">'; 
     160 
     161                if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] == 'icons' ) 
    176162                        $title = ''; 
    177                 } 
    178                 else if($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']=='text'){ 
    179  
     163                else if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'navbar_format' ] == 'text' ) 
    180164                        $icon = ''; 
    181                 }                        
    182                 $app_icons .= '<td nowrap '. 
    183                         'onmouseover="javascript:this.className=\'navbar_butOver\'; zoom_in(this.firstChild.firstChild.id)" '. 
    184                         'onmouseout="javascript:this.className=\'navbar_but\'; zoom_out(this.firstChild.firstChild.id)" '. 
    185                         'class="navbar_but"><a onclick="location.href=\''.$GLOBALS['phpgw_info']['navbar']['logout']['url'].'\'">'.$icon.'</td>'; 
    186         }                       //                      window.location.href=\''.$GLOBALS['phpgw_info']['navbar']['logout']['url'].'\' 
    187  
    188         $var['app_icons'] = $app_icons; 
     165 
     166                $app_icons .= '<td nowrap class="navbar_but"><a onclick="location.href=\'' 
     167                        . $GLOBALS[ 'phpgw_info' ][ 'navbar' ][ 'logout' ][ 'url' ] . '\'">' . $icon . '</td>'; 
     168        } 
     169 
     170        $var[ 'app_icons' ] = $app_icons; 
    189171 
    190172        $hint = $GLOBALS['phpgw_info']['navbar']['logout']['title']; 
    191         $icon = '<img src="'.$GLOBALS['phpgw_info']['navbar']['logout']['icon'].'"  alt="'.$hint.'" title="'.$hint.'">'; 
     173        $icon = "{$indent}\t\t\t" . '<img src="'.$GLOBALS['phpgw_info']['navbar']['logout']['icon'].'"  alt="'.$hint.'" title="'.$hint.'">'; 
    192174        $title = $GLOBALS['phpgw_info']['navbar']['logout']['title']; 
    193175 
    194         $app_extra_icons .= '<td  class="extraIconsRow"> 
    195                 <a href="'.$GLOBALS['phpgw_info']['navbar']['logout']['url'].'">'.$icon.'</a></td>'; 
    196  
    197         $app_extra_icons .= '<td class="extraIconsRow"> 
    198                 <a href="'.$GLOBALS['phpgw_info']['navbar']['logout']['url'].'">'.$title.'</a></td>'; 
    199  
    200  
    201         $app_extra_icons_div = ' 
    202                 <script language="javascript"> 
    203 new ypSlideOutMenu("menu1", "down", 5, 24, 160, 200,\'left\') 
    204                                 </script> 
    205                                 <div id="menu1Container"> 
    206                                 <div id="menu1Content" style="position: relative; left: 0; text-align: left;"> 
    207  
    208                                 <div id="extraIcons"> 
    209  
    210                                 <table cellspacing="0" cellpadding="0" border="0" width="100%"> 
    211                                 <tr> 
    212                                 <td colspan="2" nowrap="nowrap" align="right" style="background-color:#dddddd;padding:1px;"> 
    213                                 <a href="#" '.$show_menu_event.'="ypSlideOutMenu.hide(\'menu1\')" title="'.lang('close').'"> 
    214                                 <img style="" border="0" src="'.$var['img_root'].'/close.png"/></a></span></td></tr> 
    215                                 <tr> 
    216                                 <td colspan="1" valign="top" nowrap="nowrap" align="left" style="background-color:#dddddd;padding:1px;"> 
    217                                         <a href="#" onClick="javascript:ypSlideOutMenu.hide(\'menu1\');showBar()" title="'.lang('Expand Menu').'"> 
    218                                         <img src = "'.$var['img_root'].'/down.button.png"></a> 
    219                                 </td> 
    220                                 <td colspan="1" valign="top" nowrap="nowrap" align="left" style="background-color:#dddddd;padding:1px;"> 
    221                                         <a href="#" onClick="javascript:ypSlideOutMenu.hide(\'menu1\');showBar()" title="'.lang('Expand Menu').'"> 
    222                                         <b>'.lang('Expand Menu').'</b></a></td></tr>                             
    223                                 '.$app_extra_icons.'</table> 
    224                                 </div> 
    225  
    226                                 </div> 
    227                                 </div> 
    228                                 '; 
    229  
    230                                 $var['app_extra_icons_div']= $app_extra_icons_div;                               
    231                                 $var['app_extra_icons_icon']= '<td width="26" valign="top" align="right" style="zIndex:10000;padding-right:3px;padding-top:10px;"><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>'; 
     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>"; 
     182 
     183        $app_extra_icons_div = '<script language="javascript">' . "\n\t\t" 
     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" 
     193                . '                                                     <img style="" border="0" src="' . $var[ 'img_root' ] . '/close.png"/>' . "\n\t\t" 
     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" 
     200                . '                                                     <img src = "' . $var[ 'img_root' ] . '/down.button.png"></a>' . "\n\t\t" 
     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>'; 
     212 
     213        $var['app_extra_icons_div'] = $app_extra_icons_div; 
     214        $var['app_extra_icons_icon'] = '<td width="26" valign="top" align="right" style="zIndex:10000;padding-right:3px;padding-top:10px;">' 
     215                . $indent . '<a title="' . lang( 'show_more_apps' ) . '" ' . $show_menu_event . '="ypSlideOutMenu.showMenu(\'menu1\')">' 
     216                . "{$indent}\t" . '<img src="' . $var[ 'img_root' ] . '/extra_icons.png" border="0" />' 
     217                . "{$indent}</a>\n\t\t\t\t\t" 
     218                . '</td>'; 
    232219 
    233220 
Note: See TracChangeset for help on using the changeset viewer.