Changeset 1446
- Timestamp:
- 09/23/09 17:26:50 (15 years ago)
- Location:
- trunk/workflow
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/doc/change_log.txt
r1395 r1446 21 21 [2.0.000] 22 22 23 * Inclusão de click-to-call no organograma e outras melhorias na interface. (rodsouza) 24 * Criação do método createNewInstance na classe JobBase, que possibilita iniciar uma instância do processo a partir de um job. (rufino) 25 * Criação do plugin wf_autocomplete_input, para listar com autocomplete o resultado de uma busca ajax. (rufino) 23 26 * Correção de bug no método getByUser da classe wf_instance. (hermespinheiro) 24 27 * Melhorias no organograma, com novas visualizações nas interfaces. (rodsouza) -
trunk/workflow/inc/class.bo_userinterface.inc.php
r1277 r1446 1059 1059 return $employees; 1060 1060 } 1061 1062 function callVoipConnect($params) 1063 { 1064 $cachedLDAP = $GLOBALS['workflow']['factory']->newInstance('CachedLDAP'); 1065 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP); 1066 1067 $entry = $cachedLDAP->getEntryByID( $_SESSION['phpgw_info']['workflow']['account_id'] ); 1068 if ( $entry && ! is_null($entry['telephonenumber']) ) 1069 $fromNumber = $entry['telephonenumber']; 1070 1071 if ( $fromNumber == false ) 1072 return false; 1073 1074 $toNumber = $params['to']; 1075 1076 $voipServer = $_SESSION['phpgw_info']['workflow']['server']['voip_server']; 1077 $voipUrl = $_SESSION['phpgw_info']['workflow']['server']['voip_url']; 1078 $voipPort = $_SESSION['phpgw_info']['workflow']['server']['voip_port']; 1079 1080 if(!$voipServer || !$voipUrl || !$voipPort) 1081 return false; 1082 1083 $url = "http://".$voipServer.":".$voipPort.$voipUrl."?magic=1333&acao=liga&ramal=".$fromNumber."&numero=".$toNumber; 1084 $sMethod = 'GET '; 1085 $crlf = "\r\n"; 1086 $sRequest = " HTTP/1.1" . $crlf; 1087 $sRequest .= "Host: localhost" . $crlf; 1088 $sRequest .= "Accept: */* " . $crlf; 1089 $sRequest .= "Connection: Close" . $crlf . $crlf; 1090 $sRequest = $sMethod . $url . $sRequest; 1091 $sockHttp = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 1092 if (!$sockHttp) { 1093 return false; 1094 } 1095 $resSocketConnect = socket_connect($sockHttp, $voipServer, $voipPort); 1096 if (!$resSocketConnect) { 1097 return false; 1098 } 1099 $resSocketWrite = socket_write($sockHttp, $sRequest, strlen($sRequest)); 1100 if (!$resSocketWrite) { 1101 return false; 1102 } 1103 $sResponse = ''; 1104 while ($sRead = socket_read($sockHttp, 512)) { 1105 $sResponse .= $sRead; 1106 } 1107 1108 socket_close($sockHttp); 1109 $pos = strpos($sResponse, $crlf . $crlf); 1110 return substr($sResponse, $pos + 2 * strlen($crlf)); 1111 } 1061 1112 } 1062 1113 ?> -
trunk/workflow/inc/class.so_orgchart.inc.php
r1353 r1446 1159 1159 'value' => $areaInfo['sigla']); 1160 1160 1161 $outputInfo[] = array( 1162 'name' => 'ÁreaID', 1163 'value' => $employeeInfo['area_id']); 1164 1161 1165 $localInfo = $orgchart->getLocal($employeeInfo['localidade_id']); 1162 1166 $outputInfo[] = array( -
trunk/workflow/inc/class.so_userinterface.inc.php
r1310 r1446 352 352 { 353 353 /* initialize some variables */ 354 $output = array('employees' => array() );354 $output = array('employees' => array(), 'bygroup' => array( ) ); 355 355 $ldapResult = array(); 356 356 357 357 /* search for the $searchTerm in the LDAP */ 358 358 $ldap = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 359 359 360 $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 360 361 if ($list === false) … … 367 368 368 369 /* check if any result was found */ 369 if (count($ldapResult) < 1) 370 return $output; 370 //if (count($ldapResult) < 1) 371 // return $output; 372 373 $uids = implode( ',', array_keys( $ldapResult ) ); 371 374 372 375 /* load employee information */ 373 $query = "SELECT f.funcionario_id AS funcionario_id, f.area_id AS area_id, a.sigla AS area FROM funcionario f, area a, funcionario_status s WHERE (f.area_id = a.area_id) AND (f.organizacao_id = $organizationID) AND (f.funcionario_id IN (" . implode(',', array_keys($ldapResult)) .")) AND (f.funcionario_status_id = s.funcionario_status_id) AND (s.exibir = 'S')"; 374 $result = $this->db->query($query); 376 $query = 'SELECT f.funcionario_id AS funcionario_id, f.area_id AS area_id, a.sigla AS area'; 377 $query .= ' FROM funcionario f, area a, funcionario_status s'; 378 $query .= " WHERE (f.area_id = a.area_id) AND (f.organizacao_id = {$organizationID})"; 379 $query .= " AND (" . ( ( ! empty( $uids ) ) ? "f.funcionario_id IN ({$uids}) OR " : '' ); 380 $query .= " a.sigla LIKE UPPER(?))"; 381 $query .= " AND (f.funcionario_status_id = s.funcionario_status_id) AND (s.exibir = 'S')"; 382 $query .= " ORDER BY a.sigla asc"; 383 384 $result = $this->db->query($query, array( "%{$searchTerm}%" ) ); 385 386 if ( ! $result ) 387 return array( ); 388 389 $uids = array( ); 375 390 376 391 $employees = $result->GetArray(-1); … … 379 394 for ($j = 0; $j < $result->_numOfFields; $j++) 380 395 unset($employees[$i][$j]); 381 $employees[$i]['cn'] = is_null($ldapResult[$employees[$i]['funcionario_id']]['cn']) ? '' : $ldapResult[$employees[$i]['funcionario_id']]['cn']; 382 $employees[$i]['telephoneNumber'] = is_null($ldapResult[$employees[$i]['funcionario_id']]['telephoneNumber']) ? '' : $ldapResult[$employees[$i]['funcionario_id']]['telephoneNumber']; 383 } 384 385 $output['employees'] = $employees; 396 397 if ( array_key_exists( $employees[$i]['funcionario_id'], $ldapResult ) ) 398 { 399 $employees[$i]['cn'] = is_null($ldapResult[$employees[$i]['funcionario_id']]['cn']) ? '' : $ldapResult[$employees[$i]['funcionario_id']]['cn']; 400 $employees[$i]['telephoneNumber'] = is_null($ldapResult[$employees[$i]['funcionario_id']]['telephoneNumber']) ? '' : $ldapResult[$employees[$i]['funcionario_id']]['telephoneNumber']; 401 } 402 else 403 { 404 $employees[$i]['cn'] = $employees[$i]['funcionario_id']; 405 $employees[$i]['telephoneNumber'] = ''; 406 407 $output['bygroup'][ $employees[$i]['funcionario_id'] ] = $employees[ $i ]; 408 array_splice( $employees, $i--, 1 ); 409 } 410 } 411 412 if ( count( $output['bygroup'] ) ) 413 { 414 $list = ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(|(uidNumber=' . implode( ')(uidNumber=', array_keys( $output['bygroup'] ) ) . '))(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 415 416 if ( $list !== false ) 417 { 418 $entries = ldap_get_entries($ldap, $list); 419 420 for ( $i = 0; $i < $entries[ 'count' ]; $i++ ) 421 { 422 $output[ 'bygroup' ][ $entries[$i]['uidnumber'][0] ][ 'cn' ] = $entries[$i]['cn'][0]; 423 $output[ 'bygroup' ][ $entries[$i]['uidnumber'][0] ][ 'telephoneNumber' ] = $entries[$i]['telephonenumber'][0]; 424 } 425 } 426 } 427 428 $output[ 'bygroup' ] = array_values( $output[ 'bygroup' ] ); 429 $output[ 'employees' ] = $employees; 430 386 431 return $output; 387 432 } -
trunk/workflow/js/userinterface/orgchart.js
r1353 r1446 34 34 35 35 var content = '<ul class="horizontalMenu">'; 36 content += '<li style="margin: 5px 5px 0 5px">Visualizar : <select onclick="this.parentNode.parentNode.lastChild.style.display = (this.options[1].selected) ? \'block\' : \'none\' ">'36 content += '<li><a onclick="return false;">Visualizar : <select onclick="this.parentNode.parentNode.parentNode.lastChild.style.display = (this.options[1].selected) ? \'block\' : \'none\' ">' 37 37 content += '<option onclick="getAlphabeticalEmployees( )">Alfabética</option>' 38 38 content += '<option onclick="getHierarchicalArea( );" selected="true">Áreas</option>' … … 42 42 content += '<option onclick="getUsefulPhones( );">Telefones Úteis</option>' 43 43 content += '<option onclick="getCategoriesList( )">Vínculos</option>' 44 content += '</select></ li>';44 content += '</select></a></li>'; 45 45 content += '<li><a href="#" onclick="window.open(\'' + enderecoImagem + '\', \'extwindow\'); return false;"><img src="templateFile.php?file=images/Process.gif"> Gráfico</a></li>'; 46 46 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>'; … … 51 51 52 52 $('orgchartMenu').innerHTML = content; 53 54 $( 'search_term' ).focus( ); 53 55 } 54 56 … … 102 104 } 103 105 104 var content = ' ';106 var content = '<center><h2>Centros de Custo</h2></center>'; 105 107 content += '<table class="employeeList">'; 106 108 content += '<tr><th>Nome</th><th>Número</th><th>Grupo</th></tr>'; … … 110 112 { 111 113 current = data[i]; 112 content += '<tr class="linha'+ i%2 + '" >';114 content += '<tr class="linha'+ i%2 + '" onmouseover="this.className=\'highlight0\'" onmouseout="this.className=\'linha' + i%2 + '\'">'; 113 115 content += '<td>' + current['descricao'] + '</td>'; 114 116 content += '<td>' + current['nm_centro_custo'] + '</td>'; … … 132 134 } 133 135 134 var content = ' ';136 var content = '<center><h2>Telefones Úteis</h2></center>'; 135 137 content += '<table class="employeeList">'; 136 138 content += '<tr><th>Localidade</th><th>Número</th></tr>'; 137 139 var current; 138 var usefulPhoneCount = data.length; 139 for (var i = 0; i < usefulPhoneCount; i++) 140 for (var i = 0; i < data.length; i++) 140 141 { 141 142 current = data[i]; 142 content += '<tr class="linha'+ i%2 + '" >';143 content += '<tr class="linha'+ i%2 + '" onmouseover="this.className=\'highlight0\'" onmouseout="this.className=\'linha' + i%2 + '\'">'; 143 144 content += '<td>' + current[ 'descricao' ] + '</td>'; 144 145 content += '<td>' + current[ 'numero' ] + '</td>'; … … 161 162 } 162 163 163 var content = ' ';164 var content = '<center><h2>Substituição de Chefia</h2></center>'; 164 165 content += '<table class="employeeList">'; 165 166 content += '<tr><th>Área</th><th>Titular</th><th>Substituto</th></tr>'; 166 167 var current; 167 var usefulPhoneCount = data.length; 168 for (var i = 0; i < usefulPhoneCount; i++) 168 for (var i = 0; i < data.length; i++) 169 169 { 170 170 current = data[i]; 171 content += '<tr class="linha'+ i%2 + '" >';171 content += '<tr class="linha'+ i%2 + '" onmouseover="this.className=\'highlight0\'" onmouseout="this.className=\'linha' + i%2 + '\'">'; 172 172 content += '<td>' + current['area'] + '</td>'; 173 173 content += '<td>' + current['titular'] + '</td>'; … … 188 188 for (var i = 0; i < subdata.length; i++) 189 189 { 190 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>';190 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'] + '\')">' + subdata[i]['sigla'] + '</a>'; 191 191 if (subdata[i]['children'].length > 0) 192 192 recursivePrint(subdata[i]['children']); … … 246 246 var content = '<center><strong>VÍNCULOS</strong></center>'; 247 247 for (var i = 0; i < data.length; i++) 248 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>';248 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]['descricao'] + ' (' + data[i]['contagem'] + ')</a>'; 249 249 content += '<br/><br/>'; 250 250 $('orgchartAreas').innerHTML = content; … … 268 268 var content = '<center><strong>Localidades</strong></center>'; 269 269 for ( var i = 0; i < data.length; i++ ) 270 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>';270 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'] + '\')">' + data[i]['descricao'] + '</a>'; 271 271 272 272 content += '<br/><br/>'; … … 287 287 288 288 /* no employee to list */ 289 if ( data['employees'].length == 0)289 if ( ( ! data['employees'] || data['employees'].length == 0 ) && ( ! data['bygroup'] || data['bygroup'].length == 0 ) ) 290 290 { 291 291 div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; … … 293 293 } 294 294 295 /* initialize varivables */ 296 var content = ''; 297 var employees = data['employees']; 298 var useCategories = false; 299 var useArea = false; 300 301 /* check the informations that will be displayed */ 302 if (data['categories']) 303 if (data['categories'].length > 1) 304 useCategories = true; 305 if (employees[0]['area']) 306 useArea = true; 307 308 /* build the display table (headers)*/ 309 content += '<table id="employeeList" class="employeeList" style="clear: both">'; 310 content += '<tr>'; 311 content += '<th>Funcionário</th>'; 312 if (useArea) 313 content += '<th>Área</th>'; 314 content += '<th>Telefone</th>'; 315 content += '</tr>'; 316 317 /* if available, insert a menu to filter the categories */ 318 if (useCategories) 319 { 320 content += '<tr><td colspan="' + (useArea ? '3' : '2') + '">'; 321 content += '<ul class="horizontalMenu">'; 322 for (var i = 0; i < data['categories'].length; i++) 323 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>'; 324 content += '</ul>'; 325 content += '</td></tr>'; 326 } 327 328 /* list the employees */ 329 var complement = ''; 330 for (var i = 0; i < employees.length; i++) 331 { 332 if (employees[i]['chief']) 333 complement = ' <strong>(' + ((employees[i]['chief'] == 1) ? 'Titular' : 'Substituto') + ')</strong>'; 295 if ( data['employees'] && data['employees'].length ) 296 { 297 /* initialize varivables */ 298 var content = ''; 299 var employees = data['employees']; 300 var useCategories = false; 301 var useArea = false; 302 303 /* check the informations that will be displayed */ 304 if (data['categories']) 305 if (data['categories'].length > 1) 306 useCategories = true; 307 if (employees[0]['area']) 308 useArea = true; 309 310 /* build the display table (headers)*/ 311 content += '<table id="employeeList" class="employeeList" style="clear: both">'; 312 content += '<tr>'; 313 content += '<th>Nome</th>'; 314 if (useArea) 315 content += '<th>Área</th>'; 316 content += '<th>Telefone</th>'; 317 content += '</tr>'; 318 319 /* if available, insert a menu to filter the categories */ 320 if (useCategories) 321 { 322 content += '<tr><td colspan="' + (useArea ? '3' : '2') + '">'; 323 content += '<ul class="horizontalMenu">'; 324 for (var i = 0; i < data['categories'].length; i++) 325 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>'; 326 content += '</ul>'; 327 content += '</td></tr>'; 328 } 329 330 /* list the employees */ 331 var complement = ''; 332 for (var i = 0; i < employees.length; i++) 333 { 334 if (employees[i]['chief']) 335 complement = ' <strong>(' + ((employees[i]['chief'] == 1) ? 'Titular' : 'Substituto') + ')</strong>'; 336 else 337 complement = ''; 338 if (employees[i]['removed']) 339 complement += ' <font color="red">(excluído)</font>'; 340 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'] : '') + '\'">'; 341 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>'; 342 if (useArea) 343 content += '<td><a href="javascript:void(0);" onclick="loadAreaEmployees(\''+employees[i]['area_id']+'\', \'' + employees[i]['area'] + '\')">' + employees[i]['area'] + '</a></td>'; 344 content += '<td align="center"><a href="javascript:void(0);"'; 345 content += ' onclick="callVoipConnect(\''+employees[i]['telephoneNumber']+'\')">' + employees[i]['telephoneNumber'] + '</a></td>'; 346 content += '</tr>'; 347 } 348 content += '</table>'; 349 350 if ( arguments[ 1 ] != 'returnResult' ) 351 { 352 /* display the employees list and go to the top of the page */ 353 div.innerHTML = content; 354 window.scrollTo(0,0); 355 } 334 356 else 335 complement = ''; 336 if (employees[i]['removed']) 337 complement += ' <font color="red">(excluído)</font>'; 338 content += '<tr class="linha'+ i%2 + (useCategories ? ' categoria_' + employees[i]['funcionario_categoria_id'] : '') + '">'; 339 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>'; 340 if (useArea) 341 content += '<td>' + employees[i]['area'] + '</td>'; 342 content += '<td align="center">' + employees[i]['telephoneNumber'] + '</td>'; 343 content += '</tr>'; 344 } 345 content += '</table>'; 346 347 /* display the employees list and go to the top of the page */ 348 div.innerHTML = content; 349 window.scrollTo(0,0); 357 return content; 358 } 350 359 } 351 360 … … 369 378 } 370 379 371 function loadAreaEmployees(areaID )380 function loadAreaEmployees(areaID, areaName) 372 381 { 373 382 workflowUserInterfaceCurrentAreaID = areaID; 374 cExecute('$this.bo_userinterface.getAreaEmployees', printEmployeesHandler, 'areaID=' + areaID); 375 } 376 377 function loadCategoryEmployees(categoryID) 378 { 379 workflowUserInterfaceCurrentAreaID = 0; 380 cExecute('$this.bo_userinterface.getCategoryEmployees', printEmployeesHandler, 'categoryID=' + categoryID); 381 } 382 383 function loadManningEmployees( locationID ) 384 { 385 workflowUserInterfaceCurrentAreaID = 0; 386 cExecute('$this.bo_userinterface.getManningEmployees', printEmployeesHandler, 'locationID=' + locationID); 383 $('orgchartEmployees').innerHTML = ''; 384 cExecute('$this.bo_userinterface.getAreaEmployees', function( data ) 385 { 386 var content = printEmployeesHandler( data, 'returnResult' ); 387 if ( content ) 388 $('orgchartEmployees').innerHTML = '<center><h2>Área: ' + areaName + '</h2></center>' + content; 389 }, 'areaID=' + areaID); 390 } 391 392 function loadCategoryEmployees(categoryID, categoryName) 393 { 394 workflowUserInterfaceCurrentAreaID = 0; 395 $('orgchartEmployees').innerHTML = ''; 396 cExecute('$this.bo_userinterface.getCategoryEmployees', function( data ) 397 { 398 var content = printEmployeesHandler( data, 'returnResult' ); 399 if ( content ) 400 $('orgchartEmployees').innerHTML = '<center><h2>Vínculo: ' + categoryName + '</h2></center>' + content; 401 }, 'categoryID=' + categoryID); 402 } 403 404 function loadManningEmployees( locationID, locationName ) 405 { 406 workflowUserInterfaceCurrentAreaID = 0; 407 $('orgchartEmployees').innerHTML = ''; 408 cExecute('$this.bo_userinterface.getManningEmployees', function( data ) 409 { 410 var content = printEmployeesHandler( data, 'returnResult' ); 411 if ( content ) 412 $('orgchartEmployees').innerHTML = '<center><h2>Localidade: ' + locationName + '</h2></center>' + content; 413 }, 'locationID=' + locationID); 387 414 } 388 415 … … 417 444 } 418 445 419 printEmployeesHandler( data ); 420 421 div.innerHTML += '<br /><center>' + output + '</center>'; 446 var content = '<center><h2>Vizualização Alfabética</h2></center>'; 447 content += printEmployeesHandler( data, 'returnResult' ); 448 content += '<br /><center>' + output + '</center>'; 449 div.innerHTML = content; 450 422 451 }, 'p_page='+p_page); 423 452 } … … 426 455 { 427 456 workflowUserInterfaceCurrentAreaID = 0; 428 cExecute('$this.bo_userinterface.searchEmployee', printEmployeesHandler, 'searchTerm=' + searchTerm); 457 var div = $('orgchartEmployees'); 458 div.innerHTML = ''; 459 cExecute('$this.bo_userinterface.searchEmployee', function( data ) 460 { 461 div.innerHTML = '<center><h2>Resultado da Busca</h2>'; 462 var content = printEmployeesHandler( data, 'returnResult' ); 463 if ( content ) 464 div.innerHTML += '</center><span style="color:red">Busca pelo nome: ' + searchTerm.toUpperCase( ) + '</span>' + content; 465 466 if ( data['bygroup'] && data['bygroup'].length ) 467 { 468 employees = [ ]; 469 employees[ 'employees' ] = data['bygroup']; 470 content = printEmployeesHandler( employees, 'returnResult' ); 471 if ( content ) 472 div.innerHTML += '<br/><br/><span style="color:red">Busca pelo setor: ' + searchTerm.toUpperCase( ) + '</span><br/>' + content; 473 } 474 475 }, 'searchTerm=' + searchTerm); 429 476 } 430 477 … … 441 488 { 442 489 var div = $('employeeInfo'); 443 div.style.left = (Event.pointerX(e) + 20) + 'px';490 div.style.left = (Event.pointerX(e) - 50) + 'px'; 444 491 div.style.top = (Event.pointerY(e) + 14) + 'px'; 492 div.hide(); 445 493 446 494 if (workflowUserInterfaceEmployeeInfoTimer != null) … … 472 520 card.style.padding = '5px'; 473 521 card.style.marginRight = '70px'; 522 523 card.onmouseover = function( ) 524 { 525 workflowUserInterfaceEmployeeInfoTimer = clearTimeout(workflowUserInterfaceEmployeeInfoTimer); 526 workflowUserInterfaceEmployeeInfoTimer = null; 527 } 528 529 card.onmouseout = function( ) 530 { 531 workflowUserInterfaceEmployeeInfoTimer = setTimeout( "$('employeeInfo').hide( )", 1000 ); 532 } 474 533 475 534 var photo = document.createElement( 'img' ); … … 496 555 if ( role ) 497 556 card.appendChild( document.createTextNode( ' - ' ) ); 498 card.appendChild( document.createTextNode( card_data[ 'Área' ] ) ); 557 558 var area = document.createElement( 'a' ); 559 area.href = "javascript:void(0)"; 560 area.appendChild( document.createTextNode( card_data[ 'Área' ] ) ); 561 area.onclick = function( ) 562 { 563 loadAreaEmployees( card_data[ 'ÁreaID' ], card_data[ 'Área' ] ); 564 $('employeeInfo').hide( ); 565 }; 566 card.appendChild( area ); 567 } 568 569 if ( card_data[ 'Matrícula' ] ) 570 { 571 if ( role || area ) 572 card.appendChild( document.createElement( 'br' ) ); 573 card.appendChild( document.createTextNode( 'Matrícula : ' + card_data[ 'Matrícula' ] ) ); 499 574 } 500 575 … … 552 627 if ( card_data[ 'Telefone' ] ) 553 628 { 554 var phone = document.createElement( ' span' );629 var phone = document.createElement( 'a' ); 555 630 phone.appendChild( document.createTextNode( card_data[ 'Telefone' ] ) ); 556 631 phone.style.paddingLeft = '20px'; 557 632 phone.style.whiteSpace = 'nowrap'; 558 633 phone.style.background = 'url(templateFile.php?file=images/phone.png) no-repeat 0 0'; 634 635 var phoneNumber = card_data[ 'Telefone' ]; 636 phone.onclick = function( ) 637 { 638 callVoipConnect( phoneNumber ); 639 } 640 559 641 card.appendChild( phone ); 560 642 } … … 565 647 if ( card_data[ 'e-mail' ] ) 566 648 { 567 var mail = document.createElement( ' span' );649 var mail = document.createElement( 'a' ); 568 650 mail.appendChild( document.createTextNode( card_data[ 'e-mail' ] ) ); 651 mail.href = '../expressoMail1_2/index.php?to=' + card_data[ 'e-mail' ]; 569 652 mail.style.paddingLeft = '20px'; 570 653 mail.style.whiteSpace = 'nowrap'; … … 577 660 if ( card_data[ 'sitio' ] ) 578 661 { 579 var sitio = document.createElement( 'span' ); 662 var sitio = document.createElement( 'a' ); 663 sitio.target = '_blank'; 664 sitio.href = card_data[ 'sitio' ]; 580 665 sitio.appendChild( document.createTextNode( card_data[ 'sitio' ] ) ); 581 666 sitio.style.paddingLeft = '20px'; … … 591 676 592 677 if ((parseInt(div.style.top.replace(/px/g, '')) + div.getHeight()) > pageYLimit) 593 div.style.top = (parseInt(div.style.top.replace(/px/g, '')) - (div.getHeight())) + 'px'; 678 div.style.top = (parseInt(div.style.top.replace(/px/g, '')) - (div.getHeight() - 50)) + 'px'; 679 else 680 div.style.top = ( parseInt(div.style.top.replace(/px/g, '')) - 50 ) + 'px'; 681 594 682 div.show(); 595 683 } … … 604 692 workflowUserInterfaceEmployeeInfoTimer = null; 605 693 } 606 $('employeeInfo').hide();694 workflowUserInterfaceEmployeeInfoTimer = setTimeout( "$('employeeInfo').hide()", 1000 ); 607 695 } 608 696 … … 659 747 $('areaInfo').hide(); 660 748 } 749 750 function callVoipConnect( phoneNumber ) 751 { 752 var handler_connectVoip = function(data){ 753 if(!data) { 754 alert("Error contacting VoIP server."); 755 } 756 else{ 757 alert("Requesting a VoIP call"+":\n"+data); 758 } 759 } 760 761 cExecute( '$this.bo_userinterface.callVoipConnect&to='+phoneNumber+"&typePhone=com", handler_connectVoip ); 762 }
Note: See TracChangeset
for help on using the changeset viewer.