Commit 38bc83d614818e88b4c6083832532b34da4cb76d

Authored by Edmar Moretti
1 parent 93cd3ffb

$1

Showing 1 changed file with 167 additions and 125 deletions   Show diff stats
admin/js/editormapfile.js
... ... @@ -260,8 +260,8 @@ function montaArvore()
260 260 }
261 261 buildTree();
262 262 }();
263   - montaNosRaiz("nao");
264   - tree.draw();
  263 + montaNosRaiz("nao");
  264 + tree.draw();
265 265 }
266 266 function montaNosRaiz(redesenha)
267 267 {
... ... @@ -808,10 +808,10 @@ function classesAuto(codigoMap,codigoLayer)
808 808 var sUrl = "../php/editormapfile.php?funcao=autoClassesLayer&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&itemExpressao="+itemExpressao+"&itemNome="+itemNome;
809 809 var callback2 =
810 810 {
811   - success:function(o)
812   - {
813   - try
814   - {
  811 + success:function(o)
  812 + {
  813 + try
  814 + {
815 815 var dados = YAHOO.lang.JSON.parse(o.responseText);
816 816 var nos = tree.getNodesByProperty("classes",codigoMap+"_"+codigoLayer);
817 817 if(nos){
... ... @@ -820,14 +820,14 @@ function classesAuto(codigoMap,codigoLayer)
820 820 }
821 821 var no = tree.getNodeByProperty("etiquetaClasses",codigoMap+"_"+codigoLayer);
822 822 montaParametrosTemas(no,dados);
823   - core_carregando("desativa");
  823 + core_carregando("desativa");
824 824 YAHOO.admin.container.panelEditorAutoClasses.destroy();
825 825 YAHOO.admin.container.panelEditorAutoClasses = null;
826   - }
827   - catch(e){core_handleFailure(o,o.responseText);core_carregando("desativa");}
828   - },
829   - failure:core_handleFailure,
830   - argument: { foo:"foo", bar:"bar" }
  826 + }
  827 + catch(e){core_handleFailure(o,o.responseText);core_carregando("desativa");}
  828 + },
  829 + failure:core_handleFailure,
  830 + argument: { foo:"foo", bar:"bar" }
831 831 };
832 832 core_makeRequest(sUrl,callback2);
833 833 }
... ... @@ -857,26 +857,26 @@ function classesAuto(codigoMap,codigoLayer)
857 857 var sUrl = "../php/editormapfile.php?funcao=pegaItensLayer&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
858 858 var callback =
859 859 {
860   - success:function(o)
861   - {
862   - try
863   - {
864   - var itens = core_comboObjeto(YAHOO.lang.JSON.parse(o.responseText).itens,"","","");
865   - var ins = "<p>Item da tabela de atributos que ser&aacute; utilizado para compor a express&atilde;o de sele&ccedil;&atilde;o de cada classe</p>";
866   - ins += "<select id='itemExpressao' >";
867   - ins += itens;
868   - ins += "</select></p>";
869   - ins += "<p>Item da tabela de atributos que ser&aacute; utilizado para compor o nome de cada classe</p>";
870   - ins += "<select id='itemNome' >";
871   - ins += itens;
872   - ins += "</select></p>";
873   - $i("editor_bd").innerHTML = ins;
874   - core_carregando("desativa");
875   - }
876   - catch(e){core_handleFailure(o,o.responseText);core_carregando("desativa");}
877   - },
878   - failure:core_handleFailure,
879   - argument: { foo:"foo", bar:"bar" }
  860 + success:function(o)
  861 + {
  862 + try
  863 + {
  864 + var itens = core_comboObjeto(YAHOO.lang.JSON.parse(o.responseText).itens,"","","");
  865 + var ins = "<p>Item da tabela de atributos que ser&aacute; utilizado para compor a express&atilde;o de sele&ccedil;&atilde;o de cada classe</p>";
  866 + ins += "<select id='itemExpressao' >";
  867 + ins += itens;
  868 + ins += "</select></p>";
  869 + ins += "<p>Item da tabela de atributos que ser&aacute; utilizado para compor o nome de cada classe</p>";
  870 + ins += "<select id='itemNome' >";
  871 + ins += itens;
  872 + ins += "</select></p>";
  873 + $i("editor_bd").innerHTML = ins;
  874 + core_carregando("desativa");
  875 + }
  876 + catch(e){core_handleFailure(o,o.responseText);core_carregando("desativa");}
  877 + },
  878 + failure:core_handleFailure,
  879 + argument: { foo:"foo", bar:"bar" }
880 880 };
881 881 core_makeRequest(sUrl,callback);
882 882 }
... ... @@ -941,14 +941,14 @@ function limparCacheMapfile(codigoMap)
941 941 core_carregando(mensagem);
942 942 var callback =
943 943 {
944   - success:function(o)
945   - {
946   - try
947   - {core_carregando("desativa");}
948   - catch(e){core_handleFailure(o,o.responseText);}
949   - },
950   - failure:core_handleFailure,
951   - argument: { foo:"foo", bar:"bar" }
  944 + success:function(o)
  945 + {
  946 + try
  947 + {core_carregando("desativa");}
  948 + catch(e){core_handleFailure(o,o.responseText);}
  949 + },
  950 + failure:core_handleFailure,
  951 + argument: { foo:"foo", bar:"bar" }
952 952 };
953 953 core_makeRequest(sUrl,callback);
954 954 };
... ... @@ -1004,17 +1004,17 @@ function clonarMapfile(codigoMap)
1004 1004 core_carregando("Copiando...");
1005 1005 var callback =
1006 1006 {
1007   - success:function(o)
1008   - {
1009   - try
1010   - {
  1007 + success:function(o)
  1008 + {
  1009 + try
  1010 + {
1011 1011 core_carregando("desativa");
1012 1012 initMenu();
1013 1013 }
1014   - catch(e){core_handleFailure(o,o.responseText);}
1015   - },
1016   - failure:core_handleFailure,
1017   - argument: { foo:"foo", bar:"bar" }
  1014 + catch(e){core_handleFailure(o,o.responseText);}
  1015 + },
  1016 + failure:core_handleFailure,
  1017 + argument: { foo:"foo", bar:"bar" }
1018 1018 };
1019 1019 core_makeRequest(sUrl+"&novomap="+novonome,callback);
1020 1020 };
... ... @@ -1451,21 +1451,26 @@ function montaEditorDispo(dados)
1451 1451  
1452 1452 function montaEditorDados(dados)
1453 1453 {
1454   - var idsForms = ["connection","data","tileitem","tileindex","type","tipooriginal","metaestat_id_medida_variavel"],
  1454 + var limg = i3GEO.configura.locaplic+"/imagens/crialeg.jpg",
  1455 + idsForms = ["connection","data","tileitem","tileindex","type","tipooriginal","metaestat_id_medida_variavel"],
1455 1456 idsMetaestat = ["connection","data","tileitem","tileindex","tipooriginal"],
1456 1457 limg=i3GEO.configura.locaplic+"/imagens/crialeg.jpg",
1457 1458 param = {
1458 1459 "linhas":[
1459 1460 {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.",
1460 1461 titulo:"Esse mapfile est&aacute; integrado ao sistema de metadados estat&iacute;sticos?",id:"",value:dados.metaestat,tipo:"text",div:"<div id=cMetaestat ></div>"},
  1462 +
1461 1463 {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.",
1462   - 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:""},
  1464 + titulo:"ID da variável no sistema de metadados estatísticos ",id:"",value:"",tipo:"text",div:"<div id=cMetaestat_id_medida_variavel ></div>"},
  1465 +
1463 1466 {ajuda:"Type of connection. Default is local.",
1464 1467 titulo:"Connectiontype",id:"",value:"",div:"<div id=cConnectiontype ></div>",tipo:"text"},
1465 1468 {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'",
1466 1469 titulo:"Convers&atilde;o de caracteres (METADATA: CONVCARACTER)",id:"",value:dados.convcaracter,tipo:"text",div:"<div id=cConvcaracter ></div>"},
1467   - {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'",
1468   - titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"},
  1470 +
  1471 + {ajuda:"Voc&ecirc; pode digitar apenas o 'alias' para esconder a string de conex&atilde;o. 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'",
  1472 + titulo:"Connection ",id:"",value:"",tipo:"text",div:"<div id=cConnection ></div>"},
  1473 +
1469 1474 {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",
1470 1475 titulo:"Data",id:"data",value:dados.data,tipo:"text"},
1471 1476 {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",
... ... @@ -1489,14 +1494,7 @@ function montaEditorDados(dados)
1489 1494 var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />";
1490 1495 ins += "&nbsp;<input type=button title='Testar' value='Testar' id=testarEditor />";
1491 1496  
1492   - if(dados.postgis_mapa.length > 0)
1493   - {
1494   - ins += "<p>Os seguintes 'alias' est&atilde;o definidos em ms_configura como nomes de conex&otilde;es: ";
1495   - ins += dados.postgis_mapa;
1496   - ins += "</p><br>";
1497   - }
1498   - if(dados.colunas != "" && dados.colunas != undefined)
1499   - {
  1497 + if(dados.colunas != "" && dados.colunas != undefined){
1500 1498 ins += "<p>O layer possu&iacute; as seguintes colunas na tabela de atributos: ";
1501 1499 ins += dados.colunas+"</p><br>";
1502 1500 }
... ... @@ -1504,6 +1502,26 @@ function montaEditorDados(dados)
1504 1502 ins += "<br><br><br>";
1505 1503 $i("editor_bd").innerHTML = ins;
1506 1504  
  1505 + if($i("cConnection")){
  1506 + temp = "";
  1507 + if(dados.postgis_mapa.length > 0){
  1508 + temp += "<p class=paragrafo >Os seguintes 'alias' est&atilde;o definidos em ms_configura como nomes de conex&otilde;es: ";
  1509 + temp += "<b>"+dados.postgis_mapa+"</b>. Para definir um novo, &eacute; necess&aacute;rio editar o arquivo i3geo/ms_configura.php, consulte o administrador do servidor";
  1510 + temp += "</p>";
  1511 + }
  1512 + temp += '<input type="text" value="'+dados.connection+'" id="connection" style="width:90%;">';
  1513 + temp += "<img onclick='selConexaoBanco(\"connection\")' src='"+limg+"' style='cursor:pointer;position :relative;top:2px'/>";
  1514 +
  1515 + $i("cConnection").innerHTML = temp;
  1516 + }
  1517 +
  1518 + if($i("cMetaestat_id_medida_variavel")){
  1519 + temp = '<input type="text" value="'+dados.metaestat_id_medida_variavel+'" id="metaestat_id_medida_variavel" style="width:90%;">';
  1520 + temp += "<img onclick='selIdMedidaVariavel(\"metaestat_id_medida_variavel\",\"metaestat_id_medida_variavel\")' src='"+limg+"' style='cursor:pointer;position :relative;top:2px'/>";
  1521 + $i("cMetaestat_id_medida_variavel").innerHTML = temp;
  1522 + }
  1523 +
  1524 +
1507 1525 if($i("cMetaestat")){
1508 1526 temp = "<select id='metaestat' >";
1509 1527 temp += core_combosimnao(dados.metaestat);
... ... @@ -1967,20 +1985,20 @@ function montaEditorEstilo(dados)
1967 1985 var sUrl = "../php/editormapfile.php?funcao=editasimbolo&tipo="+dados.type+"&opcao=listaSimbolos&onclick=escolheSimbolo(this.title)";
1968 1986 var callback =
1969 1987 {
1970   - success:function(o)
1971   - {
1972   - try
1973   - {
  1988 + success:function(o)
  1989 + {
  1990 + try
  1991 + {
1974 1992 var re = new RegExp("ms_tmp", "g");
1975 1993 var t = o.responseText.replace(re,"../../../ms_tmp/");
1976 1994 var re = new RegExp("\\\\", "g");
1977 1995 t = t.replace(re,"");
1978 1996 $i("listaSimbolos").innerHTML = t;
1979   - }
1980   - catch(e){}
1981   - },
1982   - failure:core_handleFailure,
1983   - argument: { foo:"foo", bar:"bar" }
  1997 + }
  1998 + catch(e){}
  1999 + },
  2000 + failure:core_handleFailure,
  2001 + argument: { foo:"foo", bar:"bar" }
1984 2002 };
1985 2003 core_makeRequest(sUrl,callback,'POST');
1986 2004 }
... ... @@ -2101,62 +2119,62 @@ function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo,
2101 2119 var sUrl = prog+par;
2102 2120 var callback =
2103 2121 {
2104   - success:function(o)
2105   - {
2106   - try
2107   - {
2108   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
2109   - {
2110   - core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel salvar.</span>");
2111   - setTimeout("core_carregando('desativa')",3000);
2112   - }
2113   - else
2114   - {
2115   - if(testar == false){
2116   - if(tipo=="conexao")
2117   - {montaEditorDados(YAHOO.lang.JSON.parse(o.responseText));}
2118   - if(tipo=="comport")
2119   - {montaEditorComport(YAHOO.lang.JSON.parse(o.responseText));}
2120   - if(tipo=="dispo")
2121   - {montaEditorDispo(YAHOO.lang.JSON.parse(o.responseText));}
2122   - if(tipo=="titulo")
2123   - {montaEditorTitulo(YAHOO.lang.JSON.parse(o.responseText));}
2124   - if(tipo=="metadados")
2125   - {montaEditorMetadados(YAHOO.lang.JSON.parse(o.responseText));}
2126   - if(tipo=="geral")
2127   - {
2128   - var d = YAHOO.lang.JSON.parse(o.responseText);
2129   - montaEditorGeral(d);
2130   - if(d.name != codigoLayer)
2131   - {
2132   - core_pegaMapfiles("montaArvore()");
  2122 + success:function(o)
  2123 + {
  2124 + try
  2125 + {
  2126 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  2127 + {
  2128 + core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel salvar.</span>");
  2129 + setTimeout("core_carregando('desativa')",3000);
  2130 + }
  2131 + else
  2132 + {
  2133 + if(testar == false){
  2134 + if(tipo=="conexao")
  2135 + {montaEditorDados(YAHOO.lang.JSON.parse(o.responseText));}
  2136 + if(tipo=="comport")
  2137 + {montaEditorComport(YAHOO.lang.JSON.parse(o.responseText));}
  2138 + if(tipo=="dispo")
  2139 + {montaEditorDispo(YAHOO.lang.JSON.parse(o.responseText));}
  2140 + if(tipo=="titulo")
  2141 + {montaEditorTitulo(YAHOO.lang.JSON.parse(o.responseText));}
  2142 + if(tipo=="metadados")
  2143 + {montaEditorMetadados(YAHOO.lang.JSON.parse(o.responseText));}
  2144 + if(tipo=="geral")
  2145 + {
  2146 + var d = YAHOO.lang.JSON.parse(o.responseText);
  2147 + montaEditorGeral(d);
  2148 + if(d.name != codigoLayer)
  2149 + {
  2150 + core_pegaMapfiles("montaArvore()");
2133 2151 YAHOO.admin.container.panelEditor.destroy();
2134 2152 YAHOO.admin.container.panelEditor = null;
2135   - }
2136   - }
2137   - if(tipo=="classeGeral")
2138   - {montaEditorClasseGeral(YAHOO.lang.JSON.parse(o.responseText));}
2139   - if(tipo=="classeLabel")
2140   - {montaEditorClasseLabel(YAHOO.lang.JSON.parse(o.responseText));}
2141   - if(tipo=="estilo")
2142   - {montaEditorEstilo(YAHOO.lang.JSON.parse(o.responseText));}
2143   -
2144   - if(tipo =="grupousr"){
2145   - var no = tree.getNodeByProperty("id",$i("Ecodigo_mapa_usr").value);
2146   - tree.removeChildren(no) ;
2147   - no.expand();
2148   - }
2149   - }
2150   - else{
2151   - window.open("../../testamapfile.php?map="+YAHOO.lang.JSON.parse(o.responseText).url);
2152   - }
2153   - core_carregando("desativa");
2154   - }
2155   - }
2156   - catch(e){core_handleFailure(e,o.responseText);}
2157   - },
2158   - failure:core_handleFailure,
2159   - argument: { foo:"foo", bar:"bar" }
  2153 + }
  2154 + }
  2155 + if(tipo=="classeGeral")
  2156 + {montaEditorClasseGeral(YAHOO.lang.JSON.parse(o.responseText));}
  2157 + if(tipo=="classeLabel")
  2158 + {montaEditorClasseLabel(YAHOO.lang.JSON.parse(o.responseText));}
  2159 + if(tipo=="estilo")
  2160 + {montaEditorEstilo(YAHOO.lang.JSON.parse(o.responseText));}
  2161 +
  2162 + if(tipo =="grupousr"){
  2163 + var no = tree.getNodeByProperty("id",$i("Ecodigo_mapa_usr").value);
  2164 + tree.removeChildren(no) ;
  2165 + no.expand();
  2166 + }
  2167 + }
  2168 + else{
  2169 + window.open("../../testamapfile.php?map="+YAHOO.lang.JSON.parse(o.responseText).url);
  2170 + }
  2171 + core_carregando("desativa");
  2172 + }
  2173 + }
  2174 + catch(e){core_handleFailure(e,o.responseText);}
  2175 + },
  2176 + failure:core_handleFailure,
  2177 + argument: { foo:"foo", bar:"bar" }
2160 2178 };
2161 2179 core_makeRequest(sUrl,callback,'POST');
2162 2180 }
... ... @@ -2202,8 +2220,8 @@ function sobeDesce(movimento,tipo,codigoMap,codigoLayer,indiceClasse,indiceEstil
2202 2220 }
2203 2221  
2204 2222 },
2205   - failure:core_handleFailure,
2206   - argument: { foo:"foo", bar:"bar" }
  2223 + failure:core_handleFailure,
  2224 + argument: { foo:"foo", bar:"bar" }
2207 2225 };
2208 2226 if(movimenta)
2209 2227 {
... ... @@ -2213,4 +2231,28 @@ function sobeDesce(movimento,tipo,codigoMap,codigoLayer,indiceClasse,indiceEstil
2213 2231 core_makeRequest(sUrl,callback);
2214 2232 }
2215 2233 }
  2234 +function selConexaoBanco(eleValue){
  2235 + var callback = {
  2236 + success:function(o){
  2237 + try {
  2238 + var dados = YAHOO.lang.JSON.parse(o.responseText),
  2239 + n = dados.length,
  2240 + i,temp,
  2241 + valores = [],
  2242 + textos = [],
  2243 + selecionados = [];
  2244 + for(i=0;i<n;i++){
  2245 + temp = "password= user="+dados[i].usuario+" dbname="+dados[i].bancodedados+" host="+dados[i].host+" port="+dados[i].porta;
  2246 + textos.push(dados[i].bancodedados);
  2247 + valores.push(temp);
  2248 + }
  2249 + core_menuCheckBox(valores,textos,selecionados,$i(eleValue),"","","sim");
  2250 + }
  2251 + catch(e){core_handleFailure(e,o.responseText);}
  2252 + },
  2253 + failure:core_handleFailure,
  2254 + argument: { foo:"foo", bar:"bar" }
  2255 + };
  2256 + core_makeRequest(i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaConexao&formato=json",callback);
  2257 +}
2216 2258 //YAHOO.util.Event.addListener(window, "load", initMenu);
2217 2259 \ No newline at end of file
... ...