Commit 3b5eb16d3fbbdabc5fb7b05b93a70fa4bb6d1d29

Authored by anderson.peterle@previdencia.gov.br
1 parent a76bf9d8
Exists in master and in 1 other branch 3.1

Implementacao do conceito =locais secundarios= para que o usuario possa acessar …

…informacoes relativas a outros locais. Para estes casos, as estatisticas da pagina principal exibirao um link para uma janela pop-up que contera o detalhamento das quantidades.

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/gerente@109 fecfc0c7-e812-0410-ae72-849f08638ee7
admin/acoes.php
... ... @@ -134,6 +134,14 @@ function remove(box) {
134 134 FROM acoes_redes
135 135 WHERE id_acao = '".$_GET['id_acao']."' AND
136 136 id_local = ".$_SESSION['id_local'];
  137 +
  138 + if ($_SESSION['te_locais_secundarios'])
  139 + {
  140 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  141 + $query = str_replace('id_local = ','(id_local = ',$query);
  142 + $query .= ' OR id_local IN ('.$_SESSION['te_locais_secundarios'].'))';
  143 + }
  144 +
137 145 $result_acoes = mysql_query($query) or die('Ocorreu um erro durante a consulta à tabela de ações.');
138 146 $campos_acoes = mysql_fetch_array($result_acoes);
139 147 ?>
... ... @@ -192,6 +200,14 @@ function remove(box) {
192 200 <td class="opcao"> <div align="left">
193 201 <?
194 202 $where = ($_SESSION['cs_nivel_administracao']<>1?' AND acoes_redes.id_local = '.$_SESSION['id_local']:'');
  203 +
  204 + if ($_SESSION['te_locais_secundarios'])
  205 + {
  206 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  207 + $where = str_replace('AND acoes_redes.id_local = ','AND (acoes_redes.id_local = ',$where);
  208 + $where .= ' OR acoes_redes.id_local IN ('.$_SESSION['te_locais_secundarios'].'))';
  209 + }
  210 +
195 211 /* Consulto todas as redes que foram previamente selecionadas para a a ação em questão. */
196 212 $query = "SELECT acoes_redes.id_ip_rede,
197 213 nm_rede
... ... @@ -242,7 +258,7 @@ function remove(box) {
242 258 </tr>
243 259 <tr>
244 260 <td colspan="7" class="ajuda"><div align="center">&nbsp;&nbsp;(Dica:
245   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</div></td>
  261 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</div></td>
246 262 </tr>
247 263 </table>
248 264 <table width="100%" border="0" cellpadding="0" cellspacing="1">
... ... @@ -320,7 +336,7 @@ function remove(box) {
320 336 <table width="100%" border="0" cellpadding="0" cellspacing="1">
321 337 <tr>
322 338 <td class="ajuda">&nbsp;&nbsp;&nbsp;(Dica:
323   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  339 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
324 340 </tr>
325 341 <tr>
326 342 <td>&nbsp;</td>
... ...
admin/config_gerais.php
... ... @@ -162,7 +162,7 @@ function SetaServidorUpdates()
162 162 </table></td>
163 163 </tr>
164 164 <tr>
165   - <td height="1" class="ajuda">&nbsp;&nbsp;&nbsp;(Dica: use SHIFT or
  165 + <td height="1" class="ajuda">&nbsp;&nbsp;&nbsp;(Dica: use SHIFT ou
166 166 CTRL para selecionar m&uacute;ltiplos itens)</td>
167 167 </tr>
168 168 </table></td>
... ...
admin/exclui_informacoes_computadores.php
... ... @@ -44,7 +44,14 @@ if ($_POST[&#39;submit_cond&#39;])
44 44 $query_sele_exclui = str_replace('-MAIOR-',' > ',$query_sele_exclui);
45 45  
46 46 $from = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' ,redes c':'');
47   - $where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND a.id_ip_rede = c.id_ip_rede AND c.id_local='.$_SESSION['id_local']:'');
  47 + $where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND a.id_ip_rede = c.id_ip_rede AND c.id_local = '.$_SESSION['id_local']:'');
  48 + if ($_SESSION['te_locais_secundarios'] && $where)
  49 + {
  50 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  51 + $where = str_replace('c.id_local = ','(c.id_local = ',$where);
  52 + $where .= ' OR c.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  53 + }
  54 +
48 55 $Query_Pesquisa = 'SELECT a.id_so,
49 56 a.te_node_address,
50 57 a.te_nome_computador,
... ...
admin/modulos.php
... ... @@ -26,6 +26,13 @@ $query = &quot;SELECT acoes.id_acao,
26 26 FROM acoes LEFT JOIN acoes_redes ON (acoes.id_acao = acoes_redes.id_acao AND acoes_redes.id_local = ".$_SESSION['id_local'].")
27 27 GROUP BY acoes.id_acao
28 28 ORDER BY acoes.id_acao";
  29 +if ($_SESSION['te_locais_secundarios'])
  30 + {
  31 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  32 + $query = str_replace('acoes_redes.id_local = ','(acoes_redes.id_local = ',$query);
  33 + $query = str_replace(')',' OR acoes_redes.id_local IN ('.$_SESSION['te_locais_secundarios'].')))',$query);
  34 + }
  35 +
29 36 $result = mysql_query($query) or die('Erro no select');
30 37 ?>
31 38 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
... ...
admin/patrimonio/nivel2/detalhes_nivel2.php
... ... @@ -21,7 +21,14 @@ Conecta_bd_cacic();
21 21  
22 22 if ($_POST['exclui_uon2'])
23 23 {
24   - $where = ($_SESSION['cs_nivel_administracao']<>1?' AND id_local='.$_SESSION['id_local']:'');
  24 + $where = ($_SESSION['cs_nivel_administracao']<>1?' AND id_local = '.$_SESSION['id_local']:'');
  25 + if ($_SESSION['te_locais_secundarios'] && $where)
  26 + {
  27 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  28 + $where = str_replace(' id_local = ',' (id_local = ',$where);
  29 + $where .= ' OR id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  30 + }
  31 +
25 32 $query = " DELETE
26 33 FROM unid_organizacional_nivel2
27 34 WHERE id_unid_organizacional_nivel2 = ".$_POST['frm_id_unid_organizacional_nivel2']." and
... ... @@ -158,12 +165,20 @@ function valida_form()
158 165 <td class="label">Local:</td>
159 166 <td><select name="frm_id_local" id="frm_id_local"" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" >
160 167 <?
161   - $where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' WHERE id_local='.$_SESSION['id_local']:'');
  168 + $where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' WHERE id_local = '.$_SESSION['id_local']:'');
  169 + if ($_SESSION['te_locais_secundarios'] && $where)
  170 + {
  171 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  172 + $where = str_replace(' id_local = ',' (id_local = ',$where);
  173 + $where .= ' OR id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  174 + }
  175 +
162 176 $qry_locais = "SELECT id_local,
163 177 sg_local
164 178 FROM locais ".
165 179 $where ."
166 180 ORDER BY sg_local";
  181 +
167 182 $result_locais = mysql_query($qry_locais) or die ('Select falhou');
168 183 while ($row_qry=mysql_fetch_array($result_locais))
169 184 {
... ...
admin/patrimonio/nivel2/incluir_nivel2.php
... ... @@ -120,7 +120,14 @@ $result_sel1 = mysql_query($querySEL1);
120 120 </table>
121 121 <?
122 122 Conecta_bd_cacic();
123   -$where = ($_SESSION['cs_nivel_administracao']<>1?' WHERE id_local = '.$_SESSION['id_local']:'');
  123 +$where = ($_SESSION['cs_nivel_administracao']<>1?' WHERE id_local = '.$_SESSION['id_local']:'');
  124 +if ($_SESSION['te_locais_secundarios'] && $where)
  125 + {
  126 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  127 + $where = str_replace(' id_local = ',' (id_local = ',$where);
  128 + $where .= ' OR id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  129 + }
  130 +
124 131 $qry_locais = "SELECT id_local,
125 132 sg_local
126 133 FROM locais ".
... ...
admin/patrimonio/nivel2/index.php
... ... @@ -54,6 +54,14 @@ if ($id_unid_organizacional_nivel1)
54 54 }
55 55  
56 56 $where .= ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND uo2.id_local = '.$_SESSION['id_local']:'');
  57 +
  58 +if ($_SESSION['te_locais_secundarios'] && $where)
  59 + {
  60 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  61 + $where = str_replace('uo2.id_local = ','(uo2.id_local = ',$where);
  62 + $where .= ' OR uo2.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  63 + }
  64 +
57 65 $query = 'SELECT uo1.id_unid_organizacional_nivel1 as uo1_id_unid_organizacional_nivel1,
58 66 uo1.nm_unid_organizacional_nivel1 as uo1_nm_unid_organizacional_nivel1,
59 67 uo2.id_unid_organizacional_nivel2 as uo2_id_unid_organizacional_nivel2,
... ...
admin/perfis_aplicativos_monitorados/incluir_perfil.php
... ... @@ -70,7 +70,7 @@ if($submit)
70 70 te_descritivo,
71 71 dt_atualizacao,
72 72 in_disponibiliza_info,
73   - in_disponibiliza_info_usuario_comum
  73 + in_disponibiliza_info_usuario_comum)
74 74 VALUES ('$frm_nm_aplicativo',
75 75 '$frm_te_dir_padrao_w9x',
76 76 '$frm_cs_car_inst_w9x',
... ... @@ -92,7 +92,8 @@ if($submit)
92 92 '$frm_te_descritivo',
93 93 now(),
94 94 '$frm_in_disponibiliza_info',
95   - '$frm_in_disponibiliza_info_usuario_comum')";
  95 + '$frm_in_disponibiliza_info_usuario_comum')";
  96 +
96 97 $result = mysql_query($query) or die ('Insert falhou');
97 98 GravaLog('INS',$_SERVER['SCRIPT_NAME'],'perfis_aplicativos_monitorados');
98 99 header ("Location: ../../include/operacao_ok.php?chamador=../admin/perfis_aplicativos_monitorados/index.php&tempo=1");
... ...
admin/redes/detalhes_rede.php
... ... @@ -281,7 +281,7 @@ $pos = substr_count($_SERVER[&#39;HTTP_REFERER&#39;],&#39;navegacao&#39;);
281 281 <td>&nbsp;</td>
282 282 <td> <select name="frm_id_local" id="frm_id_local" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);"
283 283 <?
284   - echo ($_SESSION['cs_nivel_administracao']>1?'disabled':'');
  284 + echo ($_SESSION['cs_nivel_administracao']<>1 && $_SESSION['cs_nivel_administracao']<>3?'disabled':'');
285 285 ?>
286 286 >
287 287 <?
... ... @@ -289,6 +289,13 @@ $pos = substr_count($_SERVER[&#39;HTTP_REFERER&#39;],&#39;navegacao&#39;);
289 289 sg_local
290 290 FROM locais
291 291 ORDER BY sg_local";
  292 +
  293 + if ($_SESSION['te_locais_secundarios'])
  294 + {
  295 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  296 + $qry_locais = str_replace('locais','locais WHERE (locais.id_local = '.$_SESSION["id_local"].' OR locais.id_local in('.$_SESSION['te_locais_secundarios'].')) ',$qry_locais);
  297 + }
  298 +
292 299 $result_locais = mysql_query($qry_locais) or die ('Select falhou');
293 300 if (mysql_result($result, 0, 'nm_local')=='')
294 301 echo "<option value='-1' selected>Selecione Local</option>";
... ...
admin/redes/incluir_rede.php
... ... @@ -26,6 +26,7 @@ if($_REQUEST[&#39;submit&#39;])
26 26 FROM redes
27 27 WHERE id_ip_rede = '$frm_id_ip_rede' AND
28 28 id_local = ".$_POST['frm_id_local'];
  29 +
29 30 $result = mysql_query($query) or die ('Select falhou');
30 31  
31 32 if (mysql_num_rows($result) > 0)
... ... @@ -309,6 +310,13 @@ MM_reloadPage(true);
309 310 <td> <select name="frm_id_local" id="frm_id_local" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);">
310 311 <?
311 312 $where = ($_SESSION['cs_nivel_administracao']<>1?' WHERE id_local = '.$_SESSION['id_local']:'');
  313 + if ($_SESSION['te_locais_secundarios'] && $where)
  314 + {
  315 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  316 + $where = str_replace(' id_local = ','(id_local = ',$where);
  317 + $where .= ' OR id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  318 + }
  319 +
312 320 Conecta_bd_cacic();
313 321 $qry_locais = "SELECT id_local,
314 322 sg_local
... ...
admin/redes/index.php
... ... @@ -25,6 +25,13 @@ $where = ($_SESSION[&#39;cs_nivel_administracao&#39;]==1||$_SESSION[&#39;cs_nivel_administra
25 25 ' LEFT JOIN locais ON (locais.id_local = redes.id_local)':
26 26 ', locais WHERE redes.id_local = locais.id_local AND redes.id_local='.$_SESSION['id_local']);
27 27  
  28 +if ($_SESSION['te_locais_secundarios'] && $where)
  29 + {
  30 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  31 + $where = str_replace('redes.id_local=','(redes.id_local=',$where);
  32 + $where .= ' OR redes.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  33 + }
  34 +
28 35 $query = 'SELECT *
29 36 FROM redes '.
30 37 $where .'
... ...
admin/softwares/remover_softwares_nao_instalados.php
... ... @@ -77,7 +77,7 @@
77 77 </tr>
78 78 <tr>
79 79 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
80   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  80 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
81 81 </tr>
82 82 </table></td>
83 83 </tr>
... ...
admin/updates_subredes/index.php
... ... @@ -52,8 +52,16 @@ if ($_REQUEST[&#39;ExecutaUpdates&#39;]==&#39;Executar Updates&#39;)
52 52 {
53 53 $query_del = 'DELETE
54 54 FROM redes_versoes_modulos
55   - WHERE id_local = '.$_SESSION['id_local'].' AND
56   - id_ip_rede in (' . $v_force_redes . ') and nm_modulo in ('.$v_force_modulos.')';
  55 + WHERE id_local = '.$_SESSION['id_local'];
  56 + if ($_SESSION['te_locais_secundarios'] && $where)
  57 + {
  58 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  59 + $query_del = str_replace(' id_local = ',' (id_local = ',$query_del);
  60 + $query_del .= ' OR id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  61 + }
  62 +
  63 + $query_del .= ' AND id_ip_rede in (' . $v_force_redes . ') and nm_modulo in ('.$v_force_modulos.')';
  64 +
57 65 conecta_bd_cacic();
58 66 $result_del = mysql_query($query_del);
59 67 GravaLog('DEL',$_SERVER['SCRIPT_NAME'],'redes_versoes_modulos');
... ... @@ -219,6 +227,13 @@ else
219 227  
220 228 <?
221 229 $where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND loc.id_local = '.$_SESSION['id_local']:'');
  230 + if ($_SESSION['te_locais_secundarios'] && $where)
  231 + {
  232 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  233 + $where = str_replace(' loc.id_local = ',' (loc.id_local = ',$where);
  234 + $where .= ' OR loc.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  235 + }
  236 +
222 237 $query = " SELECT re.id_ip_rede,
223 238 re.nm_rede,
224 239 loc.id_local,
... ...
admin/usuarios/detalhes_usuario.php
... ... @@ -36,7 +36,8 @@ elseif ($GravaAlteracoes)
36 36 id_grupo_usuarios = '$frm_id_grupo_usuarios',
37 37 id_local = $frm_id_local,
38 38 te_emails_contato = '$frm_te_emails_contato',
39   - te_telefones_contato = '$frm_te_telefones_contato'
  39 + te_telefones_contato = '$frm_te_telefones_contato',
  40 + te_locais_secundarios = '$frm_te_locais_secundarios'
40 41 WHERE id_usuario = ". $_POST['frm_id_usuario'];
41 42  
42 43 mysql_query($query) or die('Falha na atualização da tabela Usuários...');
... ... @@ -63,10 +64,11 @@ else {
63 64 a.id_local,
64 65 a.te_emails_contato,
65 66 a.te_telefones_contato,
66   - loc.sg_local
  67 + loc.sg_local,
  68 + loc.nm_local
67 69 FROM usuarios a,
68 70 locais loc
69   - WHERE a.id_usuario = '".$_GET['id_usuario']."' and
  71 + WHERE a.id_usuario = ".$_GET['id_usuario']." and
70 72 a.id_local = loc.id_local";
71 73  
72 74 $result = mysql_query($query) or die ('select falhou');
... ... @@ -98,10 +100,90 @@ function valida_form() {
98 100 document.form.frm_nm_usuario_completo.focus();
99 101 return false;
100 102 }
  103 + if (document.form.frm_sel_id_locais_secundarios.value != "" )
  104 + {
  105 + var intLoop;
  106 + var strIdLocaisSecundarios;
  107 +
  108 + strIdLocaisSecundarios = "";
  109 +
  110 + for (intLoop = 0; intLoop < document.form.frm_sel_id_locais_secundarios.options.length; intLoop++)
  111 + {
  112 + if (document.form.frm_sel_id_locais_secundarios.options[intLoop].selected)
  113 + {
  114 + if (strIdLocaisSecundarios != "")
  115 + strIdLocaisSecundarios += ",";
  116 +
  117 + strIdLocaisSecundarios += document.form.frm_sel_id_locais_secundarios.options[intLoop].value;
  118 + }
  119 + }
  120 + document.form.frm_te_locais_secundarios.value = strIdLocaisSecundarios;
  121 + }
101 122  
102 123 return true;
103 124  
104 125 }
  126 +team = new Array(
  127 +<?
  128 +$sql='select * from locais ';
  129 +$where = '';
  130 +if ($_SESSION['te_locais_secundarios'])
  131 + {
  132 + $where = ' where id_local = '.$_SESSION['id_local'].' OR id_local in ('.$_SESSION['te_locais_secundarios'].') ';
  133 + }
  134 +$sql .= $where . ' order by nm_local';
  135 +conecta_bd_cacic();
  136 +$sql_result=mysql_query($sql);
  137 +$num=mysql_numrows($sql_result);
  138 +$contador = 0;
  139 +while ($row=mysql_fetch_array($sql_result))
  140 + {
  141 + $contador ++;
  142 + if ($contador > 1)
  143 + echo ",\n";
  144 +
  145 + $v_id_local=$row["id_local"];
  146 + $v_sg_local=$row["sg_local"] . ' / '.$row["nm_local"];
  147 + echo "new Array(\"$v_id_local\", \"$v_sg_local\")";
  148 + }
  149 +echo ");\n";
  150 +?>
  151 +
  152 +function fillSelectFromArray(selectCtrl, itemArray, itemAtual)
  153 + {
  154 + var i, j;
  155 + selectCtrl.disabled = true;
  156 + // empty existing items
  157 + for (i = selectCtrl.options.length; i >= 0; i--)
  158 + {
  159 + selectCtrl.options[i] = null;
  160 + }
  161 +
  162 + if (itemArray != null && itemAtual != 0)
  163 + {
  164 + selectCtrl.size = 5;
  165 + selectCtrl.disabled = false;
  166 + j = 1;
  167 + // add new items
  168 + selectCtrl.options[0] = new Option(""," ");
  169 +
  170 + for (i = 0; i < itemArray.length; i++)
  171 + {
  172 + if (itemArray[i][0] != itemAtual)
  173 + {
  174 + selectCtrl.options[j] = new Option(itemArray[i][0]);
  175 + if (itemArray[i][0] != null)
  176 + {
  177 + selectCtrl.options[j].value = itemArray[i][0];
  178 + selectCtrl.options[j].text = itemArray[i][1];
  179 + }
  180 + j++;
  181 + }
  182 + }
  183 + // select first item (prompt) for sub list
  184 + selectCtrl.options[0].selected = true;
  185 + }
  186 + }
105 187 </script>
106 188 </head>
107 189  
... ... @@ -127,15 +209,23 @@ function valida_form() {
127 209 <table border="0" cellpadding="2" cellspacing="2">
128 210 <tr>
129 211 <td class="label">Local:</td>
130   - <td><select name="frm_id_local" id="frm_id_local"" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);"
  212 + <td>
  213 + <select name="frm_id_local" id="frm_id_local"" class="normal" onChange="fillSelectFromArray(this.form.frm_sel_id_locais_secundarios, team,this.form.frm_id_local.value);" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);"
131 214 <?
132   - echo ($_SESSION['cs_nivel_administracao']>1?'disabled':'');
133   - ?>
134   - >
  215 + echo ($_SESSION['cs_nivel_administracao']>1 && !($_SESSION['cs_nivel_administracao']==3 && $_SESSION['te_locais_secundarios'])?'disabled':''); ?>>
135 216 <?
136   - $qry_locais = "SELECT id_local,
137   - sg_local
138   - FROM locais
  217 + $where = '';
  218 + if ($_SESSION['te_locais_secundarios'] && $_SESSION['cs_nivel_administracao']==3)
  219 + {
  220 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  221 + $where = 'WHERE id_local = '.$_SESSION['id_local'].' OR id_local IN ('.$_SESSION['te_locais_secundarios'].') ';
  222 + }
  223 +
  224 + $qry_locais = "SELECT id_local,
  225 + sg_local,
  226 + nm_local
  227 + FROM locais ".
  228 + $where . "
139 229 ORDER BY sg_local";
140 230 $result_locais = mysql_query($qry_locais) or die ('Select falhou');
141 231 while ($row_qry=mysql_fetch_array($result_locais))
... ... @@ -146,22 +236,51 @@ function valida_form() {
146 236 $v_sg_local = $row_qry[1];
147 237 echo 'selected';
148 238 }
149   - ?> id='
150   - <?
151   - echo $row_qry[1];?>'>
152   - <? echo $row_qry[1];?>
153   - <?
154   - }
155   -
156   - ?>
157   - </select>
158   - <?
  239 + echo ' id='.$row_qry[0].'>'. $row_qry[1].' ('.$row_qry[2].')';
  240 + }
  241 + ?>
  242 + </select>
  243 + <?
159 244 // Se não for nível Administrador então fixa o id_local...
160   - if ($_SESSION['cs_nivel_administracao']<>1)
  245 + if ($_SESSION['cs_nivel_administracao']<>1 && !($_SESSION['cs_nivel_administracao']==3 && $_SESSION['te_locais_secundarios']))
161 246 echo '<input name="frm_id_local" type="hidden" id="frm_id_local" value="'.$_SESSION['id_local'].'">';
162   - ?>
163   -
164   - </td>
  247 +
  248 + $qry_locais_secundarios = "SELECT a.te_locais_secundarios
  249 + FROM usuarios a
  250 + WHERE a.id_usuario = ".$_GET['id_usuario'];
  251 + $result_locais_secundarios = mysql_query($qry_locais_secundarios) or die ('Select falhou');
  252 + $row_locais_secundarios = mysql_fetch_array($result_locais_secundarios);
  253 + $arr_locais_secundarios = explode(',',$row_locais_secundarios['te_locais_secundarios']);
  254 +
  255 + mysql_data_seek($result_locais,0);
  256 + ?>
  257 + </td>
  258 + </tr>
  259 + <tr>
  260 + <td class="label">Locais Secund&aacute;rios:</td>
  261 + <td><select name="frm_sel_id_locais_secundarios" id="frm_sel_id_locais_secundarios" size="5" multiple class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" <? echo ($_SESSION['cs_nivel_administracao']<>1 && !($_SESSION['cs_nivel_administracao']==3 && $_SESSION['te_locais_secundarios'])?"disabled":"");?>>
  262 + <option value="0"></option>
  263 + <?
  264 + while ($row_locais_secundarios = mysql_fetch_array($result_locais))
  265 + {
  266 + if ($row_locais_secundarios['id_local'] <> $row_usuario['id_local'])
  267 + {
  268 + echo '<option value="'.$row_locais_secundarios['id_local'].'" ';
  269 + if (in_array($row_locais_secundarios['id_local'], $arr_locais_secundarios))
  270 + {
  271 + echo 'selected ';
  272 + }
  273 + echo ' id=' . $row_locais_secundarios['id_local'].'>'. $row_locais_secundarios['sg_local'].' / '.$row_locais_secundarios['nm_local'].'</option>';
  274 + }
  275 + }
  276 + ?>
  277 + </select> <input name="frm_te_locais_secundarios" type="hidden" id="frm_te_locais_secundarios">
  278 + <br> <font color="#000080" size="1">(Dica: use SHIFT ou CTRL para
  279 + selecionar m&uacute;ltiplos itens)</font></td>
  280 + </tr>
  281 + <tr>
  282 + <td class="label">&nbsp;</td>
  283 + <td>&nbsp;</td>
165 284 </tr>
166 285 <tr>
167 286 <td class="label">Identifica&ccedil;&atilde;o:</td>
... ... @@ -173,11 +292,11 @@ function valida_form() {
173 292 <input name="frm_id_usuario" type="hidden" id="frm_id_usuario" value="<? echo $_GET['id_usuario']; ?>">
174 293 <input name="id_local" type="hidden" id="id_usuario" value="<? echo $_GET['id_local']; ?>"></td>
175 294 </tr>
176   - <tr nowrap>
  295 + <tr nowrap>
177 296 <td nowrap class="label">Emails para Contato:</td>
178 297 <td nowrap><input name="frm_te_emails_contato" type="text" id="frm_te_emails_contato" value="<? echo mysql_result($result, 0, 'te_emails_contato'); ?>" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
179 298 </tr>
180   - <tr nowrap>
  299 + <tr nowrap>
181 300 <td nowrap class="label">Telefones para Contato:</td>
182 301 <td nowrap><input name="frm_te_telefones_contato" type="text" id="frm_te_telefones_contato" value="<? echo mysql_result($result, 0, 'te_telefones_contato'); ?>" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
183 302 </tr>
... ...
admin/usuarios/incluir_usuario.php
... ... @@ -15,21 +15,24 @@
15 15 */
16 16 session_start();
17 17 include_once "../../include/library.php";
  18 +
18 19 // Comentado temporariamente - AntiSpy();
19 20 Conecta_bd_cacic();
20 21  
21   -if($submit) {
22   -
  22 +if($submit)
  23 + {
23 24 $frm_nm_usuario_acesso = $_POST['frm_nm_usuario_acesso'];
24 25 $query = "SELECT *
25 26 FROM usuarios
26 27 WHERE nm_usuario_acesso = '$frm_nm_usuario_acesso'";
27 28 $result = mysql_query($query) or die ('Falha na consulta à tabela Usuários');
28 29  
29   - if (mysql_num_rows($result) > 0) {
  30 + if (mysql_num_rows($result) > 0)
  31 + {
30 32 header ("Location: ../../include/registro_ja_existente.php?chamador=../admin/usuarios/index.php&tempo=1");
31 33 }
32   - else {
  34 + else
  35 + {
33 36 $query = "INSERT
34 37 INTO usuarios
35 38 (nm_usuario_acesso,
... ... @@ -39,162 +42,274 @@ if($submit) {
39 42 id_grupo_usuarios,
40 43 id_local,
41 44 te_emails_contato,
42   - te_telefones_contato)
  45 + te_telefones_contato,
  46 + te_locais_secundarios)
43 47 VALUES ('$frm_nm_usuario_acesso',
44 48 '$frm_nm_usuario_completo',
45 49 PASSWORD('$frm_nm_usuario_acesso'), now(),
46 50 '$frm_id_grupo_usuarios',
47 51 '$frm_id_local',
48 52 '$frm_te_emails_contato',
49   - '$frm_te_telefones_contato')";
  53 + '$frm_te_telefones_contato',
  54 + '$frm_te_locais_secundarios')";
50 55 $result = mysql_query($query) or die ('Insert falhou');
51 56 GravaLog('INS',$_SERVER['SCRIPT_NAME'],'usuarios');
52 57 header ("Location: ../../include/operacao_ok.php?chamador=../admin/usuarios/index.php&tempo=1");
  58 + }
  59 + ?>
  60 + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  61 + <html>
  62 + <?
53 63 }
54   -
55   -?>
56   -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
57   -<html>
58   -<?
59   -}
60 64 else
61   -{
62   -?>
63   -<head>
64   -<link rel="stylesheet" type="text/css" href="../../include/cacic.css">
65   -<title></title>
66   -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
67   -<SCRIPT LANGUAGE="JavaScript">
68   -function SetaDescGrupo(p_descricao,p_destino)
69 65 {
70   - document.forms[0].elements[p_destino].value = p_descricao;
71   - }
  66 + ?>
  67 + <head>
  68 + <link rel="stylesheet" type="text/css" href="../../include/cacic.css">
  69 + <title></title>
  70 + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
72 71  
  72 + <SCRIPT LANGUAGE="JavaScript">
  73 + function SetaDescGrupo(p_descricao,p_destino)
  74 + {
  75 + document.forms[0].elements[p_destino].value = p_descricao;
  76 + }
  77 +
  78 + function valida_form()
  79 + {
  80 + if (document.form.frm_id_local.selectedIndex==0)
  81 + {
  82 + alert("O local do usuário é obrigatório");
  83 + document.form.frm_id_local.focus();
  84 + return false;
  85 + }
  86 +
  87 + if (document.form.frm_nm_usuario_acesso.value == "" )
  88 + {
  89 + alert("A identificação do usuário é obrigatória");
  90 + document.form.frm_nm_usuario_acesso.focus();
  91 + return false;
  92 + }
  93 + if (document.form.frm_nm_usuario_completo.value == "" )
  94 + {
  95 + alert("O nome completo do usuário é obrigatório");
  96 + document.form.frm_nm_usuario_completo.focus();
  97 + return false;
  98 + }
  99 +
  100 + if (document.form.frm_sel_id_locais_secundarios.value != "" )
  101 + {
  102 + var intLoop;
  103 + var strIdLocaisSecundarios;
  104 +
  105 + strIdLocaisSecundarios = "";
  106 +
  107 + for (intLoop = 0; intLoop < document.form.frm_sel_id_locais_secundarios.options.length; intLoop++)
  108 + {
  109 + if (document.form.frm_sel_id_locais_secundarios.options[intLoop].selected)
  110 + {
  111 + if (strIdLocaisSecundarios != "")
  112 + strIdLocaisSecundarios += ",";
  113 +
  114 + strIdLocaisSecundarios += document.form.frm_sel_id_locais_secundarios.options[intLoop].value;
  115 + }
  116 + }
  117 + document.form.frm_te_locais_secundarios.value = strIdLocaisSecundarios;
  118 + }
  119 + return true;
  120 + }
  121 + team = new Array(
  122 + <?
  123 + $sql='select * from locais ';
  124 + $where = '';
  125 + if ($_SESSION['te_locais_secundarios'])
  126 + {
  127 + $where = ' where id_local = '.$_SESSION['id_local'].' OR id_local in ('.$_SESSION['te_locais_secundarios'].') ';
  128 + }
  129 + $sql .= $where . ' order by nm_local';
73 130  
74   -function valida_form() {
75   - if (document.form.frm_id_local.selectedIndex==0) {
76   - alert("O local do usuário é obrigatório");
77   - document.form.frm_id_local.focus();
78   - return false;
79   - }
80   -
81   - if (document.form.frm_nm_usuario_acesso.value == "" ) {
82   - alert("A identificação do usuário é obrigatória");
83   - document.form.frm_nm_usuario_acesso.focus();
84   - return false;
85   - }
86   - if (document.form.frm_nm_usuario_completo.value == "" ) {
87   - alert("O nome completo do usuário é obrigatório");
88   - document.form.frm_nm_usuario_completo.focus();
89   - return false;
90   - }
  131 + conecta_bd_cacic();
91 132  
92   - return true;
93   -}
94   -</script>
95   -</head>
  133 + $sql_result=mysql_query($sql);
  134 + $num=mysql_numrows($sql_result);
  135 + $contador = 0;
  136 + while ($row=mysql_fetch_array($sql_result))
  137 + {
  138 + $contador ++;
  139 + if ($contador > 1)
  140 + echo ",\n";
  141 +
  142 + $v_id_local=$row["id_local"];
  143 + $v_sg_local=$row["sg_local"] . ' / '.$row["nm_local"];
  144 + echo "new Array(\"$v_id_local\", \"$v_sg_local\")";
  145 + }
  146 + echo ");\n";
  147 + ?>
  148 +
  149 + function fillSelectFromArray(selectCtrl, itemArray, itemAtual)
  150 + {
  151 + var i, j;
  152 + selectCtrl.disabled = true;
  153 + // empty existing items
  154 + for (i = selectCtrl.options.length; i >= 0; i--)
  155 + {
  156 + selectCtrl.options[i] = null;
  157 + }
  158 +
  159 + if (itemArray != null && itemAtual != 0)
  160 + {
  161 + selectCtrl.size = 5;
  162 + selectCtrl.disabled = false;
  163 + j = 1;
  164 + // add new items
  165 + selectCtrl.options[0] = new Option(""," ");
96 166  
97   -<body background="../../imgs/linha_v.gif" onLoad="SetaCampo('frm_id_local')">
98   -<script language="JavaScript" type="text/javascript" src="../../include/cacic.js"></script>
99   -<table width="90%" border="0" align="center">
100   - <tr>
101   - <td class="cabecalho"><div align="left">Inclus&atilde;o
102   - de novo usu&aacute;rio</div></td>
103   - </tr>
104   - <tr>
105   - <td class="descricao">As informa&ccedil;&otilde;es
106   - que dever&atilde;o ser cadastradas abaixo referem-se aos usu&aacute;rios
107   - do sistema, onde ser&aacute; determinado o tipo de acesso. <u><em>A senha
108   - inicial ser&aacute; gerada automaticamente em fun&ccedil;&atilde;o da identifica&ccedil;&atilde;o
109   - e poder&aacute; ser trocada pelo usu&aacute;rio na op&ccedil;&atilde;o Acesso/Troca
110   - de Senha no menu principal</em></u>. Ap&oacute;s o logon, ser&atilde;o exibidas
111   - a primeira e &uacute;ltima parte do campo Nome Completo.</td>
112   - </tr>
113   -</table>
114   -<?
  167 + for (i = 0; i < itemArray.length; i++)
  168 + {
  169 + if (itemArray[i][0] != itemAtual)
  170 + {
  171 + selectCtrl.options[j] = new Option(itemArray[i][0]);
  172 + if (itemArray[i][0] != null)
  173 + {
  174 + selectCtrl.options[j].value = itemArray[i][0];
  175 + selectCtrl.options[j].text = itemArray[i][1];
  176 + }
  177 + j++;
  178 + }
  179 + }
  180 + // select first item (prompt) for sub list
  181 + selectCtrl.options[0].selected = true;
  182 + }
  183 + }
  184 +
  185 + </script>
  186 + </head>
  187 +
  188 + <body background="../../imgs/linha_v.gif" onLoad="SetaCampo('frm_id_local')">
  189 + <script language="JavaScript" type="text/javascript" src="../../include/cacic.js"></script>
  190 + <table width="90%" border="0" align="center">
  191 + <tr>
  192 + <td class="cabecalho"><div align="left">Inclus&atilde;o
  193 + de novo usu&aacute;rio</div></td>
  194 + </tr>
  195 + <tr>
  196 + <td class="descricao">As informa&ccedil;&otilde;es
  197 + que dever&atilde;o ser cadastradas abaixo referem-se aos usu&aacute;rios
  198 + do sistema, onde ser&aacute; determinado o tipo de acesso. <u><em>A senha
  199 + inicial ser&aacute; gerada automaticamente em fun&ccedil;&atilde;o da identifica&ccedil;&atilde;o
  200 + e poder&aacute; ser trocada pelo usu&aacute;rio na op&ccedil;&atilde;o Acesso/Troca
  201 + de Senha no menu principal</em></u>. Ap&oacute;s o logon, ser&atilde;o exibidas
  202 + a primeira e &uacute;ltima parte do campo Nome Completo.</td>
  203 + </tr>
  204 + </table>
  205 + <?
115 206 $where = ($_SESSION['cs_nivel_administracao']<>1?' WHERE id_local = '.$_SESSION['id_local']:'');
  207 + if ($_SESSION['te_locais_secundarios'] && $where)
  208 + {
  209 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  210 + $where = str_replace('id_local = ','(id_local = ',$where);
  211 + $where .= ' OR id_local IN ('.$_SESSION['te_locais_secundarios'].'))';
  212 + }
  213 +
116 214 $qry_local = "SELECT id_local,
117   - sg_local
  215 + sg_local,
  216 + nm_local
118 217 FROM locais ".
119 218 $where . "
120 219 ORDER BY sg_local";
121 220 $result_local = mysql_query($qry_local) or die ('Falha na consulta à tabela Locais...');
122   -?>
123   -
124   - <p>&nbsp;</p><form action="incluir_usuario.php" method="post" ENCTYPE="multipart/form-data" name="form" onsubmit="return valida_form()">
125   - <table border="0" align="center" cellpadding="2" cellspacing="2">
126   - <tr>
127   - <td class="label">Local:</td>
128   - <td><select name="frm_id_local" id="frm_id_local" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" <? echo ($_SESSION['cs_nivel_administracao']<>1?"disabled":"");?>>
129   - <?
130   - echo '<option value="0">Selecione o Local</option>';
131   - while($row = mysql_fetch_row($result_local))
132   - {
133   - echo '<option value="'.$row[0].'"';
134   - echo ($_SESSION['cs_nivel_administracao']<>1?" selected ":"");
135   - echo '>'.$row[1].'</option>';
136   - }
137   - ?>
138   - </select>
  221 + ?>
  222 +
  223 + <p>&nbsp;</p><form action="incluir_usuario.php" method="post" ENCTYPE="multipart/form-data" name="form" onsubmit="return valida_form()">
  224 + <table border="0" align="center" cellpadding="2" cellspacing="2">
  225 + <tr>
  226 + <td class="label">Local Prim&aacute;rio:</td>
  227 + <td><select name="frm_id_local" id="frm_id_local" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" onChange="fillSelectFromArray(this.form.frm_sel_id_locais_secundarios, team,this.form.frm_id_local.value);" <? echo ($_SESSION['cs_nivel_administracao']<>1 && ($_SESSION['cs_nivel_administracao']<>3 && !$_SESSION['cs_nivel_administracao'])?"disabled":"");?>>
  228 + <?
  229 + echo '<option value="0">Selecione Local</option>';
  230 + while($row = mysql_fetch_row($result_local))
  231 + {
  232 + echo '<option value="'.$row[0].'"';
  233 + echo ($_SESSION['cs_nivel_administracao']<>1?" selected ":"");
  234 + echo '>'.$row[1].' / '.$row[2].'</option>';
  235 + }
  236 + ?>
  237 + </select>
  238 + <?
  239 + // Se não for nível Administrador então fixa o id_local...
  240 + if ($_SESSION['cs_nivel_administracao']<>1 && ($_SESSION['cs_nivel_administracao']<>3 && !$_SESSION['cs_nivel_administracao']))
  241 + echo '<input name="frm_id_local" type="hidden" id="frm_id_local" value="'.$_SESSION['id_local'].'">';
  242 + ?>
  243 + </td>
  244 + </tr>
  245 + <tr valign="top">
  246 + <td align="left" valign="top" nowrap class="label"><div align="left">Locais
  247 + Secund&aacute;rios:</div></td>
  248 + <td>
  249 + <select name="frm_sel_id_locais_secundarios" id="frm_sel_id_locais_secundarios" multiple disabled size="5" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" <? echo ($_SESSION['cs_nivel_administracao']<>1?"disabled":"");?>>
  250 + <option value=""></option>
  251 + </select>
  252 + <input name="frm_te_locais_secundarios" type="hidden" id="frm_te_locais_secundarios">
  253 + <br>
  254 + <font color="#000080" size="1">(Dica: use SHIFT ou CTRL para selecionar
  255 + m&uacute;ltiplos itens)</font></td>
  256 + </tr>
  257 + <tr>
  258 + <td class="label">&nbsp;</td>
  259 + <td>&nbsp;</td>
  260 + </tr>
  261 + <tr>
  262 + <td class="label">Identifica&ccedil;&atilde;o:</td>
  263 + <td> <input name="frm_nm_usuario_acesso" type="text" id="frm_nm_usuario_acesso" size="15" maxlength="15" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" >
  264 + &nbsp;&nbsp;<strong>Ex: </strong>d308951</td>
  265 + </tr>
  266 + <tr>
  267 + <td class="label">Nome Completo:</td>
  268 + <td><input name="frm_nm_usuario_completo" type="text" id="frm_nm_usuario_completo" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
  269 + </tr>
139 270 <?
140   - // Se não for nível Administrador então fixa o id_local...
141   - if ($_SESSION['cs_nivel_administracao']<>1)
142   - echo '<input name="frm_id_local" type="hidden" id="frm_id_local" value="'.$_SESSION['id_local'].'">';
143   - ?>
144   - </td>
145   - </tr>
146   - <tr>
147   - <td class="label">Identifica&ccedil;&atilde;o:</td>
148   - <td> <input name="frm_nm_usuario_acesso" type="text" id="frm_nm_usuario_acesso" size="15" maxlength="15" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" >
149   - &nbsp;&nbsp;<strong>Ex: </strong>d308951</td>
150   - </tr>
151   - <tr>
152   - <td class="label">Nome Completo:</td>
153   - <td><input name="frm_nm_usuario_completo" type="text" id="frm_nm_usuario_completo" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
154   - </tr>
155   - <?
156   - $where = ($_SESSION['cs_nivel_administracao']<>1?' WHERE cs_nivel_administracao > '.$_SESSION['cs_nivel_administracao'].' OR cs_nivel_administracao=0':'');
157   - $qry_grp_usu = "SELECT id_grupo_usuarios,
158   - te_grupo_usuarios,
159   - te_descricao_grupo
160   - FROM grupo_usuarios ".
161   - $where . "
162   - ORDER BY te_grupo_usuarios";
163   - $result_qry_grp = mysql_query($qry_grp_usu) or die ('Falha na consulta à tabela Grupo_Usuarios...');
164   -?>
165   - <tr nowrap>
166   - <td class="label">Emails para Contato:</td>
167   - <td><input name="frm_te_emails_contato" type="text" id="frm_te_emails_contato" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
168   - </tr>
169   - <tr nowrap>
170   - <td class="label">Telefones para Contato:</td>
171   - <td><input name="frm_te_telefones_contato" type="text" id="frm_te_telefones_contato" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
172   - </tr>
173   - <tr nowrap>
174   - <td class="label">Tipo de Acesso:</td>
175   - <td> <select name="frm_id_grupo_usuarios" id="frm_id_grupo_usuarios" onChange="SetaDescGrupo(this.options[selectedIndex].id,'frm_te_descricao_grupo')" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" >
176   - <?
177   - while($row = mysql_fetch_row($result_qry_grp))
178   - {
179   - if (!$v_te_descricao_grupo) $v_te_descricao_grupo = $row[2];
180   - echo '<option value="'.$row[0].'" id="'.$row[2].'">'.$row[1].'</option>';
181   - }
182   - ?>
183   - </select></td>
184   - </tr>
185   - <tr nowrap>
186   - <td class="label">Descri&ccedil;&atilde;o de Acesso:</td>
187   - <td><textarea name="frm_te_descricao_grupo" cols="50" rows="4" id="frm_te_descricao_grupo" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ><? echo $v_te_descricao_grupo;?></textarea></td>
188   - </tr>
189   - </table>
190   - <p align="center"> <br>
191   - <br>
192   - <input name="submit" type="submit" value=" Gravar Informa&ccedil;&otilde;es " onClick="return Confirma('Confirma Inclusão de Usuário?');">
193   - </p>
194   -</form>
195   -<p>
196   - <?
197   -}
  271 + $where = ($_SESSION['cs_nivel_administracao']<>1?' WHERE cs_nivel_administracao > '.$_SESSION['cs_nivel_administracao'].' OR cs_nivel_administracao=0':'');
  272 + $qry_grp_usu = "SELECT id_grupo_usuarios,
  273 + te_grupo_usuarios,
  274 + te_descricao_grupo
  275 + FROM grupo_usuarios ".
  276 + $where . "
  277 + ORDER BY te_grupo_usuarios";
  278 + $result_qry_grp = mysql_query($qry_grp_usu) or die ('Falha na consulta à tabela Grupo_Usuarios...');
  279 + ?>
  280 + <tr nowrap>
  281 + <td class="label">Emails para Contato:</td>
  282 + <td><input name="frm_te_emails_contato" type="text" id="frm_te_emails_contato" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
  283 + </tr>
  284 + <tr nowrap>
  285 + <td class="label">Telefones para Contato:</td>
  286 + <td><input name="frm_te_telefones_contato" type="text" id="frm_te_telefones_contato" size="50" maxlength="100" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ></td>
  287 + </tr>
  288 + <tr nowrap>
  289 + <td class="label">Tipo de Acesso:</td>
  290 + <td> <select name="frm_id_grupo_usuarios" id="frm_id_grupo_usuarios" onChange="SetaDescGrupo(this.options[selectedIndex].id,'frm_te_descricao_grupo')" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" >
  291 + <?
  292 + while($row = mysql_fetch_row($result_qry_grp))
  293 + {
  294 + if (!$v_te_descricao_grupo) $v_te_descricao_grupo = $row[2];
  295 + echo '<option value="'.$row[0].'" id="'.$row[2].'">'.$row[1].'</option>';
  296 + }
  297 + ?>
  298 + </select></td>
  299 + </tr>
  300 + <tr nowrap>
  301 + <td class="label">Descri&ccedil;&atilde;o de Acesso:</td>
  302 + <td><textarea name="frm_te_descricao_grupo" cols="50" rows="4" id="frm_te_descricao_grupo" class="normal" onFocus="SetaClassDigitacao(this);" onBlur="SetaClassNormal(this);" ><? echo $v_te_descricao_grupo;?></textarea></td>
  303 + </tr>
  304 + </table>
  305 + <p align="center"> <br>
  306 + <br>
  307 + <input name="submit" type="submit" value=" Gravar Informa&ccedil;&otilde;es " onClick="return Confirma('Confirma Inclusão de Usuário?');">
  308 + </p>
  309 + </form>
  310 + <p>
  311 + <?
  312 + }
198 313 ?>
199 314 </p>
200 315 </body>
... ...
admin/usuarios/index.php
... ... @@ -23,10 +23,16 @@ include_once &quot;../../include/library.php&quot;;
23 23 // Comentado temporariamente - AntiSpy();
24 24 Conecta_bd_cacic();
25 25 //LimpaTESTES();
26   -$where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND usu.id_local = '.$_SESSION['id_local'] .' AND
27   - (g_usu.cs_nivel_administracao >= '.$_SESSION['cs_nivel_administracao']. ' OR
28   - g_usu.cs_nivel_administracao = 0)':'');
29   -
  26 +$where = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND (g_usu.cs_nivel_administracao >= '.$_SESSION['cs_nivel_administracao']. ' OR
  27 + g_usu.cs_nivel_administracao = 0) AND usu.id_local = '.$_SESSION['id_local']:'');
  28 +
  29 +if ($_SESSION['te_locais_secundarios'] && $where)
  30 + {
  31 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  32 + $where = str_replace(' AND usu.id_local = ',' AND (usu.id_local = ',$where);
  33 + $where .= ' OR usu.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  34 + }
  35 +
30 36 $query = 'SELECT usu.id_usuario,
31 37 usu.nm_usuario_acesso,
32 38 usu.nm_usuario_completo,
... ...
estatisticas/aplicativos/index.php
... ... @@ -136,7 +136,7 @@ function open_window(theURL,winName,features) {
136 136 </tr>
137 137 <tr>
138 138 <td class="ajuda">&nbsp;&nbsp;&nbsp;(Dica:
139   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  139 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
140 140 </tr>
141 141 </table></td>
142 142 </tr>
... ...
estatisticas/officescan.php
... ... @@ -63,6 +63,13 @@ if ($_SESSION[&#39;cs_nivel_administracao&#39;]&lt;&gt;1 &amp;&amp; $_SESSION[&#39;cs_nivel_administracao&#39;
63 63 {
64 64 $where = ' AND locais.id_local = '.$_SESSION['id_local'];
65 65 }
  66 +
  67 +if ($_SESSION['te_locais_secundarios'] && $where)
  68 + {
  69 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  70 + $where = str_replace(' locais.id_local = ',' (locais.id_local = ',$where);
  71 + $where .= ' OR locais.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  72 + }
66 73  
67 74 // Exibir informações do Engine
68 75 $query_engine = "SELECT o.nu_versao_engine,
... ...
graficos/pie_acessos.php
... ... @@ -13,13 +13,23 @@
13 13 Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15 */
16   -
  16 +session_start();
17 17 include_once '../include/library.php';
18   -include '../include/piechart.php';
  18 +include_once '../include/piechart.php';
19 19 conecta_bd_cacic();
20 20 $where = ($_REQUEST['cs_nivel_administracao'] <> 1 &&
21 21 $_REQUEST['cs_nivel_administracao'] <> 2 ? ' AND b.id_local = '.$_REQUEST['id_local']:'');
22   -
  22 +
  23 +if ($_SESSION['te_locais_secundarios'] && $where)
  24 + {
  25 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  26 + $where = str_replace('b.id_local = ','(b.id_local = ',$where);
  27 + $where .= ' OR b.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  28 + }
  29 +
  30 +if ($_GET['in_detalhe'])
  31 + $where = ' AND b.id_local = '.$_GET['in_detalhe'];
  32 +
23 33 $query ='SELECT to_days(curdate()) - to_days(dt_hr_ult_acesso) as nr_dias, count(*)
24 34 FROM computadores a,
25 35 redes b
... ... @@ -29,42 +39,60 @@ $query =&#39;SELECT to_days(curdate()) - to_days(dt_hr_ult_acesso) as nr_dias, coun
29 39 $where . '
30 40 GROUP BY nr_dias';
31 41  
32   - $result = mysql_query($query) or die('Erro no select');
  42 +$result = mysql_query($query) or die('Erro no select');
  43 +
  44 +
  45 +$intSum = 0;
  46 +function qt_comp($result, $num_dias)
  47 + {
  48 + global $intSum;
  49 + mysql_data_seek($result, 0);
  50 + while ($reg = mysql_fetch_array($result))
  51 + {
  52 + if ($reg[0] == $num_dias)
  53 + {
  54 + $intSum += $reg[1];
  55 + return $reg[1];
  56 + }
  57 + }
  58 + }
33 59  
34   - function qt_comp($result, $num_dias)
35   - {
36   - mysql_data_seek($result, 0);
37   - while ($reg = mysql_fetch_array($result))
38   - {
39   - if ($reg[0] == $num_dias) return $reg[1];
40   - }
41   - }
  60 +function ha_mais_de($result, $num_dias_min, $num_dias_max)
  61 + {
  62 + global $intSum;
  63 + $total_dias = 0;
  64 + mysql_data_seek($result, 0);
  65 + while ($reg = mysql_fetch_array($result))
  66 + {
  67 + if (($reg[0] > $num_dias_min) &&
  68 + ($reg[0] < $num_dias_max))
  69 + {
  70 + $intSum += $reg[1];
  71 + $total_dias = $total_dias + $reg[1];
  72 + }
  73 + }
  74 + return $total_dias;
  75 + }
42 76  
43   - function ha_mais_de($result, $num_dias_min, $num_dias_max)
44   - {
45   - $total_dias = 0;
46   - mysql_data_seek($result, 0);
47   - while ($reg = mysql_fetch_array($result))
48   - {
49   - if (($reg[0] > $num_dias_min) &&
50   - ($reg[0] < $num_dias_max))
51   - $total_dias = $total_dias + $reg[1];
52   - }
53   - return $total_dias;
54   - }
  77 +$arr['Hoje................'] = qt_comp($result, 0);
  78 +$arr['Há 1 dia............'] = qt_comp($result, 1);
  79 +$arr['Há 2 dias...........'] = qt_comp($result, 2);
  80 +$arr['Há 3 dias...........'] = qt_comp($result, 3);
  81 +$arr['Há 4 dias...........'] = qt_comp($result, 4);
  82 +$arr['De 5 a 30 dias......'] = ha_mais_de($result, 4,30); // De 4 dias a 1 mês...
  83 +$arr['De 30 a 180 dias....'] = ha_mais_de($result, 29,180); // De 1 mês a 6 meses...
  84 +$arr['De 180 a 365 dias...'] = ha_mais_de($result, 179,365); // De 6 meses a 1 ano...
  85 +$arr['Há mais de 365 dias.'] = ha_mais_de($result, 364,99999); // De 1 ano em diante...
55 86  
56   - $arr['Hoje................'] = qt_comp($result, 0);
57   - $arr['Ontem...............'] = qt_comp($result, 1);
58   - $arr['Há 2 dias...........'] = qt_comp($result, 2);
59   - $arr['Há 3 dias...........'] = qt_comp($result, 3);
60   - $arr['Há 4 dias...........'] = qt_comp($result, 4);
61   - $arr['Há mais de 4 dias...'] = ha_mais_de($result, 4,30); // De 4 dias a 1 mês...
62   - $arr['Há mais de 1 mes....'] = ha_mais_de($result, 29,180); // De 1 mês a 6 meses...
63   - $arr['Há mais de 6 meses..'] = ha_mais_de($result, 179,365); // De 6 meses a 1 ano...
64   - $arr['Há mais de 1 ano....'] = ha_mais_de($result, 364,99999); // De 1 ano em diante...
  87 +if ($intSum == 0)
  88 + {
  89 + $arr = array('a');
  90 + }
  91 +
  92 +$CreatePie = 1;
  93 +$Sort = 1;
  94 +$width = 420;
  95 +$height = 159;
65 96  
66   - $CreatePie = 1;
67   - $Sort = 1;
68   - $PieSize = 159;
69   - phPie($arr, 420 , $PieSize, $CenterX, $CenterY, $DiameterX, $DiameterY, $MinDisplayPct, $DisplayColors, $BackgroundColor, $LineColor, true, 3,$CreatePie, $Sort);
  97 +phPie($arr, $width , $height, $CenterX, $CenterY, $DiameterX, $DiameterY, $MinDisplayPct, $DisplayColors, $BackgroundColor, $LineColor, true, 3,$CreatePie, $Sort);
70 98 ?>
71 99 \ No newline at end of file
... ...
graficos/pie_mac.php
... ... @@ -13,13 +13,24 @@
13 13 Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15 */
16   -
  16 +session_start();
17 17 include_once '../include/library.php';
18   -include '../include/piechart.php';
  18 +include_once '../include/piechart.php';
19 19 conecta_bd_cacic();
20 20 $where = ($_REQUEST['cs_nivel_administracao'] <> 1 &&
21 21 $_REQUEST['cs_nivel_administracao'] <> 2 ? ' AND b.id_local = '.$_REQUEST['id_local']:'');
22 22  
  23 +if ($_SESSION['te_locais_secundarios'] && $where)
  24 + {
  25 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  26 + $where = str_replace('b.id_local = ','(b.id_local = ',$where);
  27 + $where .= ' OR b.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  28 + }
  29 +
  30 +if ($_GET['in_detalhe'])
  31 + $where = ' AND b.id_local = '.$_GET['in_detalhe'];
  32 +
  33 +
23 34 $query = 'SELECT count(*) as qtd
24 35 FROM computadores a,
25 36 redes b
... ...
graficos/pie_so.php
... ... @@ -13,14 +13,25 @@
13 13 Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15 */
  16 +session_start();
16 17 include_once '../include/library.php';
17   -include '../include/piechart.php';
  18 +include_once '../include/piechart.php';
18 19 //// Comentado temporariamente - AntiSpy();
19 20  
20 21 conecta_bd_cacic();
21 22 $where = ($_REQUEST['cs_nivel_administracao'] <> 1 &&
22 23 $_REQUEST['cs_nivel_administracao'] <> 2 ? ' AND c.id_local = '.$_REQUEST['id_local']:'');
23   -
  24 +
  25 +if ($_SESSION['te_locais_secundarios'] && $where)
  26 + {
  27 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  28 + $where = str_replace('c.id_local = ','(c.id_local = ',$where);
  29 + $where .= ' OR c.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  30 + }
  31 +
  32 +if ($_GET['in_detalhe'])
  33 + $where = ' AND c.id_local = '.$_GET['in_detalhe'];
  34 +
24 35 $query = 'SELECT count(a.id_so) as qtd,
25 36 b.te_desc_so
26 37 FROM computadores a,
... ... @@ -34,14 +45,15 @@ $query = &#39;SELECT count(a.id_so) as qtd,
34 45 GROUP BY a.id_so
35 46 ORDER BY a.id_so';
36 47 $result = mysql_query($query) or die('Falha na consulta (computadores, so, redes, locais)');
37   -
38 48 while ($row_result = mysql_fetch_assoc($result))
39 49 {
40 50 $v_row_result = str_pad($row_result['te_desc_so'],20,'.',STR_PAD_RIGHT);
41 51 $arr[$v_row_result] = $row_result['qtd'];
42 52 }
43 53  
  54 +$width = 420;
  55 +$height = 159;
44 56 $CreatePie = 1;
45 57 $Sort = 1;
46   -phPie($arr, 420 , 159, $CenterX, $CenterY, $DiameterX, $DiameterY, $MinDisplayPct, $DisplayColors, $BackgroundColor, $LineColor, true, 3,$CreatePie, $Sort);
  58 +phPie($arr, $width,$height, $CenterX, $CenterY, $DiameterX, $DiameterY, $MinDisplayPct, $DisplayColors, $BackgroundColor, $LineColor, true, 3,$CreatePie, $Sort);
47 59 ?>
48 60 \ No newline at end of file
... ...
include/piechart.php
... ... @@ -13,152 +13,154 @@
13 13 Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15 */
16   -
17   -
18   - function FilledArc(&$im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $fill_color='none') {
19   - ImageArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color);
20   - // To close the arc with 2 lines between the center and the 2 limits of the arc
21   - $x = $CenterX + (cos(deg2rad($Start)) * ($DiameterX / 2));
22   - $y = $CenterY + (sin(deg2rad($Start)) * ($DiameterY / 2));
23   - ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color);
24   - $x = $CenterX + (cos(deg2rad($End)) * ($DiameterX / 2));
25   - $y = $CenterY + (sin(deg2rad($End)) * ($DiameterY / 2));
26   - ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color);
27   - // To fill the arc, the starting point is a point in the middle of the closed space
28   - $x = $CenterX + (cos(deg2rad(($Start + $End) / 2)) * ($DiameterX / 4));
29   - $y = $CenterY + (sin(deg2rad(($Start + $End) / 2)) * ($DiameterY / 4));
30   - ImageFillToBorder($im, $x, $y, $line_color, $fill_color);
31   - }
  16 +function FilledArc(&$im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $fill_color='none')
  17 + {
  18 + ImageArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color);
  19 + // To close the arc with 2 lines between the center and the 2 limits of the arc
  20 + $x = $CenterX + (cos(deg2rad($Start)) * ($DiameterX / 2));
  21 + $y = $CenterY + (sin(deg2rad($Start)) * ($DiameterY / 2));
  22 + ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color);
  23 + $x = $CenterX + (cos(deg2rad($End)) * ($DiameterX / 2));
  24 + $y = $CenterY + (sin(deg2rad($End)) * ($DiameterY / 2));
  25 + ImageLine($im, $x, $y, $CenterX, $CenterY, $line_color);
  26 + // To fill the arc, the starting point is a point in the middle of the closed space
  27 + $x = $CenterX + (cos(deg2rad(($Start + $End) / 2)) * ($DiameterX / 4));
  28 + $y = $CenterY + (sin(deg2rad(($Start + $End) / 2)) * ($DiameterY / 4));
  29 + ImageFillToBorder($im, $x, $y, $line_color, $fill_color);
  30 + }
32 31  
33   - function phPie($data, $width, $height, $CenterX, $CenterY, $DiameterX, $DiameterY, $MinDisplayPct, $DisplayColors, $BackgroundColor, $LineColor, $Legend, $FontNumber, $CreatePie, $Sort)
  32 +function phPie($data, $width, $height, $CenterX, $CenterY, $DiameterX, $DiameterY, $MinDisplayPct, $DisplayColors, $BackgroundColor, $LineColor, $Legend, $FontNumber, $CreatePie, $Sort)
  33 + {
  34 + $MinDisplayPct = 0;
  35 + $DisplayColors = 'FF0000;3399FF;66CC66;CCCC99;FFCCCC;9933FF;CC66CC;3333FF;DA3600;0F84D4;F9A308;62D038;FE670F;2C9232;7F0B80;DFDE29;9F9F9F;EDEDED;BAE700;00FFFF;0000FF';
  36 + $BackgroundColor ='FFFFFF';
  37 + $LineColor = 'FFFFFF';
  38 + if (!$CreatePie)
34 39 {
35   - $MinDisplayPct = 0;
36   - //$DisplayColors = 'FF0000;3399FF;66CC66;CCCC99;FFCCCC;9933FF;CC66CC;3333FF';
37   - $DisplayColors = 'FF0000;3399FF;66CC66;CCCC99;FFCCCC;9933FF;CC66CC;3333FF;DA3600;0F84D4;F9A308;62D038;FE670F;2C9232;7F0B80;DFDE29;9F9F9F;EDEDED;BAE700;00FFFF;0000FF';
38   - $BackgroundColor ='FFFFFF';
39   - $LineColor = 'FFFFFF';
40   - if (!$CreatePie)
41   - {
42   - $DisplayColors = '000000';
43   - $BackgroundColor ='FFFFFF';
44   - }
45   - $CenterX = round($width / 2);
46   - $CenterY = round($height / 2);
47   - $DiameterX = round($width * 0.95);
48   - $DiameterY = round($height * 0.95);
49   -
50   - if ($Legend) {
51   - $DiameterX = $DiameterY;
52   - $CenterX = $width - $CenterY;
53   - }
54   -
55   - if (isset($data) && !is_array($data)) {
56   - $data = unserialize(stripslashes($data));
57   - } else if (!isset($data)) {
58   - $data = array('NO DATA'=>1);
59   - }
60   -
61   - if ($Legend) {
62   - $DiameterX = $DiameterY;
63   - $CenterX = $width - $CenterY;
64   - }
  40 + $DisplayColors = '000000';
  41 + $BackgroundColor ='FFFFFF';
  42 + }
  43 + $CenterX = round($width / 2);
  44 + $CenterY = round($height / 2);
  45 + $DiameterX = round($width * 0.95);
  46 + $DiameterY = round($height * 0.95);
  47 +
  48 + if ($Legend)
  49 + {
  50 + $DiameterX = $DiameterY;
  51 + $CenterX = $width - $CenterY;
  52 + }
  53 +
  54 + if (isset($data) && !is_array($data))
  55 + {
  56 + $data = unserialize(stripslashes($data));
  57 + }
  58 + else if (!isset($data))
  59 + {
  60 +// $data = array('Nenhum Registro'=>1);
  61 + $height = 50;
  62 + }
65 63  
66   - if (($width > 8192) || ($height > 8192) || ($width <= 0) || ($height <= 0)) {
67   - die('Image size limited to 8192 x 8192 for safety reasons');
68   - }
  64 + if ($Legend)
  65 + {
  66 + $DiameterX = $DiameterY;
  67 + $CenterX = $width - $CenterY;
  68 + }
69 69  
  70 + if (($width > 8192) || ($height > 8192) || ($width <= 0) || ($height <= 0))
  71 + {
  72 + die('Image size limited to 8192 x 8192 for safety reasons');
  73 + }
70 74  
71   - if ($im = @ImageCreate($width, $height)) {
72   - $background_color = ImageColorAllocate($im, hexdec(substr($BackgroundColor, 0, 2)), hexdec(substr($BackgroundColor, 2, 2)), hexdec(substr($BackgroundColor, 4, 2)));
73   - $line_color = ImageColorAllocate($im, hexdec(substr($LineColor, 0, 2)), hexdec(substr($LineColor, 2, 2)), hexdec(substr($LineColor, 4, 2)));
74   - $fillcolorsarray = explode(';', $DisplayColors);
75   - for ($i = 0; $i < count($fillcolorsarray); $i++)
  75 + if ($im = @ImageCreate($width, $height))
  76 + {
  77 + $background_color = ImageColorAllocate($im, hexdec(substr($BackgroundColor, 0, 2)), hexdec(substr($BackgroundColor, 2, 2)), hexdec(substr($BackgroundColor, 4, 2)));
  78 + $line_color = ImageColorAllocate($im, hexdec(substr($LineColor, 0, 2)), hexdec(substr($LineColor, 2, 2)), hexdec(substr($LineColor, 4, 2)));
  79 + $fillcolorsarray = explode(';', $DisplayColors);
  80 + for ($i = 0; $i < count($fillcolorsarray); $i++)
76 81 {
77   - $fill_color[] = ImageColorAllocate($im, hexdec(substr($fillcolorsarray["$i"], 0, 2)), hexdec(substr($fillcolorsarray["$i"], 2, 2)), hexdec(substr($fillcolorsarray["$i"], 4, 2)));
78   - $label_color[] = ImageColorAllocate($im, hexdec(substr($fillcolorsarray["$i"], 0, 2)) * 0.8, hexdec(substr($fillcolorsarray["$i"], 2, 2)) * 0.8, hexdec(substr($fillcolorsarray["$i"], 4, 2)) * 0.8);
  82 + $fill_color[] = ImageColorAllocate($im, hexdec(substr($fillcolorsarray["$i"], 0, 2)), hexdec(substr($fillcolorsarray["$i"], 2, 2)), hexdec(substr($fillcolorsarray["$i"], 4, 2)));
  83 + $label_color[] = ImageColorAllocate($im, hexdec(substr($fillcolorsarray["$i"], 0, 2)) * 0.8, hexdec(substr($fillcolorsarray["$i"], 2, 2)) * 0.8, hexdec(substr($fillcolorsarray["$i"], 4, 2)) * 0.8);
79 84 }
80 85  
81   - if ((count($data) <= 0) and ($Legend))
  86 + if ((count($data) <= 0) and ($Legend))
82 87 {
83   - ImageString($im, $FontNumber, 5, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), 'Total: 0', '9933FF');
  88 +// ImageString($im, $FontNumber, 5, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), 'Total: 0', '9933FF');
  89 + ImageString($im, $FontNumber, 3, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), ' ***** Nenhum Registro Encontrado *****', '9933FF');
84 90 }
85   - else
  91 + else
86 92 {
87   - $TotalArrayValues = array_sum($data);
88   - if ($Sort)
89   - {
90   - arsort($data);
91   - }
  93 + $TotalArrayValues = array_sum($data);
  94 + if ($Sort)
  95 + {
  96 + arsort($data);
  97 + }
92 98  
93   - $Start = 0;
94   - $valuecounter = 0;
95   - $ValuesSoFar = 0;
96   - foreach ($data as $key => $value)
  99 + $Start = 0;
  100 + $valuecounter = 0;
  101 + $ValuesSoFar = 0;
  102 + foreach ($data as $key => $value)
  103 + {
  104 + $ValuesSoFar += $value;
  105 +
  106 + if (($value / $TotalArrayValues) > $MinDisplayPct)
97 107 {
98   - $ValuesSoFar += $value;
99   -
100   - if (($value / $TotalArrayValues) > $MinDisplayPct)
  108 + $End = ceil(($ValuesSoFar / $TotalArrayValues) * 360);
  109 + if ($CreatePie)
101 110 {
102   - //$End = $Start + floor(($value / $TotalArrayValues) * 360);
103   - $End = ceil(($ValuesSoFar / $TotalArrayValues) * 360);
104   - if ($CreatePie)
105   - {
106   - FilledArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $fill_color[$valuecounter % count($fill_color)]);
107   - }
108   - if ($Legend)
109   - {
110   - $MeuY = round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber)));
111   -// ImageString($im, $FontNumber, 5, $MeuY, $key. ': ' . $value . ' ('.number_format(($value / $TotalArrayValues) * 100, 1).'%)', $label_color[$valuecounter % count($label_color)]);
112   - ImageString($im, $FontNumber, 5, $MeuY, $key . ': ' . str_pad($value,6,' ',STR_PAD_LEFT) . '('.str_pad(number_format(($value / $TotalArrayValues) * 100, 1),5,' ',STR_PAD_LEFT).'%)', $label_color[$valuecounter % count($label_color)]);
113   - if ($CreatePie)
114   - {
115   - $MeuYLinha = $MeuY + ImageFontHeight($FontNumber) + 2;
116   - ImageLine($im, 5, $MeuYLinha, 255, $MeuYLinha, '999999');
117   - }
118   - }
119   - $Start = $End;
120   - }
121   - else
  111 + FilledArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $fill_color[$valuecounter % count($fill_color)]);
  112 + }
  113 + if ($Legend)
122 114 {
123   - // too small to bother drawing - just finish off the arc with no fill and break
124   - $End = 360;
125   - if ($CreatePie)
126   - {
127   - FilledArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $line_color);
128   - }
129   - if ($Legend)
130   - {
131   - ImageString($im, $FontNumber, 5, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), 'Other ('.str_pad(number_format((($TotalArrayValues - $ValuesSoFar) / $TotalArrayValues) * 100, 1),4,' ',STR_PAD_LEFT).'%)', $line_color);
  115 + $MeuY = round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber)));
  116 + ImageString($im, $FontNumber, 3, $MeuY, $key . ': ' . str_pad($value,6,' ',STR_PAD_LEFT) . '('.str_pad(number_format(($value / $TotalArrayValues) * 100, 1),5,' ',STR_PAD_LEFT).'%)', $label_color[$valuecounter % count($label_color)]);
  117 + if ($CreatePie)
  118 + {
  119 + $MeuYLinha = $MeuY + ImageFontHeight($FontNumber) + 2;
  120 + ImageLine($im, 5, $MeuYLinha, 255, $MeuYLinha, '999999');
132 121 }
133   - break;
134   - }
135   - $valuecounter++;
136   - }
137   -
138   -// If ($Legend) ImageString($im, $FontNumber, 6, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), str_pad('Total',strlen($key),'.',STR_PAD_RIGHT) . ': ' . str_pad($TotalArrayValues,6,' ',STR_PAD_LEFT) . ' ( 100%)', '9933FF');
139   - If ($Legend)
  122 + }
  123 + $Start = $End;
  124 + }
  125 + else
140 126 {
141   - $MeuYLinha = $MeuY + ImageFontHeight($FontNumber) + 2;
142   - $TamanhoLinha = 255;
143   - if (!$CreatePie)
  127 + // too small to bother drawing - just finish off the arc with no fill and break
  128 + $End = 360;
  129 + if ($CreatePie)
  130 + {
  131 + FilledArc($im, $CenterX, $CenterY, $DiameterX, $DiameterY, $Start, $End, $line_color, $line_color);
  132 + }
  133 + if ($Legend)
144 134 {
145   - $TamanhoLinha = $width - 24;
  135 + ImageString($im, $FontNumber, 3, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), 'Other ('.str_pad(number_format((($TotalArrayValues - $ValuesSoFar) / $TotalArrayValues) * 100, 1),4,' ',STR_PAD_LEFT).'%)', $line_color);
146 136 }
147   - ImageLine($im, 5, $MeuYLinha, $TamanhoLinha, $MeuYLinha, '999999');
148   - ImageLine($im, 5, $MeuYLinha+2, $TamanhoLinha, $MeuYLinha+2, '999999');
149   - ImageString($im, $FontNumber, 6, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), str_pad('Total',strlen($key),'.',STR_PAD_RIGHT) . ': ' . str_pad($TotalArrayValues,6,' ',STR_PAD_LEFT) . '(100.0%)', '999999');
  137 + break;
150 138 }
151   -
  139 + $valuecounter++;
  140 + }
  141 +
  142 + If ($Legend)
  143 + {
  144 + $MeuYLinha = $MeuY + ImageFontHeight($FontNumber) + 2;
  145 + $TamanhoLinha = 255;
  146 + if (!$CreatePie)
  147 + {
  148 + $TamanhoLinha = $width - 24;
  149 + }
  150 + ImageLine($im, 5, $MeuYLinha, $TamanhoLinha, $MeuYLinha, '999999');
  151 + ImageLine($im, 5, $MeuYLinha+2, $TamanhoLinha, $MeuYLinha+2, '999999');
  152 + ImageString($im, $FontNumber, 3, round((ImageFontHeight($FontNumber) * .5) + ($valuecounter * 1.5 * ImageFontHeight($FontNumber))), str_pad('Total',strlen($key),'.',STR_PAD_RIGHT) . ': ' . str_pad($TotalArrayValues,6,' ',STR_PAD_LEFT) . '(100.0%)', '999999');
  153 + }
152 154 }
153   - header('Content-type: image/png');
154   - ImagePNG($im);
155   - ImageDestroy($im);
156   - return TRUE;
157   -
158   - } else {
159   - echo 'Cannot Initialize new GD image stream';
160   - return FALSE;
  155 + header('Content-type: image/png');
  156 + ImagePNG($im);
  157 + ImageDestroy($im);
  158 + return TRUE;
  159 + }
  160 + else
  161 + {
  162 + echo 'Cannot Initialize new GD image stream';
  163 + return FALSE;
161 164 }
162 165 }
163   -
164 166 ?>
165 167 \ No newline at end of file
... ...
include/selecao_estacoes_inc.php
... ... @@ -80,6 +80,6 @@
80 80 </tr>
81 81 <tr>
82 82 <td class="descricao">&nbsp;&nbsp;(Dica:
83   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  83 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
84 84 </tr>
85 85 </table>
... ...
include/selecao_locais_inc.php
... ... @@ -67,6 +67,6 @@ $result = mysql_query($query) or die(&#39;Ocorreu um erro durante a consulta à tabel
67 67 </tr>
68 68 <tr>
69 69 <td class="descricao">&nbsp;&nbsp;(Dica:
70   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  70 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
71 71 </tr>
72 72  
... ...
include/selecao_redes_inc.php
... ... @@ -22,9 +22,17 @@
22 22 <td class="label">
23 23 <?
24 24 $where = ($_SESSION['cs_nivel_administracao']<>1 && $_SESSION['cs_nivel_administracao']<>2?' redes.id_local = '.$_SESSION['id_local']:'');
  25 + if ($_SESSION['te_locais_secundarios'] && $where)
  26 + {
  27 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  28 + $where = str_replace(' redes.id_local = ',' (redes.id_local = ',$where);
  29 + $where .= ' OR redes.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  30 + }
  31 +
25 32 if ($cs_situacao == 'T')
26 33 {
27 34 $where = ($where<>''?' WHERE '.$where:$where);
  35 +
28 36 $query = "SELECT distinct id_ip_rede,
29 37 nm_rede
30 38 FROM redes ".
... ... @@ -101,6 +109,6 @@
101 109 </tr>
102 110 <tr>
103 111 <td class="descricao">&nbsp;&nbsp;(Dica:
104   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  112 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
105 113 </tr>
106 114 </table>
... ...
include/selecao_so_inc.php
... ... @@ -63,6 +63,6 @@
63 63 </tr>
64 64 <tr>
65 65 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
66   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  66 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
67 67 </tr>
68 68 </table>
... ...
instalador/sql/cacic_create_tables.sql
... ... @@ -730,6 +730,7 @@ CREATE TABLE `usuarios` (
730 730 `id_grupo_usuarios` int(1) default NULL,
731 731 `te_emails_contato` varchar(100) default NULL,
732 732 `te_telefones_contato` varchar(100) default NULL,
  733 + `te_locais_secundarios` varchar(200) default NULL,
733 734 PRIMARY KEY (`id_usuario`),
734 735 KEY `id_localizacao` (`id_local`)
735 736 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
... ...
menu_esq.php
... ... @@ -29,6 +29,7 @@ if($_POST[&#39;logoff&#39;])
29 29 {
30 30 session_unregister('id_grupo_usuarios');
31 31 session_unregister('cs_nivel_administracao');
  32 + session_unregister('te_locais_secundarios');
32 33 session_unregister('id_local');
33 34 session_unregister('nm_local');
34 35 session_unregister('nm_usuario');
... ... @@ -36,6 +37,7 @@ if($_POST[&#39;logoff&#39;])
36 37 session_unregister('id_usuario');
37 38 session_unregister('c_Debugs');
38 39 session_unregister('c_IpsDebugs');
  40 + session_unregister('te_grupo_usuarios');
39 41  
40 42 //Adicionado pela Marisol em 12/06/2006
41 43 session_destroy();
... ... @@ -57,9 +59,11 @@ if($_POST[&#39;frm_nm_usuario_acesso&#39;] &amp;&amp; $_POST[&#39;frm_te_senha&#39;])
57 59 $qry_usuario = "SELECT a.id_grupo_usuarios,
58 60 a.nm_usuario_completo,
59 61 b.te_menu_grupo,
60   - b.cs_nivel_administracao,
  62 + b.cs_nivel_administracao,
  63 + b.te_grupo_usuarios,
61 64 a.id_usuario,
62 65 a.id_local,
  66 + a.te_locais_secundarios,
63 67 c.nm_local,
64 68 c.sg_local
65 69 FROM usuarios a,
... ... @@ -91,7 +95,8 @@ if($_POST[&#39;frm_nm_usuario_acesso&#39;] &amp;&amp; $_POST[&#39;frm_te_senha&#39;])
91 95 $_SESSION["menu_usuario"] = 'menus/'.$reg_result['te_menu_grupo'];
92 96 $_SESSION["id_usuario"] = $reg_result['id_usuario'];
93 97 $_SESSION["id_usuario_crypted"] = EnCrypt($key,$iv,$reg_result['id_usuario'],"1","0","0");
94   - $_SESSION["id_local"] = $reg_result['id_local'];
  98 + $_SESSION["te_locais_secundarios"] = $reg_result['te_locais_secundarios'];
  99 + $_SESSION["id_local"] = $reg_result['id_local'];
95 100 $_SESSION["sg_local"] = $reg_result['sg_local'];
96 101 $_SESSION["nm_local"] = $reg_result['nm_local'];
97 102 $_SESSION["cs_nivel_administracao"] = $reg_result['cs_nivel_administracao'];
... ... @@ -99,6 +104,7 @@ if($_POST[&#39;frm_nm_usuario_acesso&#39;] &amp;&amp; $_POST[&#39;frm_te_senha&#39;])
99 104 // p.s.: Não esquecer de voltar para "false" após o uso, para não encher a tabela "testes" em vão.
100 105 $_SESSION["c_IpsDebugs"] = '#10.71.0.58'; // Usado em conjunto com a constante acima, para que não entre informações além de sua estação atual.
101 106 // Separe os IP´s por ","
  107 + $_SESSION["te_grupo_usuarios"] = $reg_result['te_grupo_usuarios'];
102 108  
103 109 Log_Debug('Teste');
104 110 GravaLog('ACE',$_SERVER['SCRIPT_NAME'],'acesso');
... ... @@ -114,13 +120,15 @@ if($_POST[&#39;frm_nm_usuario_acesso&#39;] &amp;&amp; $_POST[&#39;frm_te_senha&#39;])
114 120 break;
115 121 session_unregister('id_grupo_usuarios');
116 122 session_unregister('cs_nivel_administracao');
117   - session_unregister('id_local');
  123 + session_unregister('te_locais_secundarios');
  124 + session_unregister('id_local');
118 125 session_unregister('nm_local');
119 126 session_unregister('nm_usuario');
120 127 session_unregister('menu_usuario');
121 128 session_unregister('id_usuario');
122 129 session_unregister('c_Debugs');
123 130 session_unregister('c_IpsDebugs');
  131 + session_unregister('te_grupo_usuarios');
124 132 ?>
125 133 <SCRIPT LANGUAGE="Javascript">
126 134 alert('Usuário não cadastrado ou senha inválida!');
... ... @@ -305,6 +313,9 @@ else
305 313 </td>
306 314 <td class="dado_peq_sem_fundo">&nbsp;</td>
307 315 </tr>
  316 + <tr>
  317 + <td colspan="2" class="dado_peq_sem_fundo" align="center">Nível: "<? echo $_SESSION['te_grupo_usuarios'];?>"</td>
  318 + </tr>
308 319 <tr>
309 320 <td colspan="2"><div align="center"></div>
310 321 <div align="center">
... ...
principal.php
... ... @@ -14,8 +14,7 @@
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15  
16 16 */
17   -session_start();
18   -require_once('include/config.php');
  17 +@session_start();
19 18 ?>
20 19 <html>
21 20 <head>
... ... @@ -37,12 +36,12 @@ if (!session_is_registered(&#39;cs_nivel_administracao&#39;))
37 36 {
38 37 ?>
39 38 <tr><td>
40   - <img src="graficos/pie_locais.php" border="no">
  39 + <img src="graficos/pie_acessos_locais.php" border="no">
41 40 </td>
42 41 </tr>
43 42 <tr>
44   - <td class="descricao"><div align="center">Totais de Estações Monitoradas por
45   - Local</div></td>
  43 + <td class="descricao"><div align="center">Computadores monitorados por
  44 + local nesta data</div></td>
46 45 </tr>
47 46 <tr>
48 47 <td height="1" bgcolor="#e7e7e7"></td>
... ... @@ -66,12 +65,25 @@ else
66 65 {
67 66 echo '</a>';
68 67 }
  68 + $title = 'Totais de computadores monitorados por sistemas operacionais';
69 69 ?>
70 70 </td>
71 71 </tr>
72 72 <tr>
73   - <td class="descricao"><div align="center">Distribui&ccedil;&atilde;o por sistemas operacionais dos computadores gerenciados</div></td>
  73 + <td class="descricao"><div align="center"><? echo $title;?></div></td>
74 74 </tr>
  75 +
  76 +<?
  77 +//<tr><td class="label_peq_sem_fundo"><div align="center"><b>ATENÇÃO:</b> Totais referentes a mais de uma localidade. (<a href="#" onclick="MyWindow=window.open('graficos/detalhes_estatisticas.php', 'JANELA','toolbar=no,location=no,scrollbars=yes,menubar=no');MyWindow.document.close()"><font color="#FF0000"><b>Detalhes</b></font></a>)</div></td></tr>
  78 +
  79 + if ($_SESSION['te_locais_secundarios'])
  80 + {
  81 + $html_locais_secundarios1 = '<tr><td class="label_peq_sem_fundo"><div align="center"><b>ATENÇÃO:</b> Total referente a mais de uma localidade. (<a href="#" onclick="MyWindow=window.open(\'graficos/detalhes_estatisticas.php?in_grafico=';
  82 + $html_locais_secundarios2 = '\', \'JANELA\',\'toolbar=no,location=no,width=600,left=200,height=600,top=50,scrollbars=yes,menubar=no\');MyWindow.document.close()"><font color="#FF0000"><b>Detalhes</b></font></a>)</div></td></tr>';
  83 + echo $html_locais_secundarios1 . 'so&te_title=' . $title . $html_locais_secundarios2;
  84 + }
  85 + ?>
  86 +
75 87 <tr>
76 88 <td height="1" bgcolor="#e7e7e7"></td>
77 89 </tr>
... ... @@ -94,36 +106,24 @@ else
94 106 ?>
95 107 </td>
96 108 </tr>
97   - <tr>
98   - <td class="descricao"><div align="center">Distribui&ccedil;&atilde;o por &uacute;ltimo acesso dos agentes</div></td>
99   - </tr>
  109 + <?
  110 + $title = '&Uacute;ltimos acessos dos agentes por local nesta data';
  111 + if ($_SESSION['te_locais_secundarios'])
  112 + {
  113 + echo $html_locais_secundarios1 . 'acessos&te_title=' . $title . $html_locais_secundarios2;
  114 + }
  115 + else
  116 + {
  117 + ?>
  118 + <tr>
  119 + <td class="descricao"><div align="center">&Uacute;ltimos acessos dos agentes deste local</div></td>
  120 + </tr>
  121 + <?
  122 + }
  123 + ?>
100 124 <tr>
101 125 <td height="1" bgcolor="#e7e7e7"></td>
102 126 </tr>
103   - <tr>
104   - <td>&nbsp;</td>
105   - </tr>
106   - <tr>
107   - <td>
108   - <?
109   - if ($_SESSION["cs_nivel_administracao"] <> 0)
110   - {
111   - echo '<a href="relatorios/software/rel_software.php?orderby=6&principal=1">';
112   - }
113   - echo '<img src="graficos/pie_acessos_locais.php?cs_nivel_administracao='.$_SESSION["cs_nivel_administracao"].'&id_local='.$_SESSION['id_local'].'" border="no">';
114   - if ($_SESSION["cs_nivel_administracao"] <> 0)
115   - {
116   - echo '</a>';
117   - }
118   - ?>
119   - </td>
120   - </tr>
121   - <tr>
122   - <td class="descricao"><div align="center">Distribui&ccedil;&atilde;o por acesso dos agentes por local nesta data</div></td>
123   - </tr>
124   - <tr>
125   - <td height="1" bgcolor="#e7e7e7"></td>
126   - </tr>
127 127  
128 128 <tr>
129 129 <td>&nbsp;</td>
... ... @@ -138,7 +138,7 @@ else
138 138 </td>
139 139 </tr>
140 140 <tr>
141   - <td class="descricao"><div align="center">Totais de Estações Monitoradas por Local</div></td>
  141 + <td class="descricao"><div align="center">Totais de computadores monitorados por local</div></td>
142 142 </tr>
143 143 <tr>
144 144 <td height="1" bgcolor="#e7e7e7"></td>
... ... @@ -149,17 +149,48 @@ else
149 149 <?
150 150 }
151 151 ?>
  152 + <tr>
  153 + <td>&nbsp;</td>
  154 + </tr>
  155 + <tr>
  156 + <td>
  157 + <?
  158 + if ($_SESSION["cs_nivel_administracao"] <> 0)
  159 + {
  160 + echo '<a href="relatorios/software/rel_software.php?orderby=6&principal=1">';
  161 + }
  162 + echo '<img src="graficos/pie_acessos_locais.php?cs_nivel_administracao='.$_SESSION["cs_nivel_administracao"].'&id_local='.$_SESSION['id_local'].'" border="no">';
  163 + if ($_SESSION["cs_nivel_administracao"] <> 0)
  164 + {
  165 + echo '</a>';
  166 + }
  167 + ?>
  168 + </td>
  169 + </tr>
  170 + <tr>
  171 + <td class="descricao"><div align="center"><? echo $title;?></div></td>
  172 + </tr>
  173 + <tr>
  174 + <td height="1" bgcolor="#e7e7e7"></td>
  175 + </tr>
152 176  
153 177 <tr>
154 178 <td>
155 179 <?
156 180 echo '<img src="graficos/pie_mac.php?cs_nivel_administracao='.$_SESSION["cs_nivel_administracao"].'&id_local='.$_SESSION['id_local'].'" border="no">';
  181 + $title = 'Total real de computadores monitorados (com base no Mac-Address)';
157 182 ?>
158 183 </td>
159 184 </tr>
160 185 <tr>
161   - <td class="descricao"><div align="center">Total de computadores baseado no Mac-Address</div></td>
  186 + <td class="descricao"><div align="center"><? echo $title;?></div></td>
162 187 </tr>
  188 + <?
  189 + if ($_SESSION['te_locais_secundarios'])
  190 + {
  191 + echo $html_locais_secundarios1 . 'mac&te_title=' . $title . $html_locais_secundarios2;
  192 + }
  193 + ?>
163 194  
164 195 <tr>
165 196 <td height="1" bgcolor="#e7e7e7"></td>
... ... @@ -171,8 +202,9 @@ else
171 202 <table width="90%">
172 203 <tr><td height="30"></td></tr>
173 204 <tr><td class="descricao">
174   -<p align="center">Desenvolvido pela Dataprev - Unidade de Atendimento do Esp&iacute;rito Santo
175   -<p align="center"><a href="http://www.anybrowser.org/campaign/anybrowser_br.html" target="_blank"><img src="imgs/anybrowser.gif" alt="Vis&iacute;vel por qualquer browser" width="88" height="31" border="0"></a>
  205 +<p align="center">Desenvolvido pela Dataprev - Unidade Regional Esp&iacute;rito
  206 + Santo
  207 + <p align="center"><a href="http://www.anybrowser.org/campaign/anybrowser_br.html" target="_blank"><img src="imgs/anybrowser.gif" alt="Vis&iacute;vel por qualquer browser" width="88" height="31" border="0"></a>
176 208 </td></tr>
177 209 </table>
178 210 </body>
... ...
relatorios/alteracoes_hardware/index.php
... ... @@ -103,7 +103,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
103 103 </tr>
104 104 <tr>
105 105 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
106   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  106 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
107 107 </tr>
108 108 </table></td>
109 109 </tr>
... ... @@ -212,7 +212,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
212 212 </tr>
213 213 <tr>
214 214 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
215   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  215 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
216 216 </tr>
217 217 </table></td>
218 218 </tr>
... ... @@ -266,7 +266,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
266 266 </tr>
267 267 <tr>
268 268 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
269   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  269 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
270 270 </tr>
271 271 </table></td>
272 272 </tr>
... ...
relatorios/antivirus/index.php
... ... @@ -100,7 +100,7 @@
100 100 </tr>
101 101 <tr>
102 102 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
103   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  103 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
104 104 </tr>
105 105 </table></td>
106 106 <tr>
... ... @@ -173,7 +173,7 @@
173 173 </tr>
174 174 <tr>
175 175 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
176   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  176 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
177 177 </tr>
178 178 </table></td>
179 179 </tr>
... ... @@ -224,7 +224,7 @@
224 224 </tr>
225 225 <tr>
226 226 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
227   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  227 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
228 228 </tr>
229 229 </table></td>
230 230 </tr>
... ...
relatorios/computadores.php
... ... @@ -147,6 +147,15 @@ if ($_POST[&#39;consultar&#39;] || ($_GET[&#39;campo&#39;]))
147 147 $where1 .= " AND computadores.id_so = so.id_so ";
148 148 $where2 = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?" AND computadores.id_ip_rede = redes.id_ip_rede AND redes.id_local = loc.id_local ":'');
149 149 $where3 = ($_SESSION['cs_nivel_administracao']<>1&&$_SESSION['cs_nivel_administracao']<>2?' AND loc.id_local='.$_SESSION['id_local'].' ':'');
  150 +
  151 + if ($_SESSION['te_locais_secundarios'] && $where3)
  152 + {
  153 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  154 + $where3 = str_replace('loc.id_local=','(loc.id_local=',$where3);
  155 + $where3 .= ' OR loc.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  156 + }
  157 +
  158 +
150 159  
151 160 $query = $select1 . $from1 . $from2 . $where1 . $where2 . $where3 . $orderby;
152 161  
... ...
relatorios/hardware/index.php
... ... @@ -99,7 +99,7 @@
99 99 </tr>
100 100 <tr>
101 101 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
102   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  102 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
103 103 </tr>
104 104 </table></td>
105 105 <tr>
... ... @@ -170,7 +170,7 @@
170 170 </tr>
171 171 <tr>
172 172 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
173   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  173 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
174 174 </tr>
175 175 </table></td>
176 176 </tr>
... ... @@ -221,7 +221,7 @@
221 221 </tr>
222 222 <tr>
223 223 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
224   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  224 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
225 225 </tr>
226 226 </table></td>
227 227 </tr>
... ...
relatorios/inventario_softwares/index.php
... ... @@ -98,7 +98,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
98 98 </tr>
99 99 <tr>
100 100 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
101   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  101 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
102 102 </tr>
103 103 </table></td>
104 104 <tr>
... ... @@ -160,7 +160,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
160 160 </tr>
161 161 <tr>
162 162 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
163   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  163 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
164 164 </tr>
165 165 </table></td>
166 166 </tr>
... ...
relatorios/micros_ativos/index.php
... ... @@ -95,7 +95,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
95 95 </tr>
96 96 <tr>
97 97 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
98   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  98 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
99 99 </tr>
100 100 </table></td>
101 101 </tr>
... ... @@ -146,7 +146,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
146 146 </tr>
147 147 <tr>
148 148 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
149   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  149 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
150 150 </tr>
151 151 </table></td>
152 152 </tr>
... ...
relatorios/navegacao.php
... ... @@ -77,7 +77,16 @@ if ($_REQUEST[&#39;p&#39;]==&#39;&#39; &amp;&amp; $_REQUEST[&#39;consultar&#39;] == &#39;&#39;)
77 77 $where = '1';
78 78 }
79 79  
80   - $where1 = ($_SESSION['cs_nivel_administracao']<>1 && $_SESSION['cs_nivel_administracao']<>2?" AND computadores.id_ip_rede = redes.id_ip_rede AND redes.id_local=".$_SESSION['id_local']:'');
  80 + $where1 = ($_SESSION['cs_nivel_administracao']<>1 && $_SESSION['cs_nivel_administracao']<>2?" AND computadores.id_ip_rede = redes.id_ip_rede AND redes.id_local=".$_SESSION['id_local']:'');
  81 +
  82 +
  83 + if ($_SESSION['te_locais_secundarios'] && $where1)
  84 + {
  85 + // Faço uma inserção de "(" para ajuste da lógica para consulta
  86 + $where1 = str_replace('redes.id_local=','(redes.id_local=',$where1);
  87 + $where1 .= ' OR redes.id_local in ('.$_SESSION['te_locais_secundarios'].')) ';
  88 + }
  89 +
81 90  
82 91 $query_sel = "SELECT IF(TRIM(redes.nm_rede)='' OR redes.nm_rede is null,'Rede Desconhecida', redes.nm_rede) as nm_rede,
83 92 IF(TRIM(computadores.te_nome_computador)='' OR computadores.te_nome_computador is null,'Computador Desconhecido',computadores.te_nome_computador) as te_nome_computador,
... ...
relatorios/patrimonio/index.php
... ... @@ -157,7 +157,7 @@ require_once(&#39;../../include/library.php&#39;);
157 157 </tr>
158 158 <tr>
159 159 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
160   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  160 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
161 161 </tr>
162 162 </table></td>
163 163 </tr>
... ... @@ -212,12 +212,14 @@ require_once(&#39;../../include/library.php&#39;);
212 212 redes.id_local = pat.id_local ".
213 213 $where. '
214 214 ORDER BY te_etiqueta';
  215 +/*
215 216 if ($_SERVER['REMOTE_ADDR']=='10.71.0.58')
216 217 {
217 218 echo '<br>Debug para estação 10.71.0.58<br>';
218 219 echo 'Query Combo Informações, campos Entidade e Órgão:<br>';
219 220 echo $query . '<br>';
220 221 }
  222 +*/
221 223  
222 224 $result = mysql_query($query) or die('Erro na consulta à tabela "patrimonio_config_interface".');
223 225 while ($row = mysql_fetch_array($result))
... ... @@ -279,7 +281,7 @@ if ($_SERVER[&#39;REMOTE_ADDR&#39;]==&#39;10.71.0.58&#39;)
279 281 </tr>
280 282 <tr>
281 283 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
282   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  284 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
283 285 </tr>
284 286 </table></td>
285 287 </tr>
... ... @@ -312,13 +314,14 @@ if ($_SERVER[&#39;REMOTE_ADDR&#39;]==&#39;10.71.0.58&#39;)
312 314 redes.id_local = pat.id_local ".
313 315 $where . "
314 316 ORDER BY te_etiqueta";
315   -
  317 +/*
316 318 if ($_SERVER['REMOTE_ADDR']=='10.71.0.58')
317 319 {
318 320 echo '<br>Debug para estação 10.71.0.58<br>';
319 321 echo 'Query Combo Critérios - Parte 1:<br>';
320 322 echo $query . '<br>';
321 323 }
  324 +*/
322 325 $res_fields = mysql_query($query);
323 326 $nuContaCampo = 0;
324 327 while ($row_fields = mysql_fetch_array($res_fields))
... ... @@ -378,13 +381,14 @@ if ($_SERVER[&#39;REMOTE_ADDR&#39;]==&#39;10.71.0.58&#39;)
378 381 redes.id_local = pat.id_local ".
379 382 $where . "
380 383 ORDER BY te_etiqueta";
  384 +/*
381 385 if ($_SERVER['REMOTE_ADDR']=='10.71.0.58')
382 386 {
383 387 echo '<br>Debug para estação 10.71.0.58<br>';
384 388 echo 'Query Combo Critérios - Parte 2:<br>';
385 389 echo $query . '<br>';
386 390 }
387   -
  391 +*/
388 392 $res_fields = mysql_query($query);
389 393  
390 394 while ($row_fields = mysql_fetch_array($res_fields))
... ...
relatorios/software/index.php
... ... @@ -99,7 +99,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
99 99 </tr>
100 100 <tr>
101 101 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
102   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  102 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
103 103 </tr>
104 104 </table></td>
105 105 <tr>
... ... @@ -167,7 +167,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
167 167 </tr>
168 168 <tr>
169 169 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
170   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  170 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
171 171 </tr>
172 172 </table></td>
173 173 </tr>
... ... @@ -218,7 +218,7 @@ require_once(&#39;../../include/inicio_relatorios_inc.php&#39;);
218 218 </tr>
219 219 <tr>
220 220 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
221   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  221 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
222 222 </tr>
223 223 </table></td>
224 224 </tr>
... ...
relatorios/tcpip/index.php
... ... @@ -95,7 +95,7 @@
95 95 </tr>
96 96 <tr>
97 97 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
98   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  98 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
99 99 </tr>
100 100 </table></td>
101 101 <tr>
... ... @@ -169,7 +169,7 @@
169 169 </tr>
170 170 <tr>
171 171 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
172   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  172 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
173 173 </tr>
174 174 </table></td>
175 175 </tr>
... ... @@ -220,7 +220,7 @@
220 220 </tr>
221 221 <tr>
222 222 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
223   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  223 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
224 224 </tr>
225 225 </table></td>
226 226 </tr>
... ...
relatorios/variaveis_ambiente/index.php
... ... @@ -99,7 +99,7 @@
99 99 </tr>
100 100 <tr>
101 101 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
102   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  102 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
103 103 </tr>
104 104 </table></td>
105 105 <td valign="top">&nbsp;</td>
... ... @@ -161,7 +161,7 @@
161 161 </tr>
162 162 <tr>
163 163 <td class="descricao">&nbsp;&nbsp;&nbsp;(Dica:
164   - use SHIFT or CTRL para selecionar m&uacute;ltiplos itens)</td>
  164 + use SHIFT ou CTRL para selecionar m&uacute;ltiplos itens)</td>
165 165 </tr>
166 166 </table></td>
167 167 </tr>
... ...
top.php
... ... @@ -14,15 +14,24 @@
14 14 Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 15 */
16 16 session_start();
17   -$v_versao = '2.2.3';
  17 +$v_versao = '2.2.3-dev';
18 18 /*
19   -2.2.2 - Algumas correções lógicas:
  19 +2.2.3-dev (Anderson Peterle - Dataprev/ES - Março a Maio/2007)
  20 + + Implementada a opção de seleção de "Locais Secundários" nas janelas de inclusão e detalhes de usuários,
  21 + para simulação de pseudo "relação de confiança" entre usuários e locais, possibilitando a estes usuários
  22 + o acesso e manipulação das informações dos locais "confiantes";
  23 + + Implementado o detalhamento para as estatísticas exibidas na página principal quando representarem
  24 + mais de um local (local primário + local(is) secundário(s))
  25 + + Adequação das consultas ao conceito de "relação de confiança" implementado.
  26 +
  27 +2.2.2 (Anderson Peterle - Dataprev/ES - Fevereiro/2007)
20 28 * Corrigida a atribuição indevida do nome de usuário constande de resultado de Log de Atividades ao nome do usuário logado na aplicação;
21 29 * Corrigidas algumas correlações de "local" em consultas realizadas por usuários com níveis diferentes de "Administração" e "Gestão Central";
22 30 + Implementada a opção de seleção de Coletas de Sistemas Monitorados quando do cadastramento da subrede;
23 31 + Implementada a opção de seleção/alteração de Coletas de Sistemas Monitorados quando da edição de configurações da subrede.
24 32  
25   -2.2.1 - Efetuadas adaptações para suporte a base centralizada de dados, quando as subredes cadastradas
  33 +2.2.1 (Anderson Peterle - Dataprev/ES - Janeiro/2007)
  34 + Efetuadas adaptações para suporte a base centralizada de dados, quando as subredes cadastradas
26 35 passam a fazer parte de uma "localização" ou "local".
27 36 As adaptações impactaram na definição dos seguintes níveis de acesso:
28 37 1) Administração => Acesso irrestrito, com visão total de todos os dados de todos os "locais".
... ...