From 20c93d27878d9d2299aaa477fe8edd1fabdd3b94 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 20 Aug 2009 04:13:26 +0000 Subject: [PATCH] Correção na montagem das árvores de kml e download de temas --- classesjs/i3geonaocompacto.js | 77 ----------------------------------------------------------------------------- classesphp/classe_menutemas.php | 57 ++++++++++++++++++++++++++++++++++----------------------- kml.php | 61 ++++++++++++++++++++++++++++++++++++++++++++----------------- menutemas/admin.db | Bin 53248 -> 0 bytes 4 files changed, 78 insertions(+), 117 deletions(-) delete mode 100644 classesjs/i3geonaocompacto.js diff --git a/classesjs/i3geonaocompacto.js b/classesjs/i3geonaocompacto.js deleted file mode 100644 index b4461f9..0000000 --- a/classesjs/i3geonaocompacto.js +++ /dev/null @@ -1,77 +0,0 @@ -var mostradicasf = function(){}; -var scriptLocation = ""; -var scripts = document.getElementsByTagName('script'); -for (var i = 0; i < scripts.length; i++) { - var src = scripts[i].getAttribute('src'); - if (src) { - var index = src.lastIndexOf("i3geonaocompacto.js"); - // is it found, at the end of the URL? - if ((index > -1) && (index + "i3geonaocompacto.js".length == src.length)) { - scriptLocation = src.slice(0, -"i3geonaocompacto.js".length); - break; - } - } -} -var allScriptTags = ""; -var jsfiles = new Array( -"../pacotes/yui270/build/yahoo/yahoo-min.js", -"../pacotes/yui270/build/yahoo-dom-event/yahoo-dom-event.js", -"../pacotes/yui270/build/dom/dom-min.js", -"../pacotes/yui270/build/container/container_core-min.js", -"../pacotes/yui270/build/menu/menu-min.js", -"../pacotes/yui270/build/logger/logger-min.js", -"../pacotes/yui270/build/dragdrop/dragdrop-min.js", -"../pacotes/yui270/build/slider/slider-min.js", -"../pacotes/yui270/build/animation/animation-min.js", -"../pacotes/yui270/build/container/container-min.js", -"../pacotes/yui270/build/element/element-min.js", -"../pacotes/yui270/build/tabview/tabview-min.js", -"../pacotes/yui270/build/utilities/utilities.js", -"../pacotes/cpaint/cpaint2.inc.js", -"../pacotes/yui270/build/treeview/treeview.js", -"../pacotes/balloon-tooltips/htdocs/js/balloon.config.js", -"../pacotes/balloon-tooltips/htdocs/js/balloon.js", -"classe_i3geo.js", -"classe_util.js", -"dicionario.js", -"classe_idioma.js", -"classe_php.js", -"classe_configura.js", -"depreciados.js", -"classe_calculo.js", -"classe_desenho.js", -"classe_interface.js", -"classe_mapa.js", -"classe_tema.js", -"classe_analise.js", -"classe_maparef.js", -"classe_ajuda.js", -"classe_janela.js", -"classe_guias.js", -"classe_arvoredecamadas.js", -"classe_navega.js", -"classe_selecao.js", -"classe_eventos.js", -"classe_arvoredetemas.js", -"classe_barradebotoes.js", -"../pacotes/richdraw/richdraw_tudo_compacto.js", -"classe_gadgets.js" -); -for (i = 0; i < jsfiles.length; i++) -{ - var currentScriptTag = ""; - allScriptTags += currentScriptTag; -} -//css -var allCssTags = ""; -var cssfiles = new Array( -"../css/i3geo.css.php" -); -for (i = 0; i < cssfiles.length; i++) -{ - var currentCssTag = ""; - allCssTags += currentCssTag; -} - -document.write(allCssTags); -document.write(allScriptTags); \ No newline at end of file diff --git a/classesphp/classe_menutemas.php b/classesphp/classe_menutemas.php index 29c564e..b8445ae 100644 --- a/classesphp/classe_menutemas.php +++ b/classesphp/classe_menutemas.php @@ -200,11 +200,11 @@ array // foreach($xml->TEMA as $temar) { - $down = "nao"; + $down = "sim"; $ogc = "sim"; $temp = $this->ixml($temar,"DOWNLOAD"); - if (($temp == "sim") || ($temp == "SIM")) - {$down = "sim";} + if (($temp == "nao") || ($temp == "NAO")) + {$down = "nao";} $temp = $this->ixml($temar,"OGC"); if (($temp == "nao") || ($temp == "NAO")) {$ogc = "nao";} @@ -235,11 +235,11 @@ array $temas = array(); foreach($grupo->TEMA as $temar) { - $down = "nao"; + $down = "sim"; $ogc = "sim"; $temp = $this->ixml($temar,"DOWNLOAD"); - if (($temp == "sim") || ($temp == "SIM")) - {$down = "sim";} + if (($temp == "nao") || ($temp == "NAO")) + {$down = "nao";} $temp = $this->ixml($temar,"OGC"); if (($temp == "nao") || ($temp == "NAO")) {$ogc = "nao";} @@ -251,18 +251,22 @@ array $nome = $this->ixml($temar,"TNOME"); $temas[] = array("tid"=>$tid,"nome"=>$nome,"link"=>$link,"download"=>$down,"ogc"=>$ogc); } - $grupodown = "nao"; + $grupodown = "sim"; $grupoogc = "sim"; foreach($grupo->SGRUPO as $sgrupo) { foreach($sgrupo->TEMA as $tema) { $temp = $this->ixml($tema,"DOWNLOAD"); - if (($temp == "sim") || ($temp == "SIM")) - {$grupodown = "sim";} + if (($temp == "nao") || ($temp == "NAO")) + {$grupodown = "nao";} + else + {$grupodown = "sim";} $temp = $this->ixml($tema,"OGC"); if (($temp == "nao") || ($temp == "NAO")) - {$grupoogc = "nao";} + {$grupoogc = "nao";} + else + {$grupoogc = "sim";} } } $subgrupos = array(); @@ -283,16 +287,20 @@ array if ($incluisgrupo == TRUE) { //verifica se existem temas que podem receber download - $down = "nao"; + $down = "sim"; $ogc = "sim"; foreach($sgrupo->TEMA as $tema) { $temp = $this->ixml($tema,"DOWNLOAD"); - if (($temp == "sim") || ($temp == "SIM")) + if (($temp == "nao") || ($temp == "NAO")) + {$down = "nao";} + else {$down = "sim";} $temp = $this->ixml($tema,"OGC"); if (($temp == "nao") || ($temp == "NAO")) {$ogc = "nao";} + else + {$ogc = "sim";} } $nome = $this->ixml($sgrupo,"SDTIPO"); $subgrupos[] = array("nome"=>$nome,"download"=>$down,"ogc"=>$ogc); @@ -393,16 +401,20 @@ array } if (($incluisgrupo == TRUE)) { - $down = "nao"; + $down = "sim"; $ogc = "sim"; foreach($sgrupo->TEMA as $tema) { $temp = $this->ixml($tema,"DOWNLOAD"); - if (($temp == "sim") || ($temp == "SIM")) + if (($temp == "nao") || ($temp == "NAO")) + {$down = "nao";} + else {$down = "sim";} $temp = $this->ixml($tema,"OGC"); if (($temp == "nao") || ($temp == "NAO")) - {$ogc = "nao";} + {$ogc = "nao";} + else + {$ogc = "sim";} } $nome = $this->ixml($sgrupo,"SDTIPO"); $subgrupos[] = array("nome"=>$nome,"ogc"=>$ogc,"download"=>$down); @@ -412,11 +424,11 @@ array $temas = array(); foreach($grupo->TEMA as $temar) { - $down = "nao"; + $down = "sim"; $ogc = "sim"; $temp = $this->ixml($temar,"DOWNLOAD"); - if (($temp == "sim") || ($temp == "SIM")) - {$down = "sim";} + if (($temp == "nao") || ($temp == "NAO")) + {$down = "nao";} $temp = $this->ixml($temar,"OGC"); if (($temp == "nao") || ($temp == "NAO")) {$ogc = "nao";} @@ -510,8 +522,7 @@ array { $inclui = TRUE; if ($this->ixml($tema,"PERFIL") != "") - { - + { $inclui = FALSE; $temp = $this->ixml($tema,"PERFIL"); $perfis = str_replace(","," ",$temp); @@ -521,9 +532,9 @@ array } if ($inclui == TRUE) { - $down = "nao"; - if (($tema->DOWNLOAD == "sim") || ($tema->DOWNLOAD == "SIM")) - {$down = "sim";} + $down = "sim"; + if (($tema->DOWNLOAD == "nao") || ($tema->DOWNLOAD == "NAO")) + {$down = "nao";} $ogc = "sim"; if (($tema->OGC == "nao") || ($tema->OGC == "NAO")) {$ogc = "nao";} diff --git a/kml.php b/kml.php index b6d0590..fd785f0 100644 --- a/kml.php +++ b/kml.php @@ -73,6 +73,9 @@ if ($menutemas != "" || is_array($menutemas)) foreach ($menus as $menu) { $xml = simplexml_load_file($menu); + //raiz + foreach($xml->TEMA as $tema) + {kml_tema($tema);} foreach($xml->GRUPO as $grupo) { $nome = mb_convert_encoding($grupo->GTIPO,"auto","auto"); @@ -95,50 +98,62 @@ if ($menutemas != "" || is_array($menutemas)) // //no caso do menu vir do sistema de administração // +//error_reporting(E_ALL); if($menutemas == "") { include("admin/php/admin.php"); - $menus = pegaDados("SELECT * from i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu isnull order by nome_menu "); - echo $sql; + $menus = pegaDados("SELECT * from i3geoadmin_menus where lower(publicado_menu) != 'nao' or publicado_menu isnull order by nome_menu "); + //echo $sql; foreach($menus as $menu) { - echo $menu["nome_menu"]; kml_cabecalho($menu["nome_menu"],$menu["desc_menu"]); $id_menu = $menu["id_menu"]; - $grupos = pegaDados("SELECT nome_grupo,n1.id_grupo,gr.desc_grupo from i3geoadmin_n1 as n1,i3geoadmin_grupos as gr where n1.id_menu = '$id_menu' and n1.id_grupo = gr.id_grupo order by gr.nome_grupo"); + //raiz + $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where (lower(i3geoadmin_temas.tipoa_tema) != 'wms' or i3geoadmin_temas.tipoa_tema isnull) and (lower(i3geoadmin_temas.kml_tema) != 'nao' or i3geoadmin_temas.kml_tema isnull) and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 and i3geoadmin_raiz.id_nivel = 0 order by ordem"; + $temas = pegaDados($sql); + if(count($temas) > 0) + { + foreach ($temas as $tema) + {kml_tema_bd($tema);} + } + $grupos = pegaDados("SELECT nome_grupo,n1.id_n1,n1.id_grupo,gr.desc_grupo from i3geoadmin_n1 as n1,i3geoadmin_grupos as gr where (lower(n1.publicado) != 'nao' or n1.publicado isnull) and n1.id_menu = '$id_menu' and n1.id_grupo = gr.id_grupo order by gr.nome_grupo"); foreach($grupos as $grupo) { kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]); $id_grupo = $grupo["id_grupo"]; + //raiz + $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,kml_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where lower(i3geoadmin_temas.tipoa_tema) != 'wms' and lower(i3geoadmin_temas.kml_tema) != 'nao' and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = ".$grupo["id_n1"]." order by ordem"; + $temas = pegaDados($sql); + if(count($temas) > 0) + { + foreach ($temas as $tema) + {kml_tema_bd($tema);} + } $sql = "select s.nome_subgrupo,n2.id_n2 from i3geoadmin_n2 as n2,i3geoadmin_n1 as n1, i3geoadmin_subgrupos as s "; $sql .= "where n1.id_grupo = '$id_grupo' and n2.id_subgrupo = s.id_subgrupo "; $sql .= "and n2.id_n1 = n1.id_n1 "; $sql .= "and n1.n1_perfil = '' and n2.n2_perfil = '' "; + $sql .= "and (lower(n2.publicado) != 'nao' or n2.publicado isnull) "; $sql .= "order by s.nome_subgrupo"; $subgrupos = pegaDados($sql); foreach ($subgrupos as $subgrupo) { - kml_folder($subgrupo["nome_subgrupo"]); $id_n2 = $subgrupo["id_n2"]; $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where "; $sql .= "n3.id_n2='$id_n2' "; $sql .= "and n3.id_tema = t.id_tema "; $sql .= "and n3_perfil = '' "; - $sql .= "and t.kml_tema != 'nao' "; - $sql .= "and t.tipoa_tema = ''"; + $sql .= "and lower(t.kml_tema) != 'nao' "; + $sql .= "and lower(t.tipoa_tema) != 'wms'"; + $sql .= "and (lower(n3.publicado) != 'nao' or n3.publicado isnull) "; $temas = pegadados($sql); - foreach ($temas as $tema) + if(count($temas) > 0) { - $fonte = $tema["link_tema"]; - $nome = $tema["nome_tema"]; - $id = $tema["codigo_tema"]; - $desc = $tema["desc_tema"]; - $fonte = "Fonte "; - $legenda = "Legenda "; - $href = "$urli3geo/ogc.php?tema=$id&width=800&height=800&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&STYLES=&BGCOLOR=0xFFFFFF&FORMAT=image/png&TRANSPARENT=TRUE&layers=$id"; - kml_servico($nome,$fonte,$legenda,$desc,$href); + kml_folder($subgrupo["nome_subgrupo"]); + foreach ($temas as $tema) + {kml_tema_bd($tema);} + echo "\n"; } - echo "\n"; } echo "\n"; } @@ -146,6 +161,18 @@ if($menutemas == "") } } echo "\n"; +function kml_tema_bd($tema) +{ + global $urli3geo; + $fonte = $tema["link_tema"]; + $nome = $tema["nome_tema"]; + $id = $tema["codigo_tema"]; + $desc = $tema["desc_tema"]; + $fonte = "Fonte "; + $legenda = "Legenda "; + $href = "$urli3geo/ogc.php?tema=$id&width=800&height=800&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&STYLES=&BGCOLOR=0xFFFFFF&FORMAT=image/png&TRANSPARENT=TRUE&layers=$id"; + kml_servico($nome,$fonte,$legenda,$desc,$href); +} function kml_cabecalho($nome,$desc) { echo "\n"; diff --git a/menutemas/admin.db b/menutemas/admin.db index 564194e..9355449 100644 Binary files a/menutemas/admin.db and b/menutemas/admin.db differ -- libgit2 0.21.2