[795] | 1 | var workflowUserInterfaceEmployeeInfoTimer = null; |
---|
| 2 | var workflowUserInterfaceAreaInfoTimer = null; |
---|
| 3 | var workflowUserInterfaceCurrentAreaID = 0; |
---|
| 4 | |
---|
| 5 | String.prototype.repeat = function(l) |
---|
| 6 | { |
---|
| 7 | return new Array(l+1).join(this); |
---|
| 8 | }; |
---|
| 9 | |
---|
| 10 | /* define the orgchart layout */ |
---|
| 11 | function createOrgchartLayout() |
---|
| 12 | { |
---|
| 13 | var content = '<div id="orgchartMenu"></div>'; |
---|
| 14 | content += '<div class="orgchartAreas" id="orgchartAreas"></div>'; |
---|
| 15 | content += '<div class="orgchartEmployees" id="orgchartEmployees"></div>'; |
---|
| 16 | content += '<div class="orgchartFooter" id="orgchartFooter"></div>'; |
---|
| 17 | content += '<div id="employeeInfo" class="employeeInfo" style="display: none;"></div>'; |
---|
| 18 | content += '<div id="areaInfo" class="employeeInfo" style="display: none;"></div>'; |
---|
| 19 | |
---|
| 20 | var div = $('content_id_4'); |
---|
| 21 | div.innerHTML = content; |
---|
| 22 | |
---|
| 23 | draw_orgchart_folder(); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | /* generates the orgchart menu */ |
---|
| 27 | function createOrgchartMenu(organizationID, imagemURL) |
---|
| 28 | { |
---|
| 29 | var enderecoImagem = ''; |
---|
| 30 | if ((imagemURL != null) && (imagemURL != '')) |
---|
| 31 | enderecoImagem = imagemURL; |
---|
| 32 | else |
---|
| 33 | enderecoImagem = '../index.php?menuaction=workflow.ui_orgchart.graph&organizationID=' + organizationID; |
---|
| 34 | |
---|
| 35 | var content = '<ul class="horizontalMenu">'; |
---|
[1245] | 36 | content += '<li style="margin: 5px 5px 0 5px">Visualizar : <select>' |
---|
| 37 | content += '<option>-- Selecione uma opção de visualização --</option>' |
---|
| 38 | content += '<option onclick="">Alfabética</option>' |
---|
| 39 | content += '<option onclick="getHierarchicalArea( );">Áreas</option>' |
---|
[1266] | 40 | content += '<option onclick="getManning( )">Lotação</option>' |
---|
[1245] | 41 | content += '<option onclick="getUsefulPhones( );">Telefones Úteis</option>' |
---|
| 42 | content += '<option onclick="getAreaWithSubtituteBoss( )">Substituição de Chefia</option>' |
---|
| 43 | content += '<option onclick="getCostCenters( );">Centros de Custo</option>' |
---|
[1266] | 44 | content += '<option onclick="getCategoriesList( )">Vínculos</option>' |
---|
[1245] | 45 | content += '</select></li>'; |
---|
[795] | 46 | content += '<li><a href="#" onclick="window.open(\'' + enderecoImagem + '\', \'extwindow\'); return false;"><img src="templateFile.php?file=images/Process.gif"> Gráfico</a></li>'; |
---|
[1245] | 47 | //content += '<li><a href="#" onclick="getCostCenters(); return false;"><img src="templateFile.php?file=images/coins.png"> Centros de Custo</a></li>'; |
---|
| 48 | //content += '<li><a href="#" onclick="getHierarchicalArea(); return false;"><img src="templateFile.php?file=images/orgchart_tree.png">Lista Hierárquica</a></li>'; |
---|
| 49 | //content += '<li><a href="#" onclick="getAreaList(); return false;"><img src="templateFile.php?file=images/orgchart_list.png"> Lista Alfabética</a></li>'; |
---|
| 50 | //content += '<li><a href="#" onclick="getCategoriesList(); return false;"><img src="templateFile.php?file=images/folder_green.png"> Listar Vínculos</a></li>'; |
---|
[795] | 51 | content += '<li><a href="#" onclick="printArea(); return false;"><img src="templateFile.php?file=images/imprimir.png" width="16"> Imprimir</a></li>'; |
---|
| 52 | 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>'; |
---|
| 53 | content += '</ul>'; |
---|
| 54 | content += '<br/>'; |
---|
| 55 | content += '<br/>'; |
---|
| 56 | |
---|
| 57 | $('orgchartMenu').innerHTML = content; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /* load the initial data */ |
---|
| 61 | function draw_orgchart_folder() |
---|
| 62 | { |
---|
| 63 | $('orgchartMenu').innerHTML = ''; |
---|
| 64 | $('orgchartAreas').innerHTML = ''; |
---|
| 65 | $('orgchartEmployees').innerHTML = '<br/><br/><br/><br/><center><i> carregando...<br/><img src="templateFile.php?file=images/loading.gif"></i></center>'; |
---|
| 66 | $('orgchartFooter').innerHTML = ''; |
---|
| 67 | $('orgchartMenu').innerHTML = ''; |
---|
| 68 | |
---|
| 69 | cExecute("$this.bo_userinterface.orgchart", orgchart, ""); |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | /* process the initial data */ |
---|
| 73 | function orgchart(data) |
---|
| 74 | { |
---|
| 75 | if (_checkError(data)) |
---|
| 76 | return; |
---|
| 77 | |
---|
| 78 | /* in case of any warning */ |
---|
| 79 | if (data['warning']) |
---|
| 80 | { |
---|
| 81 | $('content_id_4').innerHTML = '<br/><br/><center><strong>' + data['warning'] + '</strong></center><br/><br/>'; |
---|
| 82 | return; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | if (data['areas'].length == 0) |
---|
| 86 | { |
---|
| 87 | $('content_id_4').innerHTML = "<br/><br/><center><strong>Nenhuma área cadastrada.</strong></center><br/><br/>"; |
---|
| 88 | return; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | /* continue displaying the data */ |
---|
| 92 | displayHierarchicalAreas(data['areas']); |
---|
| 93 | createOrgchartMenu(data['organizacao_id'], data['url_imagem']); |
---|
| 94 | $('orgchartEmployees').innerHTML = '<br/><br/><br/><br/><center><i>faça uma busca ou clique em uma área para ver a lista de funcionários</i></center>'; |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | function displayCostCenters(data) |
---|
| 98 | { |
---|
| 99 | if (_checkError(data)) |
---|
| 100 | return; |
---|
| 101 | |
---|
| 102 | var div = $('orgchartEmployees'); |
---|
| 103 | if (data.length == 0) |
---|
| 104 | { |
---|
| 105 | div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; |
---|
| 106 | return; |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | var content = '<center><h3>CENTROS DE CUSTO</strong></h3>'; |
---|
| 110 | content += '<table class="employeeList">'; |
---|
| 111 | content += '<tr><th>Nome</th><th>Número</th><th>Grupo</th></tr>'; |
---|
| 112 | var current; |
---|
| 113 | var costCentersCount = data.length; |
---|
| 114 | for (var i = 0; i < costCentersCount; i++) |
---|
| 115 | { |
---|
| 116 | current = data[i]; |
---|
| 117 | content += '<tr class="linha'+ i%2 + '">'; |
---|
| 118 | content += '<td>' + current['descricao'] + '</td>'; |
---|
| 119 | content += '<td>' + current['nm_centro_custo'] + '</td>'; |
---|
| 120 | content += '<td>' + current['grupo'] + '</td>'; |
---|
| 121 | content += '</tr>'; |
---|
| 122 | } |
---|
| 123 | content += '</table>'; |
---|
| 124 | div.innerHTML = content; |
---|
| 125 | } |
---|
| 126 | |
---|
[1245] | 127 | function displayUsefulPhones( data ) |
---|
| 128 | { |
---|
| 129 | if ( _checkError( data ) ) |
---|
| 130 | return; |
---|
| 131 | |
---|
| 132 | var div = $('orgchartEmployees'); |
---|
| 133 | if (data.length == 0) |
---|
| 134 | { |
---|
| 135 | div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; |
---|
| 136 | return; |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | var content = '<center><h3>TELEFONES ÚTEIS</strong></h3>'; |
---|
| 140 | content += '<table class="employeeList">'; |
---|
| 141 | content += '<tr><th>Localidade</th><th>Número</th></tr>'; |
---|
| 142 | var current; |
---|
| 143 | var usefulPhoneCount = data.length; |
---|
| 144 | for (var i = 0; i < usefulPhoneCount; i++) |
---|
| 145 | { |
---|
| 146 | current = data[i]; |
---|
| 147 | content += '<tr class="linha'+ i%2 + '">'; |
---|
| 148 | content += '<td>' + current[ 'descricao' ] + '</td>'; |
---|
| 149 | content += '<td>' + current[ 'numero' ] + '</td>'; |
---|
| 150 | content += '</tr>'; |
---|
| 151 | } |
---|
| 152 | content += '</table>'; |
---|
| 153 | div.innerHTML = content; |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | function displayAreaWithSubtituteBoss( data ) |
---|
| 157 | { |
---|
| 158 | if ( _checkError( data ) ) |
---|
| 159 | return; |
---|
| 160 | |
---|
| 161 | var div = $('orgchartEmployees'); |
---|
| 162 | if (data.length == 0) |
---|
| 163 | { |
---|
| 164 | div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; |
---|
| 165 | return; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | var content = '<center><h3>Áreas com Substituição de Chefia</strong></h3>'; |
---|
| 169 | content += '<table class="employeeList">'; |
---|
| 170 | content += '<tr><th>Área</th><th>Titular</th><th>Substituto</th></tr>'; |
---|
| 171 | var current; |
---|
| 172 | var usefulPhoneCount = data.length; |
---|
| 173 | for (var i = 0; i < usefulPhoneCount; i++) |
---|
| 174 | { |
---|
| 175 | current = data[i]; |
---|
| 176 | content += '<tr class="linha'+ i%2 + '">'; |
---|
| 177 | content += '<td>' + current['area'] + '</td>'; |
---|
| 178 | content += '<td>' + current['titular'] + '</td>'; |
---|
| 179 | content += '<td>' + current['substituto'] + '</td>'; |
---|
| 180 | content += '</tr>'; |
---|
| 181 | } |
---|
| 182 | content += '</table>'; |
---|
| 183 | div.innerHTML = content; |
---|
| 184 | } |
---|
| 185 | |
---|
[795] | 186 | function displayHierarchicalAreas(data) |
---|
| 187 | { |
---|
| 188 | if (_checkError(data)) |
---|
| 189 | return; |
---|
| 190 | |
---|
| 191 | function recursivePrint(subdata) |
---|
| 192 | { |
---|
| 193 | for (var i = 0; i < subdata.length; i++) |
---|
| 194 | { |
---|
| 195 | div.innerHTML += '<br />' + ' '.repeat(subdata[i]['depth']) + '<a href="javascript:void(0)" id="area_' + subdata[i]['area_id'] + '" onmouseover="getAreaInfoTimer(event, ' + subdata[i]['area_id'] + '); return false;" onmouseout="hideAreaInfo(); return false;" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); this.addClassName(\'destaque\'); loadAreaEmployees(' + subdata[i]['area_id'] + ')">' + subdata[i]['sigla'] + '</a>'; |
---|
| 196 | if (subdata[i]['children'].length > 0) |
---|
| 197 | recursivePrint(subdata[i]['children']); |
---|
| 198 | } |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | var div = $('orgchartAreas'); |
---|
| 202 | div.innerHTML = "<center><strong>ÁREAS</strong></center>"; |
---|
| 203 | recursivePrint(data); |
---|
| 204 | } |
---|
| 205 | |
---|
[1245] | 206 | function getUsefulPhones( ) |
---|
| 207 | { |
---|
| 208 | cExecute("$this.bo_userinterface.getUsefulPhones", displayUsefulPhones, ""); |
---|
| 209 | } |
---|
| 210 | |
---|
| 211 | function getAreaWithSubtituteBoss( ) |
---|
| 212 | { |
---|
| 213 | cExecute("$this.bo_userinterface.getAreaWithSubtituteBoss", displayAreaWithSubtituteBoss, ""); |
---|
| 214 | } |
---|
| 215 | |
---|
[795] | 216 | function getCostCenters() |
---|
| 217 | { |
---|
| 218 | cExecute("$this.bo_userinterface.getCostCenters", displayCostCenters, ""); |
---|
| 219 | } |
---|
| 220 | |
---|
| 221 | function getHierarchicalArea() |
---|
| 222 | { |
---|
| 223 | cExecute("$this.bo_userinterface.getHierarchicalArea", displayHierarchicalAreas, ""); |
---|
| 224 | } |
---|
| 225 | |
---|
| 226 | function getAreaList() |
---|
| 227 | { |
---|
| 228 | cExecute("$this.bo_userinterface.getAreaList", displayHierarchicalAreas, ""); |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | function getCategoriesList() |
---|
| 232 | { |
---|
| 233 | function resultGetCategoriesList(data) |
---|
| 234 | { |
---|
| 235 | if (_checkError(data)) |
---|
| 236 | return; |
---|
| 237 | |
---|
| 238 | var content = '<center><strong>VÍNCULOS</strong></center>'; |
---|
| 239 | for (var i = 0; i < data.length; i++) |
---|
| 240 | content += '<br/>' + ' <a href="javascript:void(0)" id="categoria_' + data[i]['funcionario_categoria_id'] + '" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); this.addClassName(\'destaque\'); loadCategoryEmployees(' + data[i]['funcionario_categoria_id'] + ')">' + data[i]['descricao'] + ' (' + data[i]['contagem'] + ')</a>'; |
---|
| 241 | content += '<br/><br/>'; |
---|
| 242 | $('orgchartAreas').innerHTML = content; |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | cExecute("$this.bo_userinterface.getCategoriesList", resultGetCategoriesList, ""); |
---|
| 246 | } |
---|
| 247 | |
---|
[1266] | 248 | function getManning( ) |
---|
| 249 | { |
---|
| 250 | function resultGetManning( data ) |
---|
| 251 | { |
---|
| 252 | if ( _checkError( data ) ) |
---|
| 253 | return; |
---|
| 254 | |
---|
| 255 | var content = '<center><strong>Lotalidades</strong></center>'; |
---|
| 256 | for ( var i = 0; i < data.length; i++ ) |
---|
| 257 | content += '<br/>' + ' <a href="javascript:void(0)" id="localidade_' + data[i]['localidade_id'] + '" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); this.addClassName(\'destaque\');loadManningEmployees(' + data[i]['localidade_id'] + ')">' + data[i]['descricao'] + '</a>'; |
---|
| 258 | |
---|
| 259 | content += '<br/><br/>'; |
---|
| 260 | |
---|
| 261 | $('orgchartAreas').innerHTML = content; |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | cExecute("$this.bo_userinterface.getManning", resultGetManning, ""); |
---|
| 265 | } |
---|
| 266 | |
---|
[795] | 267 | function printEmployeesHandler(data) |
---|
| 268 | { |
---|
| 269 | /* check for errors */ |
---|
| 270 | if (_checkError(data)) |
---|
| 271 | return; |
---|
| 272 | |
---|
| 273 | var div = $('orgchartEmployees'); |
---|
| 274 | |
---|
| 275 | /* no employee to list */ |
---|
| 276 | if (data['employees'].length == 0) |
---|
| 277 | { |
---|
| 278 | div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; |
---|
| 279 | return; |
---|
| 280 | } |
---|
| 281 | |
---|
| 282 | /* initialize varivables */ |
---|
| 283 | var content = ''; |
---|
| 284 | var employees = data['employees']; |
---|
| 285 | var useCategories = false; |
---|
| 286 | var useArea = false; |
---|
| 287 | |
---|
| 288 | /* check the informations that will be displayed */ |
---|
| 289 | if (data['categories']) |
---|
| 290 | if (data['categories'].length > 1) |
---|
| 291 | useCategories = true; |
---|
| 292 | if (employees[0]['area']) |
---|
| 293 | useArea = true; |
---|
| 294 | |
---|
| 295 | /* build the display table (headers)*/ |
---|
| 296 | content += '<table id="employeeList" class="employeeList" style="clear: both">'; |
---|
| 297 | content += '<tr>'; |
---|
| 298 | content += '<th>Funcionário</th>'; |
---|
| 299 | if (useArea) |
---|
| 300 | content += '<th>Área</th>'; |
---|
| 301 | content += '<th>Telefone</th>'; |
---|
| 302 | content += '</tr>'; |
---|
| 303 | |
---|
| 304 | /* if available, insert a menu to filter the categories */ |
---|
| 305 | if (useCategories) |
---|
| 306 | { |
---|
| 307 | content += '<tr><td colspan="' + (useArea ? '3' : '2') + '">'; |
---|
| 308 | content += '<ul class="horizontalMenu">'; |
---|
| 309 | for (var i = 0; i < data['categories'].length; i++) |
---|
| 310 | content += '<li><a href="#" style="height: 2em; line-height: 2em;" onclick="highlightCategory(' + data['categories'][i]['funcionario_categoria_id'] + '); return false;">' + data['categories'][i]['descricao'] + ' (' + data['categories'][i]['contagem'] + ')</a></li>'; |
---|
| 311 | content += '</ul>'; |
---|
| 312 | content += '</td></tr>'; |
---|
| 313 | } |
---|
| 314 | |
---|
| 315 | /* list the employees */ |
---|
| 316 | var complement = ''; |
---|
| 317 | for (var i = 0; i < employees.length; i++) |
---|
| 318 | { |
---|
| 319 | if (employees[i]['chief']) |
---|
| 320 | complement = ' <strong>(' + ((employees[i]['chief'] == 1) ? 'Titular' : 'Substituto') + ')</strong>'; |
---|
| 321 | else |
---|
| 322 | complement = ''; |
---|
| 323 | if (employees[i]['removed']) |
---|
| 324 | complement += ' <font color="red">(excluído)</font>'; |
---|
| 325 | content += '<tr class="linha'+ i%2 + (useCategories ? ' categoria_' + employees[i]['funcionario_categoria_id'] : '') + '">'; |
---|
| 326 | 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>'; |
---|
| 327 | if (useArea) |
---|
| 328 | content += '<td>' + employees[i]['area'] + '</td>'; |
---|
| 329 | content += '<td align="center">' + employees[i]['telephoneNumber'] + '</td>'; |
---|
| 330 | content += '</tr>'; |
---|
| 331 | } |
---|
| 332 | content += '</table>'; |
---|
| 333 | |
---|
| 334 | /* display the employees list and go to the top of the page */ |
---|
| 335 | div.innerHTML = content; |
---|
| 336 | window.scrollTo(0,0); |
---|
| 337 | } |
---|
| 338 | |
---|
| 339 | function highlightCategory(categoryID) |
---|
| 340 | { |
---|
| 341 | var rows = $('employeeList').childNodes[0].childNodes; |
---|
| 342 | var categoryClass = 'categoria_' + categoryID; |
---|
| 343 | |
---|
| 344 | var highlightClass = ''; |
---|
| 345 | var row; |
---|
| 346 | for (var i = 1; i < rows.length; i++) |
---|
| 347 | { |
---|
| 348 | row = $(rows[i]); |
---|
| 349 | /* in case alternated color rows are needed, just change the second 'highlight0' to something else (e.g. 'highlight1' which is alread defined) */ |
---|
| 350 | highlightClass = row.hasClassName('linha0') ? 'highlight0' : 'highlight0'; |
---|
| 351 | if (row.hasClassName(categoryClass)) |
---|
| 352 | row.addClassName(highlightClass); |
---|
| 353 | else |
---|
| 354 | row.removeClassName(highlightClass); |
---|
| 355 | } |
---|
| 356 | } |
---|
| 357 | |
---|
| 358 | function loadAreaEmployees(areaID) |
---|
| 359 | { |
---|
| 360 | workflowUserInterfaceCurrentAreaID = areaID; |
---|
| 361 | cExecute('$this.bo_userinterface.getAreaEmployees', printEmployeesHandler, 'areaID=' + areaID); |
---|
| 362 | } |
---|
| 363 | |
---|
| 364 | function loadCategoryEmployees(categoryID) |
---|
| 365 | { |
---|
| 366 | workflowUserInterfaceCurrentAreaID = 0; |
---|
| 367 | cExecute('$this.bo_userinterface.getCategoryEmployees', printEmployeesHandler, 'categoryID=' + categoryID); |
---|
| 368 | } |
---|
| 369 | |
---|
[1266] | 370 | function loadManningEmployees( locationID ) |
---|
| 371 | { |
---|
| 372 | workflowUserInterfaceCurrentAreaID = 0; |
---|
| 373 | cExecute('$this.bo_userinterface.getManningEmployees', printEmployeesHandler, 'locationID=' + locationID); |
---|
| 374 | } |
---|
| 375 | |
---|
[795] | 376 | function orgchartSearchEmployee(searchTerm) |
---|
| 377 | { |
---|
| 378 | workflowUserInterfaceCurrentAreaID = 0; |
---|
| 379 | cExecute('$this.bo_userinterface.searchEmployee', printEmployeesHandler, 'searchTerm=' + searchTerm); |
---|
| 380 | } |
---|
| 381 | |
---|
| 382 | function printArea() |
---|
| 383 | { |
---|
| 384 | if (workflowUserInterfaceCurrentAreaID == 0) |
---|
| 385 | if (!confirm('Tem certeza de que deseja imprimir todo o Organograma?')) |
---|
| 386 | return false; |
---|
| 387 | var endereco = '../index.php?menuaction=workflow.ui_userinterface.printArea&areaID=' + workflowUserInterfaceCurrentAreaID; |
---|
| 388 | window.open(endereco, 'extwindow'); |
---|
| 389 | } |
---|
| 390 | |
---|
| 391 | function getEmployeeInfoTimer(e, employeeID) |
---|
| 392 | { |
---|
| 393 | var div = $('employeeInfo'); |
---|
| 394 | div.style.left = (Event.pointerX(e) + 20) + 'px'; |
---|
| 395 | div.style.top = (Event.pointerY(e) + 14) + 'px'; |
---|
| 396 | |
---|
| 397 | if (workflowUserInterfaceEmployeeInfoTimer != null) |
---|
| 398 | { |
---|
| 399 | workflowUserInterfaceEmployeeInfoTimer = clearTimeout(workflowUserInterfaceEmployeeInfoTimer); |
---|
| 400 | workflowUserInterfaceEmployeeInfoTimer = null; |
---|
| 401 | } |
---|
| 402 | |
---|
| 403 | workflowUserInterfaceEmployeeInfoTimer = setTimeout('getEmployeeInfo(' + employeeID + ')', 500); |
---|
| 404 | } |
---|
| 405 | |
---|
| 406 | function getEmployeeInfo(employeeID) |
---|
| 407 | { |
---|
| 408 | function resultGetEmployeeInfo(data) |
---|
| 409 | { |
---|
| 410 | if (workflowUserInterfaceEmployeeInfoTimer == null) |
---|
| 411 | return; |
---|
| 412 | |
---|
| 413 | workflowUserInterfaceEmployeeInfoTimer = clearTimeout(workflowUserInterfaceEmployeeInfoTimer); |
---|
| 414 | workflowUserInterfaceEmployeeInfoTimer = null; |
---|
| 415 | |
---|
| 416 | var content = ''; |
---|
| 417 | content += '<table><tr><td valign="top">'; |
---|
| 418 | content += '<img src="showUserPicture.php?userID=' + employeeID + '"/>'; |
---|
| 419 | content += '</td><td valign="top" style="padding-left: 12px;">'; |
---|
| 420 | for (var i = 0; i < data['info'].length; i++) |
---|
| 421 | content += '<strong>' + data['info'][i]['name'] + '</strong>: ' + data['info'][i]['value'] + '<br/>'; |
---|
| 422 | |
---|
| 423 | content += '</td></tr></table>'; |
---|
| 424 | var pageYLimit = document.body.scrollTop + document.body.clientHeight; |
---|
| 425 | var div = $('employeeInfo'); |
---|
| 426 | div.innerHTML = content; |
---|
| 427 | |
---|
| 428 | if ((parseInt(div.style.top.replace(/px/g, '')) + div.getHeight()) > pageYLimit) |
---|
| 429 | div.style.top = (parseInt(div.style.top.replace(/px/g, '')) - (div.getHeight())) + 'px'; |
---|
| 430 | div.show(); |
---|
| 431 | } |
---|
| 432 | cExecute('$this.bo_userinterface.getEmployeeInfo', resultGetEmployeeInfo, 'funcionario_id=' + employeeID); |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | function hideEmployeeInfo() |
---|
| 436 | { |
---|
| 437 | if (workflowUserInterfaceEmployeeInfoTimer != null) |
---|
| 438 | { |
---|
| 439 | workflowUserInterfaceEmployeeInfoTimer = clearTimeout(workflowUserInterfaceEmployeeInfoTimer); |
---|
| 440 | workflowUserInterfaceEmployeeInfoTimer = null; |
---|
| 441 | } |
---|
| 442 | $('employeeInfo').hide(); |
---|
| 443 | } |
---|
| 444 | |
---|
| 445 | function getAreaInfoTimer(e, areaID) |
---|
| 446 | { |
---|
| 447 | var div = $('areaInfo'); |
---|
| 448 | div.style.left = (Event.pointerX(e) + 20) + 'px'; |
---|
| 449 | div.style.top = (Event.pointerY(e) + 14) + 'px'; |
---|
| 450 | |
---|
| 451 | if (workflowUserInterfaceAreaInfoTimer != null) |
---|
| 452 | { |
---|
| 453 | workflowUserInterfaceAreaInfoTimer = clearTimeout(workflowUserInterfaceAreaInfoTimer); |
---|
| 454 | workflowUserInterfaceAreaInfoTimer = null; |
---|
| 455 | } |
---|
| 456 | |
---|
| 457 | workflowUserInterfaceAreaInfoTimer = setTimeout('getAreaInfo(' + areaID + ')', 500); |
---|
| 458 | } |
---|
| 459 | |
---|
| 460 | function getAreaInfo(areaID) |
---|
| 461 | { |
---|
| 462 | function resultGetAreaInfo(data) |
---|
| 463 | { |
---|
| 464 | if (workflowUserInterfaceAreaInfoTimer == null) |
---|
| 465 | return; |
---|
| 466 | |
---|
| 467 | workflowUserInterfaceAreaInfoTimer = clearTimeout(workflowUserInterfaceAreaInfoTimer); |
---|
| 468 | workflowUserInterfaceAreaInfoTimer = null; |
---|
| 469 | |
---|
| 470 | var content = ''; |
---|
| 471 | content += '<table><tr>'; |
---|
| 472 | content += '<td valign="top" style="padding-left: 12px;">'; |
---|
| 473 | for (var i = 0; i < data['info'].length; i++) |
---|
| 474 | content += '<strong>' + data['info'][i]['name'] + '</strong>: ' + data['info'][i]['value'] + '<br/>'; |
---|
| 475 | |
---|
| 476 | content += '</td></tr></table>'; |
---|
| 477 | var pageYLimit = document.body.scrollTop + document.body.clientHeight; |
---|
| 478 | var div = $('areaInfo'); |
---|
| 479 | div.innerHTML = content; |
---|
| 480 | |
---|
| 481 | if ((parseInt(div.style.top.replace(/px/g, '')) + div.getHeight()) > pageYLimit) |
---|
| 482 | div.style.top = (parseInt(div.style.top.replace(/px/g, '')) - (div.getHeight())) + 'px'; |
---|
| 483 | div.show(); |
---|
| 484 | } |
---|
| 485 | cExecute('$this.bo_userinterface.getAreaInfo', resultGetAreaInfo, 'area_id=' + areaID); |
---|
| 486 | } |
---|
| 487 | |
---|
| 488 | function hideAreaInfo() |
---|
| 489 | { |
---|
| 490 | if (workflowUserInterfaceAreaInfoTimer != null) |
---|
| 491 | { |
---|
| 492 | workflowUserInterfaceAreaInfoTimer = clearTimeout(workflowUserInterfaceAreaInfoTimer); |
---|
| 493 | workflowUserInterfaceAreaInfoTimer = null; |
---|
| 494 | } |
---|
| 495 | $('areaInfo').hide(); |
---|
| 496 | } |
---|