Commit 21baff3b6d0dc9648e110e16dc245f2413d82843
1 parent
1427e2e1
Exists in
master
and in
7 other branches
Novos ícones no editor de mapfiles e mudanças no plugin parametrssql para permit…
…ir mudar variaveis apos adicionar a camada ao mapa
Showing
11 changed files
with
195 additions
and
76 deletions
Show diff stats
admin/admin.db
No preview for this file type
1.82 KB
2.11 KB
admin/js/editormapfile.js
@@ -278,20 +278,21 @@ function montaNosRaiz(redesenha) | @@ -278,20 +278,21 @@ function montaNosRaiz(redesenha) | ||
278 | iconePlus = false; | 278 | iconePlus = false; |
279 | conteudo += "<b>("+$mapfiles[i].extensao+") </b>"; | 279 | conteudo += "<b>("+$mapfiles[i].extensao+") </b>"; |
280 | } | 280 | } |
281 | - conteudo += " <img style=\"width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i].codigo+"')\" title=excluir src=\"../imagens/01.png\" />"; | 281 | + conteudo += " <img style=\"margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i].codigo+"')\" title=excluir src=\"../imagens/01.png\" />"; |
282 | if(iconePlus) | 282 | if(iconePlus) |
283 | - {conteudo += " <img style=\"width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"clonarMapfile('"+$mapfiles[i].codigo+"')\" title='cria uma copia' src=\"../imagens/clonar.png\" />";} | ||
284 | - conteudo += " <img style=\"width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"limparCacheMapfile('"+$mapfiles[i].codigo+"')\" title='limpa o cache de imagens se houver' src=\"../imagens/limparcache.png\" />"; | ||
285 | - conteudo += " <img style=\"width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"editorTemaMapfile('"+$mapfiles[i].codigo+"')\" title='editar tema associado' src=\"../imagens/03.png\" />"; | 283 | + {conteudo += " <img style=\"margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"clonarMapfile('"+$mapfiles[i].codigo+"')\" title='cria uma copia' src=\"../imagens/clonar.png\" />";} |
284 | + conteudo += " <img style=\"margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"limparCacheMapfile('"+$mapfiles[i].codigo+"')\" title='limpa o cache de imagens se houver' src=\"../imagens/limparcache.png\" />"; | ||
285 | + conteudo += " <img style=\"margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"editorTemaMapfile('"+$mapfiles[i].codigo+"')\" title='editar tema associado' src=\"../imagens/03.png\" />"; | ||
286 | if(iconePlus){ | 286 | if(iconePlus){ |
287 | - conteudo += "<a style='border:solid white 0px;text-decoration:none;' href='../php/editortexto.php?mapfile="+$mapfiles[i].codigo+"' target=_self > <img title='Editor de textos' style=\"border:0px solid white;width:12px;position:relative;cursor:pointer;top:2px\" src=\"../imagens/06.png\" /></a>"; | 287 | + conteudo += "<a style='margin-left:2px;border:solid white 0px;text-decoration:none;' href='../php/editortexto.php?mapfile="+$mapfiles[i].codigo+"' target=_self > <img title='Editor de textos' style=\"border:0px solid white;width:12px;position:relative;cursor:pointer;top:2px\" src=\"../imagens/06.png\" /></a>"; |
288 | } | 288 | } |
289 | //opcao de download se for gvsig | 289 | //opcao de download se for gvsig |
290 | if($mapfiles[i].extensao === "gvp"){ | 290 | if($mapfiles[i].extensao === "gvp"){ |
291 | - conteudo += " <img style=\"width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"downloadGvp('"+$mapfiles[i].codigo+"')\" title='download' src=\"../imagens/down1.gif\" />"; | 291 | + conteudo += " <img style=\"margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"downloadGvp('"+$mapfiles[i].codigo+"')\" title='download' src=\"../imagens/down1.gif\" />"; |
292 | } | 292 | } |
293 | - conteudo += " <img style=\"width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"testarMapfile('"+$mapfiles[i].codigo+"','"+$mapfiles[i].extensao+"')\" title='testar!' src=\"../imagens/41.png\" />"; | ||
294 | - conteudo += " <img width=20px style=\"position:relative;cursor:pointer;top:2px\" onclick=\"javascript:window.open('../../interface/black_editor.php?&temaEdicao="+$mapfiles[i].codigo+"')\" title='abrir no i3Geo' src=\"../../imagens/i3geo2.jpg\" />"; | 293 | + conteudo += " <img style=\"margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px\" onclick=\"testarMapfile('"+$mapfiles[i].codigo+"','"+$mapfiles[i].extensao+"')\" title='testar!' src=\"../imagens/41.png\" />"; |
294 | + conteudo += " <img width=20px style=\"margin-left:2px;position:relative;cursor:pointer;top:2px\" onclick=\"javascript:window.open('../../interface/black_editor.php?&temaEdicao="+$mapfiles[i].codigo+"')\" title='editar no i3Geo' src=\"../imagens/i3geo2editor.jpg\" />"; | ||
295 | + conteudo += " <img width=20px style=\"margin-left:2px;position:relative;cursor:pointer;top:2px\" onclick=\"javascript:window.open('../../ms_criamapa.php?temasa="+$mapfiles[i].codigo+"&layers="+$mapfiles[i].codigo+"')\" title='testar no i3Geo' src=\"../imagens/i3geo2.jpg\" />"; | ||
295 | conteudo += "<b> <span>"+$mapfiles[i].codigo+" <span style=color:gray id='idNome_"+$mapfiles[i].codigo+"'>"+$mapfiles[i].nome+"</span></span>"; | 296 | conteudo += "<b> <span>"+$mapfiles[i].codigo+" <span style=color:gray id='idNome_"+$mapfiles[i].codigo+"'>"+$mapfiles[i].nome+"</span></span>"; |
296 | if($mapfiles[i].imagem != "" && $i("mostraMini").checked == true){ | 297 | if($mapfiles[i].imagem != "" && $i("mostraMini").checked == true){ |
297 | conteudo += "</b><br><img src='../../temas/miniaturas/"+$mapfiles[i].imagem+"'/>"; | 298 | conteudo += "</b><br><img src='../../temas/miniaturas/"+$mapfiles[i].imagem+"'/>"; |
admin/php/editormapfile.php
@@ -137,7 +137,6 @@ switch (strtoupper($funcao)) | @@ -137,7 +137,6 @@ switch (strtoupper($funcao)) | ||
137 | retornaJSON($layer->getmetadata("PLUGINI3GEO")); | 137 | retornaJSON($layer->getmetadata("PLUGINI3GEO")); |
138 | break; | 138 | break; |
139 | case "GRAVAPLUGIN": | 139 | case "GRAVAPLUGIN": |
140 | - //echo $plugin;exit; | ||
141 | $mapfile = $locaplic."/temas/".$codigoMap.".map"; | 140 | $mapfile = $locaplic."/temas/".$codigoMap.".map"; |
142 | $mapa = ms_newMapObj($mapfile); | 141 | $mapa = ms_newMapObj($mapfile); |
143 | $layer = $mapa->getlayerbyname($codigoLayer); | 142 | $layer = $mapa->getlayerbyname($codigoLayer); |
classesjs/classe_plugini3geo.js
@@ -102,6 +102,13 @@ i3GEO.pluginI3geo = | @@ -102,6 +102,13 @@ i3GEO.pluginI3geo = | ||
102 | formAdmin : function(plugin, configString) { | 102 | formAdmin : function(plugin, configString) { |
103 | return i3GEO.pluginI3geo[plugin].formAdmin(configString); | 103 | return i3GEO.pluginI3geo[plugin].formAdmin(configString); |
104 | }, | 104 | }, |
105 | + /** | ||
106 | + * Constroi um icone que sera adicionado na barra de icones do tema quando for adicionado na arvore de camadas | ||
107 | + * Esse icone e utilizado para reabrir o formulario de parametros | ||
108 | + */ | ||
109 | + iconeArvoreDeCamadas : function(nomecamada){ | ||
110 | + return i3GEO.pluginI3geo[plugin].iconeArvoreDeCamadas(nomecamada); | ||
111 | + }, | ||
105 | linkAjuda : function(plugin) { | 112 | linkAjuda : function(plugin) { |
106 | return i3GEO.pluginI3geo[plugin].linkAjuda(); | 113 | return i3GEO.pluginI3geo[plugin].linkAjuda(); |
107 | }, | 114 | }, |
@@ -234,6 +241,13 @@ i3GEO.pluginI3geo = | @@ -234,6 +241,13 @@ i3GEO.pluginI3geo = | ||
234 | + " Veja o exemplo utilizado no tema _lmapadecalor.map</p>"; | 241 | + " Veja o exemplo utilizado no tema _lmapadecalor.map</p>"; |
235 | return ins; | 242 | return ins; |
236 | }, | 243 | }, |
244 | + /** | ||
245 | + * Constroi um icone que sera adicionado na barra de icones do tema quando for adicionado na arvore de camadas | ||
246 | + * Esse icone e utilizado para reabrir o formulario de parametros | ||
247 | + */ | ||
248 | + iconeArvoreDeCamadas : function(nomecamada){ | ||
249 | + return false; | ||
250 | + }, | ||
237 | googlemaps : { | 251 | googlemaps : { |
238 | aplicaPropriedades : function(camada) { | 252 | aplicaPropriedades : function(camada) { |
239 | camada.sel = "nao"; | 253 | camada.sel = "nao"; |
@@ -511,6 +525,13 @@ i3GEO.pluginI3geo = | @@ -511,6 +525,13 @@ i3GEO.pluginI3geo = | ||
511 | 525 | ||
512 | return ins; | 526 | return ins; |
513 | }, | 527 | }, |
528 | + /** | ||
529 | + * Constroi um icone que sera adicionado na barra de icones do tema quando for adicionado na arvore de camadas | ||
530 | + * Esse icone e utilizado para reabrir o formulario de parametros | ||
531 | + */ | ||
532 | + iconeArvoreDeCamadas : function(nomecamada){ | ||
533 | + return false; | ||
534 | + }, | ||
514 | googlemaps : { | 535 | googlemaps : { |
515 | aplicaPropriedades : function(camada) { | 536 | aplicaPropriedades : function(camada) { |
516 | camada.sel = "nao"; | 537 | camada.sel = "nao"; |
@@ -853,6 +874,13 @@ i3GEO.pluginI3geo = | @@ -853,6 +874,13 @@ i3GEO.pluginI3geo = | ||
853 | + "<p>Veja o exemplo utilizado no tema _lmapakml.map</p>"; | 874 | + "<p>Veja o exemplo utilizado no tema _lmapakml.map</p>"; |
854 | return ins; | 875 | return ins; |
855 | }, | 876 | }, |
877 | + /** | ||
878 | + * Constroi um icone que sera adicionado na barra de icones do tema quando for adicionado na arvore de camadas | ||
879 | + * Esse icone e utilizado para reabrir o formulario de parametros | ||
880 | + */ | ||
881 | + iconeArvoreDeCamadas : function(nomecamada){ | ||
882 | + return false; | ||
883 | + }, | ||
856 | googlemaps : { | 884 | googlemaps : { |
857 | aplicaPropriedades : function(camada) { | 885 | aplicaPropriedades : function(camada) { |
858 | camada.sel = "nao"; | 886 | camada.sel = "nao"; |
@@ -996,6 +1024,8 @@ i3GEO.pluginI3geo = | @@ -996,6 +1024,8 @@ i3GEO.pluginI3geo = | ||
996 | } | 1024 | } |
997 | } | 1025 | } |
998 | }, | 1026 | }, |
1027 | + //TODO incluir um marcador que indique se o formulario sera aberto ao adicionar a camada ou nao | ||
1028 | + //TODO apos adicionar a camada, incluir icone que permita modificar os parametros | ||
999 | /** | 1029 | /** |
1000 | * Section: i3GEO.pluginI3geo.parametrossql | 1030 | * Section: i3GEO.pluginI3geo.parametrossql |
1001 | * | 1031 | * |
@@ -1018,8 +1048,9 @@ i3GEO.pluginI3geo = | @@ -1018,8 +1048,9 @@ i3GEO.pluginI3geo = | ||
1018 | * Exemplo: | 1048 | * Exemplo: |
1019 | * | 1049 | * |
1020 | * "PLUGINI3GEO" | 1050 | * "PLUGINI3GEO" |
1021 | - * '{"plugin":"parametrossql","parametros":{[{"titulo":"","tipo":"input|select","valores":[],"chave":"","php":""}]}}' | 1051 | + * '{"plugin":"parametrossql","parametros":{[{"titulo":"","tipo":"input|select","valores":[],"chave":"","prog":"","ativo":sim|nao}]}}' |
1022 | * | 1052 | * |
1053 | + * A opção "ativo" indica se o formulário será aberto ou não quando a camada for adicionada ao mapa | ||
1023 | */ | 1054 | */ |
1024 | parametrossql : { | 1055 | parametrossql : { |
1025 | linkAjuda : function() { | 1056 | linkAjuda : function() { |
@@ -1028,7 +1059,7 @@ i3GEO.pluginI3geo = | @@ -1028,7 +1059,7 @@ i3GEO.pluginI3geo = | ||
1028 | }, | 1059 | }, |
1029 | formAdmin : function(config) { | 1060 | formAdmin : function(config) { |
1030 | var n, i, parametros, ins = "", configDefault = | 1061 | var n, i, parametros, ins = "", configDefault = |
1031 | - '{"plugin":"parametrossql","parametros":[{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""},{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""},{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""},{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""}]}'; | 1062 | + '{"plugin":"parametrossql","ativo":"sim","parametros":[{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""},{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""},{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""},{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""}]}'; |
1032 | if (config === "") { | 1063 | if (config === "") { |
1033 | config = configDefault; | 1064 | config = configDefault; |
1034 | } | 1065 | } |
@@ -1038,7 +1069,18 @@ i3GEO.pluginI3geo = | @@ -1038,7 +1069,18 @@ i3GEO.pluginI3geo = | ||
1038 | } | 1069 | } |
1039 | parametros = config.parametros; | 1070 | parametros = config.parametros; |
1040 | n = 4; | 1071 | n = 4; |
1041 | - ins += "<table><tr><td>Título</td><td>Chave</td><td>Tipo (input ou select)</td><td>Valores</td><td>PHP que retorna os valores (opcional)</td></tr>"; | 1072 | + if(config.ativo == undefined){ |
1073 | + config.ativo = "sim"; | ||
1074 | + } | ||
1075 | + ins += "<p class='paragrafo'>Abre o formulário quando a camada é adicionada ao mapa: (true ou false)</p>"; | ||
1076 | + ins += "<select style='width:200px' id='parametrosSqlAtivo' ><option value='' ></option>"; | ||
1077 | + if(config.ativo === "nao"){ | ||
1078 | + ins += "<option value=sim >sim</option><option value=nao selected >nao</option></select>"; | ||
1079 | + } else{ | ||
1080 | + ins += "<option value=sim selected >sim</option><option value=nao >nao</option></select>"; | ||
1081 | + } | ||
1082 | + | ||
1083 | + ins += "<table><tr><td>Título</td><td>Chave</td><td>Tipo (input ou select)</td><td>Valores</td><td>PHP que retorna os valores (opcional)</td></tr>"; | ||
1042 | for (i = 0; i < n; i++) { | 1084 | for (i = 0; i < n; i++) { |
1043 | ins += "<tr><td><input name='titulo' type=text size=20 value='" | 1085 | ins += "<tr><td><input name='titulo' type=text size=20 value='" |
1044 | + parametros[i].titulo | 1086 | + parametros[i].titulo |
@@ -1054,7 +1096,8 @@ i3GEO.pluginI3geo = | @@ -1054,7 +1096,8 @@ i3GEO.pluginI3geo = | ||
1054 | + "' /></td> " | 1096 | + "' /></td> " |
1055 | + "<td><input name='prog' type=text size=20 value='" | 1097 | + "<td><input name='prog' type=text size=20 value='" |
1056 | + parametros[i].prog | 1098 | + parametros[i].prog |
1057 | - + "' /></td></tr>"; | 1099 | + + "' /></td> " |
1100 | + + "<td></tr>"; | ||
1058 | } | 1101 | } |
1059 | ins += | 1102 | ins += |
1060 | "</table>" | 1103 | "</table>" |
@@ -1063,6 +1106,7 @@ i3GEO.pluginI3geo = | @@ -1063,6 +1106,7 @@ i3GEO.pluginI3geo = | ||
1063 | + "<br>Será mostrado ao usuário um formulário com opções. Cada opção conterá um título e um campo de formulário" | 1106 | + "<br>Será mostrado ao usuário um formulário com opções. Cada opção conterá um título e um campo de formulário" |
1064 | + "<br>Cada campo de formulário pode ser dos tipos input (para digitar um valor) ou select (caixa de opções)." | 1107 | + "<br>Cada campo de formulário pode ser dos tipos input (para digitar um valor) ou select (caixa de opções)." |
1065 | + "<br>Em valores deve ser definida a lista ou o valor default que será mostrado. No caso de listas, utilize vírgula para separar os valores." | 1108 | + "<br>Em valores deve ser definida a lista ou o valor default que será mostrado. No caso de listas, utilize vírgula para separar os valores." |
1109 | + + "<br>Em ativo, é indicado com sim ou nao se o formulário será aberto quando a camada for adicionada ao mapa." | ||
1066 | + "<br>Como opcional, pode ser definido o endereço de um programa PHP que retorna a lista de nomes e valores que serão utilizados para preencher " | 1110 | + "<br>Como opcional, pode ser definido o endereço de um programa PHP que retorna a lista de nomes e valores que serão utilizados para preencher " |
1067 | + "o campo de escolha. Para mais informações, veja o mapfile i3geo/temas/_llocaliphp.map. O caminho desse arquivo PHP é relativo à pasta i3geo."; | 1111 | + "o campo de escolha. Para mais informações, veja o mapfile i3geo/temas/_llocaliphp.map. O caminho desse arquivo PHP é relativo à pasta i3geo."; |
1068 | return ins; | 1112 | return ins; |
@@ -1075,7 +1119,7 @@ i3GEO.pluginI3geo = | @@ -1075,7 +1119,7 @@ i3GEO.pluginI3geo = | ||
1075 | for (j = 0; j < nlinhas; j++) { | 1119 | for (j = 0; j < nlinhas; j++) { |
1076 | temp = []; | 1120 | temp = []; |
1077 | for (i = 0; i < ncampos; i++) { | 1121 | for (i = 0; i < ncampos; i++) { |
1078 | - if(campos[campo]){ | 1122 | + if(campos[campo] && campos[campo].name != ""){ |
1079 | temp.push('"'+campos[campo].name | 1123 | temp.push('"'+campos[campo].name |
1080 | + '" : "' | 1124 | + '" : "' |
1081 | + campos[campo].value | 1125 | + campos[campo].value |
@@ -1087,10 +1131,17 @@ i3GEO.pluginI3geo = | @@ -1087,10 +1131,17 @@ i3GEO.pluginI3geo = | ||
1087 | + temp.join(",") | 1131 | + temp.join(",") |
1088 | + "}"); | 1132 | + "}"); |
1089 | } | 1133 | } |
1090 | - return '{"plugin":"parametrossql","parametros":[' | 1134 | + return '{"plugin":"parametrossql","ativo":"' + $i("parametrosSqlAtivo").value + '","parametros":[' |
1091 | + par.join(",") | 1135 | + par.join(",") |
1092 | + ']}'; | 1136 | + ']}'; |
1093 | }, | 1137 | }, |
1138 | + /** | ||
1139 | + * Constroi um icone que sera adicionado na barra de icones do tema quando for adicionado na arvore de camadas | ||
1140 | + * Esse icone e utilizado para reabrir o formulario de parametros | ||
1141 | + */ | ||
1142 | + iconeArvoreDeCamadas : function(nomecamada){ | ||
1143 | + return false; | ||
1144 | + }, | ||
1094 | inicia : function(camada) { | 1145 | inicia : function(camada) { |
1095 | i3GEO.janela.fechaAguarde("aguardePlugin"); | 1146 | i3GEO.janela.fechaAguarde("aguardePlugin"); |
1096 | var iniciaform = function() { | 1147 | var iniciaform = function() { |
ferramentas/conectarwms/index.js
@@ -168,7 +168,7 @@ Veja: | @@ -168,7 +168,7 @@ Veja: | ||
168 | 168 | ||
169 | <TEMASWMS> | 169 | <TEMASWMS> |
170 | */ | 170 | */ |
171 | -function clickGuia3() | 171 | +function clickGuia3(codLayer) |
172 | { | 172 | { |
173 | var listatemas = function(retorno) | 173 | var listatemas = function(retorno) |
174 | { | 174 | { |
@@ -190,6 +190,8 @@ function clickGuia3() | @@ -190,6 +190,8 @@ function clickGuia3() | ||
190 | $i("textoSLD").style.display = "block"; | 190 | $i("textoSLD").style.display = "block"; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | + //ativa um layer caso tenha sido enviado como um parametro no inicio da ferramenta | ||
194 | + ativaAutoLayer(codLayer); | ||
193 | } | 195 | } |
194 | else | 196 | else |
195 | {$i("listatemas").innerHTML = "erro";} | 197 | {$i("listatemas").innerHTML = "erro";} |
@@ -209,6 +211,20 @@ function clickGuia3() | @@ -209,6 +211,20 @@ function clickGuia3() | ||
209 | cp.call(p,"temaswms",listatemas); | 211 | cp.call(p,"temaswms",listatemas); |
210 | } | 212 | } |
211 | } | 213 | } |
214 | +function ativaAutoLayer(codLayer){ | ||
215 | + if(codLayer && codLayer != ""){ | ||
216 | + var container = $i("listatemas"), | ||
217 | + rs = container.getElementsByTagName("input"), | ||
218 | + nrs = re.lenght, | ||
219 | + i,r; | ||
220 | + for(i = 0; i < nrs; i++){ | ||
221 | + r = rs[i]; | ||
222 | + if(r.type === "radio" && r.name === codLayer){ | ||
223 | + r.onclick.call(); | ||
224 | + } | ||
225 | + } | ||
226 | + } | ||
227 | +} | ||
212 | /* | 228 | /* |
213 | Function: registraws | 229 | Function: registraws |
214 | 230 |
ferramentas/conectarwms/listalayers.php
1 | +<?php | ||
2 | +/** | ||
3 | + * Este programa e utilizado pela ferramenta buscainde | ||
4 | + * E uma copia da ferramenta conctarwms sem mostrar as guias de esolha de servico | ||
5 | + * Isso pq o endereco do servico e um parametro obtido em $_GET["servico"] | ||
6 | + */ | ||
7 | +?> | ||
1 | <html> | 8 | <html> |
9 | + | ||
2 | <head> | 10 | <head> |
3 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | 11 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> |
4 | <link rel="stylesheet" type="text/css" href="../../css/i3geo_ferramentas6.css"> | 12 | <link rel="stylesheet" type="text/css" href="../../css/i3geo_ferramentas6.css"> |
@@ -43,11 +51,38 @@ p{ | @@ -43,11 +51,38 @@ p{ | ||
43 | </div> | 51 | </div> |
44 | </div> | 52 | </div> |
45 | <input type=hidden id=servico value="<?php echo $_GET["servico"];?>" /> | 53 | <input type=hidden id=servico value="<?php echo $_GET["servico"];?>" /> |
54 | + | ||
46 | <script src="../i3geo_tudo_compacto.js.php" type="text/javascript"></script> | 55 | <script src="../i3geo_tudo_compacto.js.php" type="text/javascript"></script> |
47 | <script type="text/javascript" src="index.js"></script> | 56 | <script type="text/javascript" src="index.js"></script> |
57 | + | ||
48 | <script type="text/javascript" > | 58 | <script type="text/javascript" > |
59 | +// | ||
60 | +//tenta pegar o codigo do layer do endereco do servico | ||
61 | +// | ||
62 | +var buscarEm = ["LAYER","LAYERS","layer","layers","tema","typename","typeName"], | ||
63 | + n = buscarEm.length, | ||
64 | + i,s,partes, | ||
65 | + b = [], | ||
66 | + codLayer = "", | ||
67 | + u = window.location.href; | ||
68 | + | ||
69 | +//acrescenta novas strings | ||
70 | +for(i = 0; i < n; i++){ | ||
71 | + b.push("&" + buscarEm[i] + "="); | ||
72 | + b.push("?" + buscarEm[i] + "="); | ||
73 | +} | ||
74 | +n = b.length; | ||
75 | +//quebra as strings pra achar o padrao | ||
76 | +for(i = 0; i < n; i++){ | ||
77 | + s = b[i]; | ||
78 | + partes = u.split(s); | ||
79 | + if(partes.length > 1){ | ||
80 | + partes = partes[1].split("&"); | ||
81 | + codLayer = partes[0]; | ||
82 | + } | ||
83 | +} | ||
49 | g_locaplic = "../.."; | 84 | g_locaplic = "../.."; |
50 | -clickGuia3(); | 85 | +clickGuia3(codLayer); |
51 | </script> | 86 | </script> |
52 | </body> | 87 | </body> |
53 | </html> | 88 | </html> |
ferramentas/parametrossql/exec.php
@@ -16,6 +16,8 @@ Aplica a substituicao de chaves pelos valores enviados | @@ -16,6 +16,8 @@ Aplica a substituicao de chaves pelos valores enviados | ||
16 | //pega o layer | 16 | //pega o layer |
17 | $nomeLayer = ""; | 17 | $nomeLayer = ""; |
18 | $c = $map->numlayers; | 18 | $c = $map->numlayers; |
19 | + //obtem o layer existente no mapfile | ||
20 | + //esse layer pode conter o nome no metadata nomeoriginal ou em NAME | ||
19 | for ($i=0;$i < $c;++$i){ | 21 | for ($i=0;$i < $c;++$i){ |
20 | $layer = $map->getlayer($i); | 22 | $layer = $map->getlayer($i); |
21 | if($layer->name == $tema){ | 23 | if($layer->name == $tema){ |
@@ -31,68 +33,69 @@ Aplica a substituicao de chaves pelos valores enviados | @@ -31,68 +33,69 @@ Aplica a substituicao de chaves pelos valores enviados | ||
31 | } | 33 | } |
32 | else{ | 34 | else{ |
33 | $layer = $map->getlayerbyname($nomeLayer); | 35 | $layer = $map->getlayerbyname($nomeLayer); |
34 | - $data = $layer->data; | ||
35 | - //pega as chaves do proprio mapfile | ||
36 | - $c = $layer->getmetadata("PLUGINI3GEO"); | ||
37 | - if($c == ""){ | ||
38 | - //tenta pegar os parametros do arquivo mapfile original | ||
39 | - $map1 = ms_newMapObj($locaplic."/temas/".$nomeLayer.".map"); | ||
40 | - $layer1 = $map1->getlayerbyname($nomeLayer); | ||
41 | - $c = $layer1->getmetadata("PLUGINI3GEO"); | ||
42 | - if($c == ""){ | ||
43 | - $retorno = "erro"; | ||
44 | - } | 36 | + //os parametros do plugin sao obtidos do mapfile original |
37 | + //isso evita que o mapfile temporario contenha as informacoes | ||
38 | + //sobre as variaveis de substituicao | ||
39 | + if(file_exists($locaplic."/temas/".$nomeLayer.".map")){ | ||
40 | + $map1 = @ms_newMapObj($locaplic."/temas/".$nomeLayer.".map"); | ||
45 | } | 41 | } |
46 | - if($c != ""){ | ||
47 | - $cs = json_decode($c,true); | ||
48 | - $cs = $cs["parametros"]; | ||
49 | - $chaves = array(); | ||
50 | - foreach($cs as $c){ | ||
51 | - $chaves[] = $c["chave"]; | ||
52 | - } | ||
53 | - $chaves = implode(",",$chaves); | ||
54 | - //verifica se o layer ja teve os parametros substituidos anteriormente | ||
55 | - //nesse caso, o data he obtido do metadata que guarda o valor original | ||
56 | - if($layer->getmetadata("DATAORIGINAL") != ""){ | ||
57 | - $data = $layer->getmetadata("DATAORIGINAL"); | ||
58 | - } | ||
59 | - else{ | ||
60 | - $layer->setmetadata("DATAORIGINAL",$data); | ||
61 | - } | ||
62 | - $filtro = $layer->getFilterString(); | ||
63 | - if($layer->getmetadata("FILTROORIGINAL") != ""){ | ||
64 | - $filtro = $layer->getmetadata("FILTROORIGINAL"); | ||
65 | - } | ||
66 | - else{ | ||
67 | - $layer->setmetadata("FILTROORIGINAL",$filtro); | ||
68 | - } | ||
69 | - $chaves = str_ireplace(array("and", "or", "select","from","where","update","delete","insert","--"),"",$chaves); | ||
70 | - $chaves = explode(",",$chaves); | ||
71 | - $valores = str_ireplace(array("and", "or", "select","from","where","update","delete","insert","--"),"",$valores); | ||
72 | - $valores = explode(",",strip_tags($valores)); | ||
73 | - $n = count($chaves); | ||
74 | - for($i = 0; $i < $n; $i++){ | ||
75 | - if($chaves[$i] != ""){ | ||
76 | - $v = $valores[$i]; | ||
77 | - $data = str_replace($chaves[$i],$v,$data); | ||
78 | - if($filtro != ""){ | ||
79 | - $filtro = str_replace($chaves[$i],$v,$filtro); | 42 | + elseif (file_exists($locaplic."/temas/".$layer->getmetadata("nomeoriginal").".map")){ |
43 | + $map1 = @ms_newMapObj($locaplic."/temas/".$layer->getmetadata("nomeoriginal").".map"); | ||
44 | + } | ||
45 | + if($map1){ | ||
46 | + $layer1 = $map1->getlayerbyname($nomeLayer); | ||
47 | + if($layer1 != ""){ | ||
48 | + $data = $layer1->data; | ||
49 | + $c = $layer1->getmetadata("PLUGINI3GEO"); | ||
50 | + if($c == ""){ | ||
51 | + $retorno = "erro"; | ||
52 | + } | ||
53 | + if($c != ""){ | ||
54 | + $cs = json_decode($c,true); | ||
55 | + $cs = $cs["parametros"]; | ||
56 | + $chaves = array(); | ||
57 | + foreach($cs as $c){ | ||
58 | + $chaves[] = $c["chave"]; | ||
80 | } | 59 | } |
60 | + $chaves = implode(",",$chaves); | ||
61 | + $filtro = $layer1->getFilterString(); | ||
62 | + if(!empty($valores)){ | ||
63 | + $chaves = str_ireplace(array("and", "or", "select","from","where","update","delete","insert","--"),"",$chaves); | ||
64 | + $chaves = explode(",",$chaves); | ||
65 | + $valores = str_ireplace(array("and", "or", "select","from","where","update","delete","insert","--"),"",$valores); | ||
66 | + $valores = explode(",",strip_tags($valores)); | ||
67 | + $n = count($chaves); | ||
68 | + for($i = 0; $i < $n; $i++){ | ||
69 | + if($chaves[$i] != ""){ | ||
70 | + $v = $valores[$i]; | ||
71 | + $data = str_replace($chaves[$i],$v,$data); | ||
72 | + if($filtro != ""){ | ||
73 | + $filtro = str_replace($chaves[$i],$v,$filtro); | ||
74 | + } | ||
75 | + } | ||
76 | + } | ||
77 | + if($filtro != ""){ | ||
78 | + $layer->setfilter($filtro); | ||
79 | + } | ||
80 | + $layer->set("data",$data); | ||
81 | + } | ||
82 | + $layer->set("status",MS_DEFAULT); | ||
83 | + $layer->setmetadata("PLUGINI3GEO",'{"plugin":"parametrossql","ativo":"sim","parametros":[{"titulo":"","tipo":"input","valores":[],"chave":"","prog":""}'); | ||
84 | + $layer->setmetadata("TEMA",$layer->getmetadata("TEMA")." - ".implode(",",$valores)); | ||
85 | + $layer->set("name","plugin".nomeRandomico()); | ||
86 | + if (connection_aborted()){ | ||
87 | + exit(); | ||
88 | + } | ||
89 | + $salvo = $map->save($map_file); | ||
90 | + $retorno = "ok"; | ||
81 | } | 91 | } |
82 | } | 92 | } |
83 | - if($filtro != ""){ | ||
84 | - $layer->setfilter($filtro); | 93 | + else{ |
94 | + $retorno = "layer $nomeLayer nao encontrado"; | ||
85 | } | 95 | } |
86 | - $layer->set("data",$data); | ||
87 | - $layer->set("status",MS_DEFAULT); | ||
88 | - $layer->setmetadata("PLUGINI3GEO",""); | ||
89 | - $layer->setmetadata("TEMA",$layer->getmetadata("TEMA")." - ".implode(",",$valores)); | ||
90 | - $layer->set("name","plugin".nomeRandomico()); | ||
91 | - if (connection_aborted()){ | ||
92 | - exit(); | ||
93 | - } | ||
94 | - $salvo = $map->save($map_file); | ||
95 | - $retorno = "ok"; | 96 | + } |
97 | + else{ | ||
98 | + $retorno = "mapfile nao encontrado em temas"; | ||
96 | } | 99 | } |
97 | } | 100 | } |
98 | break; | 101 | break; |
ferramentas/parametrossql/index.js
@@ -106,6 +106,20 @@ i3GEOF.parametrossql = { | @@ -106,6 +106,20 @@ i3GEOF.parametrossql = { | ||
106 | Cria a janela flutuante para controle da ferramenta. | 106 | Cria a janela flutuante para controle da ferramenta. |
107 | */ | 107 | */ |
108 | iniciaJanelaFlutuante: function(camada){ | 108 | iniciaJanelaFlutuante: function(camada){ |
109 | + //verifica se deve ser aberto o formulario | ||
110 | + if(camada.plugini3geo.ativo != undefined && camada.plugini3geo.ativo === "nao"){ | ||
111 | + fim = function(){ | ||
112 | + i3GEO.atualiza(); | ||
113 | + }; | ||
114 | + p = i3GEO.configura.locaplic+"/ferramentas/parametrossql/exec.php?g_sid="+i3GEO.configura.sid | ||
115 | + + "&funcao=aplicar" | ||
116 | + + "&tema=" + camada.name | ||
117 | + + "&chaves=&valores="; | ||
118 | + cp = new cpaint(); | ||
119 | + cp.set_response_type("JSON"); | ||
120 | + cp.call(p,"foo",fim); | ||
121 | + return; | ||
122 | + } | ||
109 | var minimiza,cabecalho,janela,divid,temp,titulo; | 123 | var minimiza,cabecalho,janela,divid,temp,titulo; |
110 | if($i("i3GEOF.parametrossql")){ | 124 | if($i("i3GEOF.parametrossql")){ |
111 | i3GEOF.parametrossql.inicia("i3GEOF.parametrossql_corpo",camada); | 125 | i3GEOF.parametrossql.inicia("i3GEOF.parametrossql_corpo",camada); |
temas/_llocaliphp.map
@@ -4,6 +4,7 @@ MAP | @@ -4,6 +4,7 @@ MAP | ||
4 | LAYER | 4 | LAYER |
5 | CONNECTION "" | 5 | CONNECTION "" |
6 | DATA "/var/www/i3geo/aplicmap/dados/locali.shp" | 6 | DATA "/var/www/i3geo/aplicmap/dados/locali.shp" |
7 | + FILTER (([ANOCRIA] = 1990)) | ||
7 | METADATA | 8 | METADATA |
8 | "METAESTAT_ID_MEDIDA_VARIAVEL" "" | 9 | "METAESTAT_ID_MEDIDA_VARIAVEL" "" |
9 | "TIP" "TIPO,NOMELOC,ANOCRIA" | 10 | "TIP" "TIPO,NOMELOC,ANOCRIA" |
@@ -35,7 +36,7 @@ MAP | @@ -35,7 +36,7 @@ MAP | ||
35 | "permitecomentario" "SIM" | 36 | "permitecomentario" "SIM" |
36 | "LTEMPOITEMICONE" "" | 37 | "LTEMPOITEMICONE" "" |
37 | "metaestat" "" | 38 | "metaestat" "" |
38 | - "PLUGINI3GEO" '{"plugin":"parametrossql","parametros":[{"titulo" : "Ano de criação","chave" : "1990","tipo" : "input","valores" : "","prog" : "aplicmap/dados/listaano.php"},{"titulo" : "","chave" : "","tipo" : "input","valores" : "","prog" : ""},{"titulo" : "","chave" : "","tipo" : "input","valores" : "","prog" : ""},{"titulo" : "","chave" : "","tipo" : "input","valores" : "","prog" : ""}]}' | 39 | + "PLUGINI3GEO" '{"plugin":"parametrossql","ativo":"nao","parametros":[{"titulo" : "Ano de criação","chave" : "1990","tipo" : "input","valores" : "","prog" : "aplicmap/dados/listaano.php"},{"titulo" : "","chave" : "","tipo" : "input","valores" : "","prog" : ""},{"titulo" : "","chave" : "","tipo" : "input","valores" : "","prog" : ""},{"titulo" : "","chave" : "","tipo" : "input","valores" : "","prog" : ""}]}' |
39 | "download" "SIM" | 40 | "download" "SIM" |
40 | "itembuscarapida" "NOMELOC" | 41 | "itembuscarapida" "NOMELOC" |
41 | "ITENS" "NOMEMUN,TIPO,NOMELOC,ANOCRIA" | 42 | "ITENS" "NOMEMUN,TIPO,NOMELOC,ANOCRIA" |
@@ -57,7 +58,6 @@ MAP | @@ -57,7 +58,6 @@ MAP | ||
57 | TEMPLATE "none.htm" | 58 | TEMPLATE "none.htm" |
58 | TILEITEM "location" | 59 | TILEITEM "location" |
59 | TYPE POINT | 60 | TYPE POINT |
60 | - FILTER (([ANOCRIA] = 1990)) | ||
61 | UNITS METERS | 61 | UNITS METERS |
62 | CLASS | 62 | CLASS |
63 | NAME "Vila" | 63 | NAME "Vila" |