Commit 06b8a201f317d5ca8b404d02a48631b49bd83b94

Authored by Edmar Moretti
1 parent d54e872d

correção no teste de layers que necessitam da substituição de string de conexão

Showing 1 changed file with 23 additions and 30 deletions   Show diff stats
testamapfile.php
... ... @@ -134,8 +134,6 @@ function verifica($map,$solegenda)
134 134 if (file_exists('temas/'.$map.'.map'))
135 135 {$tema = 'temas/'.$map.".map";}
136 136 }
137   -
138   -
139 137 if(($tipo == "") || ($tipo == "todos"))
140 138 echo "<hr><br><br><span style='color:red' ><b>Testando: $tema </span><pre></b>";
141 139 if(!file_exists($tema)){echo "Arquivo ".$map." não encontrado.";exit;}
... ... @@ -166,16 +164,31 @@ function verifica($map,$solegenda)
166 164 {
167 165 $layern = $nmapa->getLayerByName($teman);
168 166 $layern->set("status",MS_DEFAULT);
169   - if ($layern->connectiontype == MS_POSTGIS)
  167 + if (isset($postgis_mapa))
170 168 {
171   - if ($layern->connection == " " || $layern->connection == "")
  169 + if (($postgis_mapa != "") || ($postgis_mapa != " "))
172 170 {
173   - if(!is_array($postgis_mapa))
174   - $l->set("connection",$postgis_mapa);
175   - else
176   - $l->set("connection",$postgis_mapa[$l->connection]);
177   - }
178   - }
  171 + if ($layern->connectiontype == MS_POSTGIS)
  172 + {
  173 + $lcon = $layern->connection;
  174 + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa))))
  175 + {
  176 + //
  177 + //o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição
  178 + //
  179 + if(($lcon == " ") || ($lcon == ""))
  180 + {
  181 + $layern->set("connection",$postgis_mapa);
  182 + }
  183 + else
  184 + {
  185 + $layern->set("connection",$postgis_mapa[$lcon]);
  186 + }
  187 + }
  188 + }
  189 + }
  190 + }
  191 +
179 192 autoClasses(&$layern,$nmapa);
180 193 ms_newLayerObj($mapa, $layern);
181 194 if ($layern->data == "")
... ... @@ -184,24 +197,6 @@ function verifica($map,$solegenda)
184 197 $dados = $layern->data;
185 198 $pegarext = $teman;
186 199 }
187   - if (isset($postgis_mapa))
188   - {
189   - if ($postgis_mapa != "")
190   - {
191   - $numlayers = $mapa->numlayers;
192   - for ($i=0;$i < $numlayers;$i++)
193   - {
194   - $layer = $mapa->getlayer($i);
195   - if ($layer->connectiontype == MS_POSTGIS)
196   - {
197   - if ($layer->connection == " ")
198   - {
199   - $layer->set("connection",$postgis_mapa);
200   - }
201   - }
202   - }
203   - }
204   - }
205 200 zoomTema($pegarext,&$mapa);
206 201 if ($tipo == "mini")
207 202 {
... ... @@ -242,8 +237,6 @@ function verifica($map,$solegenda)
242 237 $nomel = ($objImagemLegenda->imagepath).nomeRandomico()."testel.png";
243 238 $objImagemLegenda->saveImage($nomel);
244 239 $nomerl = ($objImagemLegenda->imageurl).basename($nomel);
245   -
246   -
247 240 if(($tipo == "") || ($tipo == "todos"))
248 241 {
249 242 if($solegenda == "nao")
... ...