index.js
3.41 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
if(typeof(i3GEOF) === 'undefined'){
var i3GEOF = {};
}
i3GEOF.centroide = {
renderFunction: i3GEO.janela.formModal,
_parameters: {
"tema": "",
"mustache": "",
"idContainer": "i3GEOcentroideContainer",
"namespace": "centroide"
},
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,
...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();
i3f.t0();
},
t0: function()
{
i3GEO.util.proximoAnterior("","i3GEOF.centroide.t1()","","i3GEOF.centroide.t0","i3GEOcentroideresultado",true,"i3GEOToolFormModalFooter");
},
t1: function(){
i3GEO.util.proximoAnterior("i3GEOF.centroide.t0()","i3GEOF.centroide.t2()","","i3GEOF.centroide.t1","i3GEOcentroideresultado",true,"i3GEOToolFormModalFooter");
i3GEOF.centroide.comboTemas();
},
t2: function(){
i3GEO.util.proximoAnterior("i3GEOF.centroide.t1()","","","i3GEOF.centroide.t2","i3GEOcentroideresultado",true,"i3GEOToolFormModalFooter");
},
get: function(btn){
var par = {
g_sid: i3GEO.configura.sid,
funcao: "criaCentroide",
tema: $i("i3GEOcentroidetemasComSel").value
};
i3GEO.janela.abreAguarde();
btn = $(btn);
btn.prop("disabled",true).find("span .glyphicon").removeClass("hidden");
i3GEO.janela._formModal.block();
$.get(
i3GEO.configura.locaplic+"/ferramentas/centroide/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(
"i3GEOcentroidetemasComSel",
function(retorno){
$i("i3GEOcentroideSelTemas").innerHTML = retorno.dados;
},
"i3GEOcentroideSelTemas",
"",
false,
"selecionados",
" ",
false,
true,
"form-control comboTema"
);
}
};