Commit 736d8d6b4359b5b916288fe8a53ee4d2995b8fae

Authored by Edmar Moretti
1 parent 6a68c75d

Inclusão de temas baseados no sistema METAESTAT na árvore do catálogo

admin/admin.db
No preview for this file type
admin/js/core.js
... ... @@ -909,11 +909,16 @@ selecionados - array com os valores marcados
909 909  
910 910 target - objeto para receber o resultado
911 911  
912   -record - objeto record
  912 +record - objeto record (utilize "" para escapar)
913 913  
914   -key - chave (nome do item)
  914 +key - chave (nome do item) (utilize "" para escapar)
  915 +
  916 +unico - sim|nao indicando se apenas um pode ser escolhido
915 917 */
916   -function core_menuCheckBox(valores,textos,selecionados,target,record,key){
  918 +function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){
  919 + if(!unico){
  920 + unico = "nao";
  921 + }
917 922 function on_menuCheckBoxChange(p_oEvent){
918 923 var cks,i,
919 924 ins = [];
... ... @@ -925,7 +930,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key){
925 930 ins.push(cks[i].value);
926 931 }
927 932 }
928   - if(record){
  933 + if(record && record != ""){
929 934 target.innerHTML = "<pre ><p>"+ins.toString()+"</pre>";
930 935 record.setData(key,ins.toString());
931 936 }
... ... @@ -942,18 +947,20 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key){
942 947 novoel.id = "core_menuCK";
943 948 ndiv = document.createElement("div");
944 949 ndiv.className= "yui-dt-editor";
  950 + ndiv.style.backgroundColor = "white";
945 951 ndiv.style.height = "144px";
946 952 ndiv.style.overflow = "auto";
947   - ndiv.innerHTML = "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>";
  953 + ndiv.innerHTML = "<div id='core_botoesCabecalho' ></div><br>" +
  954 + "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>";
948 955 novoel.appendChild(ndiv);
949 956 document.body.appendChild(novoel);
950   - og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_menuCK_bd" });
  957 + og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_botoesCabecalho" });
951 958 og_core.addButtons([
952 959 { label: "OK", value: "OK", checked: false},
953   - { label: "Cancel", value: "CANCEL", checked: false }
  960 + { label: "Fecha", value: "CANCEL", checked: false }
954 961 ]);
955 962 og_core.on("checkedButtonChange", on_menuCheckBoxChange);
956   - YAHOO.admin.container.panelCK = new YAHOO.widget.Overlay("core_menuCK", { zindex:"100",close:false,underlay:false,width:"300px", height:"200px",overflow:"auto", visible:false,constraintoviewport:false } );
  963 + YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:true,zindex:"100",close:false,underlay:false,width:"168px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } );
957 964 YAHOO.admin.container.panelCK.render();
958 965 }
959 966 onde = $i("core_menuCK_bd");
... ... @@ -966,7 +973,12 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key){
966 973 if(selecionados[j] == valores[i])
967 974 ck = "CHECKED";
968 975 }
969   - ins.push("<input type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>");
  976 + if(unico === "nao"){
  977 + ins.push("<input type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>");
  978 + }
  979 + else{
  980 + ins.push("<input style='position:relative;top:2px;' type=radio name=escolha_core_menuCheckBox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>");
  981 + }
970 982 }
971 983 ins.push("<br>");
972 984 novoCK.innerHTML = ins.join(" ");
... ...
admin/js/editormapfile.js
... ... @@ -1446,41 +1446,42 @@ function montaEditorDispo(dados)
1446 1446  
1447 1447 function montaEditorDados(dados)
1448 1448 {
1449   - var idsForms = ["connection","data","tileitem","tileindex","type","tipooriginal","metaestat_id_medida_variavel"];
1450   - var idsMetaestat = ["connection","data","tileitem","tileindex","tipooriginal"];
1451   - var param = {
1452   - "linhas":[
1453   - {ajuda:"Indica se as defini&ccedil;&otilde;es da camada est&atilde;o relacionadas ao sistema de metadados estat&iacute;sticos. Se estiver, alguns par&acirc;metros s&atilde;o obtidos de forma autom&aacute;tica, como a conex&atilde;o e o SQL de acesso aos dados.",
1454   - titulo:"Esse mapfile est&aacute; integrado ao sistema de metadados estat&iacute;sticos?",id:"",value:dados.metaestat,tipo:"text",div:"<div id=cMetaestat ></div>"},
1455   - //TODO colocar icone para escolher o id
1456   - {ajuda:"ID da medida da vari&aacute;vel que relaciona a camada ao sistema de metadados estat&iacute;sticos. S&oacute; deve ser definido se o mapfile for integrado a esse sistema.",
1457   - titulo:"ID da variável no sistema de metadados estatísticos",id:"metaestat_id_medida_variavel",value:dados.metaestat_id_medida_variavel,tipo:"text",div:""},
1458   - {ajuda:"Type of connection. Default is local.",
1459   - titulo:"Connectiontype",id:"",value:"",div:"<div id=cConnectiontype ></div>",tipo:"text"},
1460   - {ajuda:"Aplica a convers&atilde;o de caracteres nas ferramentas que obt&eacute;m os dados descritivos referentes aos elementos do LAYER. Em alguns casos, a convers&atilde;o pode provocar problemas de acentua&ccedil;&atilde;o. Se isso ocorrer, na ferramenta tabela por exemplo, experimente marcar essa op&ccedil;&atilde;o como 'nao'",
1461   - titulo:"Convers&atilde;o de caracteres (METADATA: CONVCARACTER)",id:"",value:dados.convcaracter,tipo:"text",div:"<div id=cConvcaracter ></div>"},
1462   - {ajuda:"Database connection string to retrieve remote data.An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas.A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of 'user=nobody password=****** dbname=dbname host=localhost port=5432' An Oracle connection string: user/pass[@db] . Se vc tiver problemas com acentua&ccedil;&atilde;o, experimente algo como: user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'",
1463   - titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"},
1464   - {ajuda:"Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object.If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. 'mylayer,shape,myversion'.If this is a PostGIS layer, the parameter should be in the form of '<columnname> from <tablename>', where 'columnname' is the name of the column containing the geometry objects and 'tablename' is the name of the table from which the geometry data will be read.For Oracle, use 'shape FROM table' or 'shape FROM (SELECT statement)' or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name. Exemplo postgis: the_geom FROM (select * FROM biomas) as foo USING UNIQUE gid USING SRID=4291 . Exemplo shapefile: c://ms4w/Apache/htdocs/geodados/brasil/limitespol/localidades.shp",
1465   - titulo:"Data",id:"data",value:dados.data,tipo:"text"},
1466   - {ajuda:"Specifies how the data should be drawn. Need not be the same as the shapefile type. For example, a polygon shapefile may be drawn as a point layer, but a point shapefile may not be drawn as a polygon layer. Common sense rules. Annotation means that a label point will be calculated for the features, but the feature itself will not be drawn although a marker symbol can be optionally drawn. this allows for advanced labeling like numbered highway shields. Points are labeled at that point. Polygons are labeled first using a centroid, and if that doesn't fall in the polygon a scanline approach is used to guarantee the label falls within the feature. Lines are labeled at the middle of the longest arc in the visible portion of the line. Query only means the layer can be queried but not drawn.In order to differentiate between POLYGONs and POLYLINEs (which do not exist as a type), simply respectively use or ommit the COLOR keyword when classifying. If you use it, it's a polygon with a fill color, otherwise it's a polyline with only an OUTLINECOLOR.For CHART layers, see the Dynamic Charting howto.A circle must be defined by a a minimum bounding rectangle. That is, 2 points that define the smallest square that can contain it. These 2 points are the two opposite corners of said box",
1467   - titulo:"Type",id:"",value:dados.type,tipo:"text",div:"<div id=cType ></div>"},
1468   - {ajuda:"Ativa ou n&atilde;o a manuten&ccedil;&atilde;o de um cache para armazenar as imagens geradas para montar o mapa. Essa op&ccedil;&atilde;o afeta apenas as interfaces do i3Geo que utilizam o modo TILE (como a interface OpenLayers). O cache &eacute; mantido no diretório tempor&aacute;rio utilizado pelo i3Geo, na pasta chamada cache. Para cada camada &eacute; criada uma sub-pasta. Para limpar o cache, utilize a op&ccedil;&atilde;o existente junto ao nó principal desse mapfile",
1469   - titulo:"Cache de mapas. Camadas WMS s&atilde;o acessadas diretamente do servidor de origem quando o cache estiver inativo. (CACHE)",id:"",value:dados.cache,tipo:"text",div:"<div id=cCache ></div>"},
1470   - {ajuda:"Proje&ccedil;&atilde;o",
1471   - titulo:"Projection",id:"projection",value:dados.projection,tipo:"text"},
1472   - {ajuda:"This parameter allows for data specific attribute filtering that is done at the same time spatial filtering is done, but before any CLASS expressions are evaluated. For OGR and shapefiles the string is simply a mapserver regular expression. For spatial databases the string is a SQL WHERE clause that is valid with respect to the underlying database.For example: FILTER type='road' and size <2",
1473   - titulo:"Filter",id:"filter",value:dados.filter,tipo:"text"},
1474   - {ajuda:"Item to use with simple FILTER expressions. OGR and shapefiles only.",
1475   - titulo:"Filteritem",id:"filteritem",value:dados.filteritem,tipo:"text"},
1476   - {ajuda:"Item that contains the location of an individual tile, default is 'location'.",
1477   - titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"},
1478   - {ajuda:"Name of the tileindex file or layer. A tileindex is similar to an ArcInfo library index. The tileindex contains polygon features for each tile. The item that contains the location of the tiled data is given using the TILEITEM parameter. When a file is used as the tileindex for shapefile or raster layers, the tileindex should be a shapefile. For CONNECTIONTYPE OGR layers, any OGR supported datasource can be a tileindex. Normally the location should contain the path to the tile file relative to the shapepath, not relative to the tileindex itself. If the DATA parameter contains a value then it is added to the end of the location. When a tileindex layer is used, it works similarly to directly referring to a file, but any supported feature source can be used (ie. postgres, oracle).NOTE: All files in the tileindex should have the same coordinate system, and for vector files the same set of attributes in the same order.",
1479   - titulo:"tileindex",id:"tileindex",value:dados.tileindex,tipo:"text"},
1480   - {ajuda:"Tipo de representa&ccedil;&atilde;o das fei&ccedil;&otilde;es mostradas da camada. &Eacute; importante definir esse par&acirc;metro para que as fun&ccedil;&otilde;es de gera&ccedil;&atilde;o de SLD funcionem corretamente.",
1481   - titulo:"Tipo de representa&ccedil;&atilde;o (tipooriginal) - para temas do tipo WMS",id:"",value:dados.tipooriginal,tipo:"text",div:"<div id=cTipoOriginal ></div>"}
1482   - ]
1483   - };
  1449 + var idsForms = ["connection","data","tileitem","tileindex","type","tipooriginal","metaestat_id_medida_variavel"],
  1450 + idsMetaestat = ["connection","data","tileitem","tileindex","tipooriginal"],
  1451 + limg=i3GEO.configura.locaplic+"/imagens/crialeg.jpg",
  1452 + param = {
  1453 + "linhas":[
  1454 + {ajuda:"Indica se as defini&ccedil;&otilde;es da camada est&atilde;o relacionadas ao sistema de metadados estat&iacute;sticos. Se estiver, alguns par&acirc;metros s&atilde;o obtidos de forma autom&aacute;tica, como a conex&atilde;o e o SQL de acesso aos dados.",
  1455 + titulo:"Esse mapfile est&aacute; integrado ao sistema de metadados estat&iacute;sticos?",id:"",value:dados.metaestat,tipo:"text",div:"<div id=cMetaestat ></div>"},
  1456 + //TODO colocar icone para escolher o id
  1457 + {ajuda:"ID da medida da vari&aacute;vel que relaciona a camada ao sistema de metadados estat&iacute;sticos. S&oacute; deve ser definido se o mapfile for integrado a esse sistema.",
  1458 + titulo:"ID da variável no sistema de metadados estatísticos <img onclick='selIdMedidaVariavel(\"metaestat_id_medida_variavel\",\"metaestat_id_medida_variavel\")' src='"+limg+"' style='cursor:pointer;position :relative;top:2px'/>",id:"metaestat_id_medida_variavel",value:dados.metaestat_id_medida_variavel,tipo:"text",div:""},
  1459 + {ajuda:"Type of connection. Default is local.",
  1460 + titulo:"Connectiontype",id:"",value:"",div:"<div id=cConnectiontype ></div>",tipo:"text"},
  1461 + {ajuda:"Aplica a convers&atilde;o de caracteres nas ferramentas que obt&eacute;m os dados descritivos referentes aos elementos do LAYER. Em alguns casos, a convers&atilde;o pode provocar problemas de acentua&ccedil;&atilde;o. Se isso ocorrer, na ferramenta tabela por exemplo, experimente marcar essa op&ccedil;&atilde;o como 'nao'",
  1462 + titulo:"Convers&atilde;o de caracteres (METADATA: CONVCARACTER)",id:"",value:dados.convcaracter,tipo:"text",div:"<div id=cConvcaracter ></div>"},
  1463 + {ajuda:"Database connection string to retrieve remote data.An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas.A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of 'user=nobody password=****** dbname=dbname host=localhost port=5432' An Oracle connection string: user/pass[@db] . Se vc tiver problemas com acentua&ccedil;&atilde;o, experimente algo como: user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'",
  1464 + titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"},
  1465 + {ajuda:"Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object.If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. 'mylayer,shape,myversion'.If this is a PostGIS layer, the parameter should be in the form of '<columnname> from <tablename>', where 'columnname' is the name of the column containing the geometry objects and 'tablename' is the name of the table from which the geometry data will be read.For Oracle, use 'shape FROM table' or 'shape FROM (SELECT statement)' or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name. Exemplo postgis: the_geom FROM (select * FROM biomas) as foo USING UNIQUE gid USING SRID=4291 . Exemplo shapefile: c://ms4w/Apache/htdocs/geodados/brasil/limitespol/localidades.shp",
  1466 + titulo:"Data",id:"data",value:dados.data,tipo:"text"},
  1467 + {ajuda:"Specifies how the data should be drawn. Need not be the same as the shapefile type. For example, a polygon shapefile may be drawn as a point layer, but a point shapefile may not be drawn as a polygon layer. Common sense rules. Annotation means that a label point will be calculated for the features, but the feature itself will not be drawn although a marker symbol can be optionally drawn. this allows for advanced labeling like numbered highway shields. Points are labeled at that point. Polygons are labeled first using a centroid, and if that doesn't fall in the polygon a scanline approach is used to guarantee the label falls within the feature. Lines are labeled at the middle of the longest arc in the visible portion of the line. Query only means the layer can be queried but not drawn.In order to differentiate between POLYGONs and POLYLINEs (which do not exist as a type), simply respectively use or ommit the COLOR keyword when classifying. If you use it, it's a polygon with a fill color, otherwise it's a polyline with only an OUTLINECOLOR.For CHART layers, see the Dynamic Charting howto.A circle must be defined by a a minimum bounding rectangle. That is, 2 points that define the smallest square that can contain it. These 2 points are the two opposite corners of said box",
  1468 + titulo:"Type",id:"",value:dados.type,tipo:"text",div:"<div id=cType ></div>"},
  1469 + {ajuda:"Ativa ou n&atilde;o a manuten&ccedil;&atilde;o de um cache para armazenar as imagens geradas para montar o mapa. Essa op&ccedil;&atilde;o afeta apenas as interfaces do i3Geo que utilizam o modo TILE (como a interface OpenLayers). O cache &eacute; mantido no diretório tempor&aacute;rio utilizado pelo i3Geo, na pasta chamada cache. Para cada camada &eacute; criada uma sub-pasta. Para limpar o cache, utilize a op&ccedil;&atilde;o existente junto ao nó principal desse mapfile",
  1470 + titulo:"Cache de mapas. Camadas WMS s&atilde;o acessadas diretamente do servidor de origem quando o cache estiver inativo. (CACHE)",id:"",value:dados.cache,tipo:"text",div:"<div id=cCache ></div>"},
  1471 + {ajuda:"Proje&ccedil;&atilde;o",
  1472 + titulo:"Projection",id:"projection",value:dados.projection,tipo:"text"},
  1473 + {ajuda:"This parameter allows for data specific attribute filtering that is done at the same time spatial filtering is done, but before any CLASS expressions are evaluated. For OGR and shapefiles the string is simply a mapserver regular expression. For spatial databases the string is a SQL WHERE clause that is valid with respect to the underlying database.For example: FILTER type='road' and size <2",
  1474 + titulo:"Filter",id:"filter",value:dados.filter,tipo:"text"},
  1475 + {ajuda:"Item to use with simple FILTER expressions. OGR and shapefiles only.",
  1476 + titulo:"Filteritem",id:"filteritem",value:dados.filteritem,tipo:"text"},
  1477 + {ajuda:"Item that contains the location of an individual tile, default is 'location'.",
  1478 + titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"},
  1479 + {ajuda:"Name of the tileindex file or layer. A tileindex is similar to an ArcInfo library index. The tileindex contains polygon features for each tile. The item that contains the location of the tiled data is given using the TILEITEM parameter. When a file is used as the tileindex for shapefile or raster layers, the tileindex should be a shapefile. For CONNECTIONTYPE OGR layers, any OGR supported datasource can be a tileindex. Normally the location should contain the path to the tile file relative to the shapepath, not relative to the tileindex itself. If the DATA parameter contains a value then it is added to the end of the location. When a tileindex layer is used, it works similarly to directly referring to a file, but any supported feature source can be used (ie. postgres, oracle).NOTE: All files in the tileindex should have the same coordinate system, and for vector files the same set of attributes in the same order.",
  1480 + titulo:"tileindex",id:"tileindex",value:dados.tileindex,tipo:"text"},
  1481 + {ajuda:"Tipo de representa&ccedil;&atilde;o das fei&ccedil;&otilde;es mostradas da camada. &Eacute; importante definir esse par&acirc;metro para que as fun&ccedil;&otilde;es de gera&ccedil;&atilde;o de SLD funcionem corretamente.",
  1482 + titulo:"Tipo de representa&ccedil;&atilde;o (tipooriginal) - para temas do tipo WMS",id:"",value:dados.tipooriginal,tipo:"text",div:"<div id=cTipoOriginal ></div>"}
  1483 + ]
  1484 + };
1484 1485 var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />";
1485 1486 ins += "&nbsp;<input type=button title='Testar' value='Testar' id=testarEditor />";
1486 1487  
... ... @@ -1585,6 +1586,34 @@ function montaEditorDados(dados)
1585 1586 $i("connectiontype").onchange.call();
1586 1587 }
1587 1588 }
  1589 +function selIdMedidaVariavel(idEleValue,idEleCodigoConexao){
  1590 + var eleValue = $i(idEleValue),
  1591 + eleCodigoConexao = $i(idEleCodigoConexao),
  1592 + callback = {
  1593 + success:function(o){
  1594 + try {
  1595 + var dados = YAHOO.lang.JSON.parse(o.responseText),
  1596 + n = dados.length,
  1597 + i,
  1598 + valores = [],
  1599 + textos = [],
  1600 + selecionados = [eleValue.value];
  1601 + for(i=0;i<n;i++){
  1602 + valores.push(dados[i].id_medida_variavel);
  1603 + textos.push(dados[i].nome_variavel+" - "+dados[i].nomemedida);
  1604 + }
  1605 + core_menuCheckBox(valores,textos,selecionados,eleValue,"","","sim");
  1606 + }
  1607 + catch(e){core_handleFailure(e,o.responseText);}
  1608 + },
  1609 + failure:core_handleFailure,
  1610 + argument: { foo:"foo", bar:"bar" }
  1611 + };
  1612 + if(!eleValue || !eleCodigoConexao){
  1613 + return;
  1614 + }
  1615 + core_makeRequest(i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=LISTAMEDIDAVARIAVEL&formato=json&codigo_variavel=&id_medida_variavel=",callback);
  1616 +}
1588 1617 function montaEditorMetadados(dados)
1589 1618 {
1590 1619 var paramRaster = {
... ...
admin/js/estat_variavel.js
... ... @@ -1199,7 +1199,7 @@ i3GEOadmin.variaveis = {
1199 1199 valores.push(dados[i].esquema);
1200 1200 textos.push(dados[i].esquema);
1201 1201 }
1202   - core_menuCheckBox(valores,textos,selecionados,eleValue);
  1202 + core_menuCheckBox(valores,textos,selecionados,eleValue,"","","sim");
1203 1203 }
1204 1204 catch(e){core_handleFailure(e,o.responseText);}
1205 1205 },
... ... @@ -1228,7 +1228,7 @@ i3GEOadmin.variaveis = {
1228 1228 valores.push(dados[i].tabela);
1229 1229 textos.push(dados[i].tabela);
1230 1230 }
1231   - core_menuCheckBox(valores,textos,selecionados,eleValue);
  1231 + core_menuCheckBox(valores,textos,selecionados,eleValue,"","","sim");
1232 1232 }
1233 1233 catch(e){core_handleFailure(e,o.responseText);}
1234 1234 },
... ... @@ -1258,7 +1258,7 @@ i3GEOadmin.variaveis = {
1258 1258 valores.push(dados[i]);
1259 1259 textos.push(dados[i]);
1260 1260 }
1261   - core_menuCheckBox(valores,textos,selecionados,eleValue);
  1261 + core_menuCheckBox(valores,textos,selecionados,eleValue,"","","sim");
1262 1262 }
1263 1263 catch(e){core_handleFailure(e,o.responseText);}
1264 1264 },
... ...
admin/php/classe_metaestat.php
... ... @@ -1142,7 +1142,7 @@ class Metaestat{
1142 1142 $id_medida_variavel - opcional
1143 1143 */
1144 1144 function listaMedidaVariavel($codigo_variavel,$id_medida_variavel=""){
1145   - $sql = "SELECT i3geoestat_medida_variavel.*,i3geoestat_unidade_medida.permitemedia,i3geoestat_unidade_medida.permitesoma,i3geoestat_unidade_medida.nome as unidade_medida ";
  1145 + $sql = "SELECT i3geoestat_medida_variavel.*,i3geoestat_variavel.nome as nome_variavel,i3geoestat_unidade_medida.permitemedia,i3geoestat_unidade_medida.permitesoma,i3geoestat_unidade_medida.nome as unidade_medida ";
1146 1146 $sql .= "FROM ".$this->esquemaadmin."i3geoestat_variavel ";
1147 1147 $sql .= "JOIN ".$this->esquemaadmin."i3geoestat_medida_variavel ";
1148 1148 $sql .= "ON i3geoestat_variavel.codigo_variavel = i3geoestat_medida_variavel.codigo_variavel ";
... ... @@ -1154,7 +1154,7 @@ class Metaestat{
1154 1154 $sql .= "AND i3geoestat_medida_variavel.id_medida_variavel = $id_medida_variavel ";
1155 1155 }
1156 1156 }
1157   - else{
  1157 + elseif($id_medida_variavel != "") {
1158 1158 $sql .= "WHERE i3geoestat_medida_variavel.id_medida_variavel = $id_medida_variavel ";
1159 1159 }
1160 1160 return $this->execSQL($sql,$id_medida_variavel);
... ...
classesjs/classe_arvoredetemas.js
... ... @@ -1762,36 +1762,55 @@ i3GEO.arvoreDeTemas = {
1762 1762 //
1763 1763 //verifica se o tema ja existe no mapa
1764 1764 //
1765   - if(tsl.length === 1 && i3GEO.arvoreDeCamadas.pegaTema(tsl[0]) !== ""){
  1765 + if(i3GEO.arvoreDeCamadas.pegaTema(tsl[0]) !== ""){
1766 1766 temp = window.confirm("O tema existe no mapa. Adiciona novamente?");
1767 1767 if(!temp){return;}
1768 1768 }
1769 1769 if(tsl.length > 0){
1770   - temp = function(retorno){
1771   - i3GEO.atualiza();
1772   - //
1773   - //verifica se deve ser ativada uma outra guia que nao a atual
1774   - //
1775   - if(i3GEO.arvoreDeTemas.RETORNAGUIA !== ""){
1776   - if(i3GEO.arvoreDeTemas.RETORNAGUIA !== i3GEO.guias.ATUAL){
1777   - i3GEO.guias.escondeGuias();
1778   - i3GEO.guias.mostra(i3GEO.arvoreDeTemas.RETORNAGUIA);
  1770 + //verifica se o tema esta vinculado ao sistema de metadados estatisticos
  1771 + temp = i3GEO.arvoreDeTemas.ARVORE.getNodeByProperty("idtema",tsl[0]);
  1772 + if(temp && temp.data.tipoa_tema === "META"){
  1773 + //obtem os parametros do tema
  1774 + temp = function(retorno){
  1775 + var id = retorno.data[tsl[0]]["METAESTAT_ID_MEDIDA_VARIAVEL"];
  1776 + i3GEO.util.dialogoFerramenta(
  1777 + "i3GEO.mapa.dialogo.metaestat()",
  1778 + "metaestat",
  1779 + "metaestat",
  1780 + "index.js",
  1781 + "i3GEOF.metaestat.inicia('flutuanteSimples','',"+id+")"
  1782 + );
  1783 +
  1784 + };
  1785 + i3GEO.php.pegaMetaData(temp,tsl[0]);
  1786 + }
  1787 + else{
  1788 + temp = function(retorno){
  1789 + i3GEO.atualiza();
  1790 + //
  1791 + //verifica se deve ser ativada uma outra guia que nao a atual
  1792 + //
  1793 + if(i3GEO.arvoreDeTemas.RETORNAGUIA !== ""){
  1794 + if(i3GEO.arvoreDeTemas.RETORNAGUIA !== i3GEO.guias.ATUAL){
  1795 + i3GEO.guias.escondeGuias();
  1796 + i3GEO.guias.mostra(i3GEO.arvoreDeTemas.RETORNAGUIA);
  1797 + }
1779 1798 }
1780   - }
1781   - //
1782   - //verifica se a janela da ferramenta identifica esta ativa para atualizar a lista de temas
1783   - //
1784   - try{
1785   - if($i("i3GEOidentificalistaTemas")){
1786   - i3GEOF.identifica.listaTemas();
1787   - g_tipoacao = "identifica";
  1799 + //
  1800 + //verifica se a janela da ferramenta identifica esta ativa para atualizar a lista de temas
  1801 + //
  1802 + try{
  1803 + if($i("i3GEOidentificalistaTemas")){
  1804 + i3GEOF.identifica.listaTemas();
  1805 + g_tipoacao = "identifica";
  1806 + }
1788 1807 }
1789   - }
1790   - catch(r){
1791   - if(typeof(console) !== 'undefined'){console.error(r);}
1792   - }
1793   - };
1794   - i3GEO.php.adtema(temp,tsl.toString());
  1808 + catch(r){
  1809 + if(typeof(console) !== 'undefined'){console.error(r);}
  1810 + }
  1811 + };
  1812 + i3GEO.php.adtema(temp,tsl.toString());
  1813 + }
1795 1814 }
1796 1815 },
1797 1816 /*
... ...
classesjs/classe_php.js
... ... @@ -1387,6 +1387,16 @@ i3GEO.php = {
1387 1387 cpJSON.call(p,"pegadata",funcao,par);
1388 1388 },
1389 1389 /*
  1390 + Function: pegaMetaData
  1391 +
  1392 + <PEGAMETADATA>
  1393 + */
  1394 + pegaMetaData: function(funcao,tema){
  1395 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php",
  1396 + par = "g_sid="+i3GEO.configura.sid+"&funcao=pegametadata&tema="+tema;
  1397 + cpJSON.call(p,"pegametadata",funcao,par);
  1398 + },
  1399 + /*
1390 1400 Function: alteraData
1391 1401  
1392 1402 <ALTERADATA>
... ...
classesphp/classe_temas.php
... ... @@ -122,7 +122,6 @@ $ext - (opcional) extens&amp;atilde;o geogr&amp;aacute;fica que ser&amp;aacute; aplicada ao
122 122 {
123 123 $this->mapa = ms_newMapObj($map_file);
124 124 $this->arquivo = $map_file;
125   -
126 125 if($tema != "")
127 126 {
128 127 $listaTemas = str_replace(" ",",",$tema);
... ... @@ -162,6 +161,25 @@ Salva o mapfile atual
162 161 if (connection_aborted()){exit();}
163 162 $this->mapa->save($this->arquivo);
164 163 }
  164 +/*
  165 + function: pegaMetadata
  166 +
  167 +Pega os metadata do tema
  168 +
  169 +parameter:
  170 +
  171 +*/
  172 + function pegaMetadata(){
  173 + if(!$this->layer){return "erro";}
  174 + $buscar = array("METAESTAT","METAESTAT_ID_MEDIDA_VARIAVEL");
  175 + $meta = array();
  176 + foreach($buscar as $b){
  177 + $meta[$b] = $this->layer->getmetadata($b);
  178 + }
  179 + return array(
  180 + $this->layer->name => $meta
  181 + );
  182 + }
165 183 /*
166 184 function: aplicaProcessos
167 185  
... ...
classesphp/mapa_controle.php
... ... @@ -777,6 +777,24 @@ Obt&amp;eacute;m o nome de um layer e de seu arquivo mapfile original.
777 777 $m = new Temas($map_file,$tema);
778 778 $retorno = $m->peganomelayer();
779 779 break;
  780 + /*
  781 + Valor: PEGAMETADATA
  782 +
  783 + Obt&eacute;m os metadados de um tema
  784 +
  785 + Tema pode ser um mapfile existente em i3geo/temas
  786 +
  787 + <Temas->pegametadata>
  788 + */
  789 + case "PEGAMETADATA":
  790 + include_once("classe_temas.php");
  791 + //pode pegar os metadata de um mapfile existente em i3geo/temas
  792 + if(file_exists(__DIR__."/../temas/".$tema.".map")){
  793 + $map_file = __DIR__."/../temas/".$tema.".map";
  794 + }
  795 + $m = new Temas($map_file,$tema);
  796 + $retorno = $m->pegametadata();
  797 + break;
780 798 /*
781 799 Valor: PEGADATA
782 800  
... ...
ferramentas/metaestat/dicionario.js
... ... @@ -117,5 +117,12 @@ pt:&quot;Regi&amp;atilde;o&quot;,
117 117 en:"",
118 118 es:"",
119 119 it:""
  120 +}],
  121 +"17":[
  122 +{
  123 +pt:"Escolha um tipo de regi&atilde;o (limites utilizados para representar os valores) e o tipo de classifica&ccedil;&atilde;o dos dados, depois escolha os valores para os par&acirc;metros , se houver. Para adicionar a camada ao mapa, clique no bot&atilde;o de adi&ccedil;&atilde;o e feche a janela para continuar usando o mapa.",
  124 +en:"",
  125 +es:"",
  126 +it:""
120 127 }]
121 128 };
122 129 \ No newline at end of file
... ...
ferramentas/metaestat/index.js
... ... @@ -41,6 +41,10 @@ i3GEOF.metaestat = {
41 41 * Tipo de interface utilizada para construcao dos parametros
42 42 */
43 43 INTERFACE: "flutuante",
  44 + //codigo da variavel definido na inicializacao (opcional)
  45 + CODIGO_VARIAVEL: "",
  46 + //id da medida da variavel definido na inicializacao (opcional)
  47 + ID_MEDIDA_VARIAVEL: "",
44 48 CONEXAODEFAULT: 0,
45 49 TOP: 50,
46 50 LEFT: 100,
... ... @@ -54,7 +58,16 @@ i3GEOF.metaestat = {
54 58 criaJanelaFlutuante: function(){
55 59 i3GEOF.metaestat.inicia();
56 60 },
57   - inicia: function(){
  61 + inicia: function(Interface,codigo_variavel,id_medida_variavel){
  62 + if(Interface && Interface != ""){
  63 + i3GEOF.metaestat.INTERFACE = Interface;
  64 + }
  65 + if(codigo_variavel && codigo_variavel != ""){
  66 + i3GEOF.metaestat.CODIGO_VARIAVEL = codigo_variavel;
  67 + }
  68 + if(id_medida_variavel && id_medida_variavel != ""){
  69 + i3GEOF.metaestat.ID_MEDIDA_VARIAVEL = id_medida_variavel;
  70 + }
58 71 i3GEOF.metaestat.comum.iniciaDicionario();
59 72 },
60 73 analise: {
... ... @@ -553,11 +566,16 @@ i3GEOF.metaestat = {
553 566 }
554 567 if(i3GEOF.metaestat.INTERFACE == "flutuante"){
555 568 i3GEOF.metaestat.classes.abreJanela();
  569 + $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html();
  570 + i3GEOF.metaestat.classes.comboTipoRep();
  571 + i3GEOF.metaestat.classes.comboTipoClassificacao();
  572 + i3GEOF.metaestat.classes.comboRegiao();
  573 + }
  574 + if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){
  575 + i3GEOF.metaestat.classes.abreJanela();
  576 + $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html();
  577 + i3GEOF.metaestat.classes.comboTipoClassificacao();
556 578 }
557   - $i(iddiv).innerHTML = i3GEOF.metaestat.classes.html();
558   - i3GEOF.metaestat.classes.comboTipoRep();
559   - i3GEOF.metaestat.classes.comboTipoClassificacao();
560   - i3GEOF.metaestat.classes.comboRegiao();
561 579 },
562 580 abreJanela: function(){
563 581 var cabecalho,minimiza,imagemxy,janela;
... ... @@ -720,22 +738,22 @@ i3GEOF.metaestat = {
720 738 i3GEOF.metaestat.analise.comboCamadas();
721 739 };
722 740 i3GEO.php.adtema(atualiza,retorno.mapfile);
723   -
724 741 }
725 742 };
726 743 if(v != true){
727 744 i3GEO.janela.tempoMsg("erro: "+v);
  745 + return;
728 746 }
729 747 i3GEO.php.mapfileMedidaVariavel(
730   - temp,
731   - $i("i3geoCartoComboMedidasVariavel").value,
732   - i3GEOF.metaestat.comum.defineFiltro(),
733   - 0,
734   - $i("i3geoCartoComboTipoRep").value,
735   - i3GEOF.metaestat.comum.defineTitulo(),
736   - $i("i3geoCartoComboTipoClassificacao").value,
737   - i3GEOF.metaestat.comum.defineAgruparPor(),
738   - $i("i3geoCartoComboRegioesMedidasVariavel").value
  748 + temp,
  749 + $i("i3geoCartoComboMedidasVariavel").value,
  750 + i3GEOF.metaestat.comum.defineFiltro(),
  751 + 0,
  752 + $i("i3geoCartoComboTipoRep").value,
  753 + i3GEOF.metaestat.comum.defineTitulo(),
  754 + $i("i3geoCartoComboTipoClassificacao").value,
  755 + i3GEOF.metaestat.comum.defineAgruparPor(),
  756 + $i("i3geoCartoComboRegioesMedidasVariavel").value
739 757 );
740 758 },
741 759 ativaCamada: function(camada){
... ... @@ -747,7 +765,7 @@ i3GEOF.metaestat = {
747 765 },
748 766 defineTitulo: function(){
749 767 //se nao tiver parametros, filtro e vazio
750   - if(i3GEOF.metaestat.parametros.dados.length == 0){
  768 + if(i3GEOF.metaestat.parametros.dados.length == 0 || i3GEOF.metaestat.INTERFACE === "flutuanteSimples"){
751 769 return "";
752 770 }
753 771 //se tiver parametro e todos estiverem vazios, aborta
... ... @@ -1440,29 +1458,52 @@ i3GEOF.metaestat = {
1440 1458 if(!iddiv || !$i(iddiv)){
1441 1459 iddiv = "i3geoCartoParametros_corpo";
1442 1460 }
  1461 + //interface default
1443 1462 if(i3GEOF.metaestat.INTERFACE == "flutuante"){
1444 1463 i3GEOF.metaestat.principal.abreJanela();
  1464 + $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html();
  1465 + i3GEOF.metaestat.principal.opcoesVariaveis();
  1466 + }
  1467 + //interface qd a medida da variavel ja tiver sido definida
  1468 + if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){
  1469 + i3GEOF.metaestat.principal.abreJanela();
  1470 + $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html();
  1471 + //i3GEOF.metaestat.principal.opcoesVariaveis();
  1472 + $i("i3geoCartoVariaveis").innerHTML = "Aguarde...";
  1473 + $i("i3geoCartoVariaveis").innerHTML = '<input style=width: type="button" id="i3GEOcartoBotaoAdicionarCamada" onclick="i3GEOF.metaestat.principal.maisInfo()" value="'+$trad(7,i3GEOF.metaestat.dicionario)+'"class="paragrafo" style="cursor:pointer;color:blue" />' +
  1474 + "<br><br><input type=hidden value='"+i3GEOF.metaestat.ID_MEDIDA_VARIAVEL+"' id='i3geoCartoComboMedidasVariavel' />" +
  1475 + "<input type=hidden value='0' id='i3geoCartoComboVariavel' />" +
  1476 + "<input type=hidden value='0' id='i3geoCartoComboTipoRep' />" +
  1477 + "<div id='i3geoCartoRegioesMedidasVariavel'></div>" +
  1478 + "<br><div id='i3geoCartoTipoClassificacao'></div>" +
  1479 + "<br><div id='i3geoCartoParametrosMedidasVariavel'></div>" +
  1480 + "<p class=paragrafo >"+$trad(17,i3GEOF.metaestat.dicionario) + "</p>";
  1481 + i3GEOF.metaestat.classes.botaoAdicionarCamada();
  1482 + i3GEOF.metaestat.classes.comboRegiao(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL);
  1483 + i3GEOF.metaestat.classes.comboTipoClassificacao();
  1484 + i3GEOF.metaestat.parametros.lista(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL);
1445 1485 }
1446   - $i(iddiv).innerHTML = i3GEOF.metaestat.principal.html();
1447   - i3GEOF.metaestat.principal.opcoesVariaveis();
1448 1486 },
1449 1487 abreJanela: function(){
1450   - var cabecalho,minimiza,imagemxy,janela;
  1488 + var cabecalho,minimiza,imagemxy,janela,modal = false;
1451 1489 if (!$i("i3geoCartoParametros")){
1452 1490 cabecalho = function(){
1453 1491 };
1454 1492 minimiza = function(){
1455 1493 i3GEO.janela.minimiza("i3geoCartoParametros");
1456 1494 };
  1495 + if(i3GEOF.metaestat.INTERFACE == "flutuanteSimples"){
  1496 + modal = true;
  1497 + }
1457 1498 janela = i3GEO.janela.cria(
1458   - i3GEOF.metaestat.LARGURA+"px",
  1499 + i3GEOF.metaestat.LARGURA+10+"px",
1459 1500 i3GEOF.metaestat.ALTURA+"px",
1460 1501 "",
1461 1502 "",
1462 1503 "",
1463 1504 $trad("x57"),
1464 1505 "i3geoCartoParametros",
1465   - false,
  1506 + modal,
1466 1507 "hd",
1467 1508 cabecalho,
1468 1509 minimiza
... ...
temas/testemetaestat.map 0 → 100644
... ... @@ -0,0 +1,88 @@
  1 +MAP
  2 + FONTSET "../symbols/fontes.txt"
  3 + IMAGECOLOR 255 255 255
  4 + IMAGETYPE "png"
  5 + NAME "MS"
  6 + SIZE -1 -1
  7 + STATUS ON
  8 + SYMBOLSET "../symbols/simbolosv6.sym"
  9 + UNITS METERS
  10 +
  11 + OUTPUTFORMAT
  12 + NAME "png"
  13 + MIMETYPE "image/png"
  14 + DRIVER "AGG/PNG"
  15 + EXTENSION "png"
  16 + IMAGEMODE RGB
  17 + TRANSPARENT FALSE
  18 + END # OUTPUTFORMAT
  19 +
  20 + LEGEND
  21 + IMAGECOLOR 255 255 255
  22 + KEYSIZE 20 10
  23 + KEYSPACING 5 5
  24 + LABEL
  25 + SIZE MEDIUM
  26 + COLOR 0 0 0
  27 + OFFSET 0 0
  28 + SHADOWSIZE 1 1
  29 + TYPE BITMAP
  30 + END # LABEL
  31 + STATUS OFF
  32 + END # LEGEND
  33 +
  34 + QUERYMAP
  35 + COLOR 255 255 0
  36 + SIZE -1 -1
  37 + STATUS OFF
  38 + STYLE HILITE
  39 + END # QUERYMAP
  40 +
  41 + SCALEBAR
  42 + COLOR 0 0 0
  43 + IMAGECOLOR 255 255 255
  44 + INTERVALS 4
  45 + LABEL
  46 + SIZE MEDIUM
  47 + COLOR 0 0 0
  48 + OFFSET 0 0
  49 + SHADOWSIZE 1 1
  50 + TYPE BITMAP
  51 + END # LABEL
  52 + SIZE 200 3
  53 + STATUS OFF
  54 + UNITS MILES
  55 + END # SCALEBAR
  56 +
  57 + WEB
  58 + END # WEB
  59 +
  60 + LAYER
  61 + CONNECTION ""
  62 + CONNECTIONTYPE POSTGIS
  63 + DATA ""
  64 + METADATA
  65 + "METAESTAT_ID_MEDIDA_VARIAVEL" "1"
  66 + "cache" ""
  67 + "CLASSE" "SIM"
  68 + "METAESTAT" "SIM"
  69 + "convcaracter" ""
  70 + "TEMA" "Teste de tema baseado no METAESTAT"
  71 + END # METADATA
  72 + NAME "testemetaestat"
  73 + STATUS OFF
  74 + TEMPLATE "none.htm"
  75 + TILEITEM "location"
  76 + TYPE POLYGON
  77 + UNITS METERS
  78 + CLASS
  79 + NAME ""
  80 + STYLE
  81 + ANGLE 0
  82 + COLOR 0 0 0
  83 + OFFSET 0 0
  84 + END # STYLE
  85 + END # CLASS
  86 + END # LAYER
  87 +
  88 +END # MAP
... ...