Changeset 1446 for trunk/workflow


Ignore:
Timestamp:
09/23/09 17:26:50 (15 years ago)
Author:
viani
Message:

Ticket #637 - Incluido click-to-call no organograma do workflow e melhorias na interface.

Location:
trunk/workflow
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/doc/change_log.txt

    r1395 r1446  
    2121[2.0.000] 
    2222 
     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) 
    2326        * Correção de bug no método getByUser da classe wf_instance. (hermespinheiro) 
    2427        * Melhorias no organograma, com novas visualizações nas interfaces. (rodsouza) 
  • trunk/workflow/inc/class.bo_userinterface.inc.php

    r1277 r1446  
    10591059                return $employees; 
    10601060        } 
     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        } 
    10611112} 
    10621113?> 
  • trunk/workflow/inc/class.so_orgchart.inc.php

    r1353 r1446  
    11591159                        'value' => $areaInfo['sigla']); 
    11601160 
     1161                $outputInfo[] = array( 
     1162                        'name' => 'ÁreaID', 
     1163                        'value' => $employeeInfo['area_id']); 
     1164 
    11611165                $localInfo = $orgchart->getLocal($employeeInfo['localidade_id']); 
    11621166                $outputInfo[] = array( 
  • trunk/workflow/inc/class.so_userinterface.inc.php

    r1310 r1446  
    352352        { 
    353353                /* initialize some variables */ 
    354                 $output = array('employees' => array()); 
     354                $output = array('employees' => array(), 'bygroup' => array( ) ); 
    355355                $ldapResult = array(); 
    356356 
    357357                /* search for the $searchTerm in the LDAP */ 
    358358                $ldap = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     359 
    359360                $list = @ldap_search($ldap, $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getLDAPContext(), ('(&(cn=*' . $searchTerm . '*)(phpgwaccounttype=u))'), array('uidNumber', 'cn', 'telephoneNumber')); 
    360361                if ($list === false) 
     
    367368 
    368369                /* 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 ) ); 
    371374 
    372375                /* 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( ); 
    375390 
    376391                $employees = $result->GetArray(-1); 
     
    379394                        for ($j = 0; $j < $result->_numOfFields; $j++) 
    380395                                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 
    386431                return $output; 
    387432        } 
  • trunk/workflow/js/userinterface/orgchart.js

    r1353 r1446  
    3434 
    3535        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\' ">' 
    3737        content += '<option onclick="getAlphabeticalEmployees( )">Alfabética</option>' 
    3838        content += '<option onclick="getHierarchicalArea( );" selected="true">Áreas</option>' 
     
    4242        content += '<option onclick="getUsefulPhones( );">Telefones Úteis</option>' 
    4343        content += '<option onclick="getCategoriesList( )">Vínculos</option>' 
    44         content += '</select></li>'; 
     44        content += '</select></a></li>'; 
    4545        content += '<li><a href="#" onclick="window.open(\'' + enderecoImagem + '\', \'extwindow\'); return false;"><img src="templateFile.php?file=images/Process.gif">&nbsp;&nbsp;Gráfico</a></li>'; 
    4646        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;">&nbsp;busca</span></a></li>'; 
     
    5151 
    5252        $('orgchartMenu').innerHTML = content; 
     53 
     54        $( 'search_term' ).focus( ); 
    5355} 
    5456 
     
    102104        } 
    103105 
    104         var content = ''; 
     106        var content = '<center><h2>Centros de Custo</h2></center>'; 
    105107        content += '<table class="employeeList">'; 
    106108        content += '<tr><th>Nome</th><th>Número</th><th>Grupo</th></tr>'; 
     
    110112        { 
    111113                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 + '\'">'; 
    113115                content += '<td>' + current['descricao'] + '</td>'; 
    114116                content += '<td>' + current['nm_centro_custo'] + '</td>'; 
     
    132134        } 
    133135 
    134         var content = ''; 
     136        var content = '<center><h2>Telefones Úteis</h2></center>'; 
    135137        content += '<table class="employeeList">'; 
    136138        content += '<tr><th>Localidade</th><th>Número</th></tr>'; 
    137139        var current; 
    138         var usefulPhoneCount = data.length; 
    139         for (var i = 0; i < usefulPhoneCount; i++) 
     140        for (var i = 0; i < data.length; i++) 
    140141        { 
    141142                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 + '\'">'; 
    143144                content += '<td>' + current[ 'descricao' ] + '</td>'; 
    144145                content += '<td>' + current[ 'numero' ] + '</td>'; 
     
    161162        } 
    162163 
    163         var content = ''; 
     164        var content = '<center><h2>Substituição de Chefia</h2></center>'; 
    164165        content += '<table class="employeeList">'; 
    165166        content += '<tr><th>Área</th><th>Titular</th><th>Substituto</th></tr>'; 
    166167        var current; 
    167         var usefulPhoneCount = data.length; 
    168         for (var i = 0; i < usefulPhoneCount; i++) 
     168        for (var i = 0; i < data.length; i++) 
    169169        { 
    170170                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 + '\'">'; 
    172172                content += '<td>' + current['area'] + '</td>'; 
    173173                content += '<td>' + current['titular'] + '</td>'; 
     
    188188                for (var i = 0; i < subdata.length; i++) 
    189189                { 
    190                         div.innerHTML += '<br />' + '&nbsp;&nbsp;&nbsp;&nbsp;'.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 />' + '&nbsp;&nbsp;&nbsp;&nbsp;'.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>'; 
    191191                        if (subdata[i]['children'].length > 0) 
    192192                                recursivePrint(subdata[i]['children']); 
     
    246246                var content = '<center><strong>VÍNCULOS</strong></center>'; 
    247247                for (var i = 0; i < data.length; i++) 
    248                         content += '<br/>' + '&nbsp;&nbsp;<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/>' + '&nbsp;&nbsp;<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>'; 
    249249                content += '<br/><br/>'; 
    250250                $('orgchartAreas').innerHTML = content; 
     
    268268                var content = '<center><strong>Localidades</strong></center>'; 
    269269                for ( var i = 0; i < data.length; i++ ) 
    270                         content += '<br/>' + '&nbsp;<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/>' + '&nbsp;<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>'; 
    271271 
    272272                content += '<br/><br/>'; 
     
    287287 
    288288        /* no employee to list */ 
    289         if (data['employees'].length == 0) 
     289        if ( ( ! data['employees'] || data['employees'].length == 0 ) && ( ! data['bygroup'] || data['bygroup'].length == 0 ) ) 
    290290        { 
    291291                div.innerHTML = '<br/><br/><center><strong>Nenhum registro encontrado</strong></center>'; 
     
    293293        } 
    294294 
    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                } 
    334356                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        } 
    350359} 
    351360 
     
    369378} 
    370379 
    371 function loadAreaEmployees(areaID) 
     380function loadAreaEmployees(areaID, areaName) 
    372381{ 
    373382        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 
     392function 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 
     404function 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); 
    387414} 
    388415 
     
    417444                } 
    418445 
    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 
    422451        }, 'p_page='+p_page); 
    423452} 
     
    426455{ 
    427456        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); 
    429476} 
    430477 
     
    441488{ 
    442489        var div = $('employeeInfo'); 
    443         div.style.left = (Event.pointerX(e) + 20) + 'px'; 
     490        div.style.left = (Event.pointerX(e) - 50) + 'px'; 
    444491        div.style.top = (Event.pointerY(e) + 14) + 'px'; 
     492        div.hide(); 
    445493 
    446494        if (workflowUserInterfaceEmployeeInfoTimer != null) 
     
    472520                card.style.padding = '5px'; 
    473521                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                } 
    474533 
    475534                var photo = document.createElement( 'img' ); 
     
    496555                        if ( role ) 
    497556                                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' ] ) ); 
    499574                } 
    500575 
     
    552627                if ( card_data[ 'Telefone' ] ) 
    553628                { 
    554                         var phone = document.createElement( 'span' ); 
     629                        var phone = document.createElement( 'a' ); 
    555630                        phone.appendChild( document.createTextNode( card_data[ 'Telefone' ] ) ); 
    556631                        phone.style.paddingLeft = '20px'; 
    557632                        phone.style.whiteSpace = 'nowrap'; 
    558633                        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 
    559641                        card.appendChild( phone ); 
    560642                } 
     
    565647                if ( card_data[ 'e-mail' ] ) 
    566648                { 
    567                         var mail = document.createElement( 'span' ); 
     649                        var mail = document.createElement( 'a' ); 
    568650                        mail.appendChild( document.createTextNode( card_data[ 'e-mail' ] ) ); 
     651                        mail.href = '../expressoMail1_2/index.php?to=' + card_data[ 'e-mail' ]; 
    569652                        mail.style.paddingLeft = '20px'; 
    570653                        mail.style.whiteSpace = 'nowrap'; 
     
    577660                if ( card_data[ 'sitio' ] ) 
    578661                { 
    579                         var sitio = document.createElement( 'span' ); 
     662                        var sitio = document.createElement( 'a' ); 
     663                        sitio.target = '_blank'; 
     664                        sitio.href = card_data[ 'sitio' ]; 
    580665                        sitio.appendChild( document.createTextNode( card_data[ 'sitio' ] ) ); 
    581666                        sitio.style.paddingLeft = '20px'; 
     
    591676 
    592677                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 
    594682                div.show(); 
    595683        } 
     
    604692                workflowUserInterfaceEmployeeInfoTimer = null; 
    605693        } 
    606         $('employeeInfo').hide(); 
     694        workflowUserInterfaceEmployeeInfoTimer = setTimeout( "$('employeeInfo').hide()", 1000 ); 
    607695} 
    608696 
     
    659747        $('areaInfo').hide(); 
    660748} 
     749 
     750function 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.