From 51c4251337f0c63b21924a976458b64b49b7dde9 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 14 Oct 2010 14:49:48 +0000 Subject: [PATCH] Opção para escolher os símbolos de uma lista e desativação de elementos de formulário conforme contexto de outros elementos --- admin/js/core.js | 14 ++++++++++++++ admin/js/editormapfile.js | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------- admin/php/editormapfile.php | 32 +++++++++++++++++++++++++++++++- 3 files changed, 122 insertions(+), 20 deletions(-) diff --git a/admin/js/core.js b/admin/js/core.js index 44ffff9..c5e4a6a 100644 --- a/admin/js/core.js +++ b/admin/js/core.js @@ -1215,6 +1215,20 @@ function core_abreCor(janela,elemento) $i("i3geo_janelaCori").style.height = "290px"; //i3GEO.janela.cria("350px","250px","../../ferramentas/colorpicker/index.htm?doc=&elemento="+elemento+"&tipo=rgb","","","Cor","i3geo_janelaCor",true); } +function core_desativaforms(lista){ + var n = lista.length, + i; + for (i=0;i from ', 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", titulo:"Data",id:"data",value:dados.data,tipo:"text"}, + {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", + titulo:"Type",id:"",value:dados.type,tipo:"text",div:"
"}, {ajuda:"Item that contains the location of an individual tile, default is 'location'.", titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"}, {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.", @@ -970,20 +972,29 @@ function montaEditorConexao(dados) ] } var ins = "" + ins += " " + if(dados.postgis_mapa.length > 0) { - ins += "

Os seguintes 'alias' estão disponíveis para uso na opção 'connection': "; - ins += dados.postgis_mapa+"

" + ins += "

Os seguintes 'alias' estão definidos no metadata 'ITENS': "; + ins += dados.postgis_mapa; + ins += "
Os campos em cores não são compatíveis com o tipo de conexão.

"; } - ins += "" ins += core_geraLinhas(param) ins += "


" $i("editor_bd").innerHTML = ins + temp = "" $i("cConnectiontype").innerHTML = temp - + + temp = "" + $i("cType").innerHTML = temp + + var temp = function() {salvarDadosEditor('conexao',dados.codigoMap,dados.codigoLayer,false)} new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }}); @@ -991,6 +1002,27 @@ function montaEditorConexao(dados) var temp = function() {salvarDadosEditor('conexao',dados.codigoMap,dados.codigoLayer,"","",true)} new YAHOO.widget.Button("testarEditor",{ onclick: { fn: temp }}); + core_desativaforms(idsForms); + $i("connectiontype").onchange = function(){ + core_desativaforms(idsForms); + var valor = $i("connectiontype").value, + d = []; + //["connection","data","tileitem","tileindex"] + if(valor == 0 || valor == 10) + {d = [];} + if(valor == 1 || valor == 12) + {d = ["data","type"];} + if(valor == 2) + {d = ["tileitem","tileindex","type"];} + if(valor == 3 || valor == 4 || valor == 6 || valor == 8 || valor == 13) + {d = idsForms;} + if(valor == 5) + {d = ["connection","tileitem","tileindex","type"];} + if(valor == 7 || valor == 9) + {d = ["connection","type"];} + core_ativaforms(d); + }; + $i("connectiontype").onchange.call(); } function montaEditorMetadados(dados) { @@ -1169,10 +1201,12 @@ function montaEditorGeral(dados) temp += core_comboObjeto(objstatus,"valor","texto",dados.status) temp += "" $i("cStatus").innerHTML = temp + temp = "" - $i("cType").innerHTML = temp + $i("cType").innerHTML = temp + temp = "" @@ -1315,7 +1349,7 @@ function montaEditorClasseLabel(dados) temp += core_comboObjeto(objfonttypes,"valor","texto",dados.type) temp += "" $i("cType").innerHTML = temp - + temp = "" @@ -1340,11 +1374,11 @@ function montaEditorEstilo(dados) var param = { "linhas":[ {ajuda:"The symbol name or number to use for all features if attribute tables are not used. The number is the index of the symbol in the symbol file, starting at 1, the 5th symbol in the file is therefore symbol number 5. You can also give your symbols names using the NAME keyword in the symbol definition file, and use those to refer to them. Default is 0, which results in a single pixel, single width line, or solid polygon fill, depending on layer type.You can also specify a gif or png filename. The path is relative to the location of the mapfile.", - titulo:"Symbolname",id:"symbolname",value:dados.symbolname,tipo:"text"}, + titulo:"Symbolname",id:"",value:dados.symbolname,tipo:"text",div:"
"}, {ajuda:"Color to use for drawing features.", titulo:"Color",id:"color",value:dados.color,tipo:"cor"}, {ajuda:"Background-color to use for drawing features.", - titulo:"Backgroundcolo",id:"backgroundcolor",value:dados.backgroundcolor,tipo:"cor"}, + titulo:"Backgroundcolor",id:"backgroundcolor",value:dados.backgroundcolor,tipo:"cor"}, {ajuda:"Height, in pixels, of the symbol/pattern to be used. Only useful with scalable symbols. Default is 1. For symbols of Type HATCH, the SIZE is the distance between hatched lines. For its use with hatched lines, see Example#8 in the SYMBOL examples.", titulo:"Size",id:"size",value:dados.size,tipo:"text"}, {ajuda:"Color to use for outlining polygons and certain marker symbols. Line symbols do not support outline colors.", @@ -1374,9 +1408,33 @@ function montaEditorEstilo(dados) ins += "


" $i("editor_bd").innerHTML = ins + temp = ""; + temp += "
"; + $i("cSymbolname").innerHTML = temp + var temp = function() {salvarDadosEditor('estilo',dados.codigoMap,dados.codigoLayer,dados.indiceClasse,dados.indiceEstilo)} - new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }}); + new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }}); + + escolheSimbolo = function(nome){ + $i("symbolname").value = nome; + }; + //lista os simbolos + var sUrl = "../php/editormapfile.php?funcao=editasimbolo&tipo="+dados.type+"&opcao=listaSimbolos&onclick=escolheSimbolo(this.title)"; + var callback = + { + success:function(o) + { + try + { + $i("listaSimbolos").innerHTML = o.responseText; + } + catch(e){} + }, + failure:core_handleFailure, + argument: { foo:"foo", bar:"bar" } + }; + core_makeRequest(sUrl,callback,'POST') } /* Function: salvarDadosEditor @@ -1398,7 +1456,7 @@ function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo, if(arguments.length < 6){var testar = false;} if(tipo == "conexao") { - var campos = new Array("connection","data","connectiontype","tileitem","tileindex") + var campos = new Array("type","connection","data","connectiontype","tileitem","tileindex") var par = "&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer var prog = "../php/editormapfile.php?funcao=alterarConexao" } @@ -1462,8 +1520,8 @@ function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo, } prog += "&testar="+testar; try{ - for (i=0;ilistaSimbolos($tipo,$dir_tmp,"",$onclick)); + exit; + break; + /* Valor: PEGALAYERS Lista os layers existentes em um mapfile @@ -471,6 +496,8 @@ switch (strtoupper($funcao)) tileindex + type + Retorno: {JSON} @@ -1112,11 +1139,12 @@ function pegaConexao() $dados["postgis_mapa"] = $postgis_mapa; $dados["codigoMap"] = $codigoMap; $dados["codigoLayer"] = $codigoLayer; + $dados["type"] = $layer->type; return $dados; } function alterarConexao() { - global $dir_tmp,$testar,$codigoMap,$codigoLayer,$locaplic,$connection,$connectiontype,$data,$tileitem,$tileindex; + global $type,$dir_tmp,$testar,$codigoMap,$codigoLayer,$locaplic,$connection,$connectiontype,$data,$tileitem,$tileindex; $mapfile = $locaplic."/temas/".$codigoMap.".map"; $mapa = ms_newMapObj($mapfile); $layer = $mapa->getlayerbyname($codigoLayer); @@ -1128,6 +1156,7 @@ function alterarConexao() $layer->set("data",$data); $layer->set("tileitem",$tileitem); $layer->set("tileindex",$tileindex); + $layer->set("type",$type); if($testar == "true") { $nome = $dir_tmp."/".$codigoMap.".map"; @@ -1509,6 +1538,7 @@ function pegaEstilo() $dados["indiceClasse"] = $indiceClasse; $dados["indiceEstilo"] = $indiceEstilo; //$dados["opacity"] = $estilo->opacity; + $dados["type"] = $layer->type; return $dados; } function alterarEstilo() -- libgit2 0.21.2