Changeset 6477 for branches/2.2


Ignore:
Timestamp:
06/13/12 14:12:51 (12 years ago)
Author:
leticiabohnert
Message:

Ticket #2851 - Alterado para aparecer cargo e vinculo no org. quando usuário possui permissão.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/workflow/js/userinterface/orgchartPrint.js

    r3167 r6477  
    99                $('tr.employees').hide(); 
    1010} 
     11 
    1112 
    1213/** 
     
    5556} 
    5657 
     58 
     59/** 
     60* Show / Hide all photo employees 
     61*/ 
     62function togglePhotoVisibility() 
     63{ 
     64        $('#employee_table').remove(); 
     65 
     66        if ($('#groupByArea').attr('checked')) 
     67                showGroupedByArea(); 
     68        else 
     69                showUngrouped(); 
     70} 
     71 
    5772/** 
    5873* Centralize the creation of table rows for employees. 
    5974* 'showAreaColumn' specifies whether the second column will be shown 
    6075*/ 
    61 function createEmployeeRow(area_id, user_id, showAreaColumn) 
     76function createEmployeeRow(area_id, user_id, showAreaColumn, showUserPhoto) 
    6277{ 
    6378        /* set a special 'class' if the employee is a supervisor one */ 
     
    6782 
    6883        /* creating the row. */ 
    69         element = $('<tr></tr>') 
    70                                 /* name: first column */ 
    71                                 .append( 
    72                                                 $('<td></td>') 
    73                                                         .append( 
    74                                                                 $('<span></span>') 
    75                                                                         .addClass(class_name) 
    76                                                                         .append(areas[area_id].employees[user_id].cn) 
    77                                                         ) 
    78                                                         .css('width', '70%') 
    79                                                 ); 
     84        element = $('<tr></tr>'); 
     85 
     86 
     87        /* photo: zero (optional) column */ 
     88        if (showUserPhoto){ 
     89                var content = '<img src="workflow/showUserPicture.php?userID=' + areas[area_id].employees[user_id].funcionario_id + '"/>'; 
     90                element.append($('<td>' + content + '</td>').css('width', '8%')); 
     91        } 
     92 
     93        /* name: first column */ 
     94        element.append( 
     95                                $('<td></td>') 
     96                                        .append( 
     97                                                $('<span></span>') 
     98                                                        .addClass(class_name) 
     99                                                        .append(areas[area_id].employees[user_id].cn) 
     100                                                ) 
     101                                                        .css('width', '30%') 
     102                        ); 
    80103 
    81104        /* area: second (optional) column */ 
     
    83106                element.append( 
    84107                                                $('<td>' + areas[area_id].sigla + '</td>') 
    85                                                         .css('width', '15%') 
     108                                                        .css('width', '10%') 
    86109                                        ); 
    87110 
     111        /* login: show uid attribute */ 
     112        element.append( 
     113                                        $('<td>' + areas[area_id].employees[user_id].uid + '</td>') 
     114                                                .css('width', '15%') 
     115                                        ) 
     116                                         
     117         
    88118        /* telephone: last column */ 
    89119        element.append( 
    90120                                        $('<td>' + areas[area_id].employees[user_id].telephoneNumber + '</td>') 
    91                                                 .css('width', '20%') 
    92                                         ) 
     121                                                .css('width', '15%') 
     122                                        ) 
     123                                         
     124        /* Vínculo: show cargo vínculo */ 
     125        element.append( 
     126                                        $('<td>' + areas[area_id].employees[user_id].vinculo + '</td>') 
     127                                                .css('width', '15%') 
     128                                        ) 
     129 
     130        /* Cargo: show cargo attribute */ 
     131        element.append( 
     132                                        $('<td>' + areas[area_id].employees[user_id].cargo + '</td>') 
     133                                                .css('width', '15%') 
     134                                        ) 
     135 
    93136                                .addClass('employees'); 
    94137 
     
    102145{ 
    103146        var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 
    104         var i, j; 
     147        var i, j, photo; 
     148 
     149        if ($('#photoVisibility').attr('checked')) 
     150           photo = true; 
     151        else 
     152           photo = false; 
    105153 
    106154        /* iterating over areas */ 
     
    111159                                $('<tr></tr>') 
    112160                                .append( 
    113                                         $('<th></th>') 
     161                                        $('<td colspan="2"></td>') 
     162                                                .css('font-weight', 'bold') 
    114163                                                .css('text-align', 'left') 
    115164                                                .css('height', '30') 
     
    125174                /* creating employee rows */ 
    126175                for (j=0; j < areas[i].employees.length; j++) 
    127                         table.append(createEmployeeRow(i, j)); 
     176                        table.append(createEmployeeRow(i, j, false, photo)); 
    128177        } 
    129178        $('#areas_content').append(table); 
     
    139188{ 
    140189        var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 
    141         var i, less, end; 
     190        var i, less, end, photo; 
     191 
     192        if ($('#photoVisibility').attr('checked')) 
     193           photo = true; 
     194        else 
     195           photo = false; 
    142196 
    143197        /* creating and reseting indexes */ 
     
    172226 
    173227                /* inserting the row */ 
    174                 table.append(createEmployeeRow(less, areas[less].index, true)); 
     228                table.append(createEmployeeRow(less, areas[less].index, true, photo)); 
    175229                areas[less].index++; 
    176230        } 
     
    192246{ 
    193247        $('#employeesVisibility').click(toggleEmployeesVisibility); 
     248        $('#photoVisibility').click(togglePhotoVisibility); 
    194249        $('#groupByArea').click(toggleGroupByArea); 
    195250        $('#highlightSupervisor').click(toggleHighlightSupervisor); 
     
    201256{ 
    202257        toggleGroupByArea(); 
     258        togglePhotoVisibility(); 
    203259        toggleEmployeesVisibility(); 
    204260        toggleHighlightSupervisor(); 
Note: See TracChangeset for help on using the changeset viewer.