Changeset 3167 for branches/2.2/workflow/js/userinterface
- Timestamp:
- 08/17/10 16:17:12 (14 years ago)
- Location:
- branches/2.2/workflow/js/userinterface
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/workflow/js/userinterface/orgchart.js
r1452 r3167 45 45 content += '</select></a></li>'; 46 46 content += '<li><a href="#" onclick="window.open(\'' + enderecoImagem + '\', \'extwindow\'); return false;"><img src="templateFile.php?file=images/Process.gif"> Gráfico</a></li>'; 47 content += '<li><a><input type="text" name="search_term" id="search_term" onkeypress="if (((event.which) ? event.which : event.keyCode) == 13) $(\'search_span\').onclick(); return true;" /><span id="search_span" style="cursor: pointer;" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); orgchartSearchEmployee($F(\'search_term\')); return false;"> busca </span></a></li>';47 content += '<li><a><input type="text" name="search_term" id="search_term" onkeypress="if (((event.which) ? event.which : event.keyCode) == 13) $(\'search_span\').onclick(); return true;" /><span id="search_span" style="cursor: pointer;" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); orgchartSearchEmployee($F(\'search_term\')); return false;"> busca </span><img src="templateFile.php?file=images/help.png" title="Informe o nome, área ou telefone a ser pesquisado." style="cursor: help" /></a></li>'; 48 48 content += '<li><a href="#" onclick="printArea(); return false;"><img src="templateFile.php?file=images/imprimir.png" width="16"> Imprimir</a></li>'; 49 49 content += '</ul>'; … … 171 171 var content = '<center><h2>Substituição de Chefia</h2></center>'; 172 172 content += '<table class="employeeList">'; 173 content += '<tr><th>Área</th><th>Titular</th><th>Substituto</th>< /tr>';173 content += '<tr><th>Área</th><th>Titular</th><th>Substituto</th><th>Data de início</th><th>Data de término</th></tr>'; 174 174 var current; 175 175 for (var i = 0; i < data.length; i++) … … 180 180 content += '<td>' + current['titular'] + '</td>'; 181 181 content += '<td>' + current['substituto'] + '</td>'; 182 content += '<td>' + current['data_inicio'] + '</td>'; 183 content += '<td>' + current['data_fim'] + '</td>'; 182 184 content += '</tr>'; 183 185 } … … 294 296 295 297 /* no employee to list */ 296 if ( ( ! data['employees'] || data['employees'].length == 0 ) && ( ! data['bygroup'] || data['bygroup'].length == 0 ) ) 298 if ( ( ! data['employees'] || data['employees'].length == 0 ) && 299 ( ! data['bygroup'] || data['bygroup'].length == 0 ) && 300 ( ! data['bytelephone'] || data['bytelephone'].length == 0 ) ) 297 301 { 298 302 div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; … … 317 321 /* build the display table (headers)*/ 318 322 content += '<table id="employeeList" class="employeeList" style="clear: both">'; 319 content += '<tr >';323 content += '<tr class="message_header">'; 320 324 content += '<th>Nome</th>'; 321 325 if (useArea) … … 344 348 complement = ''; 345 349 if (employees[i]['removed']) 346 complement += ' <font color="red">( excluído)</font>';350 complement += ' <font color="red">(inativo)</font>'; 347 351 content += '<tr class="linha'+ i%2 + (useCategories ? ' categoria_' + employees[i]['funcionario_categoria_id'] : '') + '" onmouseover="this.className=\'highlight0\'" onmouseout="this.className=\'linha'+ i%2 + (useCategories ? ' categoria_' + employees[i]['funcionario_categoria_id'] : '') + '\'">'; 348 352 content += '<td><a href="javascript:void(0);" onmouseover="getEmployeeInfoTimer(event, ' + employees[i]['funcionario_id'] + '); return false;" onmouseout="hideEmployeeInfo(); return false;">' + employees[i]['cn'] + complement + '</a></td>'; … … 477 481 div.innerHTML += '</center><span style="color:red">Busca pelo nome: ' + searchTerm.toUpperCase( ) + '</span>' + content; 478 482 483 // printing records found by group 479 484 if ( data['bygroup'] && data['bygroup'].length ) 480 485 { … … 484 489 if ( content ) 485 490 div.innerHTML += '<br/><br/><span style="color:red">Busca pelo setor: ' + searchTerm.toUpperCase( ) + '</span><br/>' + content; 491 } 492 493 // printing records found by telephoneNumber 494 if ( data['bytelephone'] && data['bytelephone'].length ) 495 { 496 employees = [ ]; 497 employees[ 'employees' ] = data['bytelephone']; 498 content = printEmployeesHandler( employees, 'returnResult' ); 499 if ( content ) 500 div.innerHTML += '<br/><br/><span style="color:red">Busca pelo telefone: ' + searchTerm.toUpperCase( ) + '</span><br/>' + content; 486 501 } 487 502 -
branches/2.2/workflow/js/userinterface/orgchartPrint.js
r795 r3167 1 /** 2 * Show / Hide all employees 3 */ 1 4 function toggleEmployeesVisibility() 2 5 { 3 6 if ($('#employeesVisibility').attr('checked')) 4 $(' div.employees').show();7 $('tr.employees').show(); 5 8 else 6 $('div.employees').hide(); 7 } 8 9 $('tr.employees').hide(); 10 } 11 12 /** 13 * Highlight supervisor names? 14 */ 9 15 function toggleHighlightSupervisor() 10 16 { … … 15 21 } 16 22 23 /** 24 * Show / Hide orgchart area path visibility 25 */ 17 26 function toggleOrgchartPathVisibility() 18 27 { 19 28 if ($('#orgchartPathVisibility').attr('checked')) 20 {21 29 $('span.orgchartPath').css('visibility', 'visible').show(); 22 } 23 else 24 { 30 else { 25 31 if ($('#orgchartPathIndentation').attr('checked')) 26 32 $('span.orgchartPath').show().css('visibility', 'hidden'); … … 30 36 } 31 37 38 /** 39 * Group by area or show a single list alphabetically ordered 40 * For large sets of data this function may be potencially slow 41 */ 42 function toggleGroupByArea() 43 { 44 /* remove the table and compute it again */ 45 $('#employee_table').remove(); 46 47 if ($('#groupByArea').attr('checked')) 48 showGroupedByArea(); 49 else 50 showUngrouped(); 51 52 /* updating supervisor highlight and orgchart path visibility */ 53 toggleHighlightSupervisor(); 54 toggleOrgchartPathVisibility(); 55 } 56 57 /** 58 * Centralize the creation of table rows for employees. 59 * 'showAreaColumn' specifies whether the second column will be shown 60 */ 61 function createEmployeeRow(area_id, user_id, showAreaColumn) 62 { 63 /* set a special 'class' if the employee is a supervisor one */ 64 class_name = 'employee'; 65 if (areas[area_id].titular_funcionario_id == areas[area_id].employees[user_id].funcionario_id) 66 class_name += 'supervisor'; 67 68 /* 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 ); 80 81 /* area: second (optional) column */ 82 if (showAreaColumn) 83 element.append( 84 $('<td>' + areas[area_id].sigla + '</td>') 85 .css('width', '15%') 86 ); 87 88 /* telephone: last column */ 89 element.append( 90 $('<td>' + areas[area_id].employees[user_id].telephoneNumber + '</td>') 91 .css('width', '20%') 92 ) 93 .addClass('employees'); 94 95 return element; 96 } 97 98 /** 99 * Creating a employee table grouped by area 100 */ 101 function showGroupedByArea() 102 { 103 var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 104 var i, j; 105 106 /* iterating over areas */ 107 for (i=0; i < areas.length; i++) { 108 109 /* inserting area header */ 110 table.append( 111 $('<tr></tr>') 112 .append( 113 $('<th></th>') 114 .css('text-align', 'left') 115 .css('height', '30') 116 .append( 117 $('<span></span>') 118 .addClass('orgchartPath') 119 .append(areas[i].orgchartPath) 120 ) 121 .append(areas[i].sigla) 122 ) 123 ); 124 125 /* creating employee rows */ 126 for (j=0; j < areas[i].employees.length; j++) 127 table.append(createEmployeeRow(i, j)); 128 } 129 $('#areas_content').append(table); 130 } 131 132 /** 133 * Creating employess ordered alphabetically and ungrouped. In this 134 * function we implemented a 'merge' of all area's employee arrays. 135 * 136 * Be careful if you are going to update this code... =) 137 */ 138 function showUngrouped() 139 { 140 var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 141 var i, less, end; 142 143 /* creating and reseting indexes */ 144 for (i=0; i < areas.length; i++) 145 areas[i].index = 0; 146 147 /* */ 148 while (true) { 149 less = -1; 150 end = true; 151 152 /* searching the area with smallest employee name */ 153 for (i=0; i < areas.length; i++) { 154 155 /* if this area have employees left */ 156 if (areas[i].employees.length > areas[i].index) { 157 158 /* if it's the first area reached in this iteration */ 159 if (less == -1) 160 less = i; 161 162 /* updating less */ 163 if (areas[i].employees[areas[i].index].cn < areas[less].employees[areas[less].index].cn) 164 less = i; 165 166 /* so, we are not done */ 167 end = false; 168 } 169 } 170 /* if we are done */ 171 if (end) break; 172 173 /* inserting the row */ 174 table.append(createEmployeeRow(less, areas[less].index, true)); 175 areas[less].index++; 176 } 177 $('#areas_content').append(table); 178 } 179 180 /** 181 * Print me! 182 */ 32 183 function printAction() 33 184 { … … 35 186 } 36 187 188 /** 189 * Binding events to HTML elements 190 */ 37 191 function bindEvents() 38 192 { 39 193 $('#employeesVisibility').click(toggleEmployeesVisibility); 194 $('#groupByArea').click(toggleGroupByArea); 40 195 $('#highlightSupervisor').click(toggleHighlightSupervisor); 41 196 $('#orgchartPathVisibility').click(toggleOrgchartPathVisibility); … … 45 200 function initialSetup() 46 201 { 202 toggleGroupByArea(); 47 203 toggleEmployeesVisibility(); 48 204 toggleHighlightSupervisor(); … … 50 206 } 51 207 208 /** 209 * Call setup functions on body onload. 210 */ 52 211 function pageLoad() 53 212 {
Note: See TracChangeset
for help on using the changeset viewer.