Commit cc24d4e8015d3d3529d0c45a345681bb25b67d47
1 parent
20a3f138
Exists in
master
and in
7 other branches
Integração do editor de temas com o editor de mapfiles
Showing
2 changed files
with
21 additions
and
124 deletions
Show diff stats
admin/js/editormapfile.js
... | ... | @@ -178,6 +178,7 @@ function montaNosRaiz(redesenha) |
178 | 178 | for (var i=0, j=$mapfiles.length; i<j; i++) |
179 | 179 | { |
180 | 180 | conteudo = " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i]+"')\" title=excluir src=\"../imagens/01.png\" />" |
181 | + conteudo += " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editorTemaMapfile('"+$mapfiles[i]+"')\" title='editar tema associado' src=\"../imagens/06.png\" />" | |
181 | 182 | conteudo += " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"testarMapfile('"+$mapfiles[i]+"')\" title='testar!' src=\"../imagens/41.png\" /><b> <span>"+$mapfiles[i]+"</span>" |
182 | 183 | |
183 | 184 | var d = {html:conteudo,id:$mapfiles[i],codigoMap:$mapfiles[i]}; | ... | ... |
admin/js/listatemas.js
1 | -YAHOO.namespace("example.container"); | |
2 | -function initMenu() | |
1 | +function editorTemaMapfile(mapfile) | |
3 | 2 | { |
4 | - core_ativaBotaoAdicionaLinha("../php/menutemas.php?funcao=alteraTemas","adiciona") | |
5 | - core_carregando("ativa"); | |
6 | - core_ativaPainelAjuda("ajuda","botaoAjuda"); | |
7 | - core_pegaPerfis("pegaTemas()"); | |
8 | -} | |
9 | -function pegaTemas() | |
10 | -{ | |
11 | - core_pegaDados("buscando temas...","../php/menutemas.php?funcao=pegaTemas2","montaTabela") | |
12 | -} | |
13 | -function montaTabela(dados) | |
14 | -{ | |
15 | - YAHOO.example.InlineCellEditing = new function() | |
16 | - { | |
17 | - // Custom formatter for "address" column to preserve line breaks | |
18 | - var formatTextoId = function(elCell, oRecord, oColumn, oData) | |
19 | - { | |
20 | - elCell.innerHTML = "<p>" + oData + "</p>"; | |
21 | - }; | |
22 | - | |
23 | - var formatMais = function(elCell, oRecord, oColumn) | |
24 | - { | |
25 | - elCell.innerHTML = "<div class=editar style='text-align:center' ></div>"; | |
26 | - }; | |
27 | - var formatExclui = function(elCell, oRecord, oColumn) | |
28 | - { | |
29 | - elCell.innerHTML = "<div class=excluir style='text-align:center' ></div>"; | |
30 | - }; | |
31 | - var myColumnDefs = [ | |
32 | - {key:"excluir",label:"excluir",formatter:formatExclui}, | |
33 | - {key:"mais",label:"editar",formatter:formatMais}, | |
34 | - {label:"id",key:"id_tema", formatter:formatTextoId}, | |
35 | - {label:"codigo (mapfile)",key:"codigo_tema", formatter:formatTextoId}, | |
36 | - {label:"nome",key:"nome_tema", formatter:formatTextoId}, | |
37 | - ]; | |
38 | - myDataSource = new YAHOO.util.DataSource(dados); | |
39 | - myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; | |
40 | - myDataSource.responseSchema = | |
41 | - { | |
42 | - fields: ["nome_tema","codigo_tema","id_tema"] | |
43 | - }; | |
44 | - myDataTable = new YAHOO.widget.DataTable("tabela", myColumnDefs, myDataSource); | |
45 | - // Set up editing flow | |
46 | - myDataTable.subscribe('cellClickEvent',function(ev) | |
47 | - { | |
48 | - var target = YAHOO.util.Event.getTarget(ev); | |
49 | - var column = this.getColumn(target); | |
50 | - if (column.key == 'excluir') | |
51 | - { | |
52 | - var record = this.getRecord(target); | |
53 | - excluiLinha(record.getData('id_tema'),target); | |
54 | - } | |
55 | - if (column.key == 'mais') | |
56 | - { | |
57 | - var record = this.getRecord(target); | |
58 | - core_carregando("ativa"); | |
59 | - core_carregando("buscando dados..."); | |
60 | - $clicouId = record.getData('id_tema'); | |
61 | - $recordid = record.getId(); | |
62 | - var sUrl = "../php/menutemas.php?funcao=pegaTemas&id_tema="+record.getData('id_tema'); | |
63 | - var callback = | |
64 | - { | |
65 | - success:function(o) | |
66 | - { | |
67 | - try | |
68 | - { | |
69 | - montaEditorTema(YAHOO.lang.JSON.parse(o.responseText),$clicouId,$recordid); | |
70 | - } | |
71 | - catch(e){core_handleFailure(e,o.responseText);} | |
72 | - }, | |
73 | - failure:core_handleFailure, | |
74 | - argument: { foo:"foo", bar:"bar" } | |
75 | - }; | |
76 | - core_makeRequest(sUrl,callback) | |
77 | - } | |
78 | - | |
79 | - }); | |
80 | - // Hook into custom event to customize save-flow of "radio" editor | |
81 | - myDataTable.subscribe("editorUpdateEvent", function(oArgs) | |
82 | - { | |
83 | - if(oArgs.editor.column.key === "active") | |
84 | - { | |
85 | - this.saveCellEditor(); | |
86 | - } | |
87 | - }); | |
88 | - myDataTable.subscribe("editorBlurEvent", function(oArgs) | |
89 | - { | |
90 | - this.cancelCellEditor(); | |
91 | - }); | |
92 | - }; | |
93 | - core_carregando("desativa"); | |
3 | + core_pegaDados("buscando dados...","../php/menutemas.php?funcao=pegaTemaPorMapfile&codigo_tema="+mapfile,"montaEditorTema") | |
94 | 4 | } |
95 | -function montaEditorTema(dados,id,recordid) | |
5 | +function montaEditorTema(dados) | |
96 | 6 | { |
97 | 7 | function on_editorCheckBoxChange(p_oEvent) |
98 | 8 | { |
99 | 9 | var ins = ""; |
100 | 10 | if(p_oEvent.newValue.get("value") == "OK") |
101 | 11 | { |
102 | - gravaDadosTema(id,recordid); | |
12 | + gravaDadosTema(dados.id_tema); | |
103 | 13 | } |
104 | 14 | else |
105 | 15 | { |
... | ... | @@ -122,7 +32,7 @@ function montaEditorTema(dados,id,recordid) |
122 | 32 | { label: "Cancela", value: "CANCEL", checked: false } |
123 | 33 | ]); |
124 | 34 | editorBotoes.on("checkedButtonChange", on_editorCheckBoxChange); |
125 | - YAHOO.example.container.panelEditorTema = new YAHOO.widget.Panel("janela_editor", { fixedcenter:true,close:false,width:"400px", height:"400px",overflow:"auto", visible:false,constraintoviewport:true } ); | |
35 | + YAHOO.example.container.panelEditorTema = new YAHOO.widget.Panel("janela_editor", { fixedcenter:true,close:true,width:"400px", height:"400px",overflow:"auto", visible:false,constraintoviewport:true } ); | |
126 | 36 | YAHOO.example.container.panelEditorTema.render(); |
127 | 37 | } |
128 | 38 | YAHOO.example.container.panelEditorTema.show(); |
... | ... | @@ -132,15 +42,11 @@ function montaEditorTema(dados,id,recordid) |
132 | 42 | // |
133 | 43 | //preenche a div com a lista de tags |
134 | 44 | // |
135 | - core_comboTags("comboTags","Etags_tema","registraTag"); | |
136 | - // | |
137 | - //preenche a div com a lista de mapfiles | |
138 | - // | |
139 | - core_comboMapfiles("comboMapfiles","Ecodigo_tema",dados[0].codigo_tema); | |
45 | + core_comboTags("comboTags","tags_tema","registraTagTema"); | |
140 | 46 | } |
141 | -function registraTag(valor) | |
47 | +function registraTagTema(valor) | |
142 | 48 | { |
143 | - var inp = $i("Etags_tema") | |
49 | + var inp = $i("tags_tema") | |
144 | 50 | var tags = inp.value |
145 | 51 | if(tags == "") |
146 | 52 | inp.value = valor |
... | ... | @@ -151,27 +57,24 @@ function montaDivTemas(i) |
151 | 57 | { |
152 | 58 | var param = { |
153 | 59 | "linhas":[ |
154 | - {titulo:"Nome do tema:",id:"Enome_tema",size:"50",value:i.nome_tema,tipo:"text",div:""} | |
60 | + {titulo:"Nome do tema que será mostrado na árvore de menus:",id:"nome_tema",size:"50",value:i.nome_tema,tipo:"text",div:""} | |
155 | 61 | ] |
156 | 62 | } |
157 | 63 | var ins = "" |
158 | 64 | ins += core_geraLinhas(param) |
159 | - | |
160 | - ins += "<p>Mapfile (código do mapfile que será utilizado para criar a camada no i3geo):" | |
161 | - ins += "<div id=comboMapfiles >Buscando...</div>"; | |
162 | 65 | |
163 | 66 | ins += "<p>Descrição:<br>"; |
164 | - ins += "<input size=50 type=text id=Edesc_tema value='"+i.desc_tema+"' /></p>" | |
67 | + ins += "<input size=50 type=text id=desc_tema value='"+i.desc_tema+"' /></p>" | |
165 | 68 | |
166 | 69 | ins += "<p>Link para a fonte:<br>"; |
167 | - ins += "<input size=50 type=text id=Elink_tema value='"+i.link_tema+"' /></p>" | |
70 | + ins += "<input size=50 type=text id=link_tema value='"+i.link_tema+"' /></p>" | |
168 | 71 | |
169 | 72 | ins += "<p>Tags (separe com espaço). Você pode digitar novos tags ou pegar da lista abaixo:" |
170 | - ins += "<input type=text size=50 value='"+i.tags_tema+"' id='Etags_tema' ><br>" | |
73 | + ins += "<input type=text size=50 value='"+i.tags_tema+"' id='tags_tema' ><br>" | |
171 | 74 | ins += "<div id=comboTags >Buscando...</div>"; |
172 | 75 | |
173 | - ins += "<p>Tipo:<br>" | |
174 | - ins += "<select id='Etipo_tema' />" | |
76 | + ins += "<p>Tipo (preencha apenas se for do tipo WMS):<br>" | |
77 | + ins += "<select id='tipo_tema' />" | |
175 | 78 | ins += "<option value='' " |
176 | 79 | if (i.tipoa_tema == ""){ins += "selected";} |
177 | 80 | ins += ">Normal</option>" |
... | ... | @@ -180,33 +83,27 @@ function montaDivTemas(i) |
180 | 83 | ins += " >WMS<option></select></p>" |
181 | 84 | |
182 | 85 | ins += "<p>Permite acesso via WMS/WFS?<br>" |
183 | - ins += "<select id='Eogc_tema' >" | |
86 | + ins += "<select id='ogc_tema' >" | |
184 | 87 | ins += core_combosimnao(i.ogc_tema) |
185 | 88 | ins += "</select></p>" |
186 | 89 | |
187 | 90 | ins += "<p>Permite o download na aplicação datadownload.htm?<br>" |
188 | - ins += "<select id='Edownload_tema' >" | |
91 | + ins += "<select id='download_tema' >" | |
189 | 92 | ins += core_combosimnao(i.download_tema) |
190 | 93 | ins += "</select></p>" |
191 | 94 | |
192 | 95 | ins += "<p>Permite acesso via kml?<br>" |
193 | - ins += "<select id='Ekml_tema' >" | |
96 | + ins += "<select id='kml_tema' >" | |
194 | 97 | ins += core_combosimnao(i.kml_tema) |
195 | 98 | ins += "</select></p><br><br><br>" |
196 | 99 | return(ins) |
197 | 100 | } |
198 | -function excluiLinha(id,row) | |
199 | -{ | |
200 | - var mensagem = " excluindo o registro do id= "+id; | |
201 | - var sUrl = "../php/menutemas.php?funcao=excluirRegistro&id="+id+"&tabela=temas"; | |
202 | - core_excluiLinha(sUrl,row,mensagem) | |
203 | -} | |
204 | -function gravaDadosTema(id,recordid) | |
101 | +function gravaDadosTema(id) | |
205 | 102 | { |
206 | 103 | var campos = new Array("nome","codigo","desc","link","tags","tipo","ogc","download","kml") |
207 | 104 | var par = "" |
208 | 105 | for (i=0;i<campos.length;i++) |
209 | - {par += "&"+campos[i]+"="+($i("E"+campos[i]+"_tema").value)} | |
106 | + {par += "&"+campos[i]+"="+($i(campos[i]+"_tema").value)} | |
210 | 107 | par += "&id="+id |
211 | 108 | core_carregando("ativa"); |
212 | 109 | core_carregando(" gravando o registro do id= "+id); |
... | ... | @@ -237,5 +134,4 @@ function gravaDadosTema(id,recordid) |
237 | 134 | argument: { foo:"foo", bar:"bar" } |
238 | 135 | }; |
239 | 136 | core_makeRequest(sUrl,callback) |
240 | -} | |
241 | -YAHOO.util.Event.addListener(window, "load", initMenu); | |
242 | 137 | \ No newline at end of file |
138 | +} | |
243 | 139 | \ No newline at end of file | ... | ... |