index.js
4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
if(typeof(i3GEOF) === 'undefined'){
var i3GEOF = {};
}
i3GEOF.buffer = {
renderFunction: i3GEO.janela.formModal,
_parameters: {
"tema": "",
"mustache": "",
"idContainer": "i3GEObufferContainer",
"namespace": "buffer"
},
start : function(tema){
var p = this._parameters,
i3f = this,
t1 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/template_mst.html";
p.tema = tema;
if(p.mustache === ""){
i3GEO.janela.abreAguarde();
$.get(t1).done(function(r1) {
p.mustache = r1;
i3f.html();
i3GEO.janela.fechaAguarde();
}).fail(function() {
i3GEO.janela.snackBar({content: $trad("erroTpl"),style: "red"});
return;
});
} else {
i3f.html();
}
},
destroy: function(){
//nao use this aqui
//i3GEOF.legenda._parameters.mustache = "";
},
html:function() {
var p = this._parameters,
i3f = this,
hash = {};
hash = {
locaplic: i3GEO.configura.locaplic,
namespace: p.namespace,
idContainer: p.idContainer,
sim: $trad("x14"),
nao: $trad("x15"),
...i3GEO.idioma.objetoIdioma(i3f.dicionario)
};
i3f.renderFunction.call(
this,
{
texto: Mustache.render(p.mustache, hash),
onclose: i3f.destroy,
resizable: {
disabled: false,
ghost: true,
handles: "se,n"
},
css: {'cursor': 'pointer', 'width': '100%', 'height': '50%','position': 'fixed','top': '', 'left': 0, 'right': 0, 'margin': 'auto', 'bottom': 0}
});
i3GEO.eventos.cliquePerm.ativa();
i3GEOF.buffer.t0();
i3GEOF.buffer.comboTemas();
},
t0: function(){
i3GEO.util.proximoAnterior("","i3GEOF.buffer.t1()","","i3GEOFgradeDePontost0","i3GEObufferresultado",true,"i3GEOToolFormModalFooter");
},
t1: function(){
i3GEO.util.proximoAnterior("i3GEOF.buffer.t0()","i3GEOF.buffer.t2()","","i3GEOF.buffer.t1","i3GEObufferresultado",true,"i3GEOToolFormModalFooter");
i3GEOF.buffer.comboTemasSel();
},
t2: function(){
i3GEO.util.proximoAnterior("i3GEOF.buffer.t1()","i3GEOF.buffer.t3()","","i3GEOF.buffer.t2","i3GEObufferresultado",true,"i3GEOToolFormModalFooter");
i3GEOF.buffer.comboItens();
},
t3: function(){
i3GEO.util.proximoAnterior("i3GEOF.buffer.t2()","","","i3GEOF.buffer.t3","i3GEObufferresultado",true,"i3GEOToolFormModalFooter");
},
get: function(btn){
var par = {
g_sid: i3GEO.configura.sid,
funcao: "criabuffer",
tema: $i("i3GEObuffertemasComSel").value,
multiplicar: $i("i3GEObufferdfator").value*1,
itemdistancia: $i("i3GEObuffertemasItem").value,
distancia: $i("i3GEObufferd").value*1
};
if(par.itemdistancia != ""){
par.distancia = 0;
} else {
par.multiplicar = 1;
}
if(par.tema == ""){
i3GEO.janela.tempoMsg($trad('selecionaTema2',i3GEOF.centromassa.dicionario));
return;
}
i3GEO.janela.abreAguarde();
btn = $(btn);
btn.prop("disabled",true).find("span .glyphicon").removeClass("hidden");
i3GEO.janela._formModal.block();
$.get(
i3GEO.configura.locaplic+"/ferramentas/buffer/exec.php",
par
)
.done(
function(data, status){
i3GEO.janela._formModal.unblock();
i3GEO.janela.fechaAguarde();
btn.prop("disabled",false).find("span .glyphicon").addClass("hidden");
i3GEO.janela.snackBar({content: $trad('feito')});
i3GEO.atualiza();
}
)
.fail(
function(data){
i3GEO.janela._formModal.unblock();
i3GEO.janela.fechaAguarde();
if(btn){
btn.prop("disabled",false).find("span .glyphicon").addClass("hidden");
}
i3GEO.janela.snackBar({content: data.statusText, style:'red'});
}
);
},
comboTemas: function(){
i3GEO.util.comboTemas(
"i3GEObuffertemasComSel",
function(retorno){
$i("i3GEObufferSelTemas").innerHTML = retorno.dados;
$i("i3GEObuffertemasComSel").onchange = function(){
i3GEO.mapa.ativaTema($i("i3GEObuffertemasComSel").value);
};
},
"i3GEObufferSelTemas",
"",
false,
"selecionados",
" ",
false,
true,
"form-control comboTema"
);
},
comboItens: function(){
i3GEO.util.comboItens(
"i3GEObuffertemasItem",
$i("i3GEObuffertemasComSel").value,
function(retorno){
$i("i3GEObufferondeItens").innerHTML = retorno.dados;
},
"i3GEObufferondeItens",
"",
"",
"",
"form-control comboTema"
);
}
};