Commit 7c9f4e2f0f024aa012bbdc5fd91c1f53199b1158

Authored by Edmar Moretti
1 parent bc48bd29

--no commit message

Showing 1 changed file with 90 additions and 60 deletions   Show diff stats
ferramentas/metaestat/index.js
... ... @@ -837,24 +837,15 @@ i3GEOF.metaestat = {
837 837 //function mapfileMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$tipolayer="polygon",$titulolayer="",$id_classificacao="",$agruparpor=""){
838 838 var v = i3GEOF.metaestat.comum.verificaParametros(),
839 839 temp = function(retorno){
840   - var atualiza = function(){
841   - i3GEO.atualiza();
842   - i3GEOF.metaestat.CAMADAS.push(retorno.layer);
843   - i3GEO.mapa.ativaTema(retorno.layer);
844   - i3GEOF.metaestat.analise.comboCamadas();
845   - },
846   - c = i3GEO.arvoreDeCamadas.capturaCheckBox(retorno.layer);
847 840 if(i3GEO.arvoreDeCamadas.pegaTema(retorno.layer) == ""){
848 841 i3GEOF.metaestat.comum.desligaCamadas();
849   - i3GEO.php.adtema(atualiza,retorno.mapfile);
850   - }
851   - else{
852   - if(c){
853   - i3GEOF.metaestat.comum.desligaCamadas();
  842 + var atualiza = function(){
  843 + i3GEO.atualiza();
  844 + i3GEOF.metaestat.CAMADAS.push(retorno.layer);
854 845 i3GEO.mapa.ativaTema(retorno.layer);
855   - c.checked = true;
856   - i3GEO.Interface.ligaDesliga(c);
857   - }
  846 + i3GEOF.metaestat.analise.comboCamadas();
  847 + };
  848 + i3GEO.php.adtema(atualiza,retorno.mapfile);
858 849 }
859 850 };
860 851 if(v != true){
... ... @@ -1298,6 +1289,44 @@ i3GEOF.metaestat = {
1298 1289 i3GEO.util.ajaxGet(p,temp);
1299 1290 },
1300 1291 /**
  1292 + * Botao de upload
  1293 + */
  1294 + botaoUpload: function(id){
  1295 + new YAHOO.widget.Button(
  1296 + id,
  1297 + {onclick:{fn: function(){
  1298 + var cabecalho,minimiza,janela;
  1299 + if (!$i("i3geoCartoUpload")){
  1300 + cabecalho = function(){
  1301 + };
  1302 + minimiza = function(){
  1303 + i3GEO.janela.minimiza("i3geoCartoUpload");
  1304 + };
  1305 + janela = i3GEO.janela.cria(
  1306 + "500px",
  1307 + "450px",
  1308 + i3GEO.configura.locaplic+"/ferramentas/metaestat/upload.html",
  1309 + "",
  1310 + "",
  1311 + "Upload",
  1312 + "i3geoCartoUpload",
  1313 + false,
  1314 + "hd",
  1315 + cabecalho,
  1316 + minimiza
  1317 + );
  1318 + janela = janela[0];
  1319 + YAHOO.i3GEO.janela.manager.register(janela);
  1320 + janela.render();
  1321 + }
  1322 + else{
  1323 + janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoUpload");
  1324 + }
  1325 + janela.show();
  1326 + }}}
  1327 + );
  1328 + },
  1329 + /**
1301 1330 * Abertura do ajudante
1302 1331 *
1303 1332 **/
... ... @@ -1318,39 +1347,7 @@ i3GEOF.metaestat = {
1318 1347 window.open(i3GEO.configura.locaplic+"/ferramentas/metaestat/editorlimites.php");
1319 1348 }}}
1320 1349 );
1321   - new YAHOO.widget.Button(
1322   - "i3GEOFmetaestatEditorBotaot03",
1323   - {onclick:{fn: function(){
1324   - var cabecalho,minimiza,janela;
1325   - if (!$i("i3geoCartoUpload")){
1326   - cabecalho = function(){
1327   - };
1328   - minimiza = function(){
1329   - i3GEO.janela.minimiza("i3geoCartoUpload");
1330   - };
1331   - janela = i3GEO.janela.cria(
1332   - "500px",
1333   - "450px",
1334   - i3GEO.configura.locaplic+"/ferramentas/metaestat/upload.html",
1335   - "",
1336   - "",
1337   - "Upload",
1338   - "i3geoCartoUpload",
1339   - false,
1340   - "hd",
1341   - cabecalho,
1342   - minimiza
1343   - );
1344   - janela = janela[0];
1345   - YAHOO.i3GEO.janela.manager.register(janela);
1346   - janela.render();
1347   - }
1348   - else{
1349   - janela = YAHOO.i3GEO.janela.manager.find("i3geoCartoUpload");
1350   - }
1351   - janela.show();
1352   - }}}
1353   - );
  1350 + i3GEOF.metaestat.editor.botaoUpload("i3GEOFmetaestatEditorBotaot03");
