Commit 85577a2fc0fd4da869df610198695bcc228553dc

Authored by Edmar Moretti
1 parent 8de4072f

Inclusão em ogc/index.php da lista de todos as camadas e abertura de modal confo…

…rme parâmetros enviados pela url
admin/admin.db
No preview for this file type
admin1/head.php
... ... @@ -59,13 +59,13 @@ hr {
59 59  
60 60 .btn.btn-fab.btn-fab-mini {
61 61 font-size: 12px;
62   - height: 24px;
63   - min-width: 24px;
64   - padding-bottom: 5px;
65   - padding-left: 5px;
66   - padding-right: 5px;
67   - padding-top: 5px;
68   - width: 24px;
  62 + height: 28px;
  63 + min-width: 28px;
  64 + padding-bottom: 6px;
  65 + padding-left: 6px;
  66 + padding-right: 6px;
  67 + padding-top: 6px;
  68 + width: 28px;
69 69 }
70 70  
71 71 .btn.btn-fab.btn-fab-max {
... ... @@ -81,7 +81,7 @@ hr {
81 81  
82 82 .material-icons.md-18 {
83 83 font-size: 18px;
84   - background-color: #e13023;
  84 +
85 85 }
86 86  
87 87 body {
... ...
init/head.php
... ... @@ -83,14 +83,14 @@ hr {
83 83 .navbar-collapse { max-height: 100% !important; }
84 84  
85 85 .btn.btn-fab.btn-fab-mini {
86   - font-size: 12px;
87   - height: 24px;
88   - min-width: 24px;
89   - padding-bottom: 5px;
90   - padding-left: 5px;
91   - padding-right: 5px;
92   - padding-top: 5px;
93   - width: 24px;
  86 + font-size: 12px;
  87 + height: 28px;
  88 + min-width: 28px;
  89 + padding-bottom: 6px;
  90 + padding-left: 6px;
  91 + padding-right: 6px;
  92 + padding-top: 6px;
  93 + width: 28px;
94 94 }
95 95  
96 96 .btn.btn-fab.btn-fab-max {
... ...
ogc/exec.php
... ... @@ -78,6 +78,30 @@ ORDER BY lower(n0.nome_menu)
78 78 }
79 79 retornaJSON ( array("dados"=>$dados) );
80 80 break;
  81 +
  82 + case "LISTATODAS":
  83 + $sqlCamadas = "
  84 + SELECT * FROM (SELECT n3.id_tema AS id_tema,t.codigo_tema AS codigo_tema,t.nome_tema AS nome_tema,t.link_tema AS link_tema,
  85 + lower(t.ogc_tema) AS ogc_tema,lower(t.download_tema) AS download_tema
  86 + FROM {$esquemaadmin}i3geoadmin_n3 AS n3, {$esquemaadmin}i3geoadmin_temas AS t
  87 + WHERE n3.id_tema = t.id_tema AND t.ogc_tema != 'NAO' AND n3.publicado != 'NAO' AND (n3_perfil = '' OR n3_perfil isnull )
  88 + UNION
  89 + SELECT r.id_tema AS id_tema,t.codigo_tema AS codigo_tema,t.nome_tema AS nome_tema,t.link_tema AS link_tema,
  90 + lower(t.ogc_tema) AS ogc_tema,lower(t.download_tema) AS download_tema
  91 + FROM {$esquemaadmin}i3geoadmin_raiz AS r, {$esquemaadmin}i3geoadmin_temas AS t
  92 + WHERE r.id_tema = t.id_tema AND (t.ogc_tema != 'NAO' OR t.download_tema != 'NAO')) AS u
  93 + GROUP BY id_tema,codigo_tema,nome_tema,link_tema,ogc_tema,download_tema
  94 + ORDER BY lower(u.nome_tema)
  95 + ";
  96 + $camadas = pegaDados ( $sqlCamadas, "", false );
  97 + if ($camadas === false) {
  98 + header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
  99 + exit ();
  100 + }
  101 +
  102 + retornaJSON ( array("dados"=>"","camadas"=>$camadas) );
  103 + break;
81 104 }
  105 +
82 106 cpjson ( $retorno );
83 107 ?>
... ...
ogc/index.js
... ... @@ -64,5 +64,103 @@ Lista de menus
64 64 },
65 65 proximoNivel: function(id,nome){
66 66 window.location.href = "menu/index.php?id_menu=" + id + "&nome_menu=" + nome;
  67 + },
  68 + mostraLinksServico: function(codigo_tema){
  69 + $(".modal-body").html('<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i><span class="sr-only">Aguarde</span>');
  70 + var html;
  71 + tradLinks["tema"] = codigo_tema;
  72 + html = Mustache.to_html(
  73 + $("#templateLinksOgc").html(),
  74 + tradLinks
  75 + );
  76 + $(".modal-body").html(html);
  77 + },
  78 + mostraLinksDownload: function(codigo_tema){
  79 + $(".modal-body").html('<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i><span class="sr-only">Aguarde</span>');
  80 + tradLinks["tema"] = codigo_tema;
  81 + $.post(
  82 + "../classesphp/mapa_controle.php",
  83 + "map_file=&funcao=download3&tema="+codigo_tema
  84 + )
  85 + .done(
  86 + function(data, status){
  87 + var retorno = jQuery.parseJSON(data).data;
  88 + var html,arqs,i,n,ins = "";
  89 + tradLinks["mapfile"] = window.location.protocol + "//" + window.location.host + "/" + retorno.mapfileurl;
  90 + tradLinks["sldurl"] = tradLinks["urli3geo"] + "/ferramentas/legenda/exec.php?funcao=TEMA2SLD&tema=" + retorno.tema + "&map_file=" + retorno.mapfile;
  91 + arqs = retorno.arquivos.split(",");
  92 + n = arqs.length;
  93 + for (i=0; i<n; i++){
  94 + ins += "<p><a href='"+window.location.protocol+"//"+window.location.host+"/"+arqs[i]+"'>"+arqs[i]+"</a></p>";
  95 + }
  96 + tradLinks["shp"] = ins;
  97 + html = Mustache.to_html(
  98 + $("#templateLinksDownload").html(),
  99 + tradLinks
  100 + );
  101 + tradLinks["shp"] = "";
  102 + tradLinks["mapfile"] = "";
  103 + tradLinks["sldurl"] = "";
  104 + $(".modal-body").html(html);
  105 + }
  106 + )
  107 + .fail(function(data){
  108 + ogc.grupo.ondeLista.html('<div class="alert alert-danger alert-dismissible" role="alert">' + data.status + " " +data.statusText + '</div>');
  109 + });
  110 + },
  111 +
  112 + listaCompleta: function (onde){
  113 + $.post(
  114 + "exec.php",
  115 + "funcao=listatodas"
  116 + )
  117 + .done(
  118 + function(data, status){
  119 + var json = jQuery.parseJSON(data);
  120 + //
  121 + //monta a lista de camadas
  122 + //
  123 + var htmlcamadas = Mustache.to_html(
  124 + "{{#data}}" + $("#templateCamadas").html() + "{{/data}}",
  125 + $.extend(
  126 + {},
  127 + ogc.menus.dicionario,
  128 + {
  129 + "data": json["camadas"],
  130 + "dominio": "ogc.menus",
  131 + "disabledlink": function(){
  132 + if(this.link_tema == ""){
  133 + return "hidden";
  134 + }
  135 + else {
  136 + return "";
  137 + }
  138 + },
  139 + "disableddown": function(){
  140 + if(this.download_tema != "nao"){
  141 + return "";
  142 + }
  143 + else {
  144 + return "hidden";
  145 + }
  146 + },
  147 + "disabledogc": function(){
  148 + if(this.ogc_tema != "nao"){
  149 + return "";
  150 + }
  151 + else {
  152 + return "hidden";
  153 + }
  154 + }
  155 + }
  156 + )
  157 + );
  158 + ogc.menus.ondeLista.html(htmlcamadas);
  159 + $.material.init();
  160 + }
  161 + )
  162 + .fail(function(data){
  163 + ogc.menus.ondeLista.html('<div class="alert alert-danger alert-dismissible" role="alert">' + data.status + " " +data.statusText + '</div>');
  164 + });
67 165 }
68 166 };
69 167 \ No newline at end of file
... ...
ogc/index.php
... ... @@ -3,6 +3,12 @@ define ( ONDEI3GEO, &quot;..&quot; );
3 3 include (dirname ( __FILE__ ) . "/../ms_configura.php");
4 4 include_once (dirname(__FILE__)."/../classesphp/sani_request.php");
5 5 error_reporting ( 0 );
  6 +// pega a extensao geografica
  7 +if ($ogcwsmap == "") {
  8 + $ogcwsmap = $locaplic . "/aplicmap/ogcws.map";
  9 +}
  10 +$map = ms_newMapObj ( $ogcwsmap );
  11 +$mapext = $map->extent->minx . "," . $map->extent->miny . "," . $map->extent->maxx . "," . $map->extent->maxy;
6 12 include (ONDEI3GEO."/init/head.php");
7 13 ?>
8 14 <link rel='stylesheet' type='text/css' href='index.css'>
... ... @@ -23,7 +29,7 @@ include (ONDEI3GEO.&quot;/init/head.php&quot;);
23 29 <div id="menuTpl" class="escondido hidden">
24 30 <ul class="nav navbar-nav">
25 31 <li><a href="../kml.php?tipoxml=kml" target="_blank">Kml Google Earth</a></li>
26   - <li><a data-toggle="collapse" href="#listaCompleta" aria-expanded="false"
  32 + <li><a href="javascript:void(0)" onclick="ogc.menus.listaCompleta()"
27 33 aria-controls="#listaCompleta">{{{lista}}}</a>
28 34 </li>
29 35 </ul>
... ... @@ -50,8 +56,11 @@ include (ONDEI3GEO.&quot;/init/head.php&quot;);
50 56 </div>
51 57 </div>
52 58 </div>
53   -
54   -<?php include (ONDEI3GEO."/ogc/templates/templatelista.php");?>
  59 +<?php include(ONDEI3GEO."/ogc/templates/modal.php");?>
  60 +<?php include(ONDEI3GEO."/ogc/templates/templatelista.php");?>
  61 +<?php include(ONDEI3GEO."/ogc/templates/templatecamadas.php");?>
  62 +<?php include(ONDEI3GEO."/ogc/templates/templatelinksogc.php");?>
  63 +<?php include(ONDEI3GEO."/ogc/templates/templatelinksdownload.php");?>
55 64  
56 65 <script src='headjs.php'></script>
57 66 <script src='index.js'></script>
... ... @@ -59,7 +68,15 @@ include (ONDEI3GEO.&quot;/init/head.php&quot;);
59 68 <script>
60 69 $(document).ready(function(){
61 70 i3GEO.configura = {"locaplic" : "..","sid": ""};
  71 +
  72 + var servico = window.location.href.split("/ogc")[0]+"/ogc.php?";
62 73 tradLinks = i3GEO.idioma.objetoIdioma(ogc.dicionario);
  74 + tradLinks["servico"] = servico;
  75 + tradLinks["url"] = window.location.href.split("#")[0];
  76 + tradLinks["url"] = tradLinks["url"].split("?")[0];
  77 + tradLinks["urli3geo"] = window.location.href.split("/ogc")[0];
  78 + tradLinks["mapext"] = "<?php echo $mapext;?>";
  79 +
63 80 var html = Mustache.to_html(
64 81 $("#menuTpl").html(),
65 82 tradLinks
... ... @@ -67,6 +84,20 @@ include (ONDEI3GEO.&quot;/init/head.php&quot;);
67 84 $("#menuTpl").html(html);
68 85 $('.escondido').removeClass('hidden');
69 86 ogc.menus.init($("#corpo"));
  87 +
  88 + //verifica se deve abrir de imediato a janela de links
  89 + var temaOgc = "<?php echo $_GET["temaOgc"];?>";
  90 + if(temaOgc != ""){
  91 + $("#modal").modal('show');
  92 + ogc.menus.mostraLinksServico(temaOgc);
  93 +
  94 + }
  95 + var temp = window.location.href.split("temaDownload=");
  96 + var temaDownload = "<?php echo $_GET["temaDownload"];?>";
  97 + if(temaDownload != ""){
  98 + $("#modal").modal('show');
  99 + ogc.menus.mostraLinksDownload(temaDownload);
  100 + }
70 101 });
71 102 </script>
72 103 </body>
... ...
ogc/menu/grupo/exec.php
... ... @@ -40,7 +40,7 @@ JOIN {$esquemaadmin}i3geoadmin_subgrupos AS subgrupo ON n2.id_subgrupo = subgrup
40 40 JOIN (
41 41 SELECT r.id_n2
42 42 FROM {$esquemaadmin}i3geoadmin_n3 AS r, {$esquemaadmin}i3geoadmin_temas AS t
43   - WHERE r.id_tema = t.id_tema AND t.ogc_tema != 'NAO' AND r.publicado != 'NAO' AND (n3_perfil = '' OR n3_perfil isnull )
  43 + WHERE r.id_tema = t.id_tema AND (t.ogc_tema != 'NAO' OR t.download_tema != 'NAO') AND r.publicado != 'NAO' AND (n3_perfil = '' OR n3_perfil isnull )
44 44 ) AS n3 ON (n3.id_n2 = n2.id_n2 OR n2.id_n2 = 0 )
45 45  
46 46 WHERE n2.publicado != 'NAO' AND (n2.n2_perfil = '' OR n2.n2_perfil isnull )
... ...