From 62133d7d8d3e49e7474cb109ed56a8b4fead2eff Mon Sep 17 00:00:00 2001 From: anderson.peterle@previdencia.gov.br Date: Tue, 17 Jun 2008 18:36:00 +0000 Subject: [PATCH] Correcoes logicas diversas e adequacoes aos blocos de internacionalizacao --- admin/patrimonio/nivel1/index.php | 4 ++++ admin/redes/incluir_rede.php | 19 ++++++++++--------- admin/sistemas_operacionais/detalhes_sistema_operacional.php | 2 +- admin/sistemas_operacionais/incluir_sistema_operacional.php | 2 +- admin/updates_subredes/index.php | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------ admin/updates_subredes/updates_subredes.php | 44 +++++++++++++++++++++++++++++++++++--------- admin/usuarios/detalhes_usuario.php | 16 ++++++++-------- 7 files changed, 129 insertions(+), 52 deletions(-) diff --git a/admin/patrimonio/nivel1/index.php b/admin/patrimonio/nivel1/index.php index f9e4483..c5efae5 100755 --- a/admin/patrimonio/nivel1/index.php +++ b/admin/patrimonio/nivel1/index.php @@ -76,6 +76,10 @@ $titulo = $oTranslator->_('Cadastro de').' '. $_SESSION['plural_etiqueta1']; _('Modulo para cadastramento de Unidades Organizacionais de Nivel 1');?> + + Importante: A inclusão de é restrita ao nível "Administração". + +
diff --git a/admin/redes/incluir_rede.php b/admin/redes/incluir_rede.php index 3d53785..92dde6e 100755 --- a/admin/redes/incluir_rede.php +++ b/admin/redes/incluir_rede.php @@ -208,7 +208,7 @@ function SetaServidorUpdates() function valida_form(frmForm) { - //VerRedeMascara(frmForm.name,true,false); + VerRedeMascara(frmForm.name,true,false); if ( document.form.frm_nu_limite_ftp.value == "" ) { document.form.frm_nu_limite_ftp.value = "30"; @@ -220,7 +220,7 @@ function valida_form(frmForm) return false; } - + /* var ip = document.form.frm_id_ip_rede.value; var ipSplit = ip.split(/\./); @@ -236,7 +236,7 @@ function valida_form(frmForm) document.form.frm_te_mascara_rede.focus(); return false; } - + */ if ( document.form.frm_nm_rede.value == "" ) { alert("O nome da rede é obrigatório. Por favor, informe-o."); @@ -261,6 +261,12 @@ function valida_form(frmForm) document.form.frm_nu_porta_serv_updates.focus(); return false; } + else if ( document.form.frm_te_path_serv_updates.value == "" ) + { + alert("Digite o Path no Servidor de Updates"); + document.form.frm_te_path_serv_updates.focus(); + return false; + } else if ( document.form.frm_nm_usuario_login_serv_updates.value == "" ) { alert("Digite o Nome do Usuário para Login no Servidor de Updates pelo Módulo Agente"); @@ -285,12 +291,7 @@ function valida_form(frmForm) document.form.frm_te_senha_login_serv_updates_gerente.focus(); return false; } - else if ( document.form.frm_te_path_serv_updates.value == "" ) - { - alert("Digite o Path no Servidor de Updates"); - document.form.frm_te_path_serv_updates.focus(); - return false; - } + return true; } diff --git a/admin/sistemas_operacionais/detalhes_sistema_operacional.php b/admin/sistemas_operacionais/detalhes_sistema_operacional.php index 3be818e..49b57f7 100755 --- a/admin/sistemas_operacionais/detalhes_sistema_operacional.php +++ b/admin/sistemas_operacionais/detalhes_sistema_operacional.php @@ -121,7 +121,7 @@ function valida_form() - + diff --git a/admin/sistemas_operacionais/incluir_sistema_operacional.php b/admin/sistemas_operacionais/incluir_sistema_operacional.php index e7acbbe..406219c 100755 --- a/admin/sistemas_operacionais/incluir_sistema_operacional.php +++ b/admin/sistemas_operacionais/incluir_sistema_operacional.php @@ -133,7 +133,7 @@ MM_reloadPage(true); - + diff --git a/admin/updates_subredes/index.php b/admin/updates_subredes/index.php index acc116c..229659d 100755 --- a/admin/updates_subredes/index.php +++ b/admin/updates_subredes/index.php @@ -64,7 +64,7 @@ if ($_POST['ExecutaUpdates']=='Executar Updates') $v_agentes_versoes = '_-_'.$v; if ($v && substr($i,0,13)=='agentes_hashs') - $v_agentes_hashs = '_-_'.$v; + $v_agentes_hashs = '_-_'.$v; } //echo 'v_updates: '.$v_updates.'

'; @@ -73,11 +73,13 @@ if ($_POST['ExecutaUpdates']=='Executar Updates') // O tratamento de v_force_modulos foi transferido para updates_subredes.php + $v_parametros = urlencode($v_updates.'_-_'.$v_redes.'_-_'.$v_force_modulos.$v_agentes_versoes.$v_agentes_hashs); + // O script updates_subredes.php espera receber o parâmetro v_parametros contendo uma string com a seguinte formação: // objeto1__objeto2__objetoN_-_rede1__rede2__rede3__redeN // Onde: __ = Separador de itens // _-_ = Separador de Matrizes - header ("Location: updates_subredes.php?v_parametros=".$v_updates.'_-_'.$v_redes.'_-_'.$v_force_modulos.$v_agentes_versoes.$v_agentes_hashs); + header ("Location: updates_subredes.php?v_parametros=".$v_parametros); } else { @@ -104,23 +106,25 @@ function verificar() var boolModulos = false; var boolRedes = false; var strFraseErro = ''; - var intInicioModulos = 0; - var intInicioRedes = 0; for (j=0;j
@@ -251,9 +273,7 @@ function verificar() } if (file_exists('../../repositorio/versoes_agentes.ini')) - { $v_array_versoes_agentes = parse_ini_file('../../repositorio/versoes_agentes.ini'); - } sort($v_nomes_arquivos,SORT_STRING); $v_agentes_versoes = ''; // Conterá as versões dos agentes para tratamento em updates_subredes.php @@ -382,18 +402,23 @@ function verificar()
- + + - + - - + + -
 
 
Legenda para as SubRedes
Amarelo
Amarelo
Existência de MÓDULO COM VERSÃO DIFERENTE
Laranja
Laranja
INEXISTÊNCIA PARCIAL de Módulos
Vermelho
Vermelho
INEXISTÊNCIA TOTAL de Módulos
+ +
+

Obs.: Clique nas Cores da Legenda para Marcar/Desmarcar Subredes em Bloco

+

 

+
@@ -438,7 +463,8 @@ function verificar() // ******************** $queryALERTA = " SELECT re.id_ip_rede, rvm.nm_modulo, - rvm.te_versao_modulo + rvm.te_versao_modulo, + rvm.cs_tipo_so FROM redes re, redes_versoes_modulos rvm, locais loc @@ -454,20 +480,35 @@ function verificar() $intFrequenciaRede = 0; // Acumulará a frequência de cada rede e deverá ser igual ao tamanho de versoes_agentes! $strRedeAtual = ''; + $intTotalAgentes = 0; // Contarei no arquivo versoes_agentes.ini os nomes com a string "_HASH" + + $lines = file ('../../repositorio/versoes_agentes.ini'); + + // Percorre o array, mostrando o fonte HTML com numeração de linhas. + foreach ($lines as $line_num => $line) + { + $boolHASH = stripos2($line,'_HASH',false); + $intTotalAgentes += ($boolHASH?1:0); + } + while ($rowALERTA = mysql_fetch_array($resultALERTA)) { - if ($rowALERTA['nm_modulo'] <> 'chkcacic.exe' && - $rowALERTA['nm_modulo'] <> 'chkcacic.ini' && - $rowALERTA['nm_modulo'] <> 'versoes_agentes.ini' && - $rowALERTA['nm_modulo'] <> 'vaca.exe' && - $rowALERTA['nm_modulo'] <> 'install' && - $rowALERTA['nm_modulo'] <> '' && - isset($v_array_versoes_agentes) && $versao_agente = $v_array_versoes_agentes[$rowALERTA['nm_modulo']]) + $boolAgenteLinux = stripos2($rowALERTA['nm_modulo'],'PyCACIC',false); + $str_nm_modulo = ($boolAgenteLinux?'PyCACIC':$rowALERTA['nm_modulo']); + + if ($str_nm_modulo <> 'chkcacic.exe' && + $str_nm_modulo <> 'chkcacic.ini' && + $str_nm_modulo <> 'versoes_agentes.ini' && + $str_nm_modulo <> 'vaca.exe' && + $str_nm_modulo <> 'install' && + $str_nm_modulo <> 'agentes_linux' && + $str_nm_modulo <> '' && + isset($v_array_versoes_agentes) && $versao_agente = $v_array_versoes_agentes[$str_nm_modulo]) { if ($strRedeAtual <> '' && $strRedeAtual <> $rowALERTA['id_ip_rede']) { - if ($intFrequenciaRede <> count($v_array_versoes_agentes)) + if ($intFrequenciaRede <> $intTotalAgentes) $strTripaLaranja .= $strRedeAtual . '#'; $intFrequenciaRede = 1; @@ -477,9 +518,14 @@ function verificar() $strRedeAtual = $rowALERTA['id_ip_rede']; - $versao_agente = str_replace('.','',$versao_agente) . '0103'; + if ($rowALERTA['cs_tipo_so'] <> 'GNU/LINUX') + $versao_agente = str_replace('.','',$versao_agente) . '0103'; + else + $versao_agente = str_replace('.','',$versao_agente); + if ($versao_agente <> $rowALERTA['te_versao_modulo']) { + $strPesquisaRede = '#'.$strRedeAtual.'#'; $intPos = stripos2($strTripaAmarelo,$strPesquisaRede); if ($intPos === false) @@ -540,7 +586,7 @@ function verificar() ?> - > + > diff --git a/admin/updates_subredes/updates_subredes.php b/admin/updates_subredes/updates_subredes.php index 45be149..18ad23d 100755 --- a/admin/updates_subredes/updates_subredes.php +++ b/admin/updates_subredes/updates_subredes.php @@ -73,13 +73,21 @@ AntiSpy('1,2,3'); // Permitido somente a estes cs_nivel_administracao... '; - echo 'v_array_parametros[1] = '.$v_array_parametros[1].'
'; + $v_tripa_agentes_hashs = ''; + for ($i=0;$i'; + //for ($i = 0;$i < count($v_array_parametros);$i++) + // echo 'v_array_parametros['.$i.'] = '.$v_array_parametros[$i].'
'; if (count($v_array_redes)>0) { @@ -98,7 +106,7 @@ AntiSpy('1,2,3'); // Permitido somente a estes cs_nivel_administracao... FROM redes re, locais lo WHERE re.id_local = lo.id_local AND (" . $v_where . ") - ORDER BY re.nm_rede"; + ORDER BY re.nm_rede"; conecta_bd_cacic(); $result_REDES = mysql_query($query_REDES); $_SESSION['v_tripa_objetos_enviados'] = ''; // Conterá a lista de agentes e versões enviadas aos servidores. @@ -145,14 +153,32 @@ AntiSpy('1,2,3'); // Permitido somente a estes cs_nivel_administracao... $strTeServUpdatesToCheck = '#'.trim($row['te_serv_updates']).'#'; if (@substr_count($_SESSION['v_tripa_servidores_updates'],$strTeServUpdatesToCheck)>0) { - $insert = "INSERT INTO redes_versoes_modulos (id_local,id_ip_rede,nm_modulo,te_versao_modulo,dt_atualizacao) "; - $values = ""; $v_arr_agentes_versoes_enviados = explode('#',$_SESSION['v_tripa_objetos_enviados']); for ($intAgentesVersoesEnviados = 0;$intAgentesVersoesEnviados < count($v_arr_agentes_versoes_enviados);$intAgentesVersoesEnviados++) { + // Procuro por pacotes Linux previamente gravados na tabela de versões + $cs_tipo_so = (stripos2($v_arr_aux[0],'.exe',false)?'MS-Windows':'GNU/LINUX'); + $cs_tipo_so = (stripos2($v_arr_aux[0],'.ini',false)?'MS-Windows':$cs_tipo_so); + + if ($cs_tipo_so == 'GNU/LINUX') + $intAgentesVersoesEnviados < count($v_arr_agentes_versoes_enviados); + } + + if ($cs_tipo_so == 'GNU/LINUX') + { + // Excluo o pacote Linux previamente gravado na tabela + $delete = 'DELETE from redes_versoes_modulos WHERE id_local = '.$row['id_local'].' AND id_ip_rede = "'.trim($row['id_ip_rede']).'" AND cs_tipo_so="GNU/LINUX"'; + $result_DELETE = mysql_query($delete); + } + + $insert = "INSERT INTO redes_versoes_modulos (id_local,id_ip_rede,nm_modulo,te_versao_modulo,dt_atualizacao,cs_tipo_so,te_hash) "; + $values = ""; + for ($intAgentesVersoesEnviados = 0;$intAgentesVersoesEnviados < count($v_arr_agentes_versoes_enviados);$intAgentesVersoesEnviados++) + { + $cs_tipo_so = (stripos2('.exe',$v_arr_aux[0],false)?'MS-Windows':'GNU/LINUX'); $v_arr_aux = explode(',',$v_arr_agentes_versoes_enviados[$intAgentesVersoesEnviados]); $values .= ($values?",":"VALUES "); - $values .= '('.$row['id_local'].',"'.trim($row['id_ip_rede']).'","'.$v_arr_aux[0].'","'.$v_arr_aux[1].'",now())'; + $values .= '('.$row['id_local'].',"'.trim($row['id_ip_rede']).'","'.$v_arr_aux[0].'","'.$v_arr_aux[1].'",now(),"'.$cs_tipo_so.'","'.$v_array_agentes_hashs[$v_arr_aux[0]].'")'; } $result_INSERT = mysql_query($insert . $values); @@ -161,7 +187,7 @@ AntiSpy('1,2,3'); // Permitido somente a estes cs_nivel_administracao... } else { - update_subredes($row['id_ip_rede'],'Pagina','__'.$v_array_parametros[0],$row['id_local']); + update_subredes($row['id_ip_rede'],'Pagina','__'.$v_array_parametros[0],$row['id_local'],$v_array_agentes_hashs); flush(); if ($_SESSION['v_efetua_conexao_ftp'] == 1) { diff --git a/admin/usuarios/detalhes_usuario.php b/admin/usuarios/detalhes_usuario.php index 7f9a2d6..a4cf0f9 100755 --- a/admin/usuarios/detalhes_usuario.php +++ b/admin/usuarios/detalhes_usuario.php @@ -47,14 +47,14 @@ elseif ($_POST['GravaAlteracoes']) } $query = "UPDATE usuarios - SET nm_usuario_acesso = '$frm_nm_usuario_acesso', - nm_usuario_completo = '$frm_nm_usuario_completo', - id_grupo_usuarios = '$frm_id_grupo_usuarios', - id_local = $frm_id_local, - te_emails_contato = '$frm_te_emails_contato', - te_telefones_contato = '$frm_te_telefones_contato', - te_locais_secundarios = '$v_te_locais_secundarios' - WHERE id_usuario = ". $_POST['frm_id_usuario']; + SET nm_usuario_acesso = '".$_POST['frm_nm_usuario_acesso'] ."', + nm_usuario_completo = '".$_POST['frm_nm_usuario_completo'] ."', + id_grupo_usuarios = '".$_POST['frm_id_grupo_usuarios'] ."', + id_local = ".$_POST['frm_id_local'] .", + te_emails_contato = '".$_POST['frm_te_emails_contato'] ."', + te_telefones_contato = '".$_POST['frm_te_telefones_contato'] ."', + te_locais_secundarios = '".$v_te_locais_secundarios ."' + WHERE id_usuario = ". $_POST['frm_id_usuario']; mysql_query($query) or die($oTranslator->_('Ocorreu um erro durante a atualizacao da tabela %1 ou sua sessao expirou', array('usuarios'))); -- libgit2 0.21.2