Commit 51f143c312bed6cc96d588799ef7c502d395376a
1 parent
789cd359
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
40 additions
and
15 deletions
Show diff stats
testamapfile.php
@@ -73,6 +73,9 @@ $versao = $versao["principal"]; | @@ -73,6 +73,9 @@ $versao = $versao["principal"]; | ||
73 | ms_ResetErrorList(); | 73 | ms_ResetErrorList(); |
74 | if(!isset($tipo)) | 74 | if(!isset($tipo)) |
75 | {$tipo = "";} | 75 | {$tipo = "";} |
76 | +$arqs = listaArquivos("temas"); | ||
77 | +sort($arqs["arquivos"]); | ||
78 | + | ||
76 | if ($tipo == "") | 79 | if ($tipo == "") |
77 | { | 80 | { |
78 | echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; | 81 | echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; |
@@ -83,20 +86,26 @@ if ($tipo == "") | @@ -83,20 +86,26 @@ if ($tipo == "") | ||
83 | echo '</head><script>function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}</script>'; | 86 | echo '</head><script>function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}</script>'; |
84 | echo '<body class="fundoPonto"><center><div class="bordaSuperior" > </div><div class="mascaraPrincipal" id="divGeral">'; | 87 | echo '<body class="fundoPonto"><center><div class="bordaSuperior" > </div><div class="mascaraPrincipal" id="divGeral">'; |
85 | echo '<form action="testamapfile.php" method="post" id=f >'; | 88 | echo '<form action="testamapfile.php" method="post" id=f >'; |
86 | - echo 'Nome do arquivo map existente no diretório i3geo/temas. Exemplo para uso manual da URL: testamapfile.php?map=biomashp (utilize "testamapfile.php?map=todos" na URL para testar todos de uma só vez):<br><br><input id=nomemap class=digitar type="file" size=20 ><input id=map type="hidden" value="" name="map"><input type="button" onclick="roda()" class=executar value="Testar" size=10 name="submit">'; | ||
87 | - echo '<br>Mostra apenas a legenda? <input type=radio name=solegenda value=sim />sim <input type=radio name=solegenda value=nao CHECKED /> não<br></form>'; | 89 | + echo 'Nome do arquivo map existente no diretório i3geo/temas. Exemplo para uso manual da URL: testamapfile.php?map=biomashp (utilize "testamapfile.php?map=todos" na URL para testar todos de uma só vez)<br><br>'; |
90 | + echo '<br>Mostra apenas a legenda? <input type=radio name=solegenda value=sim />sim <input type=radio name=solegenda value=nao CHECKED /> não<br>'; | ||
91 | + $combo = "<br><select onchange='roda()' id=nomemap ><option value=''>Escolha o arquivo para testar</option>"; | ||
92 | + foreach ($arqs["arquivos"] as $arq){ | ||
93 | + $temp = explode(".",$arq); | ||
94 | + if($temp[1] == "map"){ | ||
95 | + $combo .= "<option value='".$temp[0]."'>".$temp[0]."</option>"; | ||
96 | + } | ||
97 | + } | ||
98 | + echo $combo."</select></form><br>"; | ||
88 | } | 99 | } |
89 | if (isset($map) && $map != "") | 100 | if (isset($map) && $map != "") |
90 | { | 101 | { |
91 | if(!isset($solegenda)){$solegenda = "nao";} | 102 | if(!isset($solegenda)){$solegenda = "nao";} |
92 | if ($map == "todos") | 103 | if ($map == "todos") |
93 | { | 104 | { |
94 | - $tipo = "todos"; | ||
95 | - $arqs = listaArquivos("temas"); | 105 | + $tipo = "todos"; |
96 | $conta = 0; | 106 | $conta = 0; |
97 | echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; | 107 | echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; |
98 | if (!isset($iniciar)){$iniciar = 0;} | 108 | if (!isset($iniciar)){$iniciar = 0;} |
99 | - sort($arqs["arquivos"]); | ||
100 | foreach ($arqs["arquivos"] as $arq) | 109 | foreach ($arqs["arquivos"] as $arq) |
101 | { | 110 | { |
102 | if (($conta >= $iniciar) && ($conta < $iniciar+10)) | 111 | if (($conta >= $iniciar) && ($conta < $iniciar+10)) |
@@ -114,9 +123,9 @@ if (isset($map) && $map != "") | @@ -114,9 +123,9 @@ if (isset($map) && $map != "") | ||
114 | else | 123 | else |
115 | {verifica($map,$solegenda);} | 124 | {verifica($map,$solegenda);} |
116 | } | 125 | } |
117 | - echo '</div>'; | ||
118 | - echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>'; | ||
119 | - echo '</body></html>'; | 126 | +echo '</div>'; |
127 | +echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>'; | ||
128 | +echo '</body></html>'; | ||
120 | function verifica($map,$solegenda) | 129 | function verifica($map,$solegenda) |
121 | { | 130 | { |
122 | global $tipo,$locaplic,$postgis_mapa,$versao,$base; | 131 | global $tipo,$locaplic,$postgis_mapa,$versao,$base; |
@@ -180,6 +189,26 @@ function verifica($map,$solegenda) | @@ -180,6 +189,26 @@ function verifica($map,$solegenda) | ||
180 | {$base = $locaplic."/aplicmap/".$base;} | 189 | {$base = $locaplic."/aplicmap/".$base;} |
181 | } | 190 | } |
182 | $mapa = ms_newMapObj($base); | 191 | $mapa = ms_newMapObj($base); |
192 | + error_reporting(0); | ||
193 | + $temasn = $mapa->getAllLayerNames(); | ||
194 | + foreach ($temasn as $teman) | ||
195 | + { | ||
196 | + $layern = $mapa->getLayerByName($teman); | ||
197 | + if (!empty($postgis_mapa)) | ||
198 | + { | ||
199 | + if ($layern->connectiontype == MS_POSTGIS) | ||
200 | + { | ||
201 | + $lcon = $layern->connection; | ||
202 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) | ||
203 | + { | ||
204 | + if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | ||
205 | + {$layern->set("connection",$postgis_mapa);} | ||
206 | + else | ||
207 | + {$layern->set("connection",$postgis_mapa[$lcon]);} | ||
208 | + } | ||
209 | + } | ||
210 | + } | ||
211 | + } | ||
183 | if(!stristr($tema, '.php') === FALSE){ | 212 | if(!stristr($tema, '.php') === FALSE){ |
184 | echo "<br>Arquivo <i>$tema</i> é um programa PHP. O teste pode não funcionar.<br>"; | 213 | echo "<br>Arquivo <i>$tema</i> é um programa PHP. O teste pode não funcionar.<br>"; |
185 | include_once($locaplic."/".$tema); | 214 | include_once($locaplic."/".$tema); |
@@ -226,18 +255,14 @@ function verifica($map,$solegenda) | @@ -226,18 +255,14 @@ function verifica($map,$solegenda) | ||
226 | if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) | 255 | if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) |
227 | { | 256 | { |
228 | if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | 257 | if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade |
229 | - { | ||
230 | - $layern->set("connection",$postgis_mapa); | ||
231 | - } | 258 | + {$layern->set("connection",$postgis_mapa);} |
232 | else | 259 | else |
233 | - { | ||
234 | - $layern->set("connection",$postgis_mapa[$lcon]); | ||
235 | - } | 260 | + {$layern->set("connection",$postgis_mapa[$lcon]);} |
236 | } | 261 | } |
237 | } | 262 | } |
238 | } | 263 | } |
239 | - error_reporting(E_ALL); | ||
240 | autoClasses($layern,$nmapa); | 264 | autoClasses($layern,$nmapa); |
265 | + error_reporting(E_ALL); | ||
241 | if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ | 266 | if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ |
242 | $tipotemp = $layern->type; | 267 | $tipotemp = $layern->type; |
243 | $tiporep = $layern->getmetadata("tipooriginal"); | 268 | $tiporep = $layern->getmetadata("tipooriginal"); |