Commit db8d23614f747a8e0a1fb95b5d0b9ca7b7c95d07
1 parent
ad8099f7
Exists in
master
and in
7 other branches
Adaptação da ferramenta de ativação de etiquetas para uso do bootstrap
Showing
3 changed files
with
114 additions
and
60 deletions
Show diff stats
ferramentas/etiqueta/index.js
@@ -50,6 +50,7 @@ i3GEOF.etiqueta = { | @@ -50,6 +50,7 @@ i3GEOF.etiqueta = { | ||
50 | * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | 50 | * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php |
51 | */ | 51 | */ |
52 | MUSTACHE : "", | 52 | MUSTACHE : "", |
53 | + MUSTACHELISTA : "", | ||
53 | /** | 54 | /** |
54 | * Susbtitutos para o template | 55 | * Susbtitutos para o template |
55 | */ | 56 | */ |
@@ -69,12 +70,20 @@ i3GEOF.etiqueta = { | @@ -69,12 +70,20 @@ i3GEOF.etiqueta = { | ||
69 | */ | 70 | */ |
70 | inicia: function(iddiv){ | 71 | inicia: function(iddiv){ |
71 | if(i3GEOF.etiqueta.MUSTACHE == ""){ | 72 | if(i3GEOF.etiqueta.MUSTACHE == ""){ |
72 | - $.get(i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html", function(template) { | ||
73 | - i3GEOF.etiqueta.MUSTACHE = template; | 73 | + var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html", |
74 | + t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html"; | ||
75 | + | ||
76 | + $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) { | ||
77 | + i3GEOF.etiqueta.MUSTACHE = r1[0]; | ||
78 | + i3GEOF.etiqueta.MUSTACHELISTA = r2[0]; | ||
74 | i3GEOF.etiqueta.inicia(iddiv); | 79 | i3GEOF.etiqueta.inicia(iddiv); |
80 | + }).fail(function() { | ||
81 | + i3GEO.janela.closeMsg($trad("erroTpl")); | ||
82 | + return; | ||
75 | }); | 83 | }); |
76 | return; | 84 | return; |
77 | } | 85 | } |
86 | + | ||
78 | if (!$i("i3GEOFetiquetaComboCabecaSel")) { | 87 | if (!$i("i3GEOFetiquetaComboCabecaSel")) { |
79 | i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){ | 88 | i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){ |
80 | var botao = evt.target; | 89 | var botao = evt.target; |
@@ -96,16 +105,7 @@ i3GEOF.etiqueta = { | @@ -96,16 +105,7 @@ i3GEOF.etiqueta = { | ||
96 | } | 105 | } |
97 | try{ | 106 | try{ |
98 | $i(iddiv).innerHTML += i3GEOF.etiqueta.html(); | 107 | $i(iddiv).innerHTML += i3GEOF.etiqueta.html(); |
99 | - var b = new YAHOO.widget.Button( | ||
100 | - "i3GEOetiquetabotao1", | ||
101 | - {onclick:{fn: i3GEOF.etiqueta.ativa}} | ||
102 | - ); | ||
103 | - b.addClass("rodar150"); | ||
104 | - b = new YAHOO.widget.Button( | ||
105 | - "i3GEOetiquetabotao2", | ||
106 | - {onclick:{fn: i3GEOF.etiqueta.desativa}} | ||
107 | - ); | ||
108 | - b.addClass("rodar150"); | 108 | + |
109 | i3GEOF.etiqueta.ativaFoco(); | 109 | i3GEOF.etiqueta.ativaFoco(); |
110 | } | 110 | } |
111 | catch(erro){i3GEO.janela.tempoMsg(erro);} | 111 | catch(erro){i3GEO.janela.tempoMsg(erro);} |
@@ -141,7 +141,7 @@ i3GEOF.etiqueta = { | @@ -141,7 +141,7 @@ i3GEOF.etiqueta = { | ||
141 | i3GEO.janela.minimiza("i3GEOF.etiqueta"); | 141 | i3GEO.janela.minimiza("i3GEOF.etiqueta"); |
142 | }; | 142 | }; |
143 | //cria a janela flutuante | 143 | //cria a janela flutuante |
144 | - titulo = "<div id='i3GEOFetiquetaComboCabeca' class='comboTemasCabecalhoBs form-group' style='width:200px; left:5px;'> ------</div></div><a class='i3GeoTituloJanelaBs' target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=5&idajuda=37' >"+$trad("d7at")+"</a>"; | 144 | + titulo = "<div id='i3GEOFetiquetaComboCabeca' class='comboTemasCabecalhoBs form-group' style='width:200px; left:15px;'> ------</div></div><a class='i3GeoTituloJanelaBs' target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=5&idajuda=37' >"+$trad("d7at")+"</a>"; |
145 | janela = i3GEO.janela.cria( | 145 | janela = i3GEO.janela.cria( |
146 | "510px", | 146 | "510px", |
147 | "300px", | 147 | "300px", |
@@ -155,7 +155,11 @@ i3GEOF.etiqueta = { | @@ -155,7 +155,11 @@ i3GEOF.etiqueta = { | ||
155 | cabecalho, | 155 | cabecalho, |
156 | minimiza, | 156 | minimiza, |
157 | "", | 157 | "", |
158 | - true | 158 | + true, |
159 | + "", | ||
160 | + "", | ||
161 | + "", | ||
162 | + "" | ||
159 | ); | 163 | ); |
160 | divid = janela[2].id; | 164 | divid = janela[2].id; |
161 | i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style; | 165 | i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style; |
@@ -190,68 +194,62 @@ i3GEOF.etiqueta = { | @@ -190,68 +194,62 @@ i3GEOF.etiqueta = { | ||
190 | */ | 194 | */ |
191 | montaListaItens: function(retorno){ | 195 | montaListaItens: function(retorno){ |
192 | var funcao = function(dadosItens){ | 196 | var funcao = function(dadosItens){ |
193 | - var ins,i,n,itensatuais,item,ck = '',lista; | 197 | + var mustache = [], ins,i,n,itensatuais,item, ck = '',lista, temp; |
194 | lista = dadosItens.data; | 198 | lista = dadosItens.data; |
195 | try{ | 199 | try{ |
196 | itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); | 200 | itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); |
197 | itensatuais = itensatuais.etiquetas.split(","); | 201 | itensatuais = itensatuais.etiquetas.split(","); |
198 | - ins = []; | ||
199 | - ins.push("<table class='lista8' >"); | ||
200 | - ins.push("<tr><td>Coluna</td><td>Identifica</td><td>Tip</td><td>Busca</td><td>Alias</td><td>Link</td>"); | ||
201 | n = retorno.data.valores.length; | 202 | n = retorno.data.valores.length; |
202 | for (i=0;i<n; i++){ | 203 | for (i=0;i<n; i++){ |
203 | - | ||
204 | - ins.push("<tr>"); | ||
205 | - //nome da coluna | 204 | + temp = {}; |
206 | item = retorno.data.valores[i].item; | 205 | item = retorno.data.valores[i].item; |
207 | - ins.push("<td> "+item+"</td>"); | ||
208 | - //itens | 206 | + temp.item = item; |
209 | if(i3GEO.util.in_array(item,lista.itens) || i3GEO.util.in_array(item,itensatuais) || lista.itembuscarapida[item]){ | 207 | if(i3GEO.util.in_array(item,lista.itens) || i3GEO.util.in_array(item,itensatuais) || lista.itembuscarapida[item]){ |
210 | - ck = "checked"; | 208 | + temp.ckIdentifica = "checked"; |
211 | } | 209 | } |
212 | else{ | 210 | else{ |
213 | - ck = ""; | 211 | + temp.ckIdentifica = ""; |
214 | } | 212 | } |
215 | - ins.push("<td><input onclick='i3GEOF.etiqueta.ativaLinha(this)' style='cursor:pointer' id='etiqueta_"+item+"' "+ck+" type='checkbox' value='"+item+"' name='identifica' /></td>"); | ||
216 | - | ||
217 | - //etiquetas tip | ||
218 | if(i3GEO.util.in_array(item,itensatuais)){ | 213 | if(i3GEO.util.in_array(item,itensatuais)){ |
219 | - ck = "checked"; | 214 | + temp.ckEtiquetaTip = "checked"; |
220 | } | 215 | } |
221 | else{ | 216 | else{ |
222 | - ck = ""; | 217 | + temp.ckEtiquetaTip = ""; |
223 | } | 218 | } |
224 | - ins.push("<td><input disabled style='cursor:pointer' "+ck+" type='checkbox' value='"+item+"' name='etiquetaTip' /></td>"); | ||
225 | //buscarapida | 219 | //buscarapida |
226 | if(lista.itembuscarapida === item){ | 220 | if(lista.itembuscarapida === item){ |
227 | - ck = "checked"; | 221 | + temp.ckBuscaRapida = "checked"; |
228 | } | 222 | } |
229 | else{ | 223 | else{ |
230 | - ck = ""; | 224 | + temp.ckBuscaRapida = ""; |
231 | } | 225 | } |
232 | - ins.push("<td><input style='cursor:pointer' value='"+item+"' type='radio' "+ck+" name='itembuscarapida' /></td>"); | ||
233 | - //alias dos itens | ||
234 | if(lista.itensdesc[item]){ | 226 | if(lista.itensdesc[item]){ |
235 | - ck = lista.itensdesc[item]; | 227 | + temp.ckitensdesc = lista.itensdesc[item]; |
236 | } | 228 | } |
237 | else{ | 229 | else{ |
238 | - ck = item; | 230 | + temp.ckitensdesc = item; |
239 | } | 231 | } |
240 | - ins.push("<td><div class='i3geoForm150 i3geoFormIconeEdita' ><input disabled type='text' value='"+ck+"' name='itensdesc' /></div></td>"); | ||
241 | //links | 232 | //links |
242 | if(lista.itenslink[item]){ | 233 | if(lista.itenslink[item]){ |
243 | - ck = lista.itenslink[item]; | 234 | + temp.ckitem = lista.itenslink[item]; |
244 | } | 235 | } |
245 | else{ | 236 | else{ |
246 | - ck = ""; | 237 | + temp.ckitem = ""; |
247 | } | 238 | } |
248 | - ins.push("<td><div class='i3geoForm150 i3geoFormIconeEdita' ><input disabled type='text' value='"+ck+"' name='itenslink' /></div></td>"); | ||
249 | - | ||
250 | - | ||
251 | - ins.push("</tr>"); | 239 | + mustache.push(temp); |
252 | } | 240 | } |
253 | - ins.push("</table>"); | ||
254 | - $i("i3GEOetiquetalistai").innerHTML = ins.join(""); | 241 | + ins = Mustache.render( |
242 | + i3GEOF.etiqueta.MUSTACHELISTA, | ||
243 | + $.extend( | ||
244 | + {}, | ||
245 | + { | ||
246 | + "linhas" : mustache, | ||
247 | + }, | ||
248 | + i3GEOF.etiqueta.DICIONARIO | ||
249 | + ) | ||
250 | + ); | ||
251 | + $i("i3GEOetiquetalistai").innerHTML = ins; | ||
252 | + | ||
255 | //enable | 253 | //enable |
256 | lista = $i("i3GEOetiquetalistai").getElementsByTagName("input"); | 254 | lista = $i("i3GEOetiquetalistai").getElementsByTagName("input"); |
257 | n = lista.length; | 255 | n = lista.length; |
@@ -294,19 +292,19 @@ i3GEOF.etiqueta = { | @@ -294,19 +292,19 @@ i3GEOF.etiqueta = { | ||
294 | n = inputs.length; | 292 | n = inputs.length; |
295 | for (i=0;i<n; i++){ | 293 | for (i=0;i<n; i++){ |
296 | it = inputs[i]; | 294 | it = inputs[i]; |
297 | - if (it.disabled === false && it.checked === true && it.name === "etiquetaTip"){ | 295 | + if (it.checked === true && it.name === "etiquetaTip"){ |
298 | tips.push(it.value); | 296 | tips.push(it.value); |
299 | } | 297 | } |
300 | - if (it.disabled === false && it.checked === true && it.name === "identifica"){ | 298 | + if (it.checked === true && it.name === "identifica"){ |
301 | itens.push(it.value); | 299 | itens.push(it.value); |
302 | } | 300 | } |
303 | - if (it.disabled === false && it.name === "itensdesc"){ | 301 | + if (it.name === "itensdesc"){ |
304 | itensdesc.push(it.value); | 302 | itensdesc.push(it.value); |
305 | } | 303 | } |
306 | - if (it.disabled === false && it.name === "itenslink"){ | 304 | + if (it.name === "itenslink"){ |
307 | itenslink.push(it.value); | 305 | itenslink.push(it.value); |
308 | } | 306 | } |
309 | - if (it.checked === true && it.name === "itembuscarapida"){ | 307 | + if (it.name === "itembuscarapida"){ |
310 | itembuscarapida = it.value; | 308 | itembuscarapida = it.value; |
311 | } | 309 | } |
312 | } | 310 | } |
@@ -0,0 +1,57 @@ | @@ -0,0 +1,57 @@ | ||
1 | +<div> | ||
2 | + <table class="lista8" style="background-color: #89afd4;"> | ||
3 | + <tr> | ||
4 | + <td>Coluna</td> | ||
5 | + <td>Identifica</td> | ||
6 | + <td>Tip</td> | ||
7 | + <td>Busca</td> | ||
8 | + <td>Alias</td> | ||
9 | + <td>Link</td> | ||
10 | + <tr>{{#linhas}} | ||
11 | + <tr> | ||
12 | + <td>{{{item}}}</td> | ||
13 | + <td> | ||
14 | + <div class="checkbox condensed"> | ||
15 | + <label> | ||
16 | + <input {{{ckIdentifica}}} value="{{{item}}}" type="checkbox" name="identifica" /> | ||
17 | + <span class="checkbox-material noprint"> | ||
18 | + <span class="check"></span> | ||
19 | + </span> | ||
20 | + </label> | ||
21 | + </div> | ||
22 | + </td> | ||
23 | + <td> | ||
24 | + <div class="checkbox condensed"> | ||
25 | + <label> | ||
26 | + <input {{{ckEtiquetaTip}}} type='checkbox' value="{{{item}}}" name='etiquetaTip' /> | ||
27 | + <span class="checkbox-material noprint"> | ||
28 | + <span class="check"></span> | ||
29 | + </span> | ||
30 | + </label> | ||
31 | + </div> | ||
32 | + </td> | ||
33 | + <td> | ||
34 | + <div class="radio radio-primary condensed"> | ||
35 | + <label> | ||
36 | + <input {{{ckBuscaRapida}}} type='radio' value="{{{item}}}" name='itembuscarapida' /> | ||
37 | + <span class="circle"> | ||
38 | + <span class="check"></span> | ||
39 | + </span> | ||
40 | + </label> | ||
41 | + </div> | ||
42 | + </td> | ||
43 | + <td> | ||
44 | + <div class='form-group condensed'> | ||
45 | + <input class="form-control input" type='text' name='itensdesc' value='{{{ckitensdesc}}}' /> | ||
46 | + </div> | ||
47 | + </td> | ||
48 | + <td> | ||
49 | + <div class='form-group condensed'> | ||
50 | + <input class="form-control input" type='text' name='itenslink' value='{{{ckitem}}}' /> | ||
51 | + </div> | ||
52 | + </td> | ||
53 | + | ||
54 | + </tr> | ||
55 | + {{/linhas}} | ||
56 | + </table> | ||
57 | +</div> | ||
0 | \ No newline at end of file | 58 | \ No newline at end of file |
ferramentas/etiqueta/template_mst.html
1 | -<div style='margin-left: 5px;'> | ||
2 | - <div id='i3GEOetiquetalistai' class='digitar' style='text-align: left; left: 0px; top: 0px; width: 100%; height: 150px; overflow: auto; display: block;'></div> | 1 | +<div class='container-fluid'> |
2 | + <!-- ver templateLista_mst.html --> | ||
3 | + <div id='i3GEOetiquetalistai'></div> | ||
4 | + | ||
5 | + <button onclick="i3GEOF.etiqueta.ativa()" class='btn btn-primary btn-sm btn-raised'>{{{aplica}}}</button> | ||
6 | + <button onclick="i3GEOF.etiqueta.desativa()" class='btn btn-primary btn-sm btn-raised'>{{{desativaEtiquetas}}}</button> | ||
7 | + | ||
8 | + <h5 class="alert alert-info">{{{selecionaItem}}}</h5> | ||
3 | 9 | ||
4 | - <br> | ||
5 | - <p class='paragrafo'> | ||
6 | - <input id='i3GEOetiquetabotao1' size='35' type='button' value='{{{aplica}}}' /> | ||
7 | - <input id='i3GEOetiquetabotao2' size='35' type='button' value='{{{desativaEtiquetas}}}' /> | ||
8 | - <p class='paragrafo'> | ||
9 | - {{{selecionaItem}}}<br> | ||
10 | - </p> | ||
11 | </div> | 10 | </div> |
12 | \ No newline at end of file | 11 | \ No newline at end of file |