index.js
3.45 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
if(typeof(i3GEOF) === 'undefined'){
var i3GEOF = {};
}
/*
Classe: i3GEOF.opcoesQuery
*/
i3GEOF.opcoesQuery = {
/*
Variavel: aguarde
Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.
*/
aguarde: "",
/**
* Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
*/
MUSTACHE : "",
/**
* Susbtitutos para o template
*/
mustacheHash : function() {
var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.opcoesQuery.dicionario);
dicionario["locaplic"] = i3GEO.configura.locaplic;
return dicionario;
},
/*
Function: inicia
Inicia a ferramenta. É chamado por criaJanelaFlutuante
Parametro:
iddiv {String} - id do div que receberá o conteudo HTML da ferramenta
*/
inicia: function(iddiv){
if(i3GEOF.opcoesQuery.MUSTACHE == ""){
$.get(i3GEO.configura.locaplic + "/ferramentas/opcoes_querymap/template_mst.html", function(template) {
i3GEOF.opcoesQuery.MUSTACHE = template;
i3GEOF.opcoesQuery.inicia(iddiv);
});
return;
}
try{
i3GEOF.opcoesQuery.aguarde.visibility = "visible";
$i(iddiv).innerHTML = i3GEOF.opcoesQuery.html();
i3GEO.util.aplicaAquarela("i3GEOF.opcoesQuery");
var p = i3GEO.configura.locaplic+"/ferramentas/opcoes_querymap/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaquerymapcor",
cp = new cpaint(),
retorno = function(retorno){
i3GEOF.opcoesQuery.aguarde.visibility = "hidden";
if(retorno.data.erro){i3GEO.janela.tempoMsg("Erro");return;}
$i("i3GEOopcoesQuerycor").value = retorno.data;
};
cp.set_response_type("JSON");
cp.call(p,"corQM",retorno);
}
catch(erro){i3GEO.janela.tempoMsg(erro);}
},
/*
Function: html
Gera o código html para apresentação das opções da ferramenta
Retorno:
String com o código html
*/
html: function() {
var ins = Mustache.render(i3GEOF.opcoesQuery.MUSTACHE, i3GEOF.opcoesQuery.mustacheHash());
return ins;
},
/*
Function: iniciaJanelaFlutuante
Cria a janela flutuante para controle da ferramenta.
*/
iniciaJanelaFlutuante: function(){
var janela,divid,titulo,cabecalho,minimiza;
if ($i("i3GEOF.opcoesQuery")) {
return;
}
cabecalho = function(){};
minimiza = function(){
i3GEO.janela.minimiza("i3GEOF.opcoesQuery");
};
//cria a janela flutuante
titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("p8") + "</span></div>";
janela = i3GEO.janela.cria(
"220px",
"120px",
"",
"",
"",
titulo,
"i3GEOF.opcoesQuery",
false,
"hd",
cabecalho,
minimiza,
"",
true,
"",
"",
"",
"",
"5"
);
divid = janela[2].id;
$i("i3GEOF.opcoesQuery_corpo").style.backgroundColor = "white";
$i("i3GEOF.opcoesQuery_corpo").style.textAlign = "left";
i3GEOF.opcoesQuery.aguarde = $i("i3GEOF.opcoesQuery_imagemCabecalho").style;
i3GEOF.opcoesQuery.inicia(divid);
},
/*
Function: executa
Aplica os parametros definidos
Veja:
<QUERYMAPCOR>
*/
executa: function(){
if(i3GEOF.opcoesQuery.aguarde.visibility === "visible")
{return;}
i3GEOF.opcoesQuery.aguarde.visibility = "visible";
var temp = function(){
i3GEOF.opcoesQuery.aguarde.visibility = "hidden";
i3GEO.Interface.atualizaMapa();
},
cor = $i("i3GEOopcoesQuerycor").value,
p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=querymapcor&cor="+cor,
cp = new cpaint();
cp.set_response_type("JSON");
cp.call(p,"corQM",temp);
}
};