Commit d81e9be00f79857ceb43107b11a6278937cb43bc

Authored by Edmar Moretti
1 parent cb52cc2f

--no commit message

admin/html/editormapfile.html 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  5 + <title>Menus</title>
  6 + <style type="text/css">
  7 + /*margin and padding on body element
  8 + can introduce errors in determining
  9 + element position and are not recommended;
  10 + we turn them off as a foundation for YUI
  11 + CSS treatments. */
  12 + body {
  13 + margin:0;
  14 + padding:0;
  15 + }
  16 + #ctx { background:orange;width:200px;height:200px; }
  17 + </style>
  18 + <script type="text/javascript" src="../js/core.js"></script>
  19 + <script type="text/javascript" src="../js/editormapfile.js"></script>
  20 +</head>
  21 +<body class=" yui-skin-sam">
  22 +<div style="margin:20px">
  23 +<div style=width:80%;text-align:center;>
  24 +<h1>Administração do i3geo - mapfiles dos temas <img src="../imagens/04.png" style="cursor:pointer" id=botaoAjuda /></h1>
  25 +
  26 +</div>
  27 +<div id="ajuda">
  28 + <div class="hd">Ajuda</div>
  29 + <div class="bd" style="height:144px;overflow:auto">
  30 + Este programa permite criar ou editar os arquivos mapfile que compõem temas no i3geo.<br>
  31 + Os arquivo .map são armazenados no diretório i3geo/temas e podem também ser editados manualmente.<br>
  32 + Cada arquivo contém layers definidos conforme a sintaxe utilizada pelo Mapserver. Esses arquivos são as
  33 + estruturas básicas utilizadas pelo i3geo na apresentação de dados e montagem das camadas que são vistas no mapa.<br>
  34 + Após criados os mapfiles, deve-se ainda definir as características de cada tema.<br>
  35 + A lista de IPs dos usuários que podem administrar o i3geo é definida no
  36 + arquivo i3geo/ms_configura.php
  37 + </div>
  38 + <div class="ft"></div>
  39 +</div>
  40 +<input onclick="adicionaLinha()" type=button id=adiciona value="Criar um novo mapfile" />
  41 +<br><br>
  42 +Além de criar os mapfiles, deve-se definir as características de cada tema antes de montar os menus.<br>
  43 +Para definir ou alterar essas características, clique <a href="listatemas.html" >aqui.</a> para abrir o editor de temas.<br>
  44 +Para excluir um mapfile, vc deve primeiro excluir o registro na lista de temas, caso exista.<br>
  45 +<p>Mapfiles:</p>
  46 +<div id="tabela" style="left:-5px;"></div>
  47 +</div>
  48 +<div id=logajax style="display:block" ></div>
  49 +<div id=dialogoContinua style="display:block" ></div>
  50 +</body>
... ...
admin/html/temas.html
... ... @@ -1,50 +0,0 @@
1   -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2   -<html>
3   -<head>
4   - <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
5   - <title>Menus</title>
6   - <style type="text/css">
7   - /*margin and padding on body element
8   - can introduce errors in determining
9   - element position and are not recommended;
10   - we turn them off as a foundation for YUI
11   - CSS treatments. */
12   - body {
13   - margin:0;
14   - padding:0;
15   - }
16   - </style>
17   - <script type="text/javascript" src="../js/core.js"></script>
18   - <script type="text/javascript" src="../js/temas.js"></script>
19   -</head>
20   -<body class=" yui-skin-sam">
21   -<div style="margin:20px">
22   -<div style=width:80%;text-align:center;>
23   -<h1>Administração do i3geo - mapfiles dos temas <img src="../imagens/04.png" style="cursor:pointer" id=botaoAjuda /></h1>
24   -
25   -</div>
26   -<div id="ajuda">
27   - <div class="hd">Ajuda</div>
28   - <div class="bd" style="height:144px;overflow:auto">
29   - Este programa permite criar ou editar os arquivos mapfile que compõem temas no i3geo.<br>
30   - Os arquivo .map são armazenados no diretório i3geo/temas e podem também ser editados manualmente.<br>
31   - Cada arquivo contém layers definidos conforme a sintaxe utilizada pelo Mapserver. Esses arquivos são as
32   - estruturas básicas utilizadas pelo i3geo na apresentação de dados e montagem das camadas que são vistas no mapa.<br>
33   - Após criados os mapfiles, deve-se ainda definir as características de cada tema.<br>
34   - A lista de IPs dos usuários que podem administrar o i3geo é definida no
35   - arquivo i3geo/ms_configura.php
36   - </div>
37   - <div class="ft"></div>
38   -</div>
39   -<input onclick="adicionaLinha()" type=button id=adiciona value="Criar um novo mapfile" />
40   -<br><br>
41   -Além de criar os mapfiles, deve-se definir as características de cada tema antes de montar os menus.<b>
42   -Para definir ou alterar essas características, clique <a href="listatemas.html" >aqui.</a> para abrir o editor de temas.<br>
43   -Para excluir um mapfile, vc deve primeiro excluir o registro na lista de temas, caso exista.<br>
44   -<p>Mapfiles:</p>
45   -<div id="tabela" style="left:-5px;"></div>
46   -</div>
47   -<div id=logajax style="display:block" ></div>
48   -<div id=dialogoContinua style="display:block" ></div>
49   -
50   -</body>
admin/index.html
... ... @@ -67,7 +67,7 @@ dos arquivos XML.
67 67 </div>
68 68 <table class=lista1 >
69 69 <tr onclick="ajuda('a8',this)"><td><div class=ajuda ></div></td><td>Ajuda</td></tr>
70   -<tr onclick="abre('html/temas.html')"><td><div class=aplicar ></div></td><td>Edição</td></tr>
  70 +<tr onclick="abre('html/editormapfile.html')"><td><div class=aplicar ></div></td><td>Edição</td></tr>
71 71 </table>
72 72 </fieldset>
73 73 <br>
... ...
admin/js/core.js
... ... @@ -263,7 +263,23 @@ function core_ativaPainelAjuda(id,botao)
263 263 YAHOO.example.container.panelAjuda = new YAHOO.widget.Panel(id, { width:"350px", height:"200px",overflow:"auto", visible:false,constraintoviewport:true } );
264 264 YAHOO.example.container.panelAjuda.render();
265 265 }
  266 + if(arguments.length == 2)
266 267 YAHOO.util.Event.addListener(botao, "click", YAHOO.example.container.panelAjuda.show, YAHOO.example.container.panelAjuda, true);
  268 + else
  269 + YAHOO.example.container.panelAjuda.show();
  270 +}
  271 +/*
  272 +Function: core_ativaPainelTexto
  273 +
  274 +Parameters:
  275 +
  276 +id - id do elemento que receberá o painel
  277 +*/
  278 +function core_ativaPainelTexto(id)
  279 +{
  280 + YAHOO.example.container.panelTexto = new YAHOO.widget.Panel(id, { width:"350px", height:"200px",overflow:"auto", visible:false,constraintoviewport:true } );
  281 + YAHOO.example.container.panelTexto.render();
  282 + YAHOO.example.container.panelTexto.show();
267 283 }
268 284 /*
269 285 function: core_pegaPerfis
... ... @@ -766,9 +782,21 @@ function core_geraLinhas(dados)
766 782 var p = dados.linhas[contaParam];
767 783 if(p.tipo == "text")
768 784 {
769   - resultado += "<p>"+p.titulo+"<br>";
  785 + if(!p.size){p.size = "50";}
  786 + if(p.ajuda)
  787 + {
  788 + var temp = "$i('"+contaParam+"_ajuda').style.display='block' "
  789 + resultado += "<p><div onclick =\""+temp+"\" style=cursor:pointer title='ajuda' ><b>"+p.titulo+"</b></div><br>"
  790 + resultado += "<div id='"+contaParam+"_ajuda' style=display:none >"+p.ajuda+"</div>"
  791 + }
  792 + else
  793 + resultado += "<p><b>"+p.titulo+"</b><br>";
  794 + if(p.texto)
  795 + resultado += "<span style=color:gray >"+p.texto+"</span</p>"
  796 + if(p.id != "")
770 797 resultado += "<input size="+p.size+" type=text id="+p.id+" value='"+p.value+"' /></p>"
771   - resultado += p.div;
  798 + if(p.div)
  799 + {resultado += p.div;}
772 800 }
773 801 contaParam++
774 802 }
... ... @@ -1092,7 +1120,9 @@ var jsfiles = new Array(
1092 1120 "../../pacotes/yui252/build/container/container-min.php",
1093 1121 "../../pacotes/yui252/build/connection/connection-min.js",
1094 1122 "../../pacotes/yui252/build/treeview/treeview-min.js",
1095   -"../../pacotes/yui252/build/json/json-min.js"
  1123 +"../../pacotes/yui252/build/json/json-min.js",
  1124 +"../../pacotes/yui252/build/menu/menu-min.js",
  1125 +"../../pacotes/yui252/build/editor/editor-beta-min.js"
1096 1126 );
1097 1127 //
1098 1128 //arquivos css
... ... @@ -1103,7 +1133,8 @@ var cssfiles =new Array(
1103 1133 "../../pacotes/yui252/build/datatable/assets/skins/sam/datatable.css",
1104 1134 "../../pacotes/yui252/build/button/assets/skins/sam/button.css",
1105 1135 "../../pacotes/yui252/build/container/assets/skins/sam/container.css",
1106   -"../../pacotes/yui252/build/treeview/assets/skins/sam/treeview.css"
  1136 +"../../pacotes/yui252/build/treeview/assets/skins/sam/treeview.css",
  1137 +"../../pacotes/yui252/build/editor/assets/skins/sam/editor.css"
1107 1138 );
1108 1139 //
1109 1140 //carrega os arquivos js
... ...
admin/js/editormapfile.js 0 → 100644
... ... @@ -0,0 +1,872 @@
  1 +contaN = 0;
  2 +objcontype = [
  3 + {texto:"MS_INLINE",valor:"0"},
  4 + {texto:"MS_SHAPEFILE",valor:"1"},
  5 + {texto:"MS_TILED_SHAPEFILE",valor:"2"},
  6 + {texto:"MS_SDE",valor:"3"},
  7 + {texto:"MS_OGR",valor:"4"},
  8 + {texto:"MS_TILED_OGR",valor:"5"},
  9 + {texto:"MS_POSTGIS",valor:"6"},
  10 + {texto:"MS_WMS",valor:"7"},
  11 + {texto:"MS_ORACLESPATIAL",valor:"8"},
  12 + {texto:"MS_WFS",valor:"9"},
  13 + {texto:"MS_GRATICULE",valor:"10"},
  14 + {texto:"MS_MYGIS",valor:"11"},
  15 + {texto:"MS_RASTER",valor:"12"},
  16 + {texto:"MS_PLUGIN",valor:"13"}
  17 +];
  18 +objbool_tf = [
  19 + {texto:"MS_TRUE",valor:"0"},
  20 + {texto:"MS_FALSE",valor:"1"}
  21 +];
  22 +objbool_of = [
  23 + {texto:"MS_ON",valor:"2"},
  24 + {texto:"MS_OFF",valor:"3"}
  25 +];
  26 +objbool_yn = [
  27 + {texto:"MS_YES",valor:"4"},
  28 + {texto:"MS_NO",valor:"5"}
  29 +];
  30 +objmapunits = [
  31 + {texto:"MS_INCHES",valor:"0"},
  32 + {texto:"MS_FEET",valor:"1"},
  33 + {texto:"MS_MILES",valor:"2"},
  34 + {texto:"MS_METERS",valor:"3"},
  35 + {texto:"MS_KILOMETERS",valor:"4"},
  36 + {texto:"MS_DD",valor:"5"},
  37 + {texto:"MS_PIXELS",valor:"6"}
  38 +];
  39 +objlayertypes = [
  40 + {texto:"MS_LAYER_POINT",valor:"0"},
  41 + {texto:"MS_LAYER_LINE",valor:"1"},
  42 + {texto:"MS_LAYER_POLYGON",valor:"2"},
  43 + {texto:"MS_LAYER_RASTER",valor:"3"},
  44 + {texto:"MS_LAYER_ANNOTATION",valor:"4"},
  45 + {texto:"MS_LAYER_QUERY",valor:"5"},
  46 + {texto:"MS_LAYER_CIRCLE",valor:"6"},
  47 + {texto:"MS_LAYER_TILEINDEX",valor:"7"},
  48 + {texto:"MS_LAYER_CHART",valor:"8"}
  49 +];
  50 +objstatus = [
  51 + {texto:"MS_ON",valor:"1"},
  52 + {texto:"MS_OFF",valor:"0"},
  53 + {texto:"MS_DEFAULT",valor:"2"}
  54 +];
  55 +objfonttypes = [
  56 + {texto:"MS_TRUETYPE",valor:"0"},
  57 + {texto:"MS_BITMAP",valor:"1"}
  58 +];
  59 +objposition = [
  60 + {texto:"MS_UL",valor:"0"},
  61 + {texto:"MS_LR",valor:"1"},
  62 + {texto:"MS_UR",valor:"2"},
  63 + {texto:"MS_LL",valor:"3"},
  64 + {texto:"MS_CR",valor:"4"},
  65 + {texto:"MS_CL",valor:"5"},
  66 + {texto:"MS_UC",valor:"6"},
  67 + {texto:"MS_WMS",valor:"7"},
  68 + {texto:"MS_LC",valor:"8"},
  69 + {texto:"MS_CC",valor:"9"},
  70 + {texto:"MS_AUTO",valor:"10"},
  71 + {texto:"MS_XY",valor:"11"},
  72 + {texto:"MS_FOLLOW",valor:"12"}
  73 +];
  74 +objfontstyle = [
  75 + {texto:"MS_TINY",valor:"0"},
  76 + {texto:"MS_SMALL",valor:"1"},
  77 + {texto:"MS_MEDIUM",valor:"2"},
  78 + {texto:"MS_LARGE",valor:"3"},
  79 + {texto:"MS_GIANT",valor:"4"},
  80 +];
  81 +objshapetype = [
  82 + {texto:"MS_SHAPE_POINT",valor:"0"},
  83 + {texto:"MS_SHAPE_LINE",valor:"1"},
  84 + {texto:"MS_SHAPE_POLYGON",valor:"2"},
  85 + {texto:"MS_SHAPE_NULL",valor:"3"}
  86 +];
  87 +objshapefiletype = [
  88 + {texto:"MS_SHP_POINT",valor:"0"},
  89 + {texto:"MS_SHP_ARC",valor:"1"},
  90 + {texto:"MS_SHP_POLYGON",valor:"2"},
  91 + {texto:"MS_SHP_MULTIPOINT",valor:"3"}
  92 +];
  93 +objalignment = [
  94 + {texto:"MS_ALIGN_LEFT",valor:"0"},
  95 + {texto:"MS_ALIGN_CENTER",valor:"1"},
  96 + {texto:"MS_ALIGN_RIGHT",valor:"2"}
  97 +];
  98 +
  99 +YAHOO.namespace("example.container");
  100 +
  101 +function initMenu()
  102 +{
  103 + ativaBotaoAdicionaMapfile("adiciona")
  104 + core_carregando("ativa");
  105 + core_carregando("buscando temas...");
  106 + core_ativaPainelAjuda("ajuda","botaoAjuda");
  107 + core_pegaMapfiles("montaArvore()")
  108 +}
  109 +function ativaBotaoAdicionaMapfile(idBotao)
  110 +{
  111 + var adiciona = function()
  112 + {
  113 + core_montaEditor("adicionaNovoMapfile()")
  114 + ins = "<p>Título do novo tema: </p>"
  115 + ins += "<input size=50 type=text id='Etitulo' value='' /></p>"
  116 + ins += "<p>Nome do arquivo mapfile (sem .map): </p>"
  117 + ins += "<input size=50 type=text id='Ecodigo' value='' /></p>"
  118 + $i("editor_bd").innerHTML = ins
  119 + };
  120 + //cria o botão de adição de um novo menu
  121 + var adiciona = new YAHOO.widget.Button(idBotao,{ onclick: { fn: adiciona } });
  122 +}
  123 +function montaArvore()
  124 +{
  125 + YAHOO.example.treeExample = new function()
  126 + {
  127 + var currentIconMode;
  128 + tree = "";
  129 + function changeIconMode()
  130 + {
  131 + var newVal = parseInt(this.value);
  132 + if (newVal != currentIconMode)
  133 + {currentIconMode = newVal;}
  134 + buildTree();
  135 + }
  136 + function loadNodeData(node, fnLoadComplete)
  137 + {
  138 + var sUrl = "../php/editormapfile.php?funcao=pegaLayers&codigoMap="+node.data.codigoMap;
  139 + var callback =
  140 + {
  141 + success: function(oResponse)
  142 + {
  143 + var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
  144 + montaRaizTema(node,dados)
  145 + oResponse.argument.fnLoadComplete();
  146 + },
  147 + failure: function(oResponse)
  148 + {
  149 + oResponse.argument.fnLoadComplete();
  150 + },
  151 + argument:
  152 + {
  153 + "node": node,
  154 + "fnLoadComplete": fnLoadComplete
  155 + },
  156 + timeout: 7000
  157 + };
  158 + YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  159 + }
  160 + function buildTree()
  161 + {
  162 + tree = new YAHOO.widget.TreeView("tabela");
  163 + tree.setDynamicLoad(loadNodeData, currentIconMode);
  164 + var root = tree.getRoot();
  165 + var tempNode = new YAHOO.widget.TextNode('', root, false);
  166 + tempNode.isLeaf = true;
  167 + core_carregando("desativa");
  168 + }
  169 + buildTree();
  170 + }();
  171 + montaNosRaiz("nao")
  172 + tree.draw();
  173 +}
  174 +function montaNosRaiz(redesenha)
  175 +{
  176 + var root = tree.getRoot();
  177 + var nos = new Array()
  178 + for (var i=0, j=$mapfiles.length; i<j; i++)
  179 + {
  180 + conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i]+"')\" title=excluir src=\"../imagens/01.png\" /><b>&nbsp;<span>"+$mapfiles[i]+"</span>"
  181 + //conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editorDeTexto('"+$mapfiles[i]+"')\" title='editor de texto' src=\"../imagens/06.png\" /><b>&nbsp;<span>"+$mapfiles[i]+"</span>"
  182 +
  183 + var d = {html:conteudo,id:$mapfiles[i],codigoMap:$mapfiles[i]};
  184 + var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true);
  185 + nos.push(tempNode)
  186 + }
  187 + if(redesenha=="sim")
  188 + tree.draw();
  189 + return nos;
  190 +}
  191 +function montaRaizTema(no,dados)
  192 +{
  193 + var codigoMap = no.data.codigoMap;
  194 + function iconMode()
  195 + {
  196 + var newVal = parseInt(this.value);
  197 + if (newVal != currentIconMode)
  198 + {currentIconMode = newVal;}
  199 + }
  200 + function loadLayerData(node, fnLoadComplete)
  201 + {
  202 + var sUrl = "../php/editormapfile.php?funcao=listaClasses&codigoMap="+node.data.codigoMap+"&codigoLayer="+node.data.codigoLayer;
  203 + var callback =
  204 + {
  205 + success: function(oResponse)
  206 + {
  207 + var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
  208 + montaParametrosTemas(node,dados,false)
  209 + oResponse.argument.fnLoadComplete();
  210 + },
  211 + failure: function(oResponse)
  212 + {
  213 + oResponse.argument.fnLoadComplete();
  214 + },
  215 + argument:
  216 + {
  217 + "node": node,
  218 + "fnLoadComplete": fnLoadComplete
  219 + },
  220 + timeout: 7000
  221 + };
  222 + YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  223 + }
  224 + if(!tree.getNodeByProperty("etiquetaLayers",no.data.codigoMap))
  225 + {
  226 + var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaNovoLayer('"+no.data.codigoMap+"')\" title='adiciona layer' src=\"../imagens/05.png\" />"
  227 + var d = {tipo:"etiqueta",etiquetaLayers:no.data.codigoMap,html:conteudo+"<i>Layers:</i>"}
  228 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  229 + tempNode.isLeaf = true;
  230 + }
  231 + for (var i=0, j=dados.layers.length; i<j; i++)
  232 + {
  233 + var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
  234 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('desce')\" title=desce src=\"../imagens/33.png\" />"
  235 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluirLayer('"+no.data.codigoMap+"','"+dados.layers[i]+"')\" title=excluir width='10px' heigth='10px' src=\"../imagens/01.png\" />&nbsp;<span>"+dados.layers[i]+"</span>"
  236 + var d = {html:conteudo,id:codigoMap+"_"+dados.layers[i],codigoMap:codigoMap,codigoLayer:dados.layers[i]}
  237 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  238 + tempNode.setDynamicLoad(loadLayerData, iconMode);
  239 + tempNode.isLeaf = false;
  240 + }
  241 + tree.draw();
  242 +}
  243 +function montaParametrosTemas(no,dados,redesenha)
  244 +{
  245 + var codigoMap = no.data.codigoMap;
  246 + var codigoLayer = no.data.codigoLayer
  247 + function iconMode()
  248 + {
  249 + var newVal = parseInt(this.value);
  250 + if (newVal != currentIconMode)
  251 + {currentIconMode = newVal;}
  252 + }
  253 + function loadClasseData(node, fnLoadComplete)
  254 + {
  255 + var indiceClasse = node.data.indiceClasse;
  256 + var sUrl = "../php/editormapfile.php?funcao=listaEstilos&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse;
  257 + var callback =
  258 + {
  259 + success: function(oResponse)
  260 + {
  261 + var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
  262 + montaParametrosClasses(node,dados,false)
  263 + oResponse.argument.fnLoadComplete();
  264 + },
  265 + failure: function(oResponse)
  266 + {
  267 + oResponse.argument.fnLoadComplete();
  268 + },
  269 + argument:
  270 + {
  271 + "node": node,
  272 + "fnLoadComplete": fnLoadComplete
  273 + },
  274 + timeout: 7000
  275 + };
  276 + YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  277 + }
  278 + if(!tree.getNodeByProperty("etiquetaConexao",no.data.id))
  279 + {
  280 + var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorConexao('"+codigoMap+"','"+codigoLayer+"')\" title='edita conexão' src=\"../imagens/06.png\" />"
  281 + var d = {tipo:"etiquetaConexao",etiquetaConexao:no.data.id,html:conteudo+" Editar fonte dos dados"}
  282 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  283 + tempNode.isLeaf = true;
  284 + }
  285 + if(!tree.getNodeByProperty("etiquetaMetadados",no.data.id))
  286 + {
  287 + var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorMetadados('"+codigoMap+"','"+codigoLayer+"')\" title='edita metadados' src=\"../imagens/06.png\" />"
  288 + var d = {tipo:"etiquetaMetadados",etiquetaMetadados:no.data.id,html:conteudo+" Editar metadados"}
  289 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  290 + tempNode.isLeaf = true;
  291 + }
  292 + if(!tree.getNodeByProperty("etiquetaGeral",no.data.id))
  293 + {
  294 + var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorGeral('"+codigoMap+"','"+codigoLayer+"')\" title='parâmetros gerais' src=\"../imagens/06.png\" />"
  295 + var d = {tipo:"etiquetaGeral",etiquetaGeral:no.data.id,html:conteudo+" Editar características gerais"}
  296 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  297 + tempNode.isLeaf = true;
  298 + }
  299 + if(!tree.getNodeByProperty("etiquetaClasses",no.data.id))
  300 + {
  301 + var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaNovaClasse('"+codigoMap+"','"+codigoLayer+"')\" title='adiciona classe' src=\"../imagens/05.png\" />&nbsp;"
  302 + conteudo += "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorClasses('"+codigoMap+"','"+codigoLayer+"')\" title='classes' src=\"../imagens/06.png\" />"
  303 + var d = {tipo:"etiquetaClasses",etiquetaClasses:no.data.id,html:conteudo+"<i>&nbsp;Classes:</i>"}
  304 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  305 + tempNode.isLeaf = true;
  306 + }
  307 + for (var i=0, j=dados.length; i<j; i++)
  308 + {
  309 + var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
  310 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('desce')\" title=desce src=\"../imagens/33.png\" />"
  311 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluirClasse('"+codigoMap+"','"+codigoLayer+"','"+dados[i].indice+"')\" title=excluir width='10px' heigth='10px' src=\"../imagens/01.png\" />&nbsp;"
  312 + conteudo += "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorClasse('"+codigoMap+"','"+codigoLayer+"','"+dados[i].indice+"')\" title='classes' src=\"../imagens/06.png\" />&nbsp;<span>"+dados[i].indice+" "+dados[i].nome+"</span>"
  313 + var d = {classes:codigoMap+"_"+codigoLayer,html:conteudo,id:codigoMap+"_"+codigoLayer+"_"+dados[i].indice,codigoMap:codigoMap,codigoLayer:codigoLayer,indiceClasse:dados[i].indice}
  314 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  315 + tempNode.setDynamicLoad(loadClasseData, iconMode);
  316 + tempNode.isLeaf = false;
  317 + }
  318 + tree.draw();
  319 +}
  320 +function montaParametrosClasses(no,dados,redesenha)
  321 +{
  322 + var codigoMap = no.data.codigoMap;
  323 + var codigoLayer = no.data.codigoLayer
  324 + var indiceClasse = no.data.indiceClasse
  325 + if(!tree.getNodeByProperty("etiquetaEstilo",no.data.id))
  326 + {
  327 + var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaNovoEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"')\" title='adiciona estilo' src=\"../imagens/05.png\" />&nbsp;"
  328 + var d = {tipo:"etiquetaEstilo",etiquetaEstilo:codigoMap+"_"+codigoLayer+"_"+indiceClasse,html:conteudo+"<i>Estilos:</i>"}
  329 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  330 + tempNode.isLeaf = true;
  331 + }
  332 + for (var i=0, j=dados.length; i<j; i++)
  333 + {
  334 + var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
  335 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('desce')\" title=desce src=\"../imagens/33.png\" />"
  336 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluirEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"','"+dados[i].estilo+"')\" title=excluir width='10px' heigth='10px' src=\"../imagens/01.png\" />&nbsp;"
  337 + conteudo += "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"','"+dados[i].estilo+"')\" title='classes' src=\"../imagens/06.png\" />&nbsp;<span>"+dados[i].estilo+"</span>"
  338 + var d = {estilos:codigoMap+"_"+codigoLayer+"_"+indiceClasse,html:conteudo,id:codigoMap+"_"+codigoLayer+"_"+indiceClasse+"_"+dados[i].estilo,codigoMap:codigoMap,codigoLayer:codigoLayer,indiceClasse:indiceClasse,indiceEstilo:dados[i].estilo}
  339 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  340 + tempNode.isLeaf = true;
  341 + }
  342 + tree.draw();
  343 +}
  344 +function editorDeTexto(codigoMap)
  345 +{
  346 + core_carregando("ativa");
  347 + core_carregando("buscando texto...");
  348 + sUrl = "../php/editormapfile.php?funcao=pegaTextoMapfile&codigoMap="+codigoMap
  349 + var callback =
  350 + {
  351 + success:function(o)
  352 + {
  353 + core_montaEditor("","600px","800px")
  354 + var ins = "<input type=button id=salvarTexto value='Salvar' />"
  355 + ins += "<textarea id='editorArea' rows='19' cols='70'>"+YAHOO.lang.JSON.parse(o.responseText)+"</textarea>"
  356 + var temp = function()
  357 + {
  358 + core_carregando("ativa");
  359 + core_carregando("salvando texto...");
  360 + var callback1 =
  361 + {
  362 + success:function(o)
  363 + {
  364 + $i("editorArea").innerHTML = YAHOO.lang.JSON.parse(o.responseText)
  365 + core_carregando("desativa");
  366 + },
  367 + failure:core_handleFailure,
  368 + argument: { foo:"foo", bar:"bar" }
  369 + }
  370 + var linhas = $i("editorArea").value.split("\n")
  371 + var tempLinhas = ""
  372 + for(var i=0, j=linhas.length; i<j; i++)
  373 + {tempLinhas += linhas[i]+"xxxxxxxx"}
  374 + sUrl = "../php/editormapfile.php?funcao=salvaTextoMapfile&codigoMap="+codigoMap+"&texto="+tempLinhas
  375 + core_makeRequest(sUrl,callback1,"GET")
  376 + }
  377 + $i("editor_bd").innerHTML = ins
  378 + new YAHOO.widget.Button("salvarTexto",{ onclick: { fn: temp }});
  379 + core_carregando("desativa");
  380 + },
  381 + failure:core_handleFailure,
  382 + argument: { foo:"foo", bar:"bar" }
  383 + };
  384 + core_makeRequest(sUrl,callback)
  385 +}
  386 +function adicionaNovoMapfile()
  387 +{
  388 + core_carregando("ativa");
  389 + core_carregando(" adicionando um novo mapfile");
  390 + var nome = $i("Etitulo").value
  391 + var codigo = $i("Ecodigo").value
  392 + sUrl = "../php/editormapfile.php?funcao=criarNovoMap&nome="+nome+"&codigo="+codigo
  393 + var callback =
  394 + {
  395 + success:function(o)
  396 + {
  397 + try
  398 + {
  399 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  400 + {
  401 + core_carregando("<span style=color:red >Código já existe</span>");
  402 + setTimeout("core_carregando('desativa')",3000)
  403 + }
  404 + else
  405 + {
  406 + $mapfiles = [codigo];
  407 + var nos = montaNosRaiz("nao");
  408 + tree.popNode(nos[0])
  409 + var noi = tree.getNodeByIndex(1);
  410 + nos[0].insertBefore(noi);
  411 + tree.draw();
  412 + core_carregando("desativa");
  413 + YAHOO.example.container.panelEditor.destroy();
  414 + YAHOO.example.container.panelEditor = null;
  415 + }
  416 + }
  417 + catch(e){core_handleFailure(e,o.responseText);}
  418 + },
  419 + failure:core_handleFailure,
  420 + argument: { foo:"foo", bar:"bar" }
  421 + };
  422 + core_makeRequest(sUrl,callback)
  423 +}
  424 +function adicionaNovoLayer(codigoMap)
  425 +{
  426 + core_carregando("ativa");
  427 + core_carregando(" adicionando um novo layer");
  428 + sUrl = "../php/editormapfile.php?funcao=criarNovoLayer&codigoMap="+codigoMap
  429 + var callback =
  430 + {
  431 + success:function(o)
  432 + {
  433 + try
  434 + {
  435 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  436 + {
  437 + core_carregando("<span style=color:red >Erro</span>");
  438 + setTimeout("core_carregando('desativa')",3000)
  439 + }
  440 + else
  441 + {
  442 + var dados = YAHOO.lang.JSON.parse(o.responseText)
  443 + var no = tree.getNodeByProperty("codigoMap",codigoMap)
  444 + montaRaizTema(no,dados)
  445 + core_carregando("desativa");
  446 + }
  447 + }
  448 + catch(e){core_handleFailure(e,o.responseText);}
  449 + },
  450 + failure:core_handleFailure,
  451 + argument: { foo:"foo", bar:"bar" }
  452 + };
  453 + core_makeRequest(sUrl,callback)
  454 +}
  455 +function adicionaNovaClasse(codigoMap,codigoLayer,indiceClasse)
  456 +{
  457 + core_carregando("ativa");
  458 + core_carregando(" adicionando uma nova classe");
  459 + sUrl = "../php/editormapfile.php?funcao=criarNovaClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer
  460 + var callback =
  461 + {
  462 + success:function(o)
  463 + {
  464 + try
  465 + {
  466 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  467 + {
  468 + core_carregando("<span style=color:red >Erro</span>");
  469 + setTimeout("core_carregando('desativa')",3000)
  470 + }
  471 + else
  472 + {
  473 + var dados = YAHOO.lang.JSON.parse(o.responseText)
  474 + var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
  475 + montaParametrosTemas(no,dados)
  476 + core_carregando("desativa");
  477 + }
  478 + }
  479 + catch(e){core_handleFailure(e,o.responseText);}
  480 + },
  481 + failure:core_handleFailure,
  482 + argument: { foo:"foo", bar:"bar" }
  483 + };
  484 + core_makeRequest(sUrl,callback)
  485 +}
  486 +function adicionaNovoEstilo(codigoMap,codigoLayer,indiceClasse)
  487 +{
  488 + core_carregando("ativa");
  489 + core_carregando(" adicionando um novo estilo");
  490 + sUrl = "../php/editormapfile.php?funcao=criarNovoEstilo&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse
  491 + var callback =
  492 + {
  493 + success:function(o)
  494 + {
  495 + try
  496 + {
  497 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  498 + {
  499 + core_carregando("<span style=color:red >Erro</span>");
  500 + setTimeout("core_carregando('desativa')",3000)
  501 + }
  502 + else
  503 + {
  504 + var dados = YAHOO.lang.JSON.parse(o.responseText)
  505 + var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer+"_"+indiceClasse)
  506 + montaParametrosClasses(no,dados)
  507 + core_carregando("desativa");
  508 + }
  509 + }
  510 + catch(e){core_handleFailure(e,o.responseText);}
  511 + },
  512 + failure:core_handleFailure,
  513 + argument: { foo:"foo", bar:"bar" }
  514 + };
  515 + core_makeRequest(sUrl,callback)
  516 +}
  517 +function excluirMapfile(codigoMap)
  518 +{
  519 + var mensagem = " excluindo "+codigoMap;
  520 + var no = tree.getNodeByProperty("id",codigoMap)
  521 + var sUrl = "../php/editormapfile.php?funcao=excluirMapfile&codigoMap="+codigoMap;
  522 + core_excluiNoTree(sUrl,no,mensagem)
  523 +}
  524 +function excluirLayer(codigoMap,codigoLayer)
  525 +{
  526 + var mensagem = " excluindo "+codigoLayer;
  527 + var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
  528 + var sUrl = "../php/editormapfile.php?funcao=excluirLayer&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
  529 + core_excluiNoTree(sUrl,no,mensagem)
  530 +}
  531 +function excluirClasse(codigoMap,codigoLayer,indiceClasse)
  532 +{
  533 + var handleYes = function()
  534 + {
  535 + this.hide();
  536 + core_carregando("ativa");
  537 + var mensagem = " excluindo "+indiceClasse;
  538 + core_carregando(mensagem);
  539 + var sUrl = "../php/editormapfile.php?funcao=excluirClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse;
  540 + var callback =
  541 + {
  542 + success:function(o)
  543 + {
  544 + try
  545 + {
  546 + var dados = YAHOO.lang.JSON.parse(o.responseText)
  547 + var nos = tree.getNodesByProperty("classes",codigoMap+"_"+codigoLayer)
  548 + for (var i=0, j=nos.length; i<j; i++)
  549 + {tree.removeNode(nos[i],false)}
  550 + var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
  551 + core_carregando("desativa");
  552 + montaParametrosTemas(no,dados)
  553 + }
  554 + catch(e){core_handleFailure(e,o.responseText);}
  555 + },
  556 + failure:core_handleFailure,
  557 + argument: { foo:"foo", bar:"bar" }
  558 + };
  559 + core_makeRequest(sUrl,callback)
  560 + }
  561 + var handleNo = function()
  562 + {this.hide();};
  563 + var mensagem = "Exclui a classe?";
  564 + var largura = "300"
  565 + core_dialogoContinua(handleYes,handleNo,mensagem,largura)
  566 +}
  567 +function excluirEstilo(codigoMap,codigoLayer,indiceClasse,indiceEstilo)
  568 +{
  569 + var handleYes = function()
  570 + {
  571 + this.hide();
  572 + core_carregando("ativa");
  573 + var mensagem = " excluindo "+indiceEstilo;
  574 + core_carregando(mensagem);
  575 + var sUrl = "../php/editormapfile.php?funcao=excluirEstilo&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse+"&indiceEstilo="+indiceEstilo;
  576 + var callback =
  577 + {
  578 + success:function(o)
  579 + {
  580 + try
  581 + {
  582 + var dados = YAHOO.lang.JSON.parse(o.responseText)
  583 + var nos = tree.getNodesByProperty("estilos",codigoMap+"_"+codigoLayer+"_"+indiceClasse)
  584 + for (var i=0, j=nos.length; i<j; i++)
  585 + {tree.removeNode(nos[i],false)}
  586 + var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer+"_"+indiceClasse)
  587 + core_carregando("desativa");
  588 + montaParametrosClasses(no,dados)
  589 + }
  590 + catch(e){core_handleFailure(e,o.responseText);}
  591 + },
  592 + failure:core_handleFailure,
  593 + argument: { foo:"foo", bar:"bar" }
  594 + };
  595 + core_makeRequest(sUrl,callback)
  596 + }
  597 + var handleNo = function()
  598 + {this.hide();};
  599 + var mensagem = "Exclui o estilo?";
  600 + var largura = "300"
  601 + core_dialogoContinua(handleYes,handleNo,mensagem,largura)
  602 +}
  603 +function editorConexao(codigoMap,codigoLayer)
  604 +{
  605 + core_montaEditor("","600px","500px")
  606 + var sUrl = "../php/editormapfile.php?funcao=pegaConexao&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
  607 + core_pegaDados("Obtendo dados...",sUrl,"montaEditorConexao")
  608 +}
  609 +function editorMetadados(codigoMap,codigoLayer)
  610 +{
  611 + core_montaEditor("","600px","500px")
  612 + var sUrl = "../php/editormapfile.php?funcao=pegaMetadados&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
  613 + core_pegaDados("Obtendo dados...",sUrl,"montaEditorMetadados")
  614 +}
  615 +function editorGeral(codigoMap,codigoLayer)
  616 +{
  617 + core_montaEditor("","600px","500px")
  618 + var sUrl = "../php/editormapfile.php?funcao=pegaGeral&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
  619 + core_pegaDados("Obtendo dados...",sUrl,"montaEditorGeral")
  620 +}
  621 +function montaEditorConexao(dados)
  622 +{
  623 + var param = {
  624 + "linhas":[
  625 + {ajuda:"Type of connection. Default is local.",
  626 + titulo:"Connectiontype",id:"",value:"",div:"<div id=cConnectiontype ></div>",tipo:"text"},
  627 + {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]",
  628 + titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"},
  629 + {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.",
  630 + titulo:"Data",id:"data",value:dados.data,tipo:"text"},
  631 + {ajuda:"Item that contains the location of an individual tile, default is 'location'.",
  632 + titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"},
  633 + {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.",
  634 + titulo:"tileindex",id:"tileindex",value:dados.tileindex,tipo:"text"}
  635 + ]
  636 + }
  637 + var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />"
  638 + if(dados.postgis_mapa.length > 0)
  639 + {
  640 + ins += "<p>Os seguintes 'alias' estão disponíveis para uso na opção 'connection': ";
  641 + ins += dados.postgis_mapa+"</p>"
  642 + }
  643 + ins += core_geraLinhas(param)
  644 + ins += "<br><br><br>"
  645 + $i("editor_bd").innerHTML = ins
  646 + temp = "<p><select id='connectiontype' >"
  647 + temp += core_comboObjeto(objcontype,"valor","texto",dados.connectiontype)
  648 + temp += "</select>"
  649 + $i("cConnectiontype").innerHTML = temp
  650 + var temp = function()
  651 + {salvarDadosEditor('conexao',dados.codigoMap,dados.codigoLayer)}
  652 + new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }});
  653 +}
  654 +function montaEditorMetadados(dados)
  655 +{
  656 + var param = {
  657 + "linhas":[
  658 + {ajuda:"Nome que será utilizado na legenda do mapa e na guia 'Temas'",
  659 + titulo:"Tema",id:"tema",value:dados.tema,tipo:"text"},
  660 + {ajuda:"Denominador da escala da fonte dos dados utilizado pelo tema. É utilizado para apresentar a indicação de compatibilidade entre a escala do tema e a escala do mapa que está sendo visto.",
  661 + titulo:"Escala",id:"escala",value:dados.escala,tipo:"text"},
  662 + {ajuda:"Extensão geográfica máxima do tema, no formato xmin ymin xmax ymax. É utilizado na opção de 'zoom para o tema'. Quando o tema é baseado em shapefile, esse metadata não é necessário, pois o mapserver consegue calcular a extensão. Já em outros tipos de dados, como Postgis, o parâmetro é necessário. Nesse caso, se não for indicado, o botão de zoom para o tema não será visível para o usuário",
  663 + titulo:"Extensao",id:"extensao",value:dados.extensao,tipo:"text"},
  664 + {ajuda:"Indica se a extensão geográfica do mapa deve ser alterada quando o tema for adicionado ao mapa",
  665 + titulo:"Aplicaextensao",id:"",value:dados.aplicaextensao,tipo:"text",div:"<div id=cAplicaextensao ></div>"},
  666 + {ajuda:"Indica se o usuário pode fazer download do tema",
  667 + titulo:"Download",id:"",value:dados.download,tipo:"text",div:"<div id=cDownload ></div>"},
  668 + {ajuda:"Indica se as classes serão mostradas ou não na legenda. Por padrão é SIM.",
  669 + titulo:"Classe",id:"",value:dados.classe,tipo:"text",div:"<div id=cClasse ></div>"},
  670 + {ajuda:"Indica se o tema é mostrado no mapa mas não nas listas da legenda e na guia 'temas'",
  671 + titulo:"Escondido",id:"",value:dados.escondido,tipo:"text",div:"<div id=cEscondido ></div>"},
  672 + {ajuda:"Indica se o tema irá ser mostrado na ferramenta de identificação",
  673 + titulo:"Identifica",id:"",value:dados.identifica,tipo:"text",div:"<div id=cIdentifica ></div>"},
  674 + {ajuda:"Nomes das colunas da tabela de atributos do tema, que serão mostradas na ferramenta de identificação. Se for vazio, todas as colunas serão mostradas. A lista de itens deve ser separada por ',' e grafada em caixa alta no caso de shapefile.",
  675 + titulo:"Itens",id:"itens",value:dados.itens,tipo:"text"},
  676 + {ajuda:"Lista com os 'alias', ou apelidos, para os nomes das colunas listados no metadata 'itens'. Os alias devem ser separados por ',' e seguir a ordem definida em ITENS.",
  677 + titulo:"Itensdesc",id:"itensdesc",value:dados.itensdesc,tipo:"text"},
  678 + {ajuda:"Lista de links que serão incluídos em cada resultado de busca da ferramenta de identificação. A lista de links deve ser separada por ',', podendo-se incluir '' para indicar que o item não tem link. Exemplo de uso para inclusão de links para o site do IBGE quando um município é clicado no mapa:<br>ITENS 'codigo,nome2,uf'<br>ITENSDESC 'codigo do IBGE,nome do município,uf'<br>ITENSLLINK ',http://www.ibge.gov.br/munic2001/tabelas.php?codmun=[codigo]&descricao=[nome],'",
  679 + titulo:"Itenslink",id:"itenslink",value:dados.itenslink,tipo:"text"},
  680 + {ajuda:"Lista de colunas que serão utilizadas na opção de inclusão de 'etiquetas'. As etiquetas são mostradas no mapa quando o usuário estaciona o mouse por alguns instantes sobre o mapa. Separe a lista com ','.",
  681 + titulo:"Tip",id:"tip",value:dados.tip,tipo:"text"},
  682 + {ajuda:"Mensagem que será mostrada no rodapé do mapa quando o tema estiver visível. É útil para apresentar ao usuário observações especiais sobre o uso daquele tema.",
  683 + titulo:"Mensagem",id:"mensagem",value:dados.mensagem,tipo:"text"},
  684 + {ajuda:"É possível a geração de classes automaticamente por meio da definição de colunas na tabela de atributos do tema que armazenam as informações sobre cor, tamanho, etc. Esse metadata é utilizado para definir qual a coluna da tabela que identifica unicamente cada classe. Para cada valor será criada uma classe.<br>O tema que utiliza a geração de classes de forma automática, deve ter definido apenas uma classe. Essa classe será utilizada como padrão para geração das demais.",
  685 + titulo:"Classesitem",id:"classesitem",value:dados.classesitem,tipo:"text"},
  686 + {ajuda:"Nome da coluna que será utilizada para compor o nome das classes geradas automaticamente.",
  687 + titulo:"Classesnome",id:"classesnome",value:dados.classesnome,tipo:"text"},
  688 + {ajuda:"Nome da coluna que definirá a cor do símbolo utilizado em cada classe. As cores devem ser definidas em RGB.",
  689 + titulo:"Classescor",id:"classescor",value:dados.classescor,tipo:"text"},
  690 + {ajuda:"Nome da coluna que definirá o símbolo utilizado em cada classe.",
  691 + titulo:"Classessimbolo",id:"classessimbolo",value:dados.classessimbolo,tipo:"text"},
  692 + {ajuda:"Nome da coluna que definirá o tamanho de cada símbolo.",
  693 + titulo:"Classestamanho",id:"classestamanho",value:dados.classestamanho,tipo:"text"}
  694 + ]
  695 + }
  696 + var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />"
  697 + if(dados.colunas != "")
  698 + {
  699 + ins += "<p>O layer possuí as seguintes colunas na tabela de atributos: ";
  700 + ins += dados.colunas+"</p>"
  701 + }
  702 + ins += core_geraLinhas(param)
  703 + ins += "<br><br><br>"
  704 + $i("editor_bd").innerHTML = ins
  705 +
  706 + temp = "<p><select id='aplicaextensao' >"
  707 + temp += core_combosimnao(dados.aplicaextensao)
  708 + temp += "</select>"
  709 + $i("cAplicaextensao").innerHTML = temp
  710 + temp = "<p><select id='download' >"
  711 + temp += core_combosimnao(dados.download)
  712 + temp += "</select>"
  713 + $i("cDownload").innerHTML = temp
  714 + temp = "<p><select id='classe' >"
  715 + temp += core_combosimnao(dados.classe)
  716 + temp += "</select>"
  717 + $i("cClasse").innerHTML = temp
  718 + temp = "<p><select id='escondido' >"
  719 + temp += core_combosimnao(dados.escondido)
  720 + temp += "</select>"
  721 + $i("cEscondido").innerHTML = temp
  722 + temp = "<p><select id='identifica' >"
  723 + temp += core_combosimnao(dados.identifica)
  724 + temp += "</select>"
  725 + $i("cIdentifica").innerHTML = temp
  726 +
  727 + var temp = function()
  728 + {salvarDadosEditor('metadados',dados.codigoMap,dados.codigoLayer)}
  729 + new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }});
  730 +}
  731 +function montaEditorGeral(dados)
  732 +{
  733 + var param = {
  734 + "linhas":[
  735 + {ajuda:"Layer name",
  736 + titulo:"Name",id:"name",value:dados.name,tipo:"text"},
  737 + {ajuda:"Name of a group that this layer belongs to. The group name can then be reference as a regular layer name in the template files, allowing to do things like turning on and off a group of layers at once.",
  738 + titulo:"Group",id:"group",value:dados.group,tipo:"text"},
  739 + {ajuda:"Projeção",
  740 + titulo:"Projection",id:"projection",value:dados.projection,tipo:"text"},
  741 + {ajuda:"Sets the current status of the layer. Often modified by MapServer itself. Default turns the layer on permanently",
  742 + titulo:"Status",id:"",value:dados.status,tipo:"text",div:"<div id=cStatus ></div>"},
  743 + {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",
  744 + titulo:"Type",id:"",value:dados.type,tipo:"text",div:"<div id=cType ></div>"},
  745 + {ajuda:"Sets the color index to treat as transparent for raster layers.",
  746 + titulo:"Offsite (R,G,B) (utilize -1,-1,-1 para anular o valor)",id:"offsite",value:dados.offsite,tipo:"text"},
  747 + {ajuda:"Sets the opacity level (or the inability to see through the layer) of all classed pixels for a given layer. The value can either be an integer in the range (0-100) or the named symbol 'ALPHA'. A value of 100 is opaque and 0 is fully transparent. Implemented in MapServer 5.0, to replace the deprecated TRANSPARENCY parameter.The 'ALPHA' symbol directs the MapServer rendering code to honor the indexed or alpha transparency of pixmap symbols used to style a layer. This is only needed in the case of RGB output formats, and should be used only when necessary as it is expensive to render transparent pixmap symbols onto an RGB map image.",
  748 + titulo:"Opacity",id:"opacity",value:dados.opacity,tipo:"text"},
  749 + {ajuda:"Maximum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
  750 + titulo:"Maxscale (utilize -1 para anular o valor)",id:"maxscale",value:dados.maxscale,tipo:"text"},
  751 + {ajuda:"Minimum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
  752 + titulo:"Minscale (utilize -1 para anular o valor)",id:"minscale",value:dados.minscale,tipo:"text"},
  753 + {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",
  754 + titulo:"Filter",id:"filter",value:dados.filter,tipo:"text"},
  755 + {ajuda:"Item to use with simple FILTER expressions. OGR and shapefiles only.",
  756 + titulo:"Filteritem",id:"filteritem",value:dados.filteritem,tipo:"text"},
  757 + {ajuda:"Item name in attribute table to use for class annotation (i.e. labeling).",
  758 + titulo:"Labelitem",id:"labelitem",value:dados.labelitem,tipo:"text"},
  759 + {ajuda:"Maximum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
  760 + titulo:"Labelmaxscale (utilize -1 para anular o valor)",id:"labelmaxscale",value:dados.labelmaxscale,tipo:"text"},
  761 + {ajuda:"Minimum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
  762 + titulo:"Labelminscale (utilize -1 para anular o valor)",id:"labelminscale",value:dados.labelminscale,tipo:"text"},
  763 + {ajuda:"The scale at which symbols and/or text appear full size. This allows for dynamic scaling of objects based on the scale of the map. If not set then this layer will always appear at the same size. Scaling only takes place within the limits of MINSIZE and MAXSIZE as described above. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
  764 + titulo:"Symbolscale (utilize -1 para anular o valor)",id:"symbolscale",value:dados.symbolscale,tipo:"text"},
  765 + {ajuda:"Sensitivity for point based queries (i.e. via mouse and/or map coordinates). Given in TOLERANCEUNITS. If the layer is a POINT or a LINE, the default is 3. For all other layer types, the default is 0. To restrict polygon searches so that the point must occur in the polygon set the tolerance to zero.",
  766 + titulo:"Tolerance",id:"tolerance",value:dados.tolerance,tipo:"text"},
  767 + {ajuda:" ",
  768 + titulo:"Tolerance units",id:"",value:dados.toleranceunits,tipo:"text",div:"<div id=cToleranceunits ></div>"},
  769 + {ajuda:"Sets the unit of CLASS object SIZE values (default is pixels). Useful for simulating buffering",
  770 + titulo:"Sizeunits",id:"",value:dados.sizeunits,tipo:"text",div:"<div id=cSizeunits ></div>"}
  771 + ]
  772 + }
  773 + var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />"
  774 + if(dados.colunas != "")
  775 + {
  776 + ins += "<p>O layer possuí as seguintes colunas na tabela de atributos: ";
  777 + ins += dados.colunas+"</p>"
  778 + }
  779 + ins += core_geraLinhas(param)
  780 + ins += "<br><br><br>"
  781 + $i("editor_bd").innerHTML = ins
  782 +
  783 + temp = "<p><select id='status' >"
  784 + temp += core_comboObjeto(objstatus,"valor","texto",dados.status)
  785 + temp += "</select>"
  786 + $i("cStatus").innerHTML = temp
  787 + temp = "<p><select id='type' >"
  788 + temp += core_comboObjeto(objlayertypes,"valor","texto",dados.type)
  789 + temp += "</select>"
  790 + $i("cType").innerHTML = temp
  791 + temp = "<p><select id='sizeunits' >"
  792 + temp += core_comboObjeto(objmapunits,"valor","texto",dados.sizeunits)
  793 + temp += "</select>"
  794 + $i("cSizeunits").innerHTML = temp
  795 + temp = "<p><select id='toleranceunits' >"
  796 + temp += core_comboObjeto(objmapunits,"valor","texto",dados.toleranceunits)
  797 + temp += "</select>"
  798 + $i("cToleranceunits").innerHTML = temp
  799 +
  800 + var temp = function()
  801 + {salvarDadosEditor('geral',dados.codigoMap,dados.codigoLayer)}
  802 + new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }});
  803 +}
  804 +
  805 +function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo)
  806 +{
  807 + if(tipo == "conexao")
  808 + {
  809 + var campos = new Array("connection","data","connectiontype","tileitem","tileindex")
  810 + var par = "&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer
  811 + var prog = "../php/editormapfile.php?funcao=alterarConexao"
  812 + }
  813 + if(tipo == "metadados")
  814 + {
  815 + var campos = new Array("aplicaextensao","classestamanho","classessimbolo","classescor","classesnome","classesitem","mensagem","identifica","extensao","escondido","download","escala","tema","classe","tip","itenslink","itens","itensdesc")
  816 + var par = "&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer
  817 + var prog = "../php/editormapfile.php?funcao=alterarMetadados"
  818 + }
  819 + if(tipo == "geral")
  820 + {
  821 + var campos = new Array("name","projection","sizeunits","status","toleranceunits","tolerance","symbolscale","opacity","offsite","minscale","maxscale","labelminscale","labelmaxscale","labelitem","group","filteritem","type","filter")
  822 + var par = "&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer
  823 + var prog = "../php/editormapfile.php?funcao=alterarGeral"
  824 + }
  825 +
  826 + for (i=0;i<campos.length;i++)
  827 + {par += "&"+campos[i]+"="+($i(campos[i]).value)}
  828 + core_carregando("ativa");
  829 + core_carregando(" gravando o registro do layer= "+codigoLayer);
  830 + var sUrl = prog+par;
  831 + var callback =
  832 + {
  833 + success:function(o)
  834 + {
  835 + try
  836 + {
  837 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  838 + {
  839 + core_carregando("<span style=color:red >Não foi possível salvar.</span>");
  840 + setTimeout("core_carregando('desativa')",3000)
  841 + }
  842 + else
  843 + {
  844 + if(tipo=="conexao")
  845 + {montaEditorConexao(YAHOO.lang.JSON.parse(o.responseText));}
  846 + if(tipo=="metadados")
  847 + {montaEditorMetadados(YAHOO.lang.JSON.parse(o.responseText));}
  848 + if(tipo=="geral")
  849 + {
  850 + var d = YAHOO.lang.JSON.parse(o.responseText)
  851 + montaEditorGeral(d);
  852 + //var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
  853 + if(d.name != codigoLayer)
  854 + {
  855 + core_pegaMapfiles("montaArvore()")
  856 + YAHOO.example.container.panelEditor.destroy();
  857 + YAHOO.example.container.panelEditor = null;
  858 + }
  859 + }
  860 +
  861 + core_carregando("desativa");
  862 + }
  863 + }
  864 + catch(e){core_handleFailure(e,o.responseText);}
  865 + },
  866 + failure:core_handleFailure,
  867 + argument: { foo:"foo", bar:"bar" }
  868 + };
  869 + core_makeRequest(sUrl,callback,'POST')
  870 +}
  871 +
  872 +YAHOO.util.Event.addListener(window, "load", initMenu);
0 873 \ No newline at end of file
... ...
admin/js/temas.js
... ... @@ -1,493 +0,0 @@
1   -contaN = 0;
2   -objcontype = [
3   - {texto:"MS_INLINE",valor:"0"},
4   - {texto:"MS_SHAPEFILE",valor:"1"},
5   - {texto:"MS_TILED_SHAPEFILE",valor:"2"},
6   - {texto:"MS_SDE",valor:"3"},
7   - {texto:"MS_OGR",valor:"4"},
8   - {texto:"MS_TILED_OGR",valor:"5"},
9   - {texto:"MS_POSTGIS",valor:"6"},
10   - {texto:"MS_WMS",valor:"7"},
11   - {texto:"MS_ORACLESPATIAL",valor:"8"},
12   - {texto:"MS_WFS",valor:"9"},
13   - {texto:"MS_GRATICULE",valor:"10"},
14   - {texto:"MS_MYGIS",valor:"11"},
15   - {texto:"MS_RASTER",valor:"12"},
16   - {texto:"MS_PLUGIN",valor:"13"}
17   -];
18   -objbool_tf = [
19   - {texto:"MS_TRUE",valor:"0"},
20   - {texto:"MS_FALSE",valor:"1"}
21   -];
22   -objbool_of = [
23   - {texto:"MS_ON",valor:"2"},
24   - {texto:"MS_OFF",valor:"3"}
25   -];
26   -objbool_yn = [
27   - {texto:"MS_YES",valor:"4"},
28   - {texto:"MS_NO",valor:"5"}
29   -];
30   -objmapunits = [
31   - {texto:"MS_INCHES",valor:"0"},
32   - {texto:"MS_FEET",valor:"1"},
33   - {texto:"MS_MILES",valor:"2"},
34   - {texto:"MS_METERS",valor:"3"},
35   - {texto:"MS_KILOMETERS",valor:"4"},
36   - {texto:"MS_DD",valor:"5"},
37   - {texto:"MS_PIXELS",valor:"6"}
38   -];
39   -objlayertypes = [
40   - {texto:"MS_LAYER_POINT",valor:"0"},
41   - {texto:"MS_LAYER_LINE",valor:"1"},
42   - {texto:"MS_LAYER_POLYGON",valor:"2"},
43   - {texto:"MS_LAYER_RASTER",valor:"3"},
44   - {texto:"MS_LAYER_ANNOTATION",valor:"4"},
45   - {texto:"MS_LAYER_QUERY",valor:"5"},
46   - {texto:"MS_LAYER_CIRCLE",valor:"6"},
47   - {texto:"MS_LAYER_TILEINDEX",valor:"7"},
48   - {texto:"MS_LAYER_CHART",valor:"8"}
49   -];
50   -objstatus = [
51   - {texto:"MS_ON",valor:"1"},
52   - {texto:"MS_OFF",valor:"0"},
53   - {texto:"MS_DEFAULT",valor:"2"}
54   -];
55   -objfonttypes = [
56   - {texto:"MS_TRUETYPE",valor:"0"},
57   - {texto:"MS_BITMAP",valor:"1"}
58   -];
59   -objposition = [
60   - {texto:"MS_UL",valor:"0"},
61   - {texto:"MS_LR",valor:"1"},
62   - {texto:"MS_UR",valor:"2"},
63   - {texto:"MS_LL",valor:"3"},
64   - {texto:"MS_CR",valor:"4"},
65   - {texto:"MS_CL",valor:"5"},
66   - {texto:"MS_UC",valor:"6"},
67   - {texto:"MS_WMS",valor:"7"},
68   - {texto:"MS_LC",valor:"8"},
69   - {texto:"MS_CC",valor:"9"},
70   - {texto:"MS_AUTO",valor:"10"},
71   - {texto:"MS_XY",valor:"11"},
72   - {texto:"MS_FOLLOW",valor:"12"}
73   -];
74   -objfontstyle = [
75   - {texto:"MS_TINY",valor:"0"},
76   - {texto:"MS_SMALL",valor:"1"},
77   - {texto:"MS_MEDIUM",valor:"2"},
78   - {texto:"MS_LARGE",valor:"3"},
79   - {texto:"MS_GIANT",valor:"4"},
80   -];
81   -objshapetype = [
82   - {texto:"MS_SHAPE_POINT",valor:"0"},
83   - {texto:"MS_SHAPE_LINE",valor:"1"},
84   - {texto:"MS_SHAPE_POLYGON",valor:"2"},
85   - {texto:"MS_SHAPE_NULL",valor:"3"}
86   -];
87   -objshapefiletype = [
88   - {texto:"MS_SHP_POINT",valor:"0"},
89   - {texto:"MS_SHP_ARC",valor:"1"},
90   - {texto:"MS_SHP_POLYGON",valor:"2"},
91   - {texto:"MS_SHP_MULTIPOINT",valor:"3"}
92   -];
93   -objalignment = [
94   - {texto:"MS_ALIGN_LEFT",valor:"0"},
95   - {texto:"MS_ALIGN_CENTER",valor:"1"},
96   - {texto:"MS_ALIGN_RIGHT",valor:"2"}
97   -];
98   -
99   -YAHOO.namespace("example.container");
100   -
101   -function initMenu()
102   -{
103   - ativaBotaoAdicionaMapfile("adiciona")
104   - core_carregando("ativa");
105   - core_carregando("buscando temas...");
106   - core_ativaPainelAjuda("ajuda","botaoAjuda");
107   - core_pegaMapfiles("montaArvore()")
108   -}
109   -function ativaBotaoAdicionaMapfile(idBotao)
110   -{
111   - var adiciona = function()
112   - {
113   - core_montaEditor("adicionaNovoMapfile()")
114   - ins = "<p>Título do novo tema: </p>"
115   - ins += "<input size=50 type=text id='Etitulo' value='' /></p>"
116   - ins += "<p>Nome do arquivo mapfile (sem .map): </p>"
117   - ins += "<input size=50 type=text id='Ecodigo' value='' /></p>"
118   - $i("editor_bd").innerHTML = ins
119   - };
120   - //cria o botão de adição de um novo menu
121   - var adiciona = new YAHOO.widget.Button(idBotao,{ onclick: { fn: adiciona } });
122   -}
123   -function montaArvore()
124   -{
125   - YAHOO.example.treeExample = new function()
126   - {
127   - var currentIconMode;
128   - tree = "";
129   - function changeIconMode()
130   - {
131   - var newVal = parseInt(this.value);
132   - if (newVal != currentIconMode)
133   - {currentIconMode = newVal;}
134   - buildTree();
135   - }
136   - function loadNodeData(node, fnLoadComplete)
137   - {
138   - var sUrl = "../php/temas.php?funcao=pegaLayers&codigoMap="+node.data.codigoMap;
139   - var callback =
140   - {
141   - success: function(oResponse)
142   - {
143   - var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
144   - montaRaizTema(node,dados)
145   - oResponse.argument.fnLoadComplete();
146   - },
147   - failure: function(oResponse)
148   - {
149   - oResponse.argument.fnLoadComplete();
150   - },
151   - argument:
152   - {
153   - "node": node,
154   - "fnLoadComplete": fnLoadComplete
155   - },
156   - timeout: 7000
157   - };
158   - YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
159   - }
160   - function buildTree()
161   - {
162   - tree = new YAHOO.widget.TreeView("tabela");
163   - tree.setDynamicLoad(loadNodeData, currentIconMode);
164   - var root = tree.getRoot();
165   - var tempNode = new YAHOO.widget.TextNode('', root, false);
166   - tempNode.isLeaf = true;
167   - core_carregando("desativa");
168   - }
169   - buildTree();
170   - }();
171   - montaNosRaiz("nao")
172   - tree.draw();
173   -}
174   -function montaNosRaiz(redesenha)
175   -{
176   - var root = tree.getRoot();
177   - var nos = new Array()
178   - for (var i=0, j=$mapfiles.length; i<j; i++)
179   - {
180   - conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i]+"')\" title=excluir src=\"../imagens/01.png\" /><b>&nbsp;<span>"+$mapfiles[i]+"</span>"
181   - var d = {html:conteudo,id:$mapfiles[i],codigoMap:$mapfiles[i]};
182   - var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true);
183   - nos.push(tempNode)
184   - }
185   - if(redesenha=="sim")
186   - tree.draw();
187   - return nos;
188   -}
189   -function montaRaizTema(no,dados)
190   -{
191   - var codigoMap = no.data.codigoMap;
192   - function iconMode()
193   - {
194   - var newVal = parseInt(this.value);
195   - if (newVal != currentIconMode)
196   - {currentIconMode = newVal;}
197   - }
198   - function loadLayerData(node, fnLoadComplete)
199   - {
200   - var sUrl = "../php/temas.php?funcao=listaClasses&codigoMap="+node.data.codigoMap+"&codigoLayer="+node.data.codigoLayer;
201   - var callback =
202   - {
203   - success: function(oResponse)
204   - {
205   - var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
206   - montaParametrosTemas(node,dados,false)
207   - oResponse.argument.fnLoadComplete();
208   - },
209   - failure: function(oResponse)
210   - {
211   - oResponse.argument.fnLoadComplete();
212   - },
213   - argument:
214   - {
215   - "node": node,
216   - "fnLoadComplete": fnLoadComplete
217   - },
218   - timeout: 7000
219   - };
220   - YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
221   - }
222   - if(!tree.getNodeByProperty("etiquetaLayers",no.data.codigoMap))
223   - {
224   - var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaNovoLayer('"+no.data.codigoMap+"')\" title='adiciona layer' src=\"../imagens/05.png\" />"
225   - var d = {tipo:"etiqueta",etiquetaLayers:no.data.codigoMap,html:conteudo+"<i>Layers:</i>"}
226   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
227   - tempNode.isLeaf = true;
228   - }
229   - for (var i=0, j=dados.layers.length; i<j; i++)
230   - {
231   - var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
232   - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('desce')\" title=desce src=\"../imagens/33.png\" />"
233   - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluirLayer('"+no.data.codigoMap+"','"+dados.layers[i]+"')\" title=excluir width='10px' heigth='10px' src=\"../imagens/01.png\" />&nbsp;<span>"+dados.layers[i]+"</span>"
234   - var d = {html:conteudo,id:codigoMap+"_"+dados.layers[i],codigoMap:codigoMap,codigoLayer:dados.layers[i]}
235   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
236   - tempNode.setDynamicLoad(loadLayerData, iconMode);
237   - tempNode.isLeaf = false;
238   - }
239   - tree.draw();
240   -}
241   -function montaParametrosTemas(no,dados,redesenha)
242   -{
243   - var codigoMap = no.data.codigoMap;
244   - var codigoLayer = no.data.codigoLayer
245   - function iconMode()
246   - {
247   - var newVal = parseInt(this.value);
248   - if (newVal != currentIconMode)
249   - {currentIconMode = newVal;}
250   - }
251   - function loadClasseData(node, fnLoadComplete)
252   - {
253   - var indiceClasse = node.data.indiceClasse;
254   - var sUrl = "../php/temas.php?funcao=listaEstilos&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse;
255   - var callback =
256   - {
257   - success: function(oResponse)
258   - {
259   - var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
260   - montaParametrosClasses(node,dados,false)
261   - oResponse.argument.fnLoadComplete();
262   - },
263   - failure: function(oResponse)
264   - {
265   - oResponse.argument.fnLoadComplete();
266   - },
267   - argument:
268   - {
269   - "node": node,
270   - "fnLoadComplete": fnLoadComplete
271   - },
272   - timeout: 7000
273   - };
274   - YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
275   - }
276   - if(!tree.getNodeByProperty("etiquetaConexao",no.data.id))
277   - {
278   - var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorConexao('"+codigoMap+"','"+codigoLayer+"')\" title='edita conexão' src=\"../imagens/06.png\" />"
279   - var d = {tipo:"etiquetaConexao",etiquetaConexao:no.data.id,html:conteudo+" Editar conexão"}
280   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
281   - tempNode.isLeaf = true;
282   - }
283   - if(!tree.getNodeByProperty("etiquetaMetadados",no.data.id))
284   - {
285   - var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorMetadados('"+codigoMap+"','"+codigoLayer+"')\" title='edita metadados' src=\"../imagens/06.png\" />"
286   - var d = {tipo:"etiquetaMetadados",etiquetaMetadados:no.data.id,html:conteudo+" Editar metadados"}
287   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
288   - tempNode.isLeaf = true;
289   - }
290   - if(!tree.getNodeByProperty("etiquetaGeral",no.data.id))
291   - {
292   - var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorGeral('"+codigoMap+"','"+codigoLayer+"')\" title='parâmetros gerais' src=\"../imagens/06.png\" />"
293   - var d = {tipo:"etiquetaGeral",etiquetaGeral:no.data.id,html:conteudo+" Editar dados gerais"}
294   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
295   - tempNode.isLeaf = true;
296   - }
297   - if(!tree.getNodeByProperty("etiquetaClasses",no.data.id))
298   - {
299   - var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaClasse('"+codigoMap+"','"+codigoLayer+"')\" title='adiciona classe' src=\"../imagens/05.png\" />&nbsp;"
300   - conteudo += "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorClasses('"+codigoMap+"','"+codigoLayer+"')\" title='classes' src=\"../imagens/06.png\" />"
301   - var d = {tipo:"etiquetaClasses",etiquetaClasses:no.data.id,html:conteudo+"<i>&nbsp;Classes:</i>"}
302   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
303   - tempNode.isLeaf = true;
304   - }
305   - for (var i=0, j=dados.length; i<j; i++)
306   - {
307   - var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
308   - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('desce')\" title=desce src=\"../imagens/33.png\" />"
309   - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluirClasse('"+codigoMap+"','"+codigoLayer+"','"+dados[i].indice+"')\" title=excluir width='10px' heigth='10px' src=\"../imagens/01.png\" />&nbsp;"
310   - conteudo += "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorClasse('"+codigoMap+"','"+codigoLayer+"','"+dados[i].indice+"')\" title='classes' src=\"../imagens/06.png\" />&nbsp;<span>"+dados[i].indice+" "+dados[i].nome+"</span>"
311   - var d = {classes:codigoMap+"_"+codigoLayer,html:conteudo,id:codigoMap+"_"+codigoLayer+"_"+dados[i].indice,codigoMap:codigoMap,codigoLayer:codigoLayer,indiceClasse:dados[i].indice}
312   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
313   - tempNode.setDynamicLoad(loadClasseData, iconMode);
314   - tempNode.isLeaf = false;
315   - }
316   - tree.draw();
317   -}
318   -function montaParametrosClasses(no,dados,redesenha)
319   -{
320   - var codigoMap = no.data.codigoMap;
321   - var codigoLayer = no.data.codigoLayer
322   - var indiceClasse = no.data.indiceClasse
323   - if(!tree.getNodeByProperty("etiquetaEstilo",no.data.id))
324   - {
325   - var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"')\" title='adiciona estilo' src=\"../imagens/05.png\" />&nbsp;"
326   - var d = {tipo:"etiquetaEstilo",etiquetaEstilo:codigoMap+"_"+codigoLayer+"_"+indiceClasse,html:conteudo+"<i>Estilos:</i>"}
327   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
328   - tempNode.isLeaf = true;
329   - }
330   - for (var i=0, j=dados.length; i<j; i++)
331   - {
332   - var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
333   - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('desce')\" title=desce src=\"../imagens/33.png\" />"
334   - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluirEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"','"+dados[i].estilo+"')\" title=excluir width='10px' heigth='10px' src=\"../imagens/01.png\" />&nbsp;"
335   - conteudo += "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"','"+dados[i].estilo+"')\" title='classes' src=\"../imagens/06.png\" />&nbsp;<span>"+dados[i].estilo+"</span>"
336   - var d = {html:conteudo,id:codigoMap+"_"+codigoLayer+"_"+"_"+indiceClasse+"_"+dados[i].estilo,codigoMap:codigoMap,codigoLayer:codigoLayer,indiceClasse:indiceClasse,indiceEstilo:dados[i].estilo}
337   - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
338   - tempNode.isLeaf = true;
339   - }
340   - tree.draw();
341   -}
342   -
343   -function adicionaNovoMapfile()
344   -{
345   - core_carregando("ativa");
346   - core_carregando(" adicionando um novo mapfile");
347   - var nome = $i("Etitulo").value
348   - var codigo = $i("Ecodigo").value
349   - sUrl = "../php/temas.php?funcao=criarNovoMap&nome="+nome+"&codigo="+codigo
350   - var callback =
351   - {
352   - success:function(o)
353   - {
354   - try
355   - {
356   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
357   - {
358   - core_carregando("<span style=color:red >Código já existe</span>");
359   - setTimeout("core_carregando('desativa')",3000)
360   - }
361   - else
362   - {
363   - $mapfiles = [codigo];
364   - var nos = montaNosRaiz("nao");
365   - tree.popNode(nos[0])
366   - var noi = tree.getNodeByIndex(1);
367   - nos[0].insertBefore(noi);
368   - tree.draw();
369   - core_carregando("desativa");
370   - YAHOO.example.container.panelEditor.destroy();
371   - YAHOO.example.container.panelEditor = null;
372   - }
373   - }
374   - catch(e){core_handleFailure(e,o.responseText);}
375   - },
376   - failure:core_handleFailure,
377   - argument: { foo:"foo", bar:"bar" }
378   - };
379   - core_makeRequest(sUrl,callback)
380   -}
381   -function adicionaNovoLayer(codigoMap)
382   -{
383   - core_carregando("ativa");
384   - core_carregando(" adicionando um novo layer");
385   - sUrl = "../php/temas.php?funcao=criarNovoLayer&codigoMap="+codigoMap
386   - var callback =
387   - {
388   - success:function(o)
389   - {
390   - try
391   - {
392   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
393   - {
394   - core_carregando("<span style=color:red >Erro</span>");
395   - setTimeout("core_carregando('desativa')",3000)
396   - }
397   - else
398   - {
399   - var dados = YAHOO.lang.JSON.parse(o.responseText)
400   - var no = tree.getNodeByProperty("codigoMap",codigoMap)
401   - montaRaizTema(no,dados)
402   - core_carregando("desativa");
403   - }
404   - }
405   - catch(e){core_handleFailure(e,o.responseText);}
406   - },
407   - failure:core_handleFailure,
408   - argument: { foo:"foo", bar:"bar" }
409   - };
410   - core_makeRequest(sUrl,callback)
411   -}
412   -function adicionaClasse(codigoMap,codigoLayer,indiceClasse)
413   -{
414   - core_carregando("ativa");
415   - core_carregando(" adicionando uma nova classe");
416   - sUrl = "../php/temas.php?funcao=criarNovaClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer
417   - var callback =
418   - {
419   - success:function(o)
420   - {
421   - try
422   - {
423   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
424   - {
425   - core_carregando("<span style=color:red >Erro</span>");
426   - setTimeout("core_carregando('desativa')",3000)
427   - }
428   - else
429   - {
430   - var dados = YAHOO.lang.JSON.parse(o.responseText)
431   - var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
432   - montaParametrosTemas(no,dados)
433   - core_carregando("desativa");
434   - }
435   - }
436   - catch(e){core_handleFailure(e,o.responseText);}
437   - },
438   - failure:core_handleFailure,
439   - argument: { foo:"foo", bar:"bar" }
440   - };
441   - core_makeRequest(sUrl,callback)
442   -}
443   -function excluirMapfile(codigoMap)
444   -{
445   - var mensagem = " excluindo "+codigoMap;
446   - var no = tree.getNodeByProperty("id",codigoMap)
447   - var sUrl = "../php/temas.php?funcao=excluirMapfile&codigoMap="+codigoMap;
448   - core_excluiNoTree(sUrl,no,mensagem)
449   -}
450   -function excluirLayer(codigoMap,codigoLayer)
451   -{
452   - var mensagem = " excluindo "+codigoLayer;
453   - var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
454   - var sUrl = "../php/temas.php?funcao=excluirLayer&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
455   - core_excluiNoTree(sUrl,no,mensagem)
456   -}
457   -function excluirClasse(codigoMap,codigoLayer,indiceClasse)
458   -{
459   - var handleYes = function()
460   - {
461   - this.hide();
462   - core_carregando("ativa");
463   - var mensagem = " excluindo "+indiceClasse;
464   - core_carregando(mensagem);
465   - var sUrl = "../php/temas.php?funcao=excluirClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse;
466   - var callback =
467   - {
468   - success:function(o)
469   - {
470   - try
471   - {
472   - var dados = YAHOO.lang.JSON.parse(o.responseText)
473   - var nos = tree.getNodesByProperty("classes",codigoMap+"_"+codigoLayer)
474   - for (var i=0, j=nos.length; i<j; i++)
475   - {tree.removeNode(nos[i],false)}
476   - var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer)
477   - core_carregando("desativa");
478   - montaParametrosTemas(no,dados)
479   - }
480   - catch(e){core_handleFailure(e,o.responseText);}
481   - },
482   - failure:core_handleFailure,
483   - argument: { foo:"foo", bar:"bar" }
484   - };
485   - core_makeRequest(sUrl,callback)
486   - }
487   - var handleNo = function()
488   - {this.hide();};
489   - var mensagem = "Exclui a classe?";
490   - var largura = "300"
491   - core_dialogoContinua(handleYes,handleNo,mensagem,largura)
492   -}
493   -YAHOO.util.Event.addListener(window, "load", initMenu);
494 0 \ No newline at end of file
admin/js/temasold.js
... ... @@ -449,205 +449,7 @@ function pegaEstilos(codigoMap,codigoLayer)
449 449 var p = "../php/temas.php?funcao=pegaEstilos&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
450 450 cPaint.call(p,"",retorna);
451 451 }
452   -function pegaMetadados(codigoMap,codigoLayer)
453   -{
454   - var ins = "<br><fieldset><legend>+- Metadados</legend><div style=display:none >"
455   - var retorna = function(retorna)
456   - {
457   - ins += "";
458   - var param = {
459   - "linhas":[
460   - {texto:"Nome que será utilizado na legenda do mapa e na guia 'Temas'",
461   - titulo:"tema",prefixoid:"tema_",id:codigoLayer,valor:"tema"},
462   - {texto:"Denominador da escala da fonte dos dados utilizado pelo tema. É utilizado para apresentar a indicação de compatibilidade entre a escala do tema e a escala do mapa que está sendo visto.",
463   - titulo:"escala",prefixoid:"escala_",id:codigoLayer,valor:"escala"},
464   - {texto:"Extensão geográfica máxima do tema, no formato xmin ymin xmax ymax. É utilizado na opção de 'zoom para o tema'. Quando o tema é baseado em shapefile, esse metadata não é necessário, pois o mapserver consegue calcular a extensão. Já em outros tipos de dados, como Postgis, o parâmetro é necessário. Nesse caso, se não for indicado, o botão de zoom para o tema não será visível para o usuário",
465   - titulo:"extensao",prefixoid:"extensao_",id:codigoLayer,valor:"extensao"}
466   - ]
467   - }
468   - ins += (geraLinhas2(retorna.data,param,"salvarMetadados"));
469   -
470   - ins += "<br><fieldset><legend>+- aplicaextensao</legend><div style=display:none >"
471   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Indica se a extensão geográfica do mapa deve ser alterada quando o tema for adicionado ao mapa</p>"
472   - ins += "<p><select onchange='this.style.color=\"blue\"' id='aplicaextensao_"+codigoLayer+"' >"
473   - ins += combosimnao(retorna.data.aplicaextensao)
474   - ins += "</select>"
475   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarMetadados(\""+codigoLayer+"\",\"aplicaextensao\",this)'/>"
476   - ins += "</p></div></fieldset>"
477   -
478   -
479   - ins += "<br><fieldset><legend>+- download</legend><div style=display:none >"
480   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Indica se o usuário pode fazer download do tema</p>"
481   - ins += "<p><select onchange='this.style.color=\"blue\"' id='download_"+codigoLayer+"' >"
482   - ins += combosimnao(retorna.data.download)
483   - ins += "</select>"
484   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarMetadados(\""+codigoLayer+"\",\"download\",this)'/>"
485   - ins += "</p></div></fieldset>"
486   -
487   - var param = {
488   - "linhas":[
489   - {texto:"Nomes das colunas da tabela de atributos do tema, que serão mostradas na ferramenta de identificação. Se for vazio, todas as colunas serão mostradas. A lista de itens deve ser separada por ',' e grafada em caixa alta no caso de shapefile.",
490   - titulo:"itens",prefixoid:"itens_",id:codigoLayer,valor:"itens"},
491   - {texto:"Lista com os 'alias', ou apelidos, para os nomes das colunas listados no metadata 'itens'. Os alias devem ser separados por ',' e seguir a ordem definida em ITENS.",
492   - titulo:"itensdesc",prefixoid:"itensdesc_",id:codigoLayer,valor:"itensdesc"},
493   - {texto:"Lista de links que serão incluídos em cada resultado de busca da ferramenta de identificação. A lista de links deve ser separada por ',', podendo-se incluir '' para indicar que o item não tem link. Exemplo de uso para inclusão de links para o site do IBGE quando um município é clicado no mapa:<br>ITENS 'codigo,nome2,uf'<br>ITENSDESC 'codigo do IBGE,nome do município,uf'<br>ITENSLLINK ',http://www.ibge.gov.br/munic2001/tabelas.php?codmun=[codigo]&descricao=[nome],'",
494   - titulo:"itenslink",prefixoid:"itenslink_",id:codigoLayer,valor:"itenslink"},
495   - {texto:"Lista de colunas que serão utilizadas na opção de inclusão de 'etiquetas'. As etiquetas são mostradas no mapa quando o usuário estaciona o mouse por alguns instantes sobre o mapa. Separe a lista com ','.",
496   - titulo:"tip",prefixoid:"tip_",id:codigoLayer,valor:"tip"},
497   - {texto:"Mensagem que será mostrada no rodapé do mapa quando o tema estiver visível. É útil para apresentar ao usuário observações especiais sobre o uso daquele tema.",
498   - titulo:"mensagem",prefixoid:"mensagem_",id:codigoLayer,valor:"mensagem"},
499   - {texto:"É possível a geração de classes automaticamente por meio da definição de colunas na tabela de atributos do tema que armazenam as informações sobre cor, tamanho, etc. Esse metadata é utilizado para definir qual a coluna da tabela que identifica unicamente cada classe. Para cada valor será criada uma classe.<br>O tema que utiliza a geração de classes de forma automática, deve ter definido apenas uma classe. Essa classe será utilizada como padrão para geração das demais.",
500   - titulo:"classesitem",prefixoid:"classesitem_",id:codigoLayer,valor:"classesitem"},
501   - {texto:"Nome da coluna que será utilizada para compor o nome das classes geradas automaticamente.",
502   - titulo:"classesnome",prefixoid:"classesnome_",id:codigoLayer,valor:"classesnome"},
503   - {texto:"Nome da coluna que definirá a cor do símbolo utilizado em cada classe. As cores devem ser definidas em RGB.",
504   - titulo:"classescor",prefixoid:"classescor_",id:codigoLayer,valor:"classescor"},
505   - {texto:"Nome da coluna que definirá o símbolo utilizado em cada classe.",
506   - titulo:"classessimbolo",prefixoid:"classessimbolo_",id:codigoLayer,valor:"classessimbolo"},
507   - {texto:"Nome da coluna que definirá o tamanho de cada símbolo.",
508   - titulo:"classestamanho",prefixoid:"classestamanho_",id:codigoLayer,valor:"classestamanho"}
509   - ]
510   - }
511   -
512   -
513   - ins += "<br><fieldset style=background-color:#f0e68c ><legend style=color:brown >+- Mais...</legend><div style=display:none >"
514   -
515   - ins += (geraLinhas2(retorna.data,param,"salvarMetadados"));
516   -
517   - ins += "<br><fieldset><legend>+- classe</legend><div style=display:none >"
518   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Indica se as classes serão mostradas ou não na legenda. Por padrão é SIM.</p>"
519   - ins += "<p><select onchange='this.style.color=\"blue\"' id='classe_"+codigoLayer+"' >"
520   - ins += combosimnao(retorna.data.classe)
521   - ins += "</select>"
522   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarMetadados(\""+codigoLayer+"\",\"classe\",this)'/>"
523   - ins += "</p></div></fieldset>"
524   -
525   - ins += "<br><fieldset><legend>+- escondido</legend><div style=display:none >"
526   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Indica se o tema é mostrado no mapa mas não nas listas da legenda e na guia 'temas'</p>"
527   - ins += "<p><select onchange='this.style.color=\"blue\"' id='escondido_"+codigoLayer+"' >"
528   - ins += combosimnao(retorna.data.escondido)
529   - ins += "</select>"
530   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarMetadados(\""+codigoLayer+"\",\"escondido\",this)'/>"
531   - ins += "</p></div></fieldset>"
532   -
533   - ins += "<br><fieldset><legend>+- identifica</legend><div style=display:none >"
534   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Indica se o tema irá ser mostrado na ferramenta de identificação</p>"
535   - ins += "<p><select onchange='this.style.color=\"blue\"' id='identifica_"+codigoLayer+"' >"
536   - ins += combosimnao(retorna.data.identifica)
537   - ins += "</select>"
538   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarMetadados(\""+codigoLayer+"\",\"identifica\",this)'/>"
539   - ins += "</p></div></fieldset>"
540   -
541   - ins += "</div></fieldset>"
542   -
543   - $i("metadados_"+codigoLayer+"_"+codigoMap).innerHTML = ins
544   - }
545   - var p = "../php/temas.php?funcao=pegaMetadados&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
546   - cPaint.call(p,"",retorna);
547   -}
548   -function pegaCaracteristicasGerais(codigoMap,codigoLayer)
549   -{
550   - var ins = "<p><input onclick=excluirLayer('"+codigoLayer+"',this) type=button value='Excluir este layer' /></p>"
551   - ins += "<br><fieldset><legend>+- Características gerais</legend><div style=display:none >"
552   - var retorna = function(retorna)
553   - {
554   - var param = {
555   - "linhas":[
556   - {texto:"Layer name",
557   - titulo:"name",prefixoid:"name_",id:codigoLayer,valor:"name"},
558   - {texto:"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]",
559   - titulo:"connection",prefixoid:"connection_",id:codigoLayer,valor:"connection"},
560   - {texto:"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.",
561   - titulo:"data",prefixoid:"data_",id:codigoLayer,valor:"data"}
562   - ]
563   - }
564   - ins += "<p>Colunas: "+retorna.data.colunas+"</p>"
565   - ins += "<br><fieldset><legend>+- status</legend><div style=display:none >"
566   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);' >Sets the current status of the layer. Often modified by MapServer itself. Default turns the layer on permanently.</b></p>"
567   - ins += "<p><select onchange='this.style.color=\"blue\"' id='status_"+codigoLayer+"' >"
568   - ins += comboObjeto(objstatus,"valor","texto",retorna.data.status)
569   - ins += "</select>"
570   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarLayer(\""+codigoLayer+"\",\"status\",this)'/>"
571   - ins += "</p></fieldset>"
572 452  
573   - ins += "<br><fieldset><legend>+- type</legend><div style=display:none >"
574   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);' >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.</b></p>"
575   - ins += "<p><select onchange='this.style.color=\"blue\"' id='type_"+codigoLayer+"' >"
576   - ins += comboObjeto(objlayertypes,"valor","texto",retorna.data.type)
577   - ins += "</select>"
578   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarLayer(\""+codigoLayer+"\",\"type\",this)'/>"
579   - ins += "</p></fieldset>"
580   -
581   - ins += "<br><fieldset><legend>+- connectiontype</legend><div style=display:none >"
582   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);' >Type of connection. Default is local.</b></p>"
583   - ins += "<p><select onchange='this.style.color=\"blue\"' id='connectiontype_"+codigoLayer+"' >"
584   - ins += comboObjeto(objcontype,"valor","texto",retorna.data.connectiontype)
585   - ins += "</select>"
586   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarLayer(\""+codigoLayer+"\",\"connectiontype\",this)'/>"
587   - ins += "</p></div></fieldset>"
588   -
589   - ins += (geraLinhas2(retorna.data,param,"salvarLayer"));
590   -
591   -
592   - var param = {
593   - "linhas":[
594   - {texto:"Name of a group that this layer belongs to. The group name can then be reference as a regular layer name in the template files, allowing to do things like turning on and off a group of layers at once.",
595   - titulo:"group",prefixoid:"group_",id:codigoLayer,valor:"group"},
596   - {texto:"Item that contains the location of an individual tile, default is 'location'.",
597   - titulo:"tileitem",prefixoid:"tileitem_",id:codigoLayer,valor:"tileitem"},
598   - {texto:"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.",
599   - titulo:"tileindex",prefixoid:"tileindex_",id:codigoLayer,valor:"tileindex"},
600   - {texto:"Maximum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
601   - titulo:"maxscale",prefixoid:"maxscale_",id:codigoLayer,valor:"maxscale"},
602   - {texto:"Minimum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
603   - titulo:"minscale",prefixoid:"minscale_",id:codigoLayer,valor:"minscale"},
604   - {texto:"Sets the color index to treat as transparent for raster layers.",
605   - titulo:"offsite (R,G,B)",prefixoid:"offsite_",id:codigoLayer,valor:"offsite"},
606   - {texto:"Sets the opacity level (or the inability to see through the layer) of all classed pixels for a given layer. The value can either be an integer in the range (0-100) or the named symbol 'ALPHA'. A value of 100 is opaque and 0 is fully transparent. Implemented in MapServer 5.0, to replace the deprecated TRANSPARENCY parameter.The 'ALPHA' symbol directs the MapServer rendering code to honor the indexed or alpha transparency of pixmap symbols used to style a layer. This is only needed in the case of RGB output formats, and should be used only when necessary as it is expensive to render transparent pixmap symbols onto an RGB map image.",
607   - titulo:"opacity",prefixoid:"opacity_",id:codigoLayer,valor:"opacity"},
608   - {texto:"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",
609   - titulo:"filter",prefixoid:"filter_",id:codigoLayer,valor:"filter"},
610   - {texto:"Item to use with simple FILTER expressions. OGR and shapefiles only.",
611   - titulo:"filteritem",prefixoid:"filteritem_",id:codigoLayer,valor:"filteritem"},
612   - {texto:"Item name in attribute table to use for class annotation angles. Values should be in degrees.",
613   - titulo:"labelangleitem",prefixoid:"labelangleitem_",id:codigoLayer,valor:"labelangleitem"},
614   - {texto:"Item name in attribute table to use for class annotation (i.e. labeling).",
615   - titulo:"labelitem",prefixoid:"labelitem_",id:codigoLayer,valor:"labelitem"},
616   - {texto:"Maximum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
617   - titulo:"labelmaxscale",prefixoid:"labelmaxscale_",id:codigoLayer,valor:"labelmaxscale"},
618   - {texto:"Minimum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
619   - titulo:"labelminscale",prefixoid:"labelminscale_",id:codigoLayer,valor:"labelminscale"},
620   - {texto:"Item name in attribute table to use for class annotation sizes. Values should be in pixels.",
621   - titulo:"labelsizeitem",prefixoid:"labelsizeitem_",id:codigoLayer,valor:"labelsizeitem"},
622   - {texto:"The scale at which symbols and/or text appear full size. This allows for dynamic scaling of objects based on the scale of the map. If not set then this layer will always appear at the same size. Scaling only takes place within the limits of MINSIZE and MAXSIZE as described above. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000.",
623   - titulo:"symbolscale",prefixoid:"symbolscale_",id:codigoLayer,valor:"symbolscale"},
624   - {texto:"Sensitivity for point based queries (i.e. via mouse and/or map coordinates). Given in TOLERANCEUNITS. If the layer is a POINT or a LINE, the default is 3. For all other layer types, the default is 0. To restrict polygon searches so that the point must occur in the polygon set the tolerance to zero.",
625   - titulo:"tolerance",prefixoid:"tolerance_",id:codigoLayer,valor:"tolerance"},
626   - {texto:" ",
627   - titulo:"projection",prefixoid:"projection_",id:codigoLayer,valor:"projection"}
628   - ]
629   - }
630   -
631   -
632   - ins += "<br><fieldset style=background-color:#f0e68c ><legend style=color:brown >+- Mais...</legend><div style=display:none >"
633   - ins += (geraLinhas2(retorna.data,param,"salvarLayer"));
634   -
635   - ins += "<br><fieldset><legend>+- sizeunits</legend><div style=display:none >"
636   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);' >Sets the unit of CLASS object SIZE values (default is pixels). Useful for simulating buffering.</b><p>"
637   - ins += "<p><select onchange='this.style.color=\"blue\"' id='sizeunits_"+codigoLayer+"' >"
638   - ins += comboObjeto(objmapunits,"valor","texto",retorna.data.sizeunits)
639   - ins += "</select>"
640   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarLayer(\""+codigoLayer+"\",\"sizeunits\",this)'/>"
641   - ins += "</p></div></fieldset>"
642   -
643   - ins += "</div></fieldset>"
644   -
645   - ins += "</div></fieldset>"
646   - $i("geral_"+codigoLayer+"_"+codigoMap).innerHTML = ins
647   - }
648   - var p = "../php/temas.php?funcao=pegaCaracteristicasGerais&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
649   - cPaint.call(p,"",retorna);
650   -}
651 453 function testarMap()
652 454 {
653 455 var codigo = $i("temaAtivo").value
... ...
admin/php/editormapfile.php 0 → 100644
... ... @@ -0,0 +1,778 @@
  1 +<?php
  2 +/*
  3 +Title: Administração do cadastro de sistemas
  4 +
  5 +About: Licença
  6 +
  7 +I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  8 +
  9 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  10 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  11 +
  12 +Este programa é software livre; você pode redistribuí-lo
  13 +e/ou modificá-lo sob os termos da Licença Pública Geral
  14 +GNU conforme publicada pela Free Software Foundation;
  15 +tanto a versão 2 da Licença.
  16 +Este programa é distribuído na expectativa de que seja útil,
  17 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  18 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  19 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  20 +Você deve ter recebido uma cópia da Licença Pública Geral do
  21 +GNU junto com este programa; se não, escreva para a
  22 +Free Software Foundation, Inc., no endereço
  23 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  24 +
  25 +File: i3geo/admin/sistemas.php
  26 +
  27 +19/6/2007
  28 +
  29 +*/
  30 +
  31 +include_once("admin.php");
  32 +include_once("../../ms_configura.php");
  33 +include_once("../../classesphp/funcoes_gerais.php");
  34 +error_reporting(0);
  35 +//faz a busca da função que deve ser executada
  36 +switch ($funcao)
  37 +{
  38 + case "pegaTextoMapfile":
  39 + $arquivo = $locaplic."/temas/".$codigoMap.".map";
  40 + $handle = fopen($arquivo, "r");
  41 + $final = "";
  42 + while (!feof($handle))
  43 + {
  44 + $linha = fgets($handle);
  45 + $final .= rtrim($linha, "\r\n") . PHP_EOL;
  46 + }
  47 + fclose($handle);
  48 + retornaJSON($final);
  49 + exit;
  50 + break;
  51 + case "salvaTextoMapfile":
  52 + $texto = str_replace('\"\"','" "',$texto);
  53 + $texto = str_replace('\"','"',$texto);
  54 + $texto = str_replace('xxxxxxxx',PHP_EOL,$texto);
  55 + /*
  56 + $arquivo = $locaplic."/temas/".$codigoMap.".map";
  57 + $fp = fopen($arquivo, 'w');
  58 + fwrite($fp, $texto);
  59 + fclose($fp);
  60 + retornaJSON(file_get_contents($arquivo));
  61 + */
  62 + retornaJSON($texto);
  63 + exit;
  64 + break;
  65 + case "pegaMapfiles":
  66 + retornaJSON(pegaLayers());
  67 + exit;
  68 + break;
  69 + case "criarNovoMap":
  70 + retornaJSON(criarNovoMap());
  71 + exit;
  72 + break;
  73 + case "pegaLayers":
  74 + retornaJSON(pegaLayers());
  75 + exit;
  76 + break;
  77 + case "excluirMapfile":
  78 + $tabela = "mapfiles";
  79 + $id = $codigoMap;
  80 + $f = verificaFilhos();
  81 + if($f)
  82 + {
  83 + retornaJSON("erro");
  84 + exit;
  85 + }
  86 + else
  87 + {
  88 + unlink("../../temas/".$codigoMap.".map");
  89 + retornaJSON("ok");
  90 + exit;
  91 + }
  92 + break;
  93 + case "criarNovoLayer":
  94 + retornaJSON(criarNovoLayer());
  95 + exit;
  96 + break;
  97 + case "excluirLayer":
  98 + retornaJSON(excluirLayer());
  99 + exit;
  100 + break;
  101 + case "listaClasses":
  102 + retornaJSON(listaClasses());
  103 + exit;
  104 + break;
  105 + case "criarNovaClasse":
  106 + retornaJSON(criarNovaClasse());
  107 + exit;
  108 + break;
  109 + case "excluirClasse":
  110 + excluirClasse();
  111 + retornaJSON(listaClasses());
  112 + exit;
  113 + break;
  114 + case "listaEstilos":
  115 + retornaJSON(listaEstilos());
  116 + exit;
  117 + break;
  118 + case "criarNovoEstilo":
  119 + retornaJSON(criarNovoEstilo());
  120 + exit;
  121 + break;
  122 + case "excluirEstilo":
  123 + excluirEstilo();
  124 + retornaJSON(listaEstilos());
  125 + exit;
  126 + break;
  127 + case "pegaConexao":
  128 + retornaJSON(pegaConexao());
  129 + exit;
  130 + break;
  131 + case "alterarConexao":
  132 + alterarConexao();
  133 + retornaJSON(pegaConexao());
  134 + exit;
  135 + break;
  136 + case "pegaMetadados":
  137 + retornaJSON(pegaMetadados());
  138 + exit;
  139 + break;
  140 + case "alterarMetadados":
  141 + alterarMetadados();
  142 + retornaJSON(pegaMetadados());
  143 + exit;
  144 + break;
  145 + case "pegaGeral":
  146 + retornaJSON(pegaGeral());
  147 + exit;
  148 + break;
  149 + case "alterarGeral":
  150 + alterarGeral();
  151 + $codigoLayer = $name;
  152 + retornaJSON(pegaGeral());
  153 + exit;
  154 + break;
  155 +}
  156 +function criarNovoMap()
  157 +{
  158 + global $nome,$codigo,$locaplic;
  159 + $arq = $locaplic."/temas/".$codigo.".map";
  160 + if(!file_exists($arq))
  161 + {
  162 + $dados[] = "SYMBOLSET ../symbols/simbolos.sym";
  163 + $dados[] = 'FONTSET "../symbols/fontes.txt"';
  164 + $dados[] = "LAYER";
  165 + $dados[] = " NAME base";
  166 + $dados[] = " TYPE line";
  167 + $dados[] = ' DATA ""';
  168 + $dados[] = ' METADATA';
  169 + $dados[] = ' TEMA "'.$nome.'"';
  170 + $dados[] = ' METADATA';
  171 + $dados[] = "END";
  172 + $dados[] = "END";
  173 + $fp = fopen($arq,"w");
  174 + foreach ($dados as $dado)
  175 + {
  176 + fwrite($fp,$dado."\n");
  177 + }
  178 + require_once("conexao.php");
  179 + $dbh->query("INSERT INTO i3geoadmin_temas (link_tema,kml_tema,ogc_tema,download_tema,desc_tema,tipoa_tema,tags_tema,nome_tema,codigo_tema) VALUES ('','', '','','','','','$nome','$codigo')");
  180 + $dbh = null;
  181 + $dbhw = null;
  182 + return "ok";
  183 + }
  184 + return "erro";
  185 +}
  186 +function criarNovoLayer()
  187 +{
  188 + global $locaplic,$codigoMap;
  189 + include_once("../../classesphp/funcoes_gerais.php");
  190 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  191 + $mapa = ms_newMapObj($mapfile);
  192 + $nl = ms_newLayerObj($mapa);
  193 + $nl->set("name",nomeRandomico());
  194 + $nl->set("type",MS_LAYER_LINE);
  195 + $mapa->save($mapfile);
  196 + removeCabecalho($mapfile);
  197 + return array("layers"=>(array($nl->name)));
  198 +}
  199 +function criarNovaClasse()
  200 +{
  201 + global $codigoMap,$codigoLayer,$locaplic;
  202 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  203 + $mapa = ms_newMapObj($mapfile);
  204 + $nl = $mapa->getlayerbyname($codigoLayer);
  205 + $nclasses = $nl->numclasses;
  206 + $classe = ms_newClassObj($nl);
  207 + $mapa->save($mapfile);
  208 + removeCabecalho($mapfile);
  209 + $dados[] = array("indice"=>($nclasses),"nome"=>(""));
  210 + return $dados;
  211 +}
  212 +function criarNovoEstilo()
  213 +{
  214 + global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
  215 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  216 + $mapa = ms_newMapObj($mapfile);
  217 + $nl = $mapa->getlayerbyname($codigoLayer);
  218 + $classObj = $nl->getclass($indiceClasse);
  219 + $numestilos = $classObj->numstyles;
  220 + $nestilo = ms_newStyleObj($classObj);
  221 + $mapa->save($mapfile);
  222 + removeCabecalho($mapfile);
  223 + $dados[] = array("estilo"=>$numestilos);
  224 + return $dados;
  225 +}
  226 +function pegaLayers()
  227 +{
  228 + global $codigoMap,$locaplic;
  229 + $dados = array();
  230 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  231 + $mapa = ms_newMapObj($mapfile);
  232 + $layers = $mapa->getalllayernames();
  233 + $dados["layers"] = $layers;
  234 + return $dados;
  235 +}
  236 +function listaClasses()
  237 +{
  238 + global $codigoMap,$codigoLayer,$locaplic;
  239 + $dados = array();
  240 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  241 + $mapa = ms_newMapObj($mapfile);
  242 + $layer = $mapa->getlayerbyname($codigoLayer);
  243 + $nclasses = $layer->numclasses;
  244 + for($i=0;$i<$nclasses;++$i)
  245 + {
  246 + $classe = $layer->getclass($i);
  247 + $dados[] = array("indice"=>$i,"nome"=>($classe->name));
  248 + }
  249 + return $dados;
  250 +}
  251 +function listaEstilos()
  252 +{
  253 + global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
  254 + $dados = array();
  255 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  256 + $mapa = ms_newMapObj($mapfile);
  257 + $layer = $mapa->getlayerbyname($codigoLayer);
  258 + $classe = $layer->getclass($indiceClasse);
  259 + $numestilos = $classe->numstyles;
  260 + for($i=0;$i<$numestilos;++$i)
  261 + {
  262 + $dados[] = array("estilo"=>$i);
  263 + }
  264 + return $dados;
  265 +}
  266 +
  267 +function excluirLayer()
  268 +{
  269 + global $codigoMap,$codigoLayer,$locaplic;
  270 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  271 + $mapa = ms_newMapObj($mapfile);
  272 + $nl = $mapa->getlayerbyname($codigoLayer);
  273 + $nl->set("status",MS_DELETE);
  274 + $mapa->save($mapfile);
  275 + removeCabecalho($mapfile);
  276 + return "ok";
  277 +}
  278 +function excluirClasse()
  279 +{
  280 + global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
  281 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  282 + $mapa = ms_newMapObj($mapfile);
  283 + $nl = $mapa->getlayerbyname($codigoLayer);
  284 + $classObj = $nl->getclass($indiceClasse);
  285 + $classObj->set("status",MS_DELETE);
  286 + $mapa->save($mapfile);
  287 + removeCabecalho($mapfile);
  288 + return "ok";
  289 +}
  290 +function excluirEstilo()
  291 +{
  292 + global $codigoMap,$codigoLayer,$indiceClasse,$indiceEstilo,$locaplic;
  293 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  294 + $mapa = ms_newMapObj($mapfile);
  295 + $nl = $mapa->getlayerbyname($codigoLayer);
  296 + $classObj = $nl->getclass($indiceClasse);
  297 + $classObj->deletestyle($indiceEstilo);
  298 + $mapa->save($mapfile);
  299 + removeCabecalho($mapfile);
  300 + return "ok";
  301 +}
  302 +function pegaConexao()
  303 +{
  304 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  305 + $dados = array();
  306 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  307 + $mapa = ms_newMapObj($mapfile);
  308 + $layer = $mapa->getlayerbyname($codigoLayer);
  309 + $dados["connection"] = $layer->connection;
  310 + $dados["connectiontype"] = $layer->connectiontype;
  311 + $dados["data"] = $layer->data;
  312 + $dados["tileindex"] = $layer->tileindex;
  313 + $dados["tileitem"] = $layer->tileitem;
  314 + if($dados["tileindex"] == ""){$dados["tileitem"] = "";}
  315 + $dados["postgis_mapa"] = array_keys($postgis_mapa);
  316 + $dados["codigoMap"] = $codigoMap;
  317 + $dados["codigoLayer"] = $codigoLayer;
  318 + return $dados;
  319 +}
  320 +function alterarConexao()
  321 +{
  322 + global $codigoMap,$codigoLayer,$locaplic,$connection,$connectiontype,$data,$tileitem,$tileindex;
  323 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  324 + $mapa = ms_newMapObj($mapfile);
  325 + $layer = $mapa->getlayerbyname($codigoLayer);
  326 + $layer->set("connection",$connection);
  327 + $layer->set("connectiontype",$connectiontype);
  328 + $layer->set("data",$data);
  329 + $layer->set("tileitem",$tileitem);
  330 + $layer->set("tileindex",$tileindex);
  331 + $mapa->save($mapfile);
  332 + removeCabecalho($mapfile);
  333 + return "ok";
  334 +}
  335 +function pegaMetadados()
  336 +{
  337 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  338 + $dados = array();
  339 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  340 + $mapa = ms_newMapObj($mapfile);
  341 + $layer = $mapa->getlayerbyname($codigoLayer);
  342 + $dados["itens"] = $layer->getmetadata("itens");
  343 + $dados["itensdesc"] = $layer->getmetadata("itensdesc");
  344 + $dados["itenslink"] = $layer->getmetadata("itenslink");
  345 + $dados["tip"] = $layer->getmetadata("tip");
  346 + $dados["tema"] = $layer->getmetadata("tema");
  347 + $dados["classe"] = $layer->getmetadata("classe");
  348 + $dados["escala"] = $layer->getmetadata("escala");
  349 + $dados["download"] = $layer->getmetadata("download");
  350 + $dados["escondido"] = $layer->getmetadata("escondido");
  351 + $dados["extensao"] = $layer->getmetadata("extensao");
  352 + $dados["identifica"] = $layer->getmetadata("identifica");
  353 + $dados["mensagem"] = $layer->getmetadata("mensagem");
  354 + $dados["classesitem"] = $layer->getmetadata("classesitem");
  355 + $dados["classesnome"] = $layer->getmetadata("classesnome");
  356 + $dados["classescor"] = $layer->getmetadata("classescor");
  357 + $dados["classessimbolo"] = $layer->getmetadata("classessimbolo");
  358 + $dados["classestamanho"] = $layer->getmetadata("classestamanho");
  359 + $dados["aplicaextensao"] = $layer->getmetadata("aplicaextensao");
  360 + $dados["codigoMap"] = $codigoMap;
  361 + $dados["codigoLayer"] = $codigoLayer;
  362 + $colunas = "";
  363 + if($layer->type < 3)
  364 + {
  365 + if(@$layer->open())
  366 + {
  367 + $layer->open();
  368 + $colunas = implode(", ",$layer->getitems());
  369 + $layer->close();
  370 + }
  371 + }
  372 + $dados["colunas"] = $colunas;
  373 +
  374 + return $dados;
  375 +}
  376 +function alterarMetadados()
  377 +{
  378 + global $codigoMap,$codigoLayer,$locaplic,$aplicaextensao,$classestamanho,$classessimbolo,$classescor,$classesnome,$classesitem,$mensagem,$identifica,$extensao,$escondido,$download,$escala,$tema,$classe,$tip,$itenslink,$itens,$itensdesc;
  379 + $dados = array();
  380 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  381 + $mapa = ms_newMapObj($mapfile);
  382 + $layer = $mapa->getlayerbyname($codigoLayer);
  383 + $layer->setmetadata("itens",$itens);
  384 + $layer->setmetadata("itensdesc",$itensdesc);
  385 + $layer->setmetadata("itenslink",$itenslink);
  386 + $layer->setmetadata("tip",$tip);
  387 + $layer->setmetadata("tema",$tema);
  388 + $layer->setmetadata("classe",$classe);
  389 + $layer->setmetadata("escala",$escala);
  390 + $layer->setmetadata("download",$download);
  391 + $layer->setmetadata("escondido",$escondido);
  392 + $layer->setmetadata("extensao",$extensao);
  393 + $layer->setmetadata("identifica",$identifica);
  394 + $layer->setmetadata("mensagem",$mensagem);
  395 + $layer->setmetadata("classesitem",$classesitem);
  396 + $layer->setmetadata("classesnome",$classesnome);
  397 + $layer->setmetadata("classescor",$classescor);
  398 + $layer->setmetadata("classessimbolo",$classessimbolo);
  399 + $layer->setmetadata("classestamanho",$classestamanho);
  400 + $layer->setmetadata("aplicaextensao",$aplicaextensao);
  401 + $mapa->save($mapfile);
  402 + removeCabecalho($mapfile);
  403 + return "ok";
  404 +}
  405 +function pegaGeral()
  406 +{
  407 + global $codigoMap,$codigoLayer,$locaplic;
  408 + $dados = array();
  409 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  410 + $mapa = ms_newMapObj($mapfile);
  411 + $layer = $mapa->getlayerbyname($codigoLayer);
  412 + $dados["type"] = $layer->type;
  413 + $dados["filter"] = $layer->getfilter();
  414 + if($dados["filter"]== ""){$dados["filter"] = "";}
  415 + $dados["filteritem"] = $layer->filteritem;
  416 + $dados["group"] = $layer->group;
  417 + //$dados["labelangleitem"] = $layer->labelangleitem;
  418 + $dados["labelitem"] = $layer->labelitem;
  419 + $dados["labelmaxscale"] = $layer->labelmaxscale;
  420 + $dados["labelmaxscale"] = $layer->labelmaxscale;
  421 + $dados["labelminscale"] = $layer->labelminscale;
  422 + //$dados["labelsizeitem"] = $layer->labelsizeitem;
  423 + $dados["maxscale"] = $layer->maxscale;
  424 + $dados["minscale"] = $layer->minscale;
  425 + $dados["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
  426 + $dados["opacity"] = $layer->opacity;
  427 + $dados["symbolscale"] = $layer->symbolscale;
  428 + $dados["tolerance"] = $layer->tolerance;
  429 + $dados["toleranceunits"] = $layer->toleranceunits;
  430 + $dados["status"] = $layer->status;
  431 + $dados["sizeunits"] = $layer->sizeunits;
  432 + $dados["projection"] = $layer->getProjection();
  433 + $dados["name"] = $layer->name;
  434 + $colunas = "";
  435 + if($layer->type < 3)
  436 + {
  437 + if(@$layer->open())
  438 + {
  439 + $layer->open();
  440 + $colunas = implode(", ",$layer->getitems());
  441 + $layer->close();
  442 + }
  443 + }
  444 + if($dados["projection"] == "null")
  445 + $dados["projection"] = "";
  446 +
  447 + $dados["colunas"] = $colunas;
  448 + $dados["codigoMap"] = $codigoMap;
  449 + $dados["codigoLayer"] = $codigoLayer;
  450 + return $dados;
  451 +}
  452 +function alterarGeral()
  453 +{
  454 + global $codigoMap,$codigoLayer,$locaplic,$name,$projection,$sizeunits,$status,$toleranceunits,$tolerance,$symbolscale,$opacity,$offsite,$minscale,$maxscale,$labelsizeitem,$labelminscale,$labelmaxscale,$labelitem,$group,$filteritem,$type,$filter;
  455 + $dados = array();
  456 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  457 + $mapa = ms_newMapObj($mapfile);
  458 + $layer = $mapa->getlayerbyname($codigoLayer);
  459 +
  460 + if($offsite == -1 || $offsite == "null")
  461 + {$offsite = "-1,-1,-1";}
  462 + $layer->set("name",$name);
  463 + $layer->set("type",$type);
  464 + $layer->setfilter($filter);
  465 + $layer->set("filteritem",$filteritem);
  466 + $layer->set("group",$group);
  467 + //$layer->set("labelangleitem",$labelangleitem);
  468 + $layer->set("labelitem",$labelitem);
  469 + $layer->set("labelmaxscale",$labelmaxscale);
  470 + $layer->set("labelminscale",$labelminscale);
  471 + //$layer->set("labelsizeitem",$labelsizeitem);
  472 + $layer->set("maxscale",$maxscale);
  473 + $layer->set("minscale",$minscale);
  474 + $cor = $layer->offsite;
  475 + $c = explode(",",$offsite);
  476 + if(count($c) < 3)
  477 + $c = explode(" ",$offsite);
  478 + $cor->setrgb($c[0],$c[1],$c[2]);
  479 + $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
  480 + $layer->set("opacity",$opacity);
  481 + $layer->set("symbolscale",$symbolscale);
  482 + $layer->set("tolerance",$tolerance);
  483 + $layer->set("toleranceunits",$toleranceunits);
  484 + $layer->set("status",$status);
  485 + $layer->set("sizeunits",$sizeunits);
  486 +
  487 + if($layer->getprojection() == MS_TRUE)
  488 + $layer->setprojection($projection);
  489 + if($layer->getprojection() == MS_FALSE && $projection != "")
  490 + $layer->setprojection($projection);
  491 +
  492 + $mapa->save($mapfile);
  493 + removeCabecalho($mapfile);
  494 + return "ok";
  495 +}
  496 +
  497 +
  498 +
  499 +
  500 +
  501 +
  502 +
  503 +
  504 +
  505 +
  506 +
  507 +
  508 +
  509 +
  510 +
  511 +
  512 +
  513 +
  514 +
  515 +
  516 +function pegaFontes()
  517 +{
  518 + $arq = "../../symbols/fontes.txt";
  519 + $h = fopen ($arq,"r");
  520 + while ($i = fscanf ($h, "%s\t%s\t"))
  521 + {
  522 + list ($f,$g) = $i;
  523 + $nome[] = $f;
  524 + }
  525 + return $nome;
  526 +}
  527 +function alteraEstilo()
  528 +{
  529 + global $codigoMap,$codigoLayer,$classe,$estilo,$parametro,$valor;
  530 + $mapfile = "../../temas/".$codigoMap.".map";
  531 + $mapa = ms_newMapObj($mapfile);
  532 + $layer = $mapa->getlayerbyname($codigoLayer);
  533 + $classe = $layer->getclass($classe);
  534 + $estilo = $classe->getstyle($estilo);
  535 + $ok = false;
  536 + $cor = "";
  537 + switch ($parametro)
  538 + {
  539 + case "backgroundcolor":
  540 + $cor = $estilo->backgroundcolor;
  541 + $ok = true;
  542 + break;
  543 + case "color":
  544 + $cor = $estilo->color;
  545 + $ok = true;
  546 + break;
  547 + case "outlinecolor":
  548 + $cor = $estilo->outlinecolor;
  549 + $ok = true;
  550 + break;
  551 + default:
  552 + if(!$ok)$estilo->set($parametro,$valor);
  553 + }
  554 + if ($cor != "")
  555 + {
  556 + $c = explode(",",$valor);
  557 + if(count($c) < 3)
  558 + $c = explode(" ",$valor);
  559 + $cor->setrgb($c[0],$c[1],$c[2]);
  560 + }
  561 + $mapa->save($mapfile);
  562 + removeCabecalho($mapfile);
  563 + return "ok";
  564 +}
  565 +function alteraClasse()
  566 +{
  567 + global $codigoMap,$codigoLayer,$classe,$parametro,$valor;
  568 + $mapfile = "../../temas/".$codigoMap.".map";
  569 + $mapa = ms_newMapObj($mapfile);
  570 + $layer = $mapa->getlayerbyname($codigoLayer);
  571 + $classe = $layer->getclass($classe);
  572 + if($parametro == "text")
  573 + {$classe->settext($valor);}
  574 + elseif
  575 + ($parametro == "expression")
  576 + {$classe->setexpression($valor);}
  577 + else
  578 + $classe->set($parametro,$valor);
  579 + $mapa->save($mapfile);
  580 + removeCabecalho($mapfile);
  581 + return "ok";
  582 +}
  583 +function alteraClasseLabel()
  584 +{
  585 + global $codigoMap,$codigoLayer,$classe,$parametro,$valor;
  586 + $mapfile = "../../temas/".$codigoMap.".map";
  587 + $mapa = ms_newMapObj($mapfile);
  588 + $layer = $mapa->getlayerbyname($codigoLayer);
  589 + $classe = $layer->getclass($classe);
  590 + $label = $classe->label;
  591 + $ok = false;
  592 + $cor = "";
  593 + switch ($parametro)
  594 + {
  595 + case "backgroundcolor":
  596 + $cor = $label->backgroundcolor;
  597 + $ok = true;
  598 + break;
  599 + case "backgroundshadowcolor":
  600 + $cor = $label->backgroundshadowcolor;
  601 + $ok = true;
  602 + break;
  603 + case "color":
  604 + $cor = $label->color;
  605 + $ok = true;
  606 + break;
  607 + case "outlinecolor":
  608 + $cor = $label->outlinecolor;
  609 + $ok = true;
  610 + break;
  611 + case "shadowcolor":
  612 + $cor = $label->shadowcolor;
  613 + $ok = true;
  614 + break;
  615 + case "shadowsizex":
  616 + $cor = $label->shadowsizex;
  617 + $ok = true;
  618 + break;
  619 + case "shadowsizey":
  620 + $cor = $label->shadowsizey;
  621 + $ok = true;
  622 + break;
  623 + case "backgroundshadowsizex":
  624 + $cor = $label->backgroundshadowsizex;
  625 + $ok = true;
  626 + break;
  627 + case "backgroundshadowsizey":
  628 + $cor = $label->backgroundshadowsizey;
  629 + $ok = true;
  630 + break;
  631 + default:
  632 + if(!$ok)$label->set($parametro,$valor);
  633 + }
  634 + if ($cor != "")
  635 + {
  636 + $c = explode(",",$valor);
  637 + if(count($c) < 3)
  638 + $c = explode(" ",$valor);
  639 + $cor->setrgb($c[0],$c[1],$c[2]);
  640 + }
  641 + $mapa->save($mapfile);
  642 + removeCabecalho($mapfile);
  643 + return "ok";
  644 +}
  645 +
  646 +function removeCabecalho($arq)
  647 +{
  648 + global $postgis_mapa;
  649 + restauraCon($arq,$postgis_mapa);
  650 + $handle = fopen($arq, "r");
  651 + if ($handle)
  652 + {
  653 + $final[] = "SYMBOLSET ../symbols/simbolos.sym\n";
  654 + $final[] = "FONTSET ".'"'."../symbols/fontes.txt".'"'."\n";
  655 + $grava = false;
  656 + while (!feof($handle))
  657 + {
  658 + $linha = fgets($handle);
  659 + if(strtoupper(trim($linha)) == "LAYER")
  660 + {$grava = true;}
  661 + if($grava)
  662 + {$final[] = rtrim($linha, "\r\n") . PHP_EOL;}//$linha."\n";}
  663 + }
  664 + fclose($handle);
  665 + }
  666 + $handle = fopen($arq, "w+");
  667 + foreach ($final as $f)
  668 + {
  669 + if(($f != "") && ($f != 'FILTERITEM ""') && ($f != 'LABELITEM ""'))
  670 + fwrite($handle,$f);
  671 + }
  672 + fclose($handle);
  673 +}
  674 +
  675 +function pegaDadosClasse()
  676 +{
  677 + global $codigoMap,$codigoLayer,$locaplic;
  678 + $dados = array();
  679 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  680 + $mapa = ms_newMapObj($mapfile);
  681 + $layer = $mapa->getlayerbyname($codigoLayer);
  682 + $nclasses = $layer->numclasses;
  683 + for($i=0;$i<$nclasses;++$i)
  684 + {
  685 + $classe = $layer->getclass($i);
  686 + $temp["name"] = $classe->name;
  687 + $temp["expression"] = $classe->getExpression();
  688 + $temp["keyimage"] = $classe->keyimage;
  689 + $temp["maxscale"] = $classe->maxscale;
  690 + $temp["minscale"] = $classe->minscale;
  691 + $temp["maxsize"] = $classe->maxsize;
  692 + $temp["minsize"] = $classe->minsize;
  693 + $temp["size"] = $classe->size;
  694 + $temp["status"] = $classe->status;
  695 + $temp["symbolname"] = $classe->symbolname;
  696 + $temp["text"] = $classe->getTextString();
  697 + $temp["type"] = $classe->type;
  698 + $label = $classe->label;
  699 + if ($label != "")
  700 + {
  701 + $t["font"] = $label->font;
  702 + $t["type"] = $label->type;
  703 + $t["backgroundcolor"] = $label->backgroundcolor->red.",".$label->backgroundcolor->green.",".$label->backgroundcolor->blue;
  704 + $t["backgroundshadowcolor"] = $label->backgroundshadowcolor->red.",".$label->backgroundshadowcolor->green.",".$label->backgroundshadowcolor->blue;
  705 + $t["color"] = $label->color->red.",".$label->color->green.",".$label->color->blue;
  706 + $t["outlinecolor"] = $label->outlinecolor->red.",".$label->outlinecolor->green.",".$label->outlinecolor->blue;
  707 + $t["shadowcolor"] = $label->shadowcolor->red.",".$label->shadowcolor->green.",".$label->shadowcolor->blue;
  708 + $t["shadowsizex"] = $label->shadowsizex;
  709 + $t["shadowsizey"] = $label->shadowsizey;
  710 + $t["backgroundshadowsizex"] = $label->backgroundshadowsizex;
  711 + $t["backgroundshadowsizey"] = $label->backgroundshadowsizey;
  712 + $t["size"] = $label->size;
  713 + $t["minsize"] = $label->minsize;
  714 + $t["maxsize"] = $label->maxsize;
  715 + $t["position"] = $label->position;
  716 + $t["offsetx"] = $label->offsetx;
  717 + $t["offsety"] = $label->offsety;
  718 + $t["angle"] = $label->angle;
  719 + $t["autoangle"] = $label->autoangle;
  720 + $t["buffer"] = $label->buffer;
  721 + $t["antialias"] = $label->antialias;
  722 + $t["wrap"] = $label->wrap;
  723 + $t["minfeaturesize"] = $label->minfeaturesize;
  724 + $t["autominfeaturesize"] = $label->autominfeaturesize;
  725 + $t["mindistance"] = $label->mindistance;
  726 + $t["partials"] = $label->partials;
  727 + $t["force"] = $label->force;
  728 + $t["encoding"] = $label->encoding;
  729 + $temp["label"] = $t;
  730 + }
  731 + else
  732 + $temp["label"] = array();
  733 + $dados[] = array("id"=>$i,"dados"=>$temp);
  734 + }
  735 + return $dados;
  736 +}
  737 +function pegaDadosEstilo()
  738 +{
  739 + global $codigoMap,$codigoLayer;
  740 + $dados = array();
  741 + $mapfile = "../../temas/".$codigoMap.".map";
  742 + $mapa = ms_newMapObj($mapfile);
  743 + $layer = $mapa->getlayerbyname($codigoLayer);
  744 + $nclasses = $layer->numclasses;
  745 + for($i=0;$i<$nclasses;++$i)
  746 + {
  747 + $classe = $layer->getclass($i);
  748 + $numestilos = $classe->numstyles;
  749 + $estilos = array();
  750 + for($j=0;$j<$numestilos;++$j)
  751 + {
  752 + $estilo = $classe->getstyle($j);
  753 + $temp["symbolname"] = $estilo->symbolname;
  754 + $temp["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue;
  755 + $temp["size"] = $estilo->size;
  756 + $temp["minsize"] = $estilo->minsize;
  757 + $temp["maxsize"] = $estilo->maxsize;
  758 + $temp["offsetx"] = $estilo->offsetx;
  759 + $temp["offsety"] = $estilo->offsety;
  760 + $temp["antialias"] = $estilo->antialias;
  761 + $temp["backgroundcolor"] = $estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue;
  762 + $temp["outlinecolor"] = $estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue;
  763 + $temp["width"] = $estilo->width;
  764 + $temp["minwidth"] = $estilo->minwidth;
  765 + $temp["maxwidth"] = $estilo->maxwidth;
  766 + $temp["angle"] = $estilo->angle;
  767 + $temp["angleitem"] = $estilo->angleitem;
  768 + $temp["sizeitem"] = $estilo->sizeitem;
  769 + $temp["minvalue"] = $estilo->minvalue;
  770 + $temp["maxvalue"] = $estilo->maxvalue;
  771 + $estilos[] = array("estilo"=>$j,"dados"=>$temp);
  772 + }
  773 + $dados[] = array("classe"=>$i,"estilos"=>$estilos);
  774 + }
  775 + return $dados;
  776 +}
  777 +
  778 +?>
0 779 \ No newline at end of file
... ...
admin/php/temas.php
... ... @@ -1,670 +0,0 @@
1   -<?php
2   -/*
3   -Title: Administração do cadastro de sistemas
4   -
5   -About: Licença
6   -
7   -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
8   -
9   -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
10   -Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
11   -
12   -Este programa é software livre; você pode redistribuí-lo
13   -e/ou modificá-lo sob os termos da Licença Pública Geral
14   -GNU conforme publicada pela Free Software Foundation;
15   -tanto a versão 2 da Licença.
16   -Este programa é distribuído na expectativa de que seja útil,
17   -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
18   -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
19   -Consulte a Licença Pública Geral do GNU para mais detalhes.
20   -Você deve ter recebido uma cópia da Licença Pública Geral do
21   -GNU junto com este programa; se não, escreva para a
22   -Free Software Foundation, Inc., no endereço
23   -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
24   -
25   -File: i3geo/admin/sistemas.php
26   -
27   -19/6/2007
28   -
29   -*/
30   -include_once("admin.php");
31   -include_once("../../ms_configura.php");
32   -include_once("../../classesphp/funcoes_gerais.php");
33   -//faz a busca da função que deve ser executada
34   -switch ($funcao)
35   -{
36   - case "pegaMapfiles":
37   - retornaJSON(pegaLayers());
38   - exit;
39   - case "criarNovoMap":
40   - retornaJSON(criarNovoMap());
41   - exit;
42   - break;
43   - case "pegaLayers":
44   - retornaJSON(pegaLayers());
45   - exit;
46   - break;
47   - case "excluirMapfile":
48   - $tabela = "mapfiles";
49   - $id = $codigoMap;
50   - $f = verificaFilhos();
51   - if($f)
52   - {
53   - retornaJSON("erro");
54   - exit;
55   - }
56   - else
57   - {
58   - unlink("../../temas/".$codigoMap.".map");
59   - retornaJSON("ok");
60   - exit;
61   - }
62   - break;
63   - case "criarNovoLayer":
64   - retornaJSON(criarNovoLayer());
65   - exit;
66   - break;
67   - case "excluirLayer":
68   - retornaJSON(excluirLayer());
69   - exit;
70   - break;
71   - case "listaClasses":
72   - retornaJSON(listaClasses());
73   - exit;
74   - break;
75   - case "criarNovaClasse":
76   - retornaJSON(criarNovaClasse());
77   - exit;
78   - break;
79   - case "excluirClasse":
80   - excluirClasse();
81   - retornaJSON(listaClasses());
82   - exit;
83   - break;
84   - case "listaEstilos":
85   - retornaJSON(listaEstilos());
86   - exit;
87   - break;
88   -
89   -
90   - case "pegaCaracteristicasGerais":
91   - $cp->set_data(pegaCaracteristicasGerais());
92   - $cp->return_data();
93   - break;
94   - case "pegaMetadados":
95   - $cp->set_data(pegaMetadados());
96   - $cp->return_data();
97   - break;
98   - case "pegaClasses":
99   - $cp->set_data(pegaClasses());
100   - $cp->return_data();
101   - break;
102   - case "alteraLayer":
103   - substituiCon($map_file,$postgis_mapa);
104   - $cp->set_data(alteraLayer());
105   - $cp->return_data();
106   - break;
107   - case "alteraMetadados":
108   - $cp->set_data(alteraMetadados());
109   - $cp->return_data();
110   - break;
111   - case "alteraClasse":
112   - substituiCon($map_file,$postgis_mapa);
113   - $cp->set_data(alteraClasse());
114   - $cp->return_data();
115   - break;
116   - case "alteraClasseLabel":
117   - substituiCon($map_file,$postgis_mapa);
118   - $cp->set_data(alteraClasseLabel());
119   - $cp->return_data();
120   - break;
121   - case "alteraEstilo":
122   - substituiCon($map_file,$postgis_mapa);
123   - $cp->set_data(alteraEstilo());
124   - $cp->return_data();
125   - break;
126   - case "pegaFontes":
127   - $cp->set_data(pegaFontes());
128   - $cp->return_data();
129   - break;
130   -
131   - case "adicionarEstilo":
132   - substituiCon($map_file,$postgis_mapa);
133   - $cp->set_data(adicionarEstilo());
134   - $cp->return_data();
135   - break;
136   -}
137   -function criarNovoMap()
138   -{
139   - global $nome,$codigo;
140   - $arq = "../../temas/".$codigo.".map";
141   - if(!file_exists($arq))
142   - {
143   - $dados[] = "SYMBOLSET ../symbols/simbolos.sym";
144   - $dados[] = 'FONTSET "../symbols/fontes.txt"';
145   - $dados[] = "LAYER";
146   - $dados[] = " NAME base";
147   - $dados[] = " TYPE line";
148   - $dados[] = ' DATA ""';
149   - $dados[] = ' METADATA';
150   - $dados[] = ' TEMA "'.$nome.'"';
151   - $dados[] = ' METADATA';
152   - $dados[] = "END";
153   - $dados[] = "END";
154   - $fp = fopen($arq,"w");
155   - foreach ($dados as $dado)
156   - {
157   - fwrite($fp,$dado."\n");
158   - }
159   - require_once("conexao.php");
160   - $dbh->query("INSERT INTO i3geoadmin_temas (link_tema,kml_tema,ogc_tema,download_tema,desc_tema,tipoa_tema,tags_tema,nome_tema,codigo_tema) VALUES ('','', '','','','','','$nome','$codigo')");
161   - $dbh = null;
162   - $dbhw = null;
163   - return "ok";
164   - }
165   - return "erro";
166   -}
167   -function criarNovoLayer()
168   -{
169   - global $locaplic,$codigoMap;
170   - include_once("../../classesphp/funcoes_gerais.php");
171   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
172   - $mapa = ms_newMapObj($mapfile);
173   - $nl = ms_newLayerObj($mapa);
174   - $nl->set("name",nomeRandomico());
175   - $nl->set("type",MS_LAYER_LINE);
176   - $mapa->save($mapfile);
177   - removeCabecalho($mapfile);
178   - return array("layers"=>(array($nl->name)));
179   -}
180   -function criarNovaClasse()
181   -{
182   - global $codigoMap,$codigoLayer,$locaplic;
183   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
184   - $mapa = ms_newMapObj($mapfile);
185   - $nl = $mapa->getlayerbyname($codigoLayer);
186   - $nclasses = $nl->numclasses;
187   - $classe = ms_newClassObj($nl);
188   - $mapa->save($mapfile);
189   - removeCabecalho($mapfile);
190   - $dados[] = array("indice"=>($nclasses),"nome"=>(""));
191   - return $dados;
192   -}
193   -function pegaLayers()
194   -{
195   - global $codigoMap,$locaplic;
196   - $dados = array();
197   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
198   - $mapa = ms_newMapObj($mapfile);
199   - $layers = $mapa->getalllayernames();
200   - $dados["layers"] = $layers;
201   - return $dados;
202   -}
203   -function listaClasses()
204   -{
205   - global $codigoMap,$codigoLayer,$locaplic;
206   - $dados = array();
207   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
208   - $mapa = ms_newMapObj($mapfile);
209   - $layer = $mapa->getlayerbyname($codigoLayer);
210   - $nclasses = $layer->numclasses;
211   - for($i=0;$i<$nclasses;++$i)
212   - {
213   - $classe = $layer->getclass($i);
214   - $dados[] = array("indice"=>$i,"nome"=>($classe->name));
215   - }
216   - return $dados;
217   -}
218   -function listaEstilos()
219   -{
220   - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
221   - $dados = array();
222   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
223   - $mapa = ms_newMapObj($mapfile);
224   - $layer = $mapa->getlayerbyname($codigoLayer);
225   - $classe = $layer->getclass($indiceClasse);
226   - $numestilos = $classe->numstyles;
227   - for($i=0;$i<$numestilos;++$i)
228   - {
229   - $dados[] = array("estilo"=>$i);
230   - }
231   - return $dados;
232   -}
233   -
234   -function excluirLayer()
235   -{
236   - global $codigoMap,$codigoLayer,$locaplic;
237   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
238   - $mapa = ms_newMapObj($mapfile);
239   - $nl = $mapa->getlayerbyname($codigoLayer);
240   - $nl->set("status",MS_DELETE);
241   - $mapa->save($mapfile);
242   - removeCabecalho($mapfile);
243   - return "ok";
244   -}
245   -function excluirClasse()
246   -{
247   - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
248   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
249   - $mapa = ms_newMapObj($mapfile);
250   - $nl = $mapa->getlayerbyname($codigoLayer);
251   - $classObj = $nl->getclass($indiceClasse);
252   - $classObj->set("status",MS_DELETE);
253   - $mapa->save($mapfile);
254   - removeCabecalho($mapfile);
255   - return "ok";
256   -}
257   -
258   -
259   -
260   -
261   -
262   -
263   -
264   -
265   -
266   -
267   -
268   -
269   -
270   -
271   -
272   -
273   -
274   -
275   -
276   -
277   -
278   -function adicionarEstilo()
279   -{
280   - global $codigoMap,$codigoLayer,$codigoClasse;
281   - $mapfile = "../../temas/".$codigoMap.".map";
282   - $mapa = ms_newMapObj($mapfile);
283   - $nl = $mapa->getlayerbyname($codigoLayer);
284   - $classObj = $nl->getclass($codigoClasse);
285   - $nestilo = ms_newStyleObj($classObj);
286   - $mapa->save($mapfile);
287   - removeCabecalho($mapfile);
288   - return "ok";
289   -}
290   -
291   -
292   -function pegaFontes()
293   -{
294   - $arq = "../../symbols/fontes.txt";
295   - $h = fopen ($arq,"r");
296   - while ($i = fscanf ($h, "%s\t%s\t"))
297   - {
298   - list ($f,$g) = $i;
299   - $nome[] = $f;
300   - }
301   - return $nome;
302   -}
303   -function alteraEstilo()
304   -{
305   - global $codigoMap,$codigoLayer,$classe,$estilo,$parametro,$valor;
306   - $mapfile = "../../temas/".$codigoMap.".map";
307   - $mapa = ms_newMapObj($mapfile);
308   - $layer = $mapa->getlayerbyname($codigoLayer);
309   - $classe = $layer->getclass($classe);
310   - $estilo = $classe->getstyle($estilo);
311   - $ok = false;
312   - $cor = "";
313   - switch ($parametro)
314   - {
315   - case "backgroundcolor":
316   - $cor = $estilo->backgroundcolor;
317   - $ok = true;
318   - break;
319   - case "color":
320   - $cor = $estilo->color;
321   - $ok = true;
322   - break;
323   - case "outlinecolor":
324   - $cor = $estilo->outlinecolor;
325   - $ok = true;
326   - break;
327   - default:
328   - if(!$ok)$estilo->set($parametro,$valor);
329   - }
330   - if ($cor != "")
331   - {
332   - $c = explode(",",$valor);
333   - if(count($c) < 3)
334   - $c = explode(" ",$valor);
335   - $cor->setrgb($c[0],$c[1],$c[2]);
336   - }
337   - $mapa->save($mapfile);
338   - removeCabecalho($mapfile);
339   - return "ok";
340   -}
341   -function alteraClasse()
342   -{
343   - global $codigoMap,$codigoLayer,$classe,$parametro,$valor;
344   - $mapfile = "../../temas/".$codigoMap.".map";
345   - $mapa = ms_newMapObj($mapfile);
346   - $layer = $mapa->getlayerbyname($codigoLayer);
347   - $classe = $layer->getclass($classe);
348   - if($parametro == "text")
349   - {$classe->settext($valor);}
350   - elseif
351   - ($parametro == "expression")
352   - {$classe->setexpression($valor);}
353   - else
354   - $classe->set($parametro,$valor);
355   - $mapa->save($mapfile);
356   - removeCabecalho($mapfile);
357   - return "ok";
358   -}
359   -function alteraClasseLabel()
360   -{
361   - global $codigoMap,$codigoLayer,$classe,$parametro,$valor;
362   - $mapfile = "../../temas/".$codigoMap.".map";
363   - $mapa = ms_newMapObj($mapfile);
364   - $layer = $mapa->getlayerbyname($codigoLayer);
365   - $classe = $layer->getclass($classe);
366   - $label = $classe->label;
367   - $ok = false;
368   - $cor = "";
369   - switch ($parametro)
370   - {
371   - case "backgroundcolor":
372   - $cor = $label->backgroundcolor;
373   - $ok = true;
374   - break;
375   - case "backgroundshadowcolor":
376   - $cor = $label->backgroundshadowcolor;
377   - $ok = true;
378   - break;
379   - case "color":
380   - $cor = $label->color;
381   - $ok = true;
382   - break;
383   - case "outlinecolor":
384   - $cor = $label->outlinecolor;
385   - $ok = true;
386   - break;
387   - case "shadowcolor":
388   - $cor = $label->shadowcolor;
389   - $ok = true;
390   - break;
391   - case "shadowsizex":
392   - $cor = $label->shadowsizex;
393   - $ok = true;
394   - break;
395   - case "shadowsizey":
396   - $cor = $label->shadowsizey;
397   - $ok = true;
398   - break;
399   - case "backgroundshadowsizex":
400   - $cor = $label->backgroundshadowsizex;
401   - $ok = true;
402   - break;
403   - case "backgroundshadowsizey":
404   - $cor = $label->backgroundshadowsizey;
405   - $ok = true;
406   - break;
407   - default:
408   - if(!$ok)$label->set($parametro,$valor);
409   - }
410   - if ($cor != "")
411   - {
412   - $c = explode(",",$valor);
413   - if(count($c) < 3)
414   - $c = explode(" ",$valor);
415   - $cor->setrgb($c[0],$c[1],$c[2]);
416   - }
417   - $mapa->save($mapfile);
418   - removeCabecalho($mapfile);
419   - return "ok";
420   -}
421   -
422   -function alteraMetadados()
423   -{
424   - global $codigoMap,$codigoLayer,$parametro,$valor;
425   - $mapfile = "../../temas/".$codigoMap.".map";
426   - $mapa = ms_newMapObj($mapfile);
427   - $layer = $mapa->getlayerbyname($codigoLayer);
428   - $layer->setmetadata(strtoupper($parametro),$valor);
429   - if($valor == "")
430   - $layer->removemetadata(strtoupper($parametro));
431   - $mapa->save($mapfile);
432   - removeCabecalho($mapfile);
433   - return "ok";
434   -}
435   -
436   -function alteraLayer()
437   -{
438   - global $codigoMap,$codigoLayer,$parametro,$valor;
439   - $mapfile = "../../temas/".$codigoMap.".map";
440   - $mapa = ms_newMapObj($mapfile);
441   - $layer = $mapa->getlayerbyname($codigoLayer);
442   - $ok = false;
443   - switch ($parametro)
444   - {
445   - case "offsite":
446   - $cor = $layer->offsite;
447   - $c = explode(",",$valor);
448   - if(count($c) < 3)
449   - $c = explode(" ",$valor);
450   - $cor->setrgb($c[0],$c[1],$c[2]);
451   - $ok = true;
452   - break;
453   - case "filter":
454   - $layer->setfilter($valor);
455   - $ok = true;
456   - break;
457   - default:
458   - if(!$ok)$layer->set($parametro,$valor);
459   - }
460   - $mapa->save($mapfile);
461   - removeCabecalho($mapfile);
462   - return "ok";
463   -}
464   -
465   -
466   -
467   -
468   -
469   -function removeCabecalho($arq)
470   -{
471   - global $postgis_mapa;
472   - restauraCon($arq,$postgis_mapa);
473   - $handle = fopen($arq, "r");
474   - if ($handle)
475   - {
476   - $final[] = "SYMBOLSET ../symbols/simbolos.sym\n";
477   - $final[] = "FONTSET ".'"'."../symbols/fontes.txt".'"'."\n";
478   - $grava = false;
479   - while (!feof($handle))
480   - {
481   - $linha = fgets($handle);
482   - if(strtoupper(trim($linha)) == "LAYER")
483   - {$grava = true;}
484   - if($grava)
485   - {$final[] = $linha."\n";}
486   - }
487   - fclose($handle);
488   - }
489   - $handle = fopen($arq, "w+");
490   - foreach ($final as $f)
491   - {
492   - if(($f != "") && ($f != 'FILTERITEM ""') && ($f != 'LABELITEM ""'))
493   - fwrite($handle,$f);
494   - }
495   - fclose($handle);
496   -}
497   -function pegaCaracteristicasGerais()
498   -{
499   - global $codigoMap,$codigoLayer;
500   - $dados = array();
501   - $mapfile = "../../temas/".$codigoMap.".map";
502   - $mapa = ms_newMapObj($mapfile);
503   - $layer = $mapa->getlayerbyname($codigoLayer);
504   - $dados["connection"] = $layer->connection;
505   - $dados["connectiontype"] = $layer->connectiontype;
506   - $dados["data"] = $layer->data;
507   - $dados["type"] = $layer->type;
508   - $dados["filter"] = $layer->getfilter();
509   - if($dados["filter"]== ""){$dados["filter"] = "";}
510   - $dados["filteritem"] = $layer->filteritem;
511   - $dados["group"] = $layer->group;
512   - $dados["labelangleitem"] = $layer->labelangleitem;
513   - $dados["labelitem"] = $layer->labelitem;
514   - $dados["labelmaxscale"] = $layer->labelmaxscale;
515   - $dados["labelmaxscale"] = $layer->labelmaxscale;
516   - $dados["labelminscale"] = $layer->labelminscale;
517   - $dados["labelsizeitem"] = $layer->labelsizeitem;
518   - $dados["maxscale"] = $layer->maxscale;
519   - $dados["minscale"] = $layer->minscale;
520   - $dados["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
521   - $dados["opacity"] = $layer->opacity;
522   - $dados["symbolscale"] = $layer->symbolscale;
523   - $dados["tileindex"] = $layer->tileindex;
524   - $dados["tileitem"] = $layer->tileitem;
525   - $dados["tolerance"] = $layer->tolerance;
526   - $dados["toleranceunits"] = $layer->toleranceunits;
527   - $dados["status"] = $layer->status;
528   - $dados["sizeunits"] = $layer->sizeunits;
529   - $dados["projection"] = $layer->getProjection;
530   - $dados["name"] = $layer->name;
531   - if($dados["type"] < 3)
532   - {
533   - $layer->open();
534   - $colunas = implode(", ",$layer->getitems());
535   - $layer->close();
536   - }
537   - $dados["colunas"] = $colunas;
538   - return $dados;
539   -}
540   -function pegaMetadados()
541   -{
542   - global $codigoMap,$codigoLayer;
543   - $dados = array();
544   - $mapfile = "../../temas/".$codigoMap.".map";
545   - $mapa = ms_newMapObj($mapfile);
546   - $layer = $mapa->getlayerbyname($codigoLayer);
547   - $dados["itens"] = $layer->getmetadata("itens");
548   - $dados["itensdesc"] = $layer->getmetadata("itensdesc");
549   - $dados["itenslink"] = $layer->getmetadata("itenslink");
550   - $dados["tip"] = $layer->getmetadata("tip");
551   - $dados["tema"] = mb_convert_encoding(($layer->getmetadata("tema")),"UTF-8","ISO-8859-1");
552   - $dados["classe"] = $layer->getmetadata("classe");
553   - $dados["escala"] = $layer->getmetadata("escala");
554   - $dados["download"] = $layer->getmetadata("download");
555   - $dados["escondido"] = $layer->getmetadata("escondido");
556   - $dados["extensao"] = $layer->getmetadata("extensao");
557   - $dados["identifica"] = $layer->getmetadata("identifica");
558   - $dados["mensagem"] = mb_convert_encoding(($layer->getmetadata("mensagem")),"UTF-8","ISO-8859-1");
559   - $dados["classesitem"] = $layer->getmetadata("classesitem");
560   - $dados["classesnome"] = $layer->getmetadata("classesnome");
561   - $dados["classescor"] = $layer->getmetadata("classescor");
562   - $dados["classessimbolo"] = $layer->getmetadata("classessimbolo");
563   - $dados["classestamanho"] = $layer->getmetadata("classestamanho");
564   - $dados["aplicaextensao"] = $layer->getmetadata("aplicaextensao");
565   - return $dados;
566   -}
567   -function pegaDadosClasse()
568   -{
569   - global $codigoMap,$codigoLayer,$locaplic;
570   - $dados = array();
571   - $mapfile = $locaplic."/temas/".$codigoMap.".map";
572   - $mapa = ms_newMapObj($mapfile);
573   - $layer = $mapa->getlayerbyname($codigoLayer);
574   - $nclasses = $layer->numclasses;
575   - for($i=0;$i<$nclasses;++$i)
576   - {
577   - $classe = $layer->getclass($i);
578   - $temp["name"] = $classe->name;
579   - $temp["expression"] = $classe->getExpression();
580   - $temp["keyimage"] = $classe->keyimage;
581   - $temp["maxscale"] = $classe->maxscale;
582   - $temp["minscale"] = $classe->minscale;
583   - $temp["maxsize"] = $classe->maxsize;
584   - $temp["minsize"] = $classe->minsize;
585   - $temp["size"] = $classe->size;
586   - $temp["status"] = $classe->status;
587   - $temp["symbolname"] = $classe->symbolname;
588   - $temp["text"] = $classe->getTextString();
589   - $temp["type"] = $classe->type;
590   - $label = $classe->label;
591   - if ($label != "")
592   - {
593   - $t["font"] = $label->font;
594   - $t["type"] = $label->type;
595   - $t["backgroundcolor"] = $label->backgroundcolor->red.",".$label->backgroundcolor->green.",".$label->backgroundcolor->blue;
596   - $t["backgroundshadowcolor"] = $label->backgroundshadowcolor->red.",".$label->backgroundshadowcolor->green.",".$label->backgroundshadowcolor->blue;
597   - $t["color"] = $label->color->red.",".$label->color->green.",".$label->color->blue;
598   - $t["outlinecolor"] = $label->outlinecolor->red.",".$label->outlinecolor->green.",".$label->outlinecolor->blue;
599   - $t["shadowcolor"] = $label->shadowcolor->red.",".$label->shadowcolor->green.",".$label->shadowcolor->blue;
600   - $t["shadowsizex"] = $label->shadowsizex;
601   - $t["shadowsizey"] = $label->shadowsizey;
602   - $t["backgroundshadowsizex"] = $label->backgroundshadowsizex;
603   - $t["backgroundshadowsizey"] = $label->backgroundshadowsizey;
604   - $t["size"] = $label->size;
605   - $t["minsize"] = $label->minsize;
606   - $t["maxsize"] = $label->maxsize;
607   - $t["position"] = $label->position;
608   - $t["offsetx"] = $label->offsetx;
609   - $t["offsety"] = $label->offsety;
610   - $t["angle"] = $label->angle;
611   - $t["autoangle"] = $label->autoangle;
612   - $t["buffer"] = $label->buffer;
613   - $t["antialias"] = $label->antialias;
614   - $t["wrap"] = $label->wrap;
615   - $t["minfeaturesize"] = $label->minfeaturesize;
616   - $t["autominfeaturesize"] = $label->autominfeaturesize;
617   - $t["mindistance"] = $label->mindistance;
618   - $t["partials"] = $label->partials;
619   - $t["force"] = $label->force;
620   - $t["encoding"] = $label->encoding;
621   - $temp["label"] = $t;
622   - }
623   - else
624   - $temp["label"] = array();
625   - $dados[] = array("id"=>$i,"dados"=>$temp);
626   - }
627   - return $dados;
628   -}
629   -function pegaDadosEstilo()
630   -{
631   - global $codigoMap,$codigoLayer;
632   - $dados = array();
633   - $mapfile = "../../temas/".$codigoMap.".map";
634   - $mapa = ms_newMapObj($mapfile);
635   - $layer = $mapa->getlayerbyname($codigoLayer);
636   - $nclasses = $layer->numclasses;
637   - for($i=0;$i<$nclasses;++$i)
638   - {
639   - $classe = $layer->getclass($i);
640   - $numestilos = $classe->numstyles;
641   - $estilos = array();
642   - for($j=0;$j<$numestilos;++$j)
643   - {
644   - $estilo = $classe->getstyle($j);
645   - $temp["symbolname"] = $estilo->symbolname;
646   - $temp["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue;
647   - $temp["size"] = $estilo->size;
648   - $temp["minsize"] = $estilo->minsize;
649   - $temp["maxsize"] = $estilo->maxsize;
650   - $temp["offsetx"] = $estilo->offsetx;
651   - $temp["offsety"] = $estilo->offsety;
652   - $temp["antialias"] = $estilo->antialias;
653   - $temp["backgroundcolor"] = $estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue;
654   - $temp["outlinecolor"] = $estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue;
655   - $temp["width"] = $estilo->width;
656   - $temp["minwidth"] = $estilo->minwidth;
657   - $temp["maxwidth"] = $estilo->maxwidth;
658   - $temp["angle"] = $estilo->angle;
659   - $temp["angleitem"] = $estilo->angleitem;
660   - $temp["sizeitem"] = $estilo->sizeitem;
661   - $temp["minvalue"] = $estilo->minvalue;
662   - $temp["maxvalue"] = $estilo->maxvalue;
663   - $estilos[] = array("estilo"=>$j,"dados"=>$temp);
664   - }
665   - $dados[] = array("classe"=>$i,"estilos"=>$estilos);
666   - }
667   - return $dados;
668   -}
669   -
670   -?>
671 0 \ No newline at end of file