1354 1351 },
1355 1352 /**
1356 1353 * Edicao da variavel
... ... @@ -1402,7 +1399,7 @@ i3GEOF.metaestat = {
1402 1399 "<span>" + i3GEOF.metaestat.principal.comboMedidasVariavel(dados,"i3geoCartoComboMedidaVariavelEditor","i3GEOF.metaestat.editor.comboMedidaVariavelOnchange(this)","","nao") + "</span>" +
1403 1400 "<br><br><p><input id=i3GEOFmetaestatEditorBotao4 type='button' value='"+$trad(8,i3GEOF.metaestat.dicionario1)+"' />" +
1404 1401 "&nbsp;<input id=i3GEOFmetaestatEditorBotao4a type='button' value='"+$trad(5,i3GEOF.metaestat.dicionario1)+"' /><br>";
1405   - i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t1()","i3GEOF.metaestat.editor.t3()",ins,"i3GEOF.metaestat.editor.t2","i3GEOFmetaestatEditor",true);
  1402 + i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t1()","i3GEOF.metaestat.editor.t3a()",ins,"i3GEOF.metaestat.editor.t2","i3GEOFmetaestatEditor",true);
1406 1403 new YAHOO.widget.Button(
1407 1404 "i3GEOFmetaestatEditorBotao4",
1408 1405 {onclick:{fn: i3GEOF.metaestat.editor.editaMedidaVariavel}}
... ... @@ -1427,6 +1424,26 @@ i3GEOF.metaestat = {
1427 1424 }
1428 1425 },
1429 1426 /**
  1427 + * Opcao de upload
  1428 + */
  1429 + t3a: function(remove,textoSelecionado){
  1430 + if(remove == true){
  1431 + //remove o conteudo anteriormente construido
  1432 + i3GEOF.metaestat.editor.removeEl("i3GEOF.metaestat.editor.t3a");
  1433 + }
  1434 + if($i("i3geoCartoComboMedidaVariavelEditor").value === ""){
  1435 + i3GEO.janela.tempoMsg($trad(2,i3GEOF.metaestat.dicionario));
  1436 + i3GEOF.metaestat.editor.t2(false);
  1437 + }
  1438 + else{
  1439 + var ins = "<p class='paragrafo' >" + $trad(20,i3GEOF.metaestat.dicionario1) +
  1440 + "<br><br><p><input id=i3GEOFmetaestatEditorBotaot3a type='button' value='Upload CSV' />";
  1441 + i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t2()","i3GEOF.metaestat.editor.t3()",ins,"i3GEOF.metaestat.editor.t3a","i3GEOFmetaestatEditor",true);
  1442 + i3GEOF.metaestat.editor.botaoUpload("i3GEOFmetaestatEditorBotaot3a");
  1443 + $i("i3GEOFmetaestatEditorBotaot3a-button").style.width = (i3GEOF.metaestat.LARGURA / 2) + "px";
  1444 + }
  1445 + },
  1446 + /**
1430 1447 * Edicao da classificacao
1431 1448 */
1432 1449 t3: function(remove,textoSelecionado){
... ... @@ -1445,7 +1462,7 @@ i3GEOF.metaestat = {
1445 1462 "<br><br>"+$trad(14,i3GEOF.metaestat.dicionario1)+": " + i3GEOF.metaestat.editor.dadoMedidaSelecionada("unidade_medida") +
1446 1463 "<br><br><p><input id=i3GEOFmetaestatEditorBotao5 type='button' value='"+$trad(8,i3GEOF.metaestat.dicionario1)+"' />" +
1447 1464 "&nbsp;<input id=i3GEOFmetaestatEditorBotao5a type='button' value='"+$trad(5,i3GEOF.metaestat.dicionario1)+"' /><br>";
1448   - i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t2()","i3GEOF.metaestat.editor.t4()",ins,"i3GEOF.metaestat.editor.t3","i3GEOFmetaestatEditor",true);
  1465 + i3GEO.util.proximoAnterior("i3GEOF.metaestat.editor.t3a()","i3GEOF.metaestat.editor.t4()",ins,"i3GEOF.metaestat.editor.t3","i3GEOFmetaestatEditor",true);
1449 1466  
1450 1467 new YAHOO.widget.Button(
1451 1468 "i3GEOFmetaestatEditorBotao5",
... ... @@ -1763,7 +1780,7 @@ i3GEOF.metaestat = {
1763 1780 }
1764 1781 },
1765 1782 comboVariaveis: function(dados,idcombo,stronchange,largura,mostraIconeinfo){
1766   - var ins,i,n = dados.length;
  1783 + var ins,i,n = dados.length,selecionado = "";
1767 1784 if(!largura || largura === ""){
1768 1785 largura = i3GEOF.metaestat.LARGURA - 40;
1769 1786 }
... ... @@ -1772,7 +1789,13 @@ i3GEOF.metaestat = {
1772 1789 }
1773 1790 ins = "<select id='"+idcombo+"' style='box-shadow:0 1px 5px gray;width:"+largura+"px' onchange='"+stronchange+"'><option value=''>---</option>";
1774 1791 for(i=0;i<n;i++){
1775   - ins += "<option title='"+dados[i].descricao+"' value='"+dados[i].codigo_variavel+"'>"+dados[i].nome+"</option>";
  1792 + if(dados[i].codigo_variavel === i3GEOF.metaestat.CODIGO_VARIAVEL){
  1793 + selecionado = "SELECTED";
  1794 + }
  1795 + else{
  1796 + selecionado = "";
  1797 + }
  1798 + ins += "<option "+selecionado+" title='"+dados[i].descricao+"' value='"+dados[i].codigo_variavel+"'>"+dados[i].nome+"</option>";
1776 1799 }
1777 1800 ins += "</select>";
1778 1801 if(mostraIconeinfo == "sim"){
... ... @@ -1841,20 +1864,20 @@ i3GEOF.metaestat = {
1841 1864 i3GEO.php.listaVariavel(temp);
1842 1865 },
1843 1866 comboVariaveisOnchange: function(combo){
1844   - if($i("i3geoCartoParametrosMedidasVariavel")){
1845   - $i("i3geoCartoParametrosMedidasVariavel").innerHTML = "";
1846   - }
  1867 + i3GEOF.metaestat.CODIGO_VARIAVEL = combo.value;
1847 1868 if(combo.value != ""){
1848 1869 i3GEOF.metaestat.principal.opcoesMedidasVariavel(combo.value);
1849 1870 }
1850 1871 else{
1851 1872 $i("i3geoCartoMedidasVariavel").innerHTML = "";
1852 1873 }
  1874 + $i("i3geoCartoParametrosMedidasVariavel").innerHTML = "";
1853 1875 i3GEOF.metaestat.classes.zeraParametros();
1854 1876 },
1855 1877 comboMedidasVariavel: function(dados,idcombo,stronchange,filtroesquema,largura,mostraIconeprop,mostraIconedown){
1856 1878 i3GEOF.metaestat.DADOSMEDIDASVARIAVEL = dados;
1857 1879 var n = dados.length,
  1880 + selecionado = "",
1858 1881 ins = '',
1859 1882 i;
1860 1883 if(!largura || largura === ""){
... ... @@ -1875,7 +1898,13 @@ i3GEOF.metaestat = {
1875 1898 ins += "<select id='"+idcombo+"' style='box-shadow:0 1px 5px gray;width:"+largura+"px' onchange='"+stronchange+"'><option value=''>---</option>";
1876 1899 for(i=0;i<n;i++){
1877 1900 if(!filtroesquema || (filtroesquema != "" && dados[i].esquemadb != filtroesquema)){
1878   - ins += "<option value='"+dados[i].id_medida_variavel+"'>"+dados[i].nomemedida+"</option>";
  1901 + if(i3GEOF.metaestat.ID_MEDIDA_VARIAVEL === dados[i].id_medida_variavel){
  1902 + selecionado = "selected";
  1903 + }
  1904 + else{
  1905 + selecionado = "";
  1906 + }
  1907 + ins += "<option "+selecionado+" value='"+dados[i].id_medida_variavel+"'>"+dados[i].nomemedida+"</option>";
1879 1908 }
1880 1909 }
1881 1910 ins += "</select>";
... ... @@ -1901,14 +1930,15 @@ i3GEOF.metaestat = {
1901 1930 i3GEO.php.listaMedidaVariavel(codigo_variavel,temp);
1902 1931 },
1903 1932 comboMedidaVariavelOnchange: function(combo){
1904   - if($i("i3geoCartoParametrosMedidasVariavel")){
1905   - $i("i3geoCartoParametrosMedidasVariavel").innerHTML = "";
1906   - }
  1933 + i3GEOF.metaestat.ID_MEDIDA_VARIAVEL = combo.value;
1907 1934 if(combo.value != ""){
1908 1935 //i3GEOF.metaestat.classes.inicia();
1909 1936 i3GEOF.metaestat.parametros.lista(combo.value);
1910 1937 i3GEOF.metaestat.principal.botaoAdicionaCamada();
1911 1938 }
  1939 + else{
  1940 + $i("i3geoCartoParametrosMedidasVariavel").innerHTML = "";
  1941 + }
1912 1942 i3GEOF.metaestat.classes.zeraParametros();
1913 1943 },
1914 1944 comboClassificacoesMedidaVariavel: function(dados,idcombo){
... ... @@ -1981,4 +2011,4 @@ i3GEOF.metaestat = {
1981 2011 i3GEOF.metaestat.principal.comboMedidaVariavelOnchange(obj);
1982 2012 }
1983 2013 }
1984   -};
1985 2014 \ No newline at end of file
  2015 +};
... ...