Ignore:
Timestamp:
03/16/12 10:03:07 (12 years ago)
Author:
adeildosantos
Message:

Ticket #2530 - Adicionada a opção de incluir as fotos dos usuários na lista

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/js/userinterface/orgchartPrint.js

    r5242 r5739  
    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', '60%') 
    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', '55%') 
     102                        ); 
    80103 
    81104        /* area: second (optional) column */ 
     
    108131{ 
    109132        var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 
    110         var i, j; 
     133        var i, j, photo; 
     134 
     135        if ($('#photoVisibility').attr('checked')) 
     136           photo = true; 
     137        else 
     138           photo = false; 
    111139 
    112140        /* iterating over areas */ 
     
    117145                                $('<tr></tr>') 
    118146                                .append( 
    119                                         $('<th></th>') 
     147                                        $('<td colspan="2"></td>') 
     148                                                .css('font-weight', 'bold') 
    120149                                                .css('text-align', 'left') 
    121150                                                .css('height', '30') 
     
    131160                /* creating employee rows */ 
    132161                for (j=0; j < areas[i].employees.length; j++) 
    133                         table.append(createEmployeeRow(i, j)); 
     162                        table.append(createEmployeeRow(i, j, false, photo)); 
    134163        } 
    135164        $('#areas_content').append(table); 
     
    145174{ 
    146175        var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 
    147         var i, less, end; 
     176        var i, less, end, photo; 
     177 
     178        if ($('#photoVisibility').attr('checked')) 
     179           photo = true; 
     180        else 
     181           photo = false; 
    148182 
    149183        /* creating and reseting indexes */ 
     
    178212 
    179213                /* inserting the row */ 
    180                 table.append(createEmployeeRow(less, areas[less].index, true)); 
     214                table.append(createEmployeeRow(less, areas[less].index, true, photo)); 
    181215                areas[less].index++; 
    182216        } 
     
    198232{ 
    199233        $('#employeesVisibility').click(toggleEmployeesVisibility); 
     234        $('#photoVisibility').click(togglePhotoVisibility); 
    200235        $('#groupByArea').click(toggleGroupByArea); 
    201236        $('#highlightSupervisor').click(toggleHighlightSupervisor); 
     
    207242{ 
    208243        toggleGroupByArea(); 
     244        togglePhotoVisibility(); 
    209245        toggleEmployeesVisibility(); 
    210246        toggleHighlightSupervisor(); 
Note: See TracChangeset for help on using the changeset viewer.