Commit 58b26ea734d95daa5d75c4083eb776371ca2be80
1 parent
bc61c9e9
Exists in
master
and in
7 other branches
$1
Showing
5 changed files
with
79 additions
and
10 deletions
Show diff stats
admin/js/estat_conexao.js
... | ... | @@ -5,7 +5,7 @@ i3GEOadmin.conexao = { |
5 | 5 | dados: "", |
6 | 6 | letra: "", |
7 | 7 | dataTable: null, |
8 | - colunas: ["codigo_estat_conexao","bancodedados","host","porta","usuario","senha"], | |
8 | + colunas: ["codigo_estat_conexao","bancodedados","host","porta","usuario","senha","fonte"], | |
9 | 9 | formatTexto: function(elCell, oRecord, oColumn, oData){ |
10 | 10 | if(oData === ""){ |
11 | 11 | oData = "<span style='color:gray' ></span>"; |
... | ... | @@ -13,10 +13,14 @@ i3GEOadmin.conexao = { |
13 | 13 | elCell.innerHTML = "<pre ><p style=cursor:default >" + oData + "</pre>"; |
14 | 14 | }, |
15 | 15 | formatExclui: function(elCell, oRecord, oColumn){ |
16 | - elCell.innerHTML = "<div title='exclui' class=excluir style='text-align:center' ></div>"; | |
16 | + if(oRecord.getData("fonte") == "metaestat"){ | |
17 | + elCell.innerHTML = "<div title='exclui' class=excluir style='text-align:center' ></div>"; | |
18 | + } | |
17 | 19 | }, |
18 | 20 | formatMais: function(elCell, oRecord, oColumn){ |
19 | - elCell.innerHTML = "<div class=editar style='text-align:center' ></div>"; | |
21 | + if(oRecord.getData("fonte") == "metaestat"){ | |
22 | + elCell.innerHTML = "<div class=editar style='text-align:center' ></div>"; | |
23 | + } | |
20 | 24 | }, |
21 | 25 | formatSenha: function(elCell, oRecord, oColumn){ |
22 | 26 | elCell.innerHTML = "A senha deve ser editada diretamente no banco de dados de administração. Veja o i3geo/ms_configura.php para saber qual é o banco."; |
... | ... | @@ -30,6 +34,7 @@ i3GEOadmin.conexao = { |
30 | 34 | {label:"Host",resizeable:true,key:"host", formatter:i3GEOadmin.conexao.formatTexto}, |
31 | 35 | {label:"Porta",key:"porta",formatter:i3GEOadmin.conexao.formatTexto}, |
32 | 36 | {label:"Usuário",key:"usuario",formatter:i3GEOadmin.conexao.formatTexto}, |
37 | + {label:"Fonte",key:"fonte",formatter:i3GEOadmin.conexao.formatTexto}, | |
33 | 38 | {label:"Senha",key:"senha",formatter:i3GEOadmin.conexao.formatSenha} |
34 | 39 | ]; |
35 | 40 | }, |
... | ... | @@ -87,7 +92,11 @@ i3GEOadmin.conexao = { |
87 | 92 | YAHOO.conexao.panelCK = null; |
88 | 93 | } |
89 | 94 | if (column.key == 'excluir'){ |
90 | - i3GEOadmin.conexao.exclui(registro.getData('codigo_estat_conexao'),target); | |
95 | + if(registro.getData('fonte')){ | |
96 | + alert("Nao pode ser editado. Veja em ms_configura.php"); | |
97 | + return; | |
98 | + } | |
99 | + //i3GEOadmin.conexao.exclui(registro.getData('codigo_estat_conexao'),target); | |
91 | 100 | } |
92 | 101 | if (column.key == 'mais'){ |
93 | 102 | core_carregando("ativa"); |
... | ... | @@ -225,4 +234,4 @@ i3GEOadmin.conexao = { |
225 | 234 | }; |
226 | 235 | core_makeRequest(sUrl,callback); |
227 | 236 | } |
228 | -}; | |
229 | 237 | \ No newline at end of file |
238 | +}; | ... | ... |
admin/js/estat_editor.js
... | ... | @@ -29,7 +29,7 @@ i3GEOadmin.editor = { |
29 | 29 | var dados = YAHOO.lang.JSON.parse(o.responseText), |
30 | 30 | temp = "<p>Escolha a conexão com o banco: "; |
31 | 31 | temp += "<select id='i3GEOadmincodigo_estat_conexao' onchange='i3GEOadmin.editor.esquema.lista()'>"; |
32 | - temp += core_comboObjeto(dados,"codigo_estat_conexao","bancodedados","","usuario"); | |
32 | + temp += core_comboObjeto(dados,"codigo_estat_conexao","bancodedados","","codigo_estat_conexao"); | |
33 | 33 | temp += "</select></p>"; |
34 | 34 | $i(i3GEOadmin.editor.conexao.onde).innerHTML = temp; |
35 | 35 | core_carregando("desativa"); | ... | ... |
admin/php/classe_metaestat.php
... | ... | @@ -1792,7 +1792,7 @@ class Metaestat{ |
1792 | 1792 | return $regioes; |
1793 | 1793 | } |
1794 | 1794 | /** |
1795 | - * Lista os dads de uma conexao ou de todas | |
1795 | + * Lista os dados de uma conexao ou de todas | |
1796 | 1796 | * @param id da conexao |
1797 | 1797 | * @param boolean inclui na lista a senha ou nao |
1798 | 1798 | */ |
... | ... | @@ -1808,7 +1808,50 @@ class Metaestat{ |
1808 | 1808 | $sql .= "WHERE codigo_estat_conexao = $codigo_estat_conexao "; |
1809 | 1809 | } |
1810 | 1810 | $sql .= "ORDER BY bancodedados,host,usuario"; |
1811 | - return $this->execSQL($sql,$codigo_estat_conexao); | |
1811 | + $res = $this->execSQL($sql,$codigo_estat_conexao); | |
1812 | + //se achou e a requisico e para listar uma conexao, retorna o que for encontrado | |
1813 | + $cres = count($res); | |
1814 | + if($cres > 0 && $codigo_estat_conexao != "" && !empty($cres[0]["dbname"])){ | |
1815 | + return $res; | |
1816 | + } | |
1817 | + //caso contrario, e deve retornar todas as conexoes, inclui a fonte | |
1818 | + if($codigo_estat_conexao == ""){ | |
1819 | + for($i=0; $i<$cres;$i++){ | |
1820 | + $res[$i]["fonte"] = "metaestat"; | |
1821 | + } | |
1822 | + } | |
1823 | + //obtem as conexoes definidas em ms_configgura.php | |
1824 | + if(!isset($postgis_mapa)){ | |
1825 | + require(dirname(__FILE__)."/../../ms_configura.php"); | |
1826 | + } | |
1827 | + if(!empty($postgis_mapa)){ | |
1828 | + foreach(array_keys($postgis_mapa) as $key){ | |
1829 | + $lista = explode(" ",$postgis_mapa[$key]); | |
1830 | + $con = array(); | |
1831 | + foreach($lista as $l){ | |
1832 | + $teste = explode("=",$l); | |
1833 | + $con[trim($teste[0])] = trim($teste[1]); | |
1834 | + } | |
1835 | + $c = array( | |
1836 | + "codigo_estat_conexao" => $key, | |
1837 | + "bancodedados" => $con["dbname"], | |
1838 | + "host" => $con["host"], | |
1839 | + "porta" => $con["port"], | |
1840 | + "usuario" => $con["user"], | |
1841 | + "fonte" => "ms_configura" | |
1842 | + ); | |
1843 | + if($senha == true){ | |
1844 | + $c["senha"] = $con["password"]; | |
1845 | + } | |
1846 | + $res[] = $c; | |
1847 | + if($codigo_estat_conexao != "" && $codigo_estat_conexao == $key){ | |
1848 | + return $c; | |
1849 | + } | |
1850 | + } | |
1851 | + } | |
1852 | + //echo "<pre>"; | |
1853 | + //var_dump($res);exit; | |
1854 | + return $res; | |
1812 | 1855 | } |
1813 | 1856 | function listaParametroTempo2CampoData($id_medida_variavel,$prefixoAlias = ""){ |
1814 | 1857 | //lista os parametros temporais | ... | ... |
ferramentas/salvamapa/index.js
... | ... | @@ -151,8 +151,9 @@ i3GEOF.salvaMapa = { |
151 | 151 | }; |
152 | 152 | i3GEO.php.salvaMapaBanco(temp,titulo,id_mapa,true,true); |
153 | 153 | }; |
154 | - texto = $trad(7,i3GEOF.salvaMapa.dicionario)+"<br><input id=salvamapaId type=text /><br><br>"+$trad(15,i3GEOF.salvaMapa.dicionario); | |
154 | + texto = $trad(7,i3GEOF.salvaMapa.dicionario)+"<br><div id=i3GEOFsalvamapaMapa ></div><br><br>"+$trad(15,i3GEOF.salvaMapa.dicionario); | |
155 | 155 | i3GEO.janela.prompt(texto + "<br><br>"+$trad(8,i3GEOF.salvaMapa.dicionario),funcaoOK); |
156 | + i3GEOF.salvaMapa.comboMapas("i3GEOFsalvamapaMapa"); | |
156 | 157 | } |
157 | 158 | }, |
158 | 159 | /* |
... | ... | @@ -202,5 +203,21 @@ i3GEOF.salvaMapa = { |
202 | 203 | divid = janela[2].id; |
203 | 204 | i3GEOF.salvaMapa.aguarde = $i("i3GEOF.salvaMapa_imagemCabecalho").style; |
204 | 205 | i3GEOF.salvaMapa.inicia(divid); |
206 | + }, | |
207 | + comboMapas: function(onde){ | |
208 | + var p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaMapas", | |
209 | + combo = function(retorno){ | |
210 | + var n = retorno.length, | |
211 | + i, | |
212 | + ins = "" + | |
213 | + "<select id='i3GEOFsalvamapaMapa' >" + | |
214 | + " <option value=''>---</option>"; | |
215 | + for(i=0;i<n;i++){ | |
216 | + ins += "<option value='"+retorno[i].id_mapa+"'>"+retorno[i].id_mapa+" - "+retorno[i].titulo+"</option>"; | |
217 | + } | |
218 | + ins += "</select>"; | |
219 | + $i(onde).innerHTML = ins; | |
220 | + }; | |
221 | + i3GEO.util.ajaxGet(p,combo); | |
205 | 222 | } |
206 | 223 | }; | ... | ... |
ms_configura.php
... | ... | @@ -353,7 +353,7 @@ Tipo: |
353 | 353 | */ |
354 | 354 | $postgis_mapa = array( |
355 | 355 | "teste"=>"user=postgres password=postgres dbname=postgis host=localhost port=5432 options='-c client_encoding=LATIN1'", |
356 | - "postgres"=>"user=postgres password=postgres dbname=postgis host=localhost port=5432", | |
356 | + "postgres"=>"user=postgres password=postgres dbname=postgres host=localhost port=5432", | |
357 | 357 | ); |
358 | 358 | /* |
359 | 359 | Variable: utilizacgi | ... | ... |