Commit 8eeb0f4ce14cdf354805080969959b04da1b93c9

Authored by Edmar Moretti
1 parent 92fc19fa

--no commit message

admin/js/core.js
... ... @@ -794,7 +794,11 @@ function core_geraLinhas(dados)
794 794 if(p.texto)
795 795 resultado += "<span style=color:gray >"+p.texto+"</span</p>"
796 796 if(p.id != "")
797   - resultado += "<input size="+p.size+" type=text id="+p.id+" value='"+p.value+"' /></p>"
  797 + {
  798 + if(!p.value)
  799 + p.value = ""
  800 + resultado += "<input size="+p.size+" type=text id="+p.id+" value=\""+p.value+"\" /></p>"
  801 + }
798 802 if(p.div)
799 803 {resultado += p.div;}
800 804 }
... ...
admin/js/editormapfile.js
... ... @@ -299,7 +299,7 @@ function montaParametrosTemas(no,dados,redesenha)
299 299 if(!tree.getNodeByProperty("etiquetaClasses",no.data.id))
300 300 {
301 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\" />"
  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 303 var d = {tipo:"etiquetaClasses",etiquetaClasses:no.data.id,html:conteudo+"<i>&nbsp;Classes:</i>"}
304 304 var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
305 305 tempNode.isLeaf = true;
... ... @@ -308,8 +308,8 @@ function montaParametrosTemas(no,dados,redesenha)
308 308 {
309 309 var conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"sobeDesce('sobe')\" title=sobe src=\"../imagens/34.png\" />"
310 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>"
  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;<span>"+dados[i].indice+" "+dados[i].nome+"</span>"
  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 313 var d = {classes:codigoMap+"_"+codigoLayer,html:conteudo,id:codigoMap+"_"+codigoLayer+"_"+dados[i].indice,codigoMap:codigoMap,codigoLayer:codigoLayer,indiceClasse:dados[i].indice}
314 314 var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
315 315 tempNode.setDynamicLoad(loadClasseData, iconMode);
... ... @@ -322,6 +322,21 @@ function montaParametrosClasses(no,dados,redesenha)
322 322 var codigoMap = no.data.codigoMap;
323 323 var codigoLayer = no.data.codigoLayer
324 324 var indiceClasse = no.data.indiceClasse
  325 + if(!tree.getNodeByProperty("etiquetaClasseGeral",no.data.id))
  326 + {
  327 + var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorClasseGeral('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"')\" title='edita características da classe' src=\"../imagens/06.png\" />"
  328 + var d = {tipo:"etiquetaClasseGeral",etiquetaClasseGeral:codigoMap+"_"+codigoLayer+"_"+indiceClasse,html:conteudo+" Editar características gerais"}
  329 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  330 + tempNode.isLeaf = true;
  331 + }
  332 + if(!tree.getNodeByProperty("etiquetaClasseLabel",no.data.id))
  333 + {
  334 + var conteudo = "<img width='10px' heigth='10px' style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editorClasseLabel('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"')\" title='edita características da classe' src=\"../imagens/06.png\" />"
  335 + var d = {tipo:"etiquetaClasseLabel",etiquetaClasseGeral:codigoMap+"_"+codigoLayer+"_"+indiceClasse,html:conteudo+" Editar etiquetas"}
  336 + var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
  337 + tempNode.isLeaf = true;
  338 + }
  339 +
325 340 if(!tree.getNodeByProperty("etiquetaEstilo",no.data.id))
326 341 {
327 342 var conteudo = "<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionaNovoEstilo('"+codigoMap+"','"+codigoLayer+"','"+indiceClasse+"')\" title='adiciona estilo' src=\"../imagens/05.png\" />&nbsp;"
... ... @@ -618,6 +633,18 @@ function editorGeral(codigoMap,codigoLayer)
618 633 var sUrl = "../php/editormapfile.php?funcao=pegaGeral&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
619 634 core_pegaDados("Obtendo dados...",sUrl,"montaEditorGeral")
620 635 }
  636 +function editorClasseGeral(codigoMap,codigoLayer,indiceClasse)
  637 +{
  638 + core_montaEditor("","600px","500px")
  639 + var sUrl = "../php/editormapfile.php?funcao=pegaClasseGeral&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse;
  640 + core_pegaDados("Obtendo dados...",sUrl,"montaEditorClasseGeral")
  641 +}
  642 +function editorClasseLabel(codigoMap,codigoLayer,indiceClasse)
  643 +{
  644 + core_montaEditor("","600px","500px")
  645 + var sUrl = "../php/editormapfile.php?funcao=pegaClasseLabel&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse;
  646 + core_pegaDados("Obtendo dados...",sUrl,"montaEditorClasseLabel")
  647 +}
621 648 function montaEditorConexao(dados)
622 649 {
623 650 var param = {
... ... @@ -801,6 +828,70 @@ function montaEditorGeral(dados)
801 828 {salvarDadosEditor('geral',dados.codigoMap,dados.codigoLayer)}
802 829 new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }});
803 830 }
  831 +function montaEditorClasseGeral(dados)
  832 +{
  833 + var param = {
  834 + "linhas":[
  835 + {ajuda:"Nome da classe para ser mostrada na legenda",
  836 + titulo:"Name",id:"name",value:dados.name,tipo:"text"},
  837 + {ajuda:"Sets the current display status of the class. Default turns the class on",
  838 + titulo:"Status",id:"",value:dados.status,tipo:"text",div:"<div id=cStatus ></div>"},
  839 + {ajuda:"Four types of expressions are now supported to define class membership. String comparisons, regular expressions, simple logical expressions, and string functions. If no expression is given, then all features are said to belong to this class.<br>String comparisons are case sensitive and are the fastest to evaluate. No special delimiters are necessary although string must be quoted if they contain special characters. (As a matter of good habit, it is recommended you quote all strings).<br>Regular expressions function just like previous versions of MapServer. However, you must now delimit a regular expression using /regex/. No quotes should be used.<br><br>Logical expressions allow you to build fairly complex tests based on one or more attributes and therefore are only available with shapefiles. Logical expressions are delimited by parentheses '(expression)'. Attribute names are delimited by square brackets '[ATTRIBUTE]'. These names are case sensitive and must match the items in the shapefile. For example: EXPRESSION ([POPULATION] > 50000 AND '[LANGUAGE]' eq 'FRENCH') ... The following logical operators are supported: =,>,<,<=,>=,=,or,and,lt,gt,ge,le,eq,ne. As you might expect this level of complexity is slower to process.<br>One string function exists: length(). This obviously computes the length of a string. An example follows:<br>EXPRESSION (length('[NAME_E]') < 8)<br>String comparisons and regular expressions work from the classitem defined at the layer level. You may mix expression types within the different classes of a layer",
  840 + titulo:"Expression",id:"expression",value:dados.expression,tipo:"text"},
  841 + {ajuda:"Full filename of the legend image for the CLASS. This image is used when building a legend (or requesting a legend icon via MapScript or the CGI application).",
  842 + titulo:"Keyimage",id:"keyimage",value:dados.keyimage,tipo:"text"},
  843 + {ajuda:"Maximum scale at which this CLASS 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.",
  844 + titulo:"Maxscale",id:"maxscale",value:dados.maxscale,tipo:"text"},
  845 + {ajuda:"Minimum scale at which this CLASS 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.",
  846 + titulo:"Minscale",id:"minscale",value:dados.minscale,tipo:"text"}
  847 + ]
  848 + }
  849 + var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />"
  850 + if(dados.colunas != "")
  851 + {
  852 + ins += "<p>O layer possuí as seguintes colunas na tabela de atributos: ";
  853 + ins += dados.colunas+"</p>"
  854 + }
  855 + ins += core_geraLinhas(param)
  856 + ins += "<br><br><br>"
  857 + $i("editor_bd").innerHTML = ins
  858 +
  859 + temp = "<p><select id='status' >"
  860 + temp += core_comboObjeto(objstatus,"valor","texto",dados.status)
  861 + temp += "</select>"
  862 + $i("cStatus").innerHTML = temp
  863 +
  864 + var temp = function()
  865 + {salvarDadosEditor('classeGeral',dados.codigoMap,dados.codigoLayer,dados.indiceClasse)}
  866 + new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }});
  867 +}
  868 +function montaEditorClasseLabel(dados)
  869 +{
  870 + var param = {
  871 + "linhas":[
  872 + {ajuda:"Nome da classe para ser mostrada na legenda",
  873 + titulo:"Name",id:"name",value:dados.name,tipo:"text"},
  874 + ]
  875 + }
  876 + var ins = "<input type=button title='Salvar' value='Salvar' id=salvarEditor />"
  877 + if(dados.colunas != "")
  878 + {
  879 + ins += "<p>O layer possuí as seguintes colunas na tabela de atributos: ";
  880 + ins += dados.colunas+"</p>"
  881 + }
  882 + ins += core_geraLinhas(param)
  883 + ins += "<br><br><br>"
  884 + $i("editor_bd").innerHTML = ins
  885 +/*
  886 + temp = "<p><select id='status' >"
  887 + temp += core_comboObjeto(objstatus,"valor","texto",dados.status)
  888 + temp += "</select>"
  889 + $i("cStatus").innerHTML = temp
  890 +*/
  891 + var temp = function()
  892 + {salvarDadosEditor('classeLabel',dados.codigoMap,dados.codigoLayer,dados.indiceClasse)}
  893 + new YAHOO.widget.Button("salvarEditor",{ onclick: { fn: temp }});
  894 +}
804 895  
805 896 function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo)
806 897 {
... ... @@ -822,7 +913,12 @@ function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo)
822 913 var par = "&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer
823 914 var prog = "../php/editormapfile.php?funcao=alterarGeral"
824 915 }
825   -
  916 + if(tipo == "classeGeral")
  917 + {
  918 + var campos = new Array("status","minscale","maxscale","name","expression","keyimage")
  919 + var par = "&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&indiceClasse="+indiceClasse
  920 + var prog = "../php/editormapfile.php?funcao=alterarClasseGeral"
  921 + }
826 922 for (i=0;i<campos.length;i++)
827 923 {par += "&"+campos[i]+"="+($i(campos[i]).value)}
828 924 core_carregando("ativa");
... ... @@ -857,6 +953,8 @@ function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo)
857 953 YAHOO.example.container.panelEditor = null;
858 954 }
859 955 }
  956 + if(tipo=="classeGeral")
  957 + {montaEditorClasseGeral(YAHOO.lang.JSON.parse(o.responseText));}
860 958  
861 959 core_carregando("desativa");
862 960 }
... ...
admin/js/temasold.js
... ... @@ -25,195 +25,12 @@ GNU junto com este programa; se não, escreva para a
25 25 Free Software Foundation, Inc., no endereço
26 26 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
27 27 */
28   -contaN = 0;
29   -objcontype = [
30   - {texto:"MS_INLINE",valor:"0"},
31   - {texto:"MS_SHAPEFILE",valor:"1"},
32   - {texto:"MS_TILED_SHAPEFILE",valor:"2"},
33   - {texto:"MS_SDE",valor:"3"},
34   - {texto:"MS_OGR",valor:"4"},
35   - {texto:"MS_TILED_OGR",valor:"5"},
36   - {texto:"MS_POSTGIS",valor:"6"},
37   - {texto:"MS_WMS",valor:"7"},
38   - {texto:"MS_ORACLESPATIAL",valor:"8"},
39   - {texto:"MS_WFS",valor:"9"},
40   - {texto:"MS_GRATICULE",valor:"10"},
41   - {texto:"MS_MYGIS",valor:"11"},
42   - {texto:"MS_RASTER",valor:"12"},
43   - {texto:"MS_PLUGIN",valor:"13"}
44   -];
45   -objbool_tf = [
46   - {texto:"MS_TRUE",valor:"0"},
47   - {texto:"MS_FALSE",valor:"1"}
48   -];
49   -objbool_of = [
50   - {texto:"MS_ON",valor:"2"},
51   - {texto:"MS_OFF",valor:"3"}
52   -];
53   -objbool_yn = [
54   - {texto:"MS_YES",valor:"4"},
55   - {texto:"MS_NO",valor:"5"}
56   -];
57   -objmapunits = [
58   - {texto:"MS_INCHES",valor:"0"},
59   - {texto:"MS_FEET",valor:"1"},
60   - {texto:"MS_MILES",valor:"2"},
61   - {texto:"MS_METERS",valor:"3"},
62   - {texto:"MS_KILOMETERS",valor:"4"},
63   - {texto:"MS_DD",valor:"5"},
64   - {texto:"MS_PIXELS",valor:"6"}
65   -];
66   -objlayertypes = [
67   - {texto:"MS_LAYER_POINT",valor:"0"},
68   - {texto:"MS_LAYER_LINE",valor:"1"},
69   - {texto:"MS_LAYER_POLYGON",valor:"2"},
70   - {texto:"MS_LAYER_RASTER",valor:"3"},
71   - {texto:"MS_LAYER_ANNOTATION",valor:"4"},
72   - {texto:"MS_LAYER_QUERY",valor:"5"},
73   - {texto:"MS_LAYER_CIRCLE",valor:"6"},
74   - {texto:"MS_LAYER_TILEINDEX",valor:"7"},
75   - {texto:"MS_LAYER_CHART",valor:"8"}
76   -];
77   -objstatus = [
78   - {texto:"MS_ON",valor:"1"},
79   - {texto:"MS_OFF",valor:"0"},
80   - {texto:"MS_DEFAULT",valor:"2"}
81   -];
82   -objfonttypes = [
83   - {texto:"MS_TRUETYPE",valor:"0"},
84   - {texto:"MS_BITMAP",valor:"1"}
85   -];
86   -objposition = [
87   - {texto:"MS_UL",valor:"0"},
88   - {texto:"MS_LR",valor:"1"},
89   - {texto:"MS_UR",valor:"2"},
90   - {texto:"MS_LL",valor:"3"},
91   - {texto:"MS_CR",valor:"4"},
92   - {texto:"MS_CL",valor:"5"},
93   - {texto:"MS_UC",valor:"6"},
94   - {texto:"MS_WMS",valor:"7"},
95   - {texto:"MS_LC",valor:"8"},
96   - {texto:"MS_CC",valor:"9"},
97   - {texto:"MS_AUTO",valor:"10"},
98   - {texto:"MS_XY",valor:"11"},
99   - {texto:"MS_FOLLOW",valor:"12"}
100   -];
101   -objfontstyle = [
102   - {texto:"MS_TINY",valor:"0"},
103   - {texto:"MS_SMALL",valor:"1"},
104   - {texto:"MS_MEDIUM",valor:"2"},
105   - {texto:"MS_LARGE",valor:"3"},
106   - {texto:"MS_GIANT",valor:"4"},
107   -];
108   -objshapetype = [
109   - {texto:"MS_SHAPE_POINT",valor:"0"},
110   - {texto:"MS_SHAPE_LINE",valor:"1"},
111   - {texto:"MS_SHAPE_POLYGON",valor:"2"},
112   - {texto:"MS_SHAPE_NULL",valor:"3"}
113   -];
114   -objshapefiletype = [
115   - {texto:"MS_SHP_POINT",valor:"0"},
116   - {texto:"MS_SHP_ARC",valor:"1"},
117   - {texto:"MS_SHP_POLYGON",valor:"2"},
118   - {texto:"MS_SHP_MULTIPOINT",valor:"3"}
119   -];
120   -objalignment = [
121   - {texto:"MS_ALIGN_LEFT",valor:"0"},
122   - {texto:"MS_ALIGN_CENTER",valor:"1"},
123   - {texto:"MS_ALIGN_RIGHT",valor:"2"}
124   -];
125 28  
126 29 $i = function(i)
127 30 {return document.getElementById(i);};
128 31  
129 32 YAHOO.namespace("example.container");
130 33  
131   -/*
132   -var retorna = function(retorno)
133   -{
134   - fontes = retorno.data;
135   -}
136   -var p = "../php/temas.php?funcao=pegaFontes";
137   -cPaint.call(p,"",retorna);
138   -*/
139   -
140   -function iniciaMenu()
141   -{
142   - verificaEditores()
143   -}
144   -function montaParametros()
145   -{
146   - var retorna = function(retorno)
147   - {
148   - ins = "<select id=temaAtivo onchange='ativaTema(this.value)'>"
149   - ins += comboObjeto(retorno.data,"codigo_tema","nome_tema","")
150   - ins += "</select>"
151   - $i("arquivoAtivo").innerHTML = ins
152   - }
153   - var p = "../php/menutemas.php?funcao=pegaTemas";
154   - cPaint.call(p,"",retorna);
155   -}
156   -function adicionarLayer()
157   -{
158   - var codigoMap = $i("temaAtivo").value
159   - if(codigoMap != "")
160   - {
161   - var retorna = function(retorno)
162   - {
163   - ativaTema(codigoMap)
164   - }
165   - var p = "../php/temas.php?funcao=criarNovoLayer&codigoMap="+codigoMap;
166   - cPaint.call(p,"",retorna);
167   - }
168   -}
169   -function criarNovoMap()
170   -{
171   - var nome = $i("nomeNovoMap").value
172   - var codigo = $i("codigoNovoMap").value
173   - if(nome != "" && codigo != "")
174   - {
175   - var retorna = function(retorno)
176   - {
177   - $i("nomeNovoMap").value = ""
178   - $i("codigoNovoMap").value = ""
179   - $i("forms").style.display="none"
180   - montaParametros()
181   - }
182   - var p = "../php/temas.php?funcao=criarNovoMap&nome="+nome+"&codigo="+codigo;
183   - cPaint.call(p,"",retorna);
184   - }
185   -}
186   -function ativaTema(codigoMap)
187   -{
188   - var retorna = function(retorno)
189   - {
190   - var cl = retorno.data.layers
191   - var ins = ""
192   - for(c=0;c<cl.length;c++)
193   - {
194   - ins += "<br><fieldset><legend>+- "+cl[c]+"</legend><div >"
195   - ins += "<div id='geral_"+cl[c]+"_"+codigoMap+"' >"
196   - ins += "</div>"
197   - ins += "<div id='metadados_"+cl[c]+"_"+codigoMap+"' >"
198   - ins += "</div>"
199   - ins += "<div id='classes_"+cl[c]+"_"+codigoMap+"' >"
200   - ins += "</div>"
201   -
202   - ins += "</div></fieldset>"
203   - }
204   - $i("forms").innerHTML = ins
205   - var ins = ""
206   - for(c=0;c<cl.length;c++)
207   - {
208   - pegaCaracteristicasGerais(codigoMap,cl[c])
209   - pegaMetadados(codigoMap,cl[c])
210   - pegaClasses(codigoMap,cl[c])
211   - }
212   - }
213   - $i("forms").style.display="block"
214   - var p = "../php/temas.php?funcao=pegaLayers&codigoMap="+codigoMap;
215   - cPaint.call(p,"",retorna);
216   -}
217 34 function pegaClasses(codigoMap,codigoLayer)
218 35 {
219 36 var ins = "<br><fieldset style='background-color:beige'><legend>+- Classes</legend><div style=display:none >"
... ... @@ -227,47 +44,11 @@ function pegaClasses(codigoMap,codigoLayer)
227 44 for(c=0;c<nc;c++)
228 45 {
229 46 d = retorna.data[c]
230   - var param = {
231   - "linhas":[
232   - {texto:"Nome da classe para ser mostrada na legenda",
233   - titulo:"name",prefixoid:"name_",id:codigoLayer+"_"+d.id,valor:"name"}
234   - ]
235   - }
236 47  
237   - ins += "<br><fieldset><legend>+- "+d.id+"</legend><div style=display:none >"
238   - ins += "<p><input onclick=excluirClasse('"+codigoLayer+"','"+d.id+"',this) type=button value='Excluir classe' /></p>"
239   - ins += "<br><fieldset><legend>+- status</legend><div style=display:none >"
240   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Sets the current display status of the class. Default turns the class on.</p>"
241   - ins += "<p><select onchange='this.style.color=\"blue\"' id='status_"+codigoLayer+"_"+d.id+"' >"
242   - ins += comboObjeto(objstatus,"valor","texto",d.dados.status)
243   - ins += "</select>"
244   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarClasse(\""+codigoLayer+"_"+d.id+"\",\"status\",this)'/>"
245   - ins += "</p></div></fieldset>"
246   -
247   - ins += "<br><fieldset><legend>+- expression</legend><div style=display:none >"
248   - ins += "<p class=textoAjuda style='background-color:rgb(250,250,250);'>Four types of expressions are now supported to define class membership. String comparisons, regular expressions, simple logical expressions, and string functions. If no expression is given, then all features are said to belong to this class.<br>String comparisons are case sensitive and are the fastest to evaluate. No special delimiters are necessary although string must be quoted if they contain special characters. (As a matter of good habit, it is recommended you quote all strings).<br>Regular expressions function just like previous versions of MapServer. However, you must now delimit a regular expression using /regex/. No quotes should be used.<br><br>Logical expressions allow you to build fairly complex tests based on one or more attributes and therefore are only available with shapefiles. Logical expressions are delimited by parentheses '(expression)'. Attribute names are delimited by square brackets '[ATTRIBUTE]'. These names are case sensitive and must match the items in the shapefile. For example: EXPRESSION ([POPULATION] > 50000 AND '[LANGUAGE]' eq 'FRENCH') ... The following logical operators are supported: =,>,<,<=,>=,=,or,and,lt,gt,ge,le,eq,ne. As you might expect this level of complexity is slower to process.<br>One string function exists: length(). This obviously computes the length of a string. An example follows:<br>EXPRESSION (length('[NAME_E]') < 8)<br>String comparisons and regular expressions work from the classitem defined at the layer level. You may mix expression types within the different classes of a layer.</p>"
249   - ins += "<p><input type=text onchange='this.style.color=\"blue\"' id='expression_"+codigoLayer+"_"+d.id+"' value=\""+d.dados.expression+"\" />"
250   - ins += "<img src=../imagens/02.png style=cursor:pointer title='Aplicar' onclick='salvarClasse(\""+codigoLayer+"_"+d.id+"\",\"expression\",this)'/>"
251   - ins += "</p></div></fieldset>"
252   -
253 48 ins += (geraLinhas2(d.dados,param,"salvarClasse"));
254 49  
255 50 var param = {
256 51 "linhas":[
257   - {texto:"Full filename of the legend image for the CLASS. This image is used when building a legend (or requesting a legend icon via MapScript or the CGI application).",
258   - titulo:"keyimage",prefixoid:"keyimage_",id:codigoLayer+"_"+d.id,valor:"keyimage"},
259   - {texto:"Maximum scale at which this CLASS 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.",
260   - titulo:"maxscale",prefixoid:"maxscale_",id:codigoLayer+"_"+d.id,valor:"maxscale"},
261   - {texto:"Minimum scale at which this CLASS 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.",
262   - titulo:"minscale",prefixoid:"minscale_",id:codigoLayer+"_"+d.id,valor:"minscale"},
263   - {texto:"Maximum size in pixels to draw a symbol. Default is 50.",
264   - titulo:"maxsize",prefixoid:"maxsize_",id:codigoLayer+"_"+d.id,valor:"maxsize"},
265   - {texto:"Minimum size in pixels to draw a symbol. Default is 0.",
266   - titulo:"minsize",prefixoid:"minsize_",id:codigoLayer+"_"+d.id,valor:"minsize"},
267   - {texto:"Height, in pixels, of the symbol/pattern to be used. Only useful with scalable symbols. For vector (and ellipse) symbol types the default size is based on the range of Y values in the POINTS defining the symbol. For pixmaps, the default is the vertical size of the image. Default size is 1 for TTF symbols.",
268   - titulo:"size",prefixoid:"size_",id:codigoLayer+"_"+d.id,valor:"size"},
269   - {texto:"Static text to label features in this class with. This overrides values obtained from the LABELTIEM. The string may be given as an expression delimited using the ()'s. This allows you to concatenate multiple attributes into a single label. For example: ([FIRSTNAME],[LASTNAME]).",
270   - titulo:"text",prefixoid:"text_",id:codigoLayer+"_"+d.id,valor:"text"}
271 52 ]
272 53 }
273 54  
... ...
admin/php/admin.php
... ... @@ -51,13 +51,12 @@ error_reporting(E_ALL);
51 51 //carrega o phpmapscript
52 52 //
53 53 include_once ($locaplic."/classesphp/carrega_ext.php");
54   -set_time_limit(120);
55 54 //
56 55 //verifica se o cliente pode editar
57 56 //se funcao for verificaEditores vai para case específico
58 57 //
59 58 if($funcao != "verificaEditores")
60   -{if(verificaEditores($editores) == "nao"){exit;}}
  59 +{if(verificaEditores($editores) == "nao"){echo "vc nao e um editor cadastrado";exit;}}
61 60 if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
62 61 {
63 62 $mapfile = "geral1windows";
... ... @@ -80,9 +79,22 @@ if($funcao == &quot;limpar&quot;)
80 79 }
81 80 function retornaJSON($obj)
82 81 {
83   - if(extension_loaded('zlib')){ob_start('ob_gzhandler');}
84   - echo json_encode($obj);
85   - if(extension_loaded('zlib')){ob_end_flush();}
  82 + global $locaplic;
  83 + //
  84 + //para os casos em que json não está habilitado
  85 + //
  86 + if (!function_exists("json_encode"))
  87 + {
  88 + include_once($locaplic."/pacotes/cpaint/JSON/json2.php");
  89 + $j = new Services_JSON();
  90 + echo $j->encode($obj);
  91 + }
  92 + else
  93 + {
  94 + if(extension_loaded('zlib')){ob_start('ob_gzhandler');}
  95 + echo json_encode($obj);
  96 + if(extension_loaded('zlib')){ob_end_flush();}
  97 + }
86 98 exit;
87 99 }
88 100 function verificaDuplicados($sql,$dbh)
... ...
admin/php/editormapfile.php
... ... @@ -35,33 +35,6 @@ error_reporting(0);
35 35 //faz a busca da função que deve ser executada
36 36 switch ($funcao)
37 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 38 case "pegaMapfiles":
66 39 retornaJSON(pegaLayers());
67 40 exit;
... ... @@ -152,6 +125,19 @@ switch ($funcao)
152 125 retornaJSON(pegaGeral());
153 126 exit;
154 127 break;
  128 + case "pegaClasseGeral":
  129 + retornaJSON(pegaClasseGeral());
  130 + exit;
  131 + break;
  132 + case "alterarClasseGeral":
  133 + alterarClasseGeral();
  134 + retornaJSON(pegaClasseGeral());
  135 + exit;
  136 + break;
  137 + case "pegaClasseLabel":
  138 + retornaJSON(pegaClasseLabel());
  139 + exit;
  140 + break;
155 141 }
156 142 function criarNovoMap()
157 143 {
... ... @@ -443,7 +429,6 @@ function pegaGeral()
443 429 }
444 430 if($dados["projection"] == "null")
445 431 $dados["projection"] = "";
446   -
447 432 $dados["colunas"] = $colunas;
448 433 $dados["codigoMap"] = $codigoMap;
449 434 $dados["codigoLayer"] = $codigoLayer;
... ... @@ -493,8 +478,109 @@ function alterarGeral()
493 478 removeCabecalho($mapfile);
494 479 return "ok";
495 480 }
496   -
497   -
  481 +function pegaClasseGeral()
  482 +{
  483 + global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
  484 + $dados = array();
  485 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  486 + $mapa = ms_newMapObj($mapfile);
  487 + $layer = $mapa->getlayerbyname($codigoLayer);
  488 + $classe = $layer->getclass($indiceClasse);
  489 + $dados["name"] = $classe->name;
  490 + $dados["expression"] = $classe->getExpression();
  491 + $dados["keyimage"] = $classe->keyimage;
  492 + $dados["maxscale"] = $classe->maxscale;
  493 + $dados["minscale"] = $classe->minscale;
  494 + $dados["status"] = $classe->status;
  495 + $dados["text"] = $classe->getTextString();
  496 + $dados["codigoMap"] = $codigoMap;
  497 + $dados["codigoLayer"] = $codigoLayer;
  498 + $dados["indiceClasse"] = $indiceClasse;
  499 + $colunas = "";
  500 + if($layer->type < 3)
  501 + {
  502 + if(@$layer->open())
  503 + {
  504 + $layer->open();
  505 + $colunas = implode(", ",$layer->getitems());
  506 + $layer->close();
  507 + }
  508 + }
  509 + return $dados;
  510 +}
  511 +function alterarClasseGeral()
  512 +{
  513 + global $codigoMap,$codigoLayer,$indiceClasse,$locaplic,$status,$minscale,$maxscale,$name,$expression,$keyimage;
  514 + $dados = array();
  515 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  516 + $mapa = ms_newMapObj($mapfile);
  517 + $layer = $mapa->getlayerbyname($codigoLayer);
  518 + $classe = $layer->getclass($indiceClasse);
  519 + $classe->set("name",$name);
  520 + $classe->setexpression($expression);
  521 + $classe->set("keyimage",$keyimage);
  522 + $classe->set("maxscale",$maxscale);
  523 + $classe->set("minscale",$minscale);
  524 + $classe->set("status",$status);
  525 + $mapa->save($mapfile);
  526 + removeCabecalho($mapfile);
  527 + return "ok";
  528 +}
  529 +function pegaClasseLabel()
  530 +{
  531 + global $codigoMap,$codigoLayer,$indiceClasse,$locaplic;
  532 + $dados = array();
  533 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  534 + $mapa = ms_newMapObj($mapfile);
  535 + $layer = $mapa->getlayerbyname($codigoLayer);
  536 + $classe = $layer->getclass($indiceClasse);
  537 + $label = $classe->label;
  538 + if ($label != "")
  539 + {
  540 + $dados["font"] = $label->font;
  541 + $dados["type"] = $label->type;
  542 + $dados["backgroundcolor"] = $label->backgroundcolor->red.",".$label->backgroundcolor->green.",".$label->backgroundcolor->blue;
  543 + $dados["backgroundshadowcolor"] = $label->backgroundshadowcolor->red.",".$label->backgroundshadowcolor->green.",".$label->backgroundshadowcolor->blue;
  544 + $dados["color"] = $label->color->red.",".$label->color->green.",".$label->color->blue;
  545 + $dados["outlinecolor"] = $label->outlinecolor->red.",".$label->outlinecolor->green.",".$label->outlinecolor->blue;
  546 + $dados["shadowcolor"] = $label->shadowcolor->red.",".$label->shadowcolor->green.",".$label->shadowcolor->blue;
  547 + $dados["shadowsizex"] = $label->shadowsizex;
  548 + $dados["shadowsizey"] = $label->shadowsizey;
  549 + $dados["backgroundshadowsizex"] = $label->backgroundshadowsizex;
  550 + $dados["backgroundshadowsizey"] = $label->backgroundshadowsizey;
  551 + $dados["size"] = $label->size;
  552 + $dados["minsize"] = $label->minsize;
  553 + $dados["maxsize"] = $label->maxsize;
  554 + $dados["position"] = $label->position;
  555 + $dados["offsetx"] = $label->offsetx;
  556 + $dados["offsety"] = $label->offsety;
  557 + $dados["angle"] = $label->angle;
  558 + $dados["autoangle"] = $label->autoangle;
  559 + $dados["buffer"] = $label->buffer;
  560 + $dados["antialias"] = $label->antialias;
  561 + $dados["wrap"] = $label->wrap;
  562 + $dados["minfeaturesize"] = $label->minfeaturesize;
  563 + $dados["autominfeaturesize"] = $label->autominfeaturesize;
  564 + $dados["mindistance"] = $label->mindistance;
  565 + $dados["partials"] = $label->partials;
  566 + $dados["force"] = $label->force;
  567 + $dados["encoding"] = $label->encoding;
  568 + }
  569 + $dados["codigoMap"] = $codigoMap;
  570 + $dados["codigoLayer"] = $codigoLayer;
  571 + $dados["indiceClasse"] = $indiceClasse;
  572 + $colunas = "";
  573 + if($layer->type < 3)
  574 + {
  575 + if(@$layer->open())
  576 + {
  577 + $layer->open();
  578 + $colunas = implode(", ",$layer->getitems());
  579 + $layer->close();
  580 + }
  581 + }
  582 + return $dados;
  583 +}
498 584  
499 585  
500 586  
... ... @@ -562,24 +648,7 @@ function alteraEstilo()
562 648 removeCabecalho($mapfile);
563 649 return "ok";
564 650 }
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   -}
  651 +
583 652 function alteraClasseLabel()
584 653 {
585 654 global $codigoMap,$codigoLayer,$classe,$parametro,$valor;
... ... @@ -672,68 +741,6 @@ function removeCabecalho($arq)
672 741 fclose($handle);
673 742 }
674 743  
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 744 function pegaDadosEstilo()
738 745 {
739 746 global $codigoMap,$codigoLayer;
... ...