Commit 040f9db30a92e798e240d4d5d4835cabaa409138
1 parent
29bd2305
Exists in
master
and in
6 other branches
Atualização do READ-ME e da interface da ferramenta tabela
Showing
17 changed files
with
2989 additions
and
1364 deletions
Show diff stats
README.md
@@ -53,7 +53,7 @@ Alguns usuários reportaram problemas ao instalar o Apache em algumas versões d | @@ -53,7 +53,7 @@ Alguns usuários reportaram problemas ao instalar o Apache em algumas versões d | ||
53 | * Execute novamente o arquivo apache-install.bat | 53 | * Execute novamente o arquivo apache-install.bat |
54 | * Para confirmar que tudo ocorreu bem, abra o navegador de internet e digite http:\\localhost | 54 | * Para confirmar que tudo ocorreu bem, abra o navegador de internet e digite http:\\localhost |
55 | 55 | ||
56 | -### i3Geo | 56 | +### i3Geo Windows |
57 | 57 | ||
58 | Para obter o código do i3Geo você tem duas opções, a primeira utiliza simplesmente o download de um arquivo e a segunda utiliza o Git. A vantagem da segunda opção é que você poderá atualizar sua instalação de forma mais fácil. | 58 | Para obter o código do i3Geo você tem duas opções, a primeira utiliza simplesmente o download de um arquivo e a segunda utiliza o Git. A vantagem da segunda opção é que você poderá atualizar sua instalação de forma mais fácil. |
59 | 59 | ||
@@ -100,7 +100,7 @@ git config --global user.name "Seu Nome" | @@ -100,7 +100,7 @@ git config --global user.name "Seu Nome" | ||
100 | ``` | 100 | ``` |
101 | 101 | ||
102 | 102 | ||
103 | -### PostGIS (opcional) | 103 | +### PostGIS Windows (opcional) |
104 | 104 | ||
105 | Para instalar o PostGIS siga o roteiro mostrado em http://postgis.net/windows_downloads | 105 | Para instalar o PostGIS siga o roteiro mostrado em http://postgis.net/windows_downloads |
106 | 106 | ||
@@ -218,7 +218,7 @@ service apache2 restart | @@ -218,7 +218,7 @@ service apache2 restart | ||
218 | 218 | ||
219 | ``` | 219 | ``` |
220 | 220 | ||
221 | -### i3Geo | 221 | +### i3Geo Linux |
222 | 222 | ||
223 | Para obter o código do i3Geo você tem duas opções, a primeira utiliza simplesmente o download de um arquivo e a segunda utiliza o Git. A vantagem da segunda opção é que você poderá atualizar sua instalação de forma mais fácil. | 223 | Para obter o código do i3Geo você tem duas opções, a primeira utiliza simplesmente o download de um arquivo e a segunda utiliza o Git. A vantagem da segunda opção é que você poderá atualizar sua instalação de forma mais fácil. |
224 | 224 | ||
@@ -277,7 +277,7 @@ git config --global user.email seuemail@example.com | @@ -277,7 +277,7 @@ git config --global user.email seuemail@example.com | ||
277 | git config --global user.name "Seu Nome" | 277 | git config --global user.name "Seu Nome" |
278 | ``` | 278 | ``` |
279 | 279 | ||
280 | -### PostGIS (opcional) | 280 | +### PostGIS Linux (opcional) |
281 | 281 | ||
282 | Instale o PostgreSQL e PostGIS | 282 | Instale o PostgreSQL e PostGIS |
283 | 283 | ||
@@ -292,7 +292,7 @@ apt-get install postgresql-9.1-postgis | @@ -292,7 +292,7 @@ apt-get install postgresql-9.1-postgis | ||
292 | 292 | ||
293 | Observações: | 293 | Observações: |
294 | 294 | ||
295 | -* Pependendo da versão do PostgreSQL alguns comandos podem ser diferentes. Veja a pasta /usr/share/postgresql para descobrir a versão instalada) | 295 | +* Dependendo da versão do PostgreSQL alguns comandos podem ser diferentes. Veja a pasta /usr/share/postgresql para descobrir a versão instalada) |
296 | 296 | ||
297 | * Pode ser necessário o uso de sudo, exemplo: sudo su - postgres -c "createdb i3geosaude" | 297 | * Pode ser necessário o uso de sudo, exemplo: sudo su - postgres -c "createdb i3geosaude" |
298 | 298 |
css/default.css
1 | - | 1 | +.navbar .navbar-nav > li > a { |
2 | + padding-top: 5px; | ||
3 | + padding-bottom: 5px; | ||
4 | +} | ||
5 | + | ||
6 | +.ui-resizable-n { | ||
7 | + cursor: n-resize; | ||
8 | + height: 12px; | ||
9 | + width: 14px; | ||
10 | + background-image: url("../pacotes/jquery/jquery-ui/images/ui-icons_444444_256x240.png"); | ||
11 | + background-position: -50px -224px; | ||
12 | + left: 0px; | ||
13 | + right: 0px; | ||
14 | + margin: auto; | ||
15 | +} | ||
2 | 16 | ||
3 | .glyphicon.normal-right-spinner { | 17 | .glyphicon.normal-right-spinner { |
4 | -webkit-animation: glyphicon-spin-r 2s infinite linear; | 18 | -webkit-animation: glyphicon-spin-r 2s infinite linear; |
ferramentas/tabela/dicionario.js
@@ -249,5 +249,10 @@ i3GEOF.tabela.dicionario = { | @@ -249,5 +249,10 @@ i3GEOF.tabela.dicionario = { | ||
249 | pt : "Selecione pelo menos um registro", | 249 | pt : "Selecione pelo menos um registro", |
250 | en : "Select at least one record", | 250 | en : "Select at least one record", |
251 | es : "Seleccione al menos un registro" | 251 | es : "Seleccione al menos un registro" |
252 | + } ], | ||
253 | + 'operReg' : [ { | ||
254 | + pt : "Operações que são executadas considerando a lista de registros marcados", | ||
255 | + en : "", | ||
256 | + es : "" | ||
252 | } ] | 257 | } ] |
253 | }; | 258 | }; |
ferramentas/tabela/index.js
1 | if (typeof (i3GEOF) === 'undefined') { | 1 | if (typeof (i3GEOF) === 'undefined') { |
2 | var i3GEOF = {}; | 2 | var i3GEOF = {}; |
3 | } | 3 | } |
4 | -/* | ||
5 | - * Classe: i3GEOF.tabela | ||
6 | - */ | ||
7 | i3GEOF.tabela = | 4 | i3GEOF.tabela = |
8 | { | 5 | { |
9 | - /** | ||
10 | - * Controla se o evento de atualizacao da lista de registros esta ativo ou nao E utilizado quando os graficos sao recuperados de um | ||
11 | - * mapa que foi salvo | ||
12 | - */ | ||
13 | - LISTAREGATIVO : true, | ||
14 | - /** | ||
15 | - * Array com os ids das janelas ja criadas | ||
16 | - */ | ||
17 | - janelas : [], | ||
18 | - /** | ||
19 | - * Objeto com as propriedades de cada janela. A chave e o id da janela armazenado em i3GEO.tabela.janelas | ||
20 | - */ | ||
21 | - propJanelas : {}, | ||
22 | - /** | ||
23 | - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | ||
24 | - */ | ||
25 | - MUSTACHE : "", | ||
26 | - MUSTACHELISTA : "", | ||
27 | - MUSTACHEVINCULO: "", | ||
28 | - /** | ||
29 | - * Susbtitutos para o template | ||
30 | - */ | ||
31 | - mustacheHash : function(idjanela) { | ||
32 | - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.tabela.dicionario); | ||
33 | - dicionario["idjanela"] = idjanela; | ||
34 | - dicionario["idjanelaA"] = '"' + idjanela + '"'; | ||
35 | - dicionario["locaplic"] = i3GEO.configura.locaplic; | ||
36 | - dicionario["propriedades"] = $trad('p13'); | ||
37 | - dicionario["ini"] = $inputText("", "", idjanela + 'i3GEOtabelainicio', "", 5, "1"); | ||
38 | - dicionario["fim"] = $inputText("", "", idjanela + 'i3GEOtabelafim', "", 5, "20"); | ||
39 | - return dicionario; | ||
40 | - }, | ||
41 | - /** | ||
42 | - * Configura a tabela conforme um objeto contendo parametros. Alguns parametros possuem definicoes padrao, usadas quando o valor nao | ||
43 | - * e passado | ||
44 | - * | ||
45 | - * Qualquer outro campo de formulario pode ter seu valor passado como parametro, desde que use o mesmo ID, excluindo-se do nome do | ||
46 | - * ID o prefixo (codigo da janela) | ||
47 | - * | ||
48 | - * parametros {objeto} com os seguintes elementos: | ||
49 | - * | ||
50 | - * idjanela - id da tabela. Usado como prefixo para inserir os identificadores dos elementos DOM que fazem parte da interface do | ||
51 | - * tabela. Se existir um elemento dom esse id, a tabela sera inserido nesse elemento | ||
52 | - * | ||
53 | - * tema - codigo do tema existente no mapa e que sera a fonte para os dados | ||
54 | - * | ||
55 | - * atualiza true|false - a janela sera atualizada na navegacao do mapa ou nao | ||
56 | - * | ||
57 | - */ | ||
58 | - configura : function(parametros) { | ||
59 | - var idjanela; | ||
60 | - if (!parametros.idjanela) { | ||
61 | - idjanela = "tabela" + parseInt(Math.random() * 1000000, 10); | ||
62 | - } else { | ||
63 | - idjanela = parametros.idjanela; | ||
64 | - } | ||
65 | - i3GEOF.tabela.janelas.push(idjanela); | ||
66 | - if (parametros) { | ||
67 | - i3GEOF.tabela.propJanelas[idjanela] = parametros; | ||
68 | - } else { | ||
69 | - i3GEOF.tabela.propJanelas[idjanela] = {}; | ||
70 | - } | ||
71 | - if (!parametros.tema || parametros.tema == undefined) { | ||
72 | - i3GEOF.tabela.propJanelas[idjanela].tema = i3GEO.temaAtivo; | ||
73 | - } | ||
74 | - if (!parametros.atualiza || parametros.atualiza == undefined) { | ||
75 | - i3GEOF.tabela.propJanelas[idjanela].atualiza = true; | ||
76 | - } | ||
77 | - // guarda para essa tabela alguns valores default obtidos dos | ||
78 | - // parametros gerais da ferramenta | ||
79 | - if (!parametros.w || parametros.w == undefined) { | ||
80 | - i3GEOF.tabela.propJanelas[idjanela].w = i3GEOF.tabela.w; | ||
81 | - } | ||
82 | - if (!parametros.h || parametros.h == undefined) { | ||
83 | - i3GEOF.tabela.propJanelas[idjanela].h = i3GEOF.tabela.h; | ||
84 | - } | ||
85 | - i3GEOF.tabela.propJanelas[idjanela].colunas = { | ||
86 | - "itens" : [], | ||
87 | - "alias" : [] | ||
88 | - }; | ||
89 | - i3GEOF.tabela.propJanelas[idjanela].registros = []; | ||
90 | - return idjanela; | ||
91 | - }, | ||
92 | - /** | ||
93 | - * Aplica a tabela os parametros de configuracao definidos para cada interface que controla a tabela. Os parametros de configuracao | ||
94 | - * sao obtidos na inicializacao, passados como parametros. Essa funcao deve ser executada apos os elementos html terem sido | ||
95 | - * renderizados | ||
96 | - */ | ||
97 | - aplicaConfig : function(idjanela) { | ||
98 | - var config, nomesIds, i, o, n, j; | ||
99 | - config = i3GEOF.tabela.propJanelas[idjanela]; | ||
100 | - nomesIds = i3GEO.util.listaChaves(config); | ||
101 | - n = nomesIds.length; | ||
102 | - for (j = 0; j < n; j++) { | ||
103 | - i = nomesIds[j]; | ||
104 | - if (config[i]) { | ||
105 | - o = $i(i); | ||
106 | - if (o && o.type) { | ||
107 | - if (o.type.toLowerCase() === "radio" || o.type.toLowerCase() === "checkbox") { | ||
108 | - o.checked = config[i]; | ||
109 | - } else { | ||
110 | - o.value = config[i]; | ||
111 | - } | ||
112 | - } | ||
113 | - } | ||
114 | - } | ||
115 | - }, | ||
116 | - /* | ||
117 | - * Function: inicia | ||
118 | - * | ||
119 | - * Inicia a ferramenta. É chamado por criaJanelaFlutuante | ||
120 | - * | ||
121 | - * Parametro: | ||
122 | - * | ||
123 | - * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | ||
124 | - */ | ||
125 | - inicia : function(iddiv, idjanela) { | ||
126 | - if(i3GEOF.tabela.MUSTACHE == ""){ | ||
127 | - var t1 = i3GEO.configura.locaplic + "/ferramentas/tabela/template_mst.html", | ||
128 | - t2 = i3GEO.configura.locaplic + "/ferramentas/tabela/templateLista_mst.html", | ||
129 | - t3 = i3GEO.configura.locaplic + "/ferramentas/tabela/templateVinculo_mst.html"; | 6 | + LISTAREGATIVO : true, |
7 | + refreshOnNavigate : true, | ||
8 | + renderFunction: i3GEO.janela.formModal, | ||
9 | + _parameters: { | ||
10 | + "tema": "", | ||
11 | + "mustache": "", | ||
12 | + "mustachelista": "", | ||
13 | + "idContainer": "i3GEOtabelaContainer", | ||
14 | + "idRegistros" : "i3GEOtabelaregistros", | ||
15 | + "namespace": "tabela", | ||
16 | + "colunas" :{ | ||
17 | + "itens" : [], | ||
18 | + "alias" : [] | ||
19 | + }, | ||
20 | + "registros": [] | ||
21 | + }, | ||
22 | + start : function(tema){ | ||
23 | + var p = this._parameters, | ||
24 | + i3f = this, | ||
25 | + t1 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/template_mst.html", | ||
26 | + t2 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/templateLista_mst.html"; | ||
27 | + p.tema = tema; | ||
28 | + if(p.mustache === ""){ | ||
29 | + i3GEO.janela.abreAguarde(); | ||
30 | + $.when( $.get(t1),$.get(t2)).done(function(r1,r2) { | ||
31 | + p.mustache = r1[0]; | ||
32 | + p.mustachelista = r2[0]; | ||
33 | + i3f.html(); | ||
34 | + i3GEO.janela.fechaAguarde(); | ||
35 | + }).fail(function() { | ||
36 | + i3GEO.janela.closeMsg($trad("erroTpl")); | ||
37 | + return; | ||
38 | + }); | ||
39 | + } else { | ||
40 | + i3f.html(); | ||
41 | + } | ||
42 | + }, | ||
43 | + destroy: function(){ | ||
44 | + //nao use this aqui | ||
45 | + i3GEOF.tabela._parameters.mustache = ""; | ||
46 | + i3GEOF.tabela._parameters.tema = ""; | ||
47 | + i3GEOF.tabela._parameters.registros = []; | ||
48 | + i3GEOF.tabela._parameters.colunas = { | ||
49 | + "itens" : [], | ||
50 | + "alias" : [] | ||
51 | + }; | ||
130 | 52 | ||
131 | - $.when( $.get(t1),$.get(t2),$.get(t3) ).done(function(r1,r2,r3) { | ||
132 | - i3GEOF.tabela.MUSTACHE = r1[0]; | ||
133 | - i3GEOF.tabela.MUSTACHELISTA = r2[0]; | ||
134 | - i3GEOF.tabela.MUSTACHEVINCULO = r3[0]; | ||
135 | - i3GEOF.tabela.inicia(iddiv, idjanela); | ||
136 | - }).fail(function() { | ||
137 | - i3GEO.janela.closeMsg($trad("erroTpl")); | ||
138 | - return; | ||
139 | - }); | ||
140 | - return; | ||
141 | - } | ||
142 | - $i(iddiv).innerHTML = i3GEOF.tabela.html(idjanela); | 53 | + i3GEO.eventos.removeEventos("NAVEGAMAPA", [ |
54 | + "i3GEOF.tabela.atualizaListaDeRegistros()" | ||
55 | + ]); | ||
143 | 56 | ||
144 | - //i3GEO.janela.applyScrollBar(iddiv,".customScrollBar",{advanced:{ autoExpandHorizontalScroll: 2 }}); | 57 | + }, |
58 | + html:function() { | ||
59 | + var p = this._parameters, | ||
60 | + i3f = this, | ||
61 | + hash = { | ||
62 | + locaplic: i3GEO.configura.locaplic, | ||
63 | + namespace: p.namespace, | ||
64 | + idContainer: p.idContainer, | ||
65 | + idRegistros: p.idRegistros, | ||
66 | + propriedades: $trad("p13"), | ||
67 | + opcoes: $trad("opcoes"), | ||
68 | + ...i3GEO.idioma.objetoIdioma(i3f.dicionario) | ||
69 | + }; | ||
70 | + i3f.renderFunction.call( | ||
71 | + this, | ||
72 | + { | ||
73 | + texto: Mustache.render(p.mustache, hash), | ||
74 | + onclose: i3f.destroy, | ||
75 | + resizable: { | ||
76 | + disabled: false, | ||
77 | + ghost: true, | ||
78 | + handles: "se,n" | ||
79 | + }, | ||
80 | + css: {'cursor': 'pointer', 'width': '100%', 'height': '50%','position': 'fixed','top': '', 'left': 0, 'right': 0, 'margin': 'auto', 'bottom': 0} | ||
81 | + }); | ||
145 | 82 | ||
146 | - var b, onButtonClick = function(evt) { | ||
147 | - var botao = evt.target; | ||
148 | - if (botao) { | ||
149 | - if (botao.value != "") { | ||
150 | - i3GEO.mapa.ativaTema(botao.value); | ||
151 | - i3GEOF.tabela.propJanelas[idjanela].tema = botao.value; | ||
152 | - i3GEOF.tabela.inicia(iddiv, idjanela); | ||
153 | - } | ||
154 | - } | ||
155 | - }; | ||
156 | - if (!$i(idjanela + "i3GEOFtabelaComboCabecaSel")) { | ||
157 | - i3GEO.janela.comboCabecalhoTemasBs( | ||
158 | - idjanela + "i3GEOFtabelaComboCabeca", | ||
159 | - idjanela + "i3GEOFtabelaComboCabecaSel", | ||
160 | - "tabela", | ||
161 | - "comTabela", | ||
162 | - onButtonClick); | ||
163 | - } | ||
164 | - i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia1", idjanela + "i3GEOtabelaguia"); | ||
165 | - // eventos das guias | ||
166 | - $i(idjanela + "i3GEOtabelaguia6").onclick = function() { | ||
167 | - i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia6", idjanela + "i3GEOtabelaguia"); | ||
168 | - }; | ||
169 | - $i(idjanela + "i3GEOtabelaguia1").onclick = function() { | ||
170 | - i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia1", idjanela + "i3GEOtabelaguia"); | ||
171 | - }; | ||
172 | - $i(idjanela + "i3GEOtabelaguia3").onclick = function() { | ||
173 | - i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia3", idjanela + "i3GEOtabelaguia"); | ||
174 | - if (!$i(idjanela + "i3GEOtabelaComboItensGuia3")) { | ||
175 | - i3GEOF.tabela.comboItensEstat(idjanela); | ||
176 | - } | ||
177 | - }; | ||
178 | - // relatorio | ||
179 | - $i(idjanela + "i3GEOtabelaguia5").onclick = | ||
180 | - function() { | ||
181 | - i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia5", idjanela + "i3GEOtabelaguia"); | ||
182 | - i3GEO.util.checkItensEditaveis(i3GEOF.tabela.propJanelas[idjanela].tema, function(retorno) { | ||
183 | - if (retorno.tipo === "dados") { | ||
184 | - $i(idjanela + "i3GEOtabelaitensrelatorio").innerHTML = retorno.dados; | ||
185 | - } | ||
186 | - }, idjanela + "i3GEOtabelaitensrelatorio", "320px", "", "sim"); | ||
187 | - i3GEO.util.comboItens(idjanela + "i3GEOtabelaagrupaItem", i3GEOF.tabela.propJanelas[idjanela].tema, function( | ||
188 | - retorno) { | ||
189 | - if (retorno.tipo === "erro") { | ||
190 | - i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem',i3GEOF.tabela.dicionario) + '</div>'); | ||
191 | - } else { | ||
192 | - $i(idjanela + "i3GEOtabelaagrupamento").innerHTML = retorno.dados; | ||
193 | - } | ||
194 | - }, idjanela + "i3GEOtabelaagrupamento", "","sim","","form-control"); | ||
195 | - }; | 83 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOtabelaguia1", "i3GEOtabelaguia"); |
84 | + // | ||
85 | + // eventos das guias | ||
86 | + // | ||
87 | + $i("i3GEOtabelaguia6").onclick = function() { | ||
88 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOtabelaguia6", "i3GEOtabelaguia"); | ||
89 | + }; | ||
90 | + $i("i3GEOtabelaguia1").onclick = function() { | ||
91 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOtabelaguia1", "i3GEOtabelaguia"); | ||
92 | + }; | ||
93 | + $i("i3GEOtabelaguia3").onclick = function() { | ||
94 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOtabelaguia3", "i3GEOtabelaguia"); | ||
95 | + if (!$i("i3GEOtabelaComboItensGuia3")) { | ||
96 | + i3GEOF.tabela.comboItensEstat(); | ||
97 | + } | ||
98 | + }; | ||
99 | + // relatorio | ||
100 | + $i("i3GEOtabelaguia5").onclick = function() { | ||
101 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOtabelaguia5", "i3GEOtabelaguia"); | ||
196 | 102 | ||
103 | + i3GEO.util.comboItens("i3GEOtabelaagrupaItem", i3GEOF.tabela._parameters.tema, function( | ||
104 | + retorno) { | ||
105 | + if (retorno.tipo === "erro") { | ||
106 | + i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem',i3GEOF.tabela.dicionario) + '</div>'); | ||
107 | + } else { | ||
108 | + $i("i3GEOtabelaagrupamento").innerHTML = retorno.dados; | ||
109 | + } | ||
110 | + }, "i3GEOtabelaagrupamento", "","sim","","form-control"); | ||
111 | + }; | ||
112 | + i3GEO.eventos.adicionaEventos("NAVEGAMAPA", [ | ||
113 | + "i3GEOF.tabela.atualizaListaDeRegistros()" | ||
114 | + ]); | ||
115 | + i3GEOF.tabela.pegaRegistros(); | ||
116 | + }, | ||
117 | + comboJanelas : function(idcombo, funcao, w) { | ||
118 | + }, | ||
119 | + comboColunas : function(idJanela, idcombo, funcao) { | ||
120 | + var i, c = i3GEOF.tabela._parameters.colunas, n = c.itens.length; | ||
121 | + if (!funcao) { | ||
122 | + funcao = ""; | ||
123 | + } | ||
124 | + ins = "<select class='form-control' id='" | ||
125 | + + idcombo | ||
126 | + + "' onchange='" | ||
127 | + + funcao | ||
128 | + + "'>" | ||
129 | + + " <option value='' >---</option>"; | ||
130 | + for (i = 0; i < n; i++) { | ||
131 | + ins += "<option value='" + c.itens[i] + "' >" + c.alias[i] + "</option>"; | ||
132 | + } | ||
133 | + ins += "</select>"; | ||
134 | + return ins; | ||
135 | + }, | ||
136 | + /* | ||
137 | + * Function: ativaAutoAtualiza | ||
138 | + * | ||
139 | + * Ativa ou desativa a atualização automática da tabela quando o usuário navega no mapa | ||
140 | + */ | ||
141 | + atualizaListaDeRegistros : function() { | ||
142 | + i3GEOF.tabela.pegaRegistros(); | ||
143 | + }, | ||
144 | + pegaRegistros : function(tipolista, dadosDaClasse, inicio, fim) { | ||
145 | + var p = this._parameters, | ||
146 | + i3f = this; | ||
147 | + $i(p.idRegistros).innerHTML = ""; | ||
148 | + var p, ext, tiporeg = "brasil", cp = new cpaint(); | ||
149 | + // verifica se esta no modo de atualizacao automatica | ||
150 | + if (i3GEOF.tabela.refreshOnNavigate === true) { | ||
151 | + tiporeg = "mapa"; | ||
152 | + } | ||
153 | + if (!tipolista) { | ||
154 | + if ($i("i3GEOtabelatipolista").checked) { | ||
155 | + tipolista = "selecionados"; | ||
156 | + } else { | ||
157 | + tipolista = "tudo"; | ||
158 | + } | ||
159 | + } | ||
160 | + if (!dadosDaClasse) { | ||
161 | + if ($i("i3GEOtabelalegenda").checked) { | ||
162 | + dadosDaClasse = "sim"; | ||
163 | + } else { | ||
164 | + dadosDaClasse = "nao"; | ||
165 | + } | ||
166 | + } | ||
167 | + if (!inicio) { | ||
168 | + inicio = $i("i3GEOtabelainicio").value - 1; | ||
169 | + } else { | ||
170 | + inicio = ""; | ||
171 | + } | ||
172 | + if (!fim) { | ||
173 | + fim = $i("i3GEOtabelafim").value - 1; | ||
174 | + } else { | ||
175 | + fim = ""; | ||
176 | + } | ||
177 | + funcao = function(retorno) { | ||
178 | + i3GEOF.tabela._parameters.registros = []; | ||
179 | + i3GEOF.tabela.montaTabela(retorno); | ||
180 | + }; | ||
181 | + ext = i3GEO.parametros.mapexten; | ||
182 | + ext = i3GEO.util.extOSM2Geo(ext); | ||
183 | + p = | ||
184 | + i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid=" | ||
185 | + + i3GEO.configura.sid | ||
186 | + + "&funcao=listaregistros" | ||
187 | + + "&inicio=" | ||
188 | + + inicio | ||
189 | + + "&fim=" | ||
190 | + + fim | ||
191 | + + "&tema=" | ||
192 | + + p.tema | ||
193 | + + "&tipo=" | ||
194 | + + tiporeg | ||
195 | + + "&tipolista=" | ||
196 | + + tipolista | ||
197 | + + "&ext=" | ||
198 | + + ext | ||
199 | + + "&dadosDaClasse=" | ||
200 | + + dadosDaClasse; | ||
201 | + cp.set_response_type("JSON"); | ||
202 | + cp.call(p, "listaRegistros", funcao); | ||
203 | + }, | ||
204 | + /* | ||
205 | + * Function: montaTabela | ||
206 | + * | ||
207 | + * Monta a visualização da tabela de atributos | ||
208 | + */ | ||
209 | + montaTabela : function(retorno) { | ||
210 | + var p = this._parameters, | ||
211 | + i3f = this; | ||
212 | + if (retorno.data !== undefined) { | ||
213 | + var mustache = { | ||
214 | + "cabecalho": [{"classe":"hidden"},{"classe":"hidden"},{"classe":"hidden"},{"classe":"hidden"}], //4 colunas com icones | ||
215 | + "linhas": [], | ||
216 | + "ordena": $trad('ordena', i3GEOF.tabela.dicionario), | ||
217 | + "excluir": $trad("t12") | ||
218 | + }, | ||
219 | + linha = { | ||
220 | + "classezoom": "", | ||
221 | + "ext": "", | ||
222 | + "indice": "" | ||
223 | + }, | ||
224 | + ins, i, vals, cor, j, n, stat, imagem, registros = p.registros, i3GEOtabelalegenda = | ||
225 | + $i("i3GEOtabelalegenda").checked; | ||
226 | + // cabecalho da tabela | ||
227 | + p.colunas = { | ||
228 | + "itens" : retorno.data[0].itens, | ||
229 | + "alias" : retorno.data[0].alias | ||
230 | + }; | ||
231 | + n = retorno.data[0].itens.length; | ||
232 | + for (i = 0; i < n; i++) { | ||
233 | + mustache.cabecalho.push({ | ||
234 | + "idcoluna": i * 1 + 4, //pq tem 3 colunas com icones | ||
235 | + "item": retorno.data[0].itens[i], | ||
236 | + "alias": retorno.data[0].alias[i], | ||
237 | + "classe": "" | ||
238 | + }); | ||
239 | + } | ||
240 | + n = retorno.data[1].registros.length; | ||
241 | + if ($i("i3GEOtabelafim").value === "") { | ||
242 | + $i("i3GEOtabelafim").value = n - 1; | ||
243 | + } | ||
244 | + for (i = 0; i < n; i++) { | ||
245 | + linha = {}; | ||
246 | + linha.classezoom = "hidden"; | ||
247 | + linha.ext = ""; | ||
248 | + linha.indice = retorno.data[1].registros[i].indice; | ||
249 | + if (retorno.data[1].registros[i].ext && retorno.data[1].registros[i].ext != "") { | ||
250 | + linha.classezoom = ""; | ||
251 | + linha.ext = retorno.data[1].registros[i].ext; | ||
252 | + } | ||
253 | + linha.stat = ""; | ||
254 | + if (retorno.data[1].registros[i].status === "CHECKED") { | ||
255 | + linha.stat = "CHECKED"; | ||
256 | + } | ||
257 | + if (registros[retorno.data[1].registros[i].indice]) { | ||
258 | + if (registros[retorno.data[1].registros[i].indice] === true) { | ||
259 | + linha.stat = "CHECKED"; | ||
260 | + } else { | ||
261 | + linha.stat = ""; | ||
262 | + } | ||
263 | + } | ||
264 | + if (i3GEOtabelalegenda == true) { | ||
265 | + linha.classelegenda = ""; | ||
266 | + linha.nomeClasse = retorno.data[1].registros[i].classe["nome"]; | ||
267 | + linha.imagemClasse = retorno.data.legenda[retorno.data[1].registros[i].classe["indice"]]; | ||
268 | + imagem = retorno.data.legenda[retorno.data[1].registros[i].classe["indice"]]; | ||
269 | + } else { | ||
270 | + linha.classelegenda = "hidden"; | ||
271 | + linha.nomeClasse = ""; | ||
272 | + linha.imagemClasse = ""; | ||
273 | + } | ||
274 | + if (linha.stat === "CHECKED") { | ||
275 | + registros[retorno.data[1].registros[i].indice] = true; | ||
276 | + } | ||
277 | + vals = retorno.data[1].registros[i].valores; | ||
278 | + linha.colunas = ""; | ||
279 | + for (j = 0; j < vals.length; j++) { | ||
280 | + linha.colunas += "<td style='min-width: 150px;' title='" + vals[j].item + "' >" + vals[j].valor + "</td>"; | ||
281 | + } | ||
282 | + mustache.linhas.push(linha); | ||
283 | + } | ||
284 | + ins = Mustache.render(p.mustachelista, mustache); | ||
285 | + $i(p.idRegistros).innerHTML = ins; | ||
286 | + } | ||
287 | + }, | ||
288 | + /* | ||
289 | + * Function: mais | ||
290 | + * | ||
291 | + * Avança o contador de registros para a listagem | ||
292 | + */ | ||
293 | + mais : function(idjanela) { | ||
294 | + var i = $i("i3GEOtabelainicio").value * 1, f = $i("i3GEOtabelafim").value * 1, d = f - i; | ||
295 | + $i("i3GEOtabelainicio").value = f + 1; | ||
296 | + $i("i3GEOtabelafim").value = f + d + 1; | ||
297 | + i3GEOF.tabela.pegaRegistros(); | ||
298 | + }, | ||
299 | + /* | ||
300 | + * Function: todos | ||
301 | + * | ||
302 | + * Avança o contador de registros para o fim da listagem | ||
303 | + */ | ||
304 | + todos : function(idjanela) { | ||
305 | + $i("i3GEOtabelainicio").value = 1; | ||
306 | + $i("i3GEOtabelafim").value = ""; | ||
307 | + i3GEOF.tabela.pegaRegistros(false, false, false, 1, false); | ||
308 | + }, | ||
309 | + /* | ||
310 | + * Function: menos | ||
311 | + * | ||
312 | + * Retrocede o contador de registros para a listagem | ||
313 | + */ | ||
314 | + menos : function(idjanela) { | ||
315 | + var i = $i("i3GEOtabelainicio").value * 1, f = $i("i3GEOtabelafim").value * 1, d = f - i; | ||
316 | + $i("i3GEOtabelainicio").value = i - d - 1; | ||
317 | + $i("i3GEOtabelafim").value = i - 1; | ||
318 | + if ($i("i3GEOtabelainicio").value < 1) { | ||
319 | + $i("i3GEOtabelainicio").value = 1; | ||
320 | + $i("i3GEOtabelafim").value = 1 + d; | ||
321 | + } | ||
322 | + i3GEOF.tabela.pegaRegistros(); | ||
323 | + }, | ||
324 | + /* | ||
325 | + * Function: excluiColuna | ||
326 | + * | ||
327 | + * Exclui uma coluna da visualização da tabela | ||
328 | + */ | ||
329 | + excluiColuna : function(coluna, cid, idjanela) { | ||
330 | + try { | ||
331 | + var tabela = $i("i3GEOtabelatabelai"), trs, tds, i, t, nt, ni; | ||
332 | + // pega o indice correto | ||
333 | + tds = coluna.parentNode.parentNode.getElementsByTagName("td"); | ||
334 | + nt = tds.length; | ||
335 | + for (t = 0; t < nt; t++) { | ||
336 | + if (tds[t].accessKey == cid) { | ||
337 | + cid = t; | ||
338 | + break; | ||
339 | + } | ||
340 | + } | ||
341 | + trs = tabela.getElementsByTagName("tr"); | ||
342 | + nt = trs.length; | ||
343 | + for (t = 0; t < nt; t++) { | ||
344 | + i = trs[t]; | ||
345 | + if (i.getElementsByTagName("td")[cid]) { | ||
346 | + ni = i.getElementsByTagName("td")[cid]; | ||
347 | + i.removeChild(ni); | ||
348 | + } | ||
349 | + } | ||
350 | + } catch (e) { | ||
351 | + if (typeof (console) !== 'undefined') { | ||
352 | + console.error(e); | ||
353 | + } | ||
354 | + } | ||
355 | + }, | ||
356 | + /* | ||
357 | + * Function: ordenaColuna | ||
358 | + * | ||
359 | + * Ordena uma coluna da tabela | ||
360 | + */ | ||
361 | + ordenaColuna : function(coluna, cid, idjanela) { | ||
362 | + try { | ||
363 | + var numero = false,tabela = $i("i3GEOtabelatabelai"), trs = tabela.getElementsByTagName("tr"), | ||
364 | + ntrs = trs.length, tds, nt, psort = [], t, psortfim, npsortfim, ins, p, e, c; | ||
197 | 365 | ||
198 | - if (i3GEO.parametros.r.toLowerCase() !== "sim") { | ||
199 | - $i(idjanela + "i3GEOtabelaguia4obj").innerHTML = $trad("x22"); | ||
200 | - } | ||
201 | - i3GEOF.tabela.pegaRegistros(idjanela); | ||
202 | - i3GEO.guias.ajustaGuiaFerramenta(idjanela, idjanela + "i3GEOtabela"); | ||
203 | - // | ||
204 | - // Apos todos os elementos HTML da ferramenta terem sido renderizados | ||
205 | - // aplicam-se os parametros armazenados nas propriedades da janela atual | ||
206 | - // Isso e necessario pois os parametros podem ter sido enviados na inicializacao da ferramenta, | ||
207 | - // por exemplo, quando um mapa e salvo, os parametros sao armazenados e depois recuperados | ||
208 | - // | ||
209 | - i3GEOF.tabela.aplicaConfig(idjanela); | ||
210 | - if ($i(idjanela)) { | ||
211 | - $i(idjanela).style.visibility = "visible"; | ||
212 | - } | ||
213 | - }, | ||
214 | - /* | ||
215 | - * Function: html | ||
216 | - * | ||
217 | - * Gera o código html para apresentação das opções da ferramenta | ||
218 | - * | ||
219 | - * Retorno: | ||
220 | - * | ||
221 | - * String com o código html | ||
222 | - */ | ||
223 | - html : function(idjanela) { | ||
224 | - var ins = Mustache.render(i3GEOF.tabela.MUSTACHE, i3GEOF.tabela.mustacheHash(idjanela)); | ||
225 | - return ins; | ||
226 | - }, | ||
227 | - /* | ||
228 | - * Function: criaJanelaFlutuante | ||
229 | - * | ||
230 | - * Cria a janela flutuante para controle da ferramenta. | ||
231 | - */ | ||
232 | - iniciaJanelaFlutuante : function(parametros) { | ||
233 | - var duplica, minimiza, cabecalho, janela, divid, temp, titulo, id; | ||
234 | - if (!parametros) { | ||
235 | - parametros = {}; | ||
236 | - } | ||
237 | - // | ||
238 | - // configura a tabela baseado no objeto parametros | ||
239 | - // se em parametros existir um idjanela, o mesmo e retornado, caso contrario, e criado | ||
240 | - // | ||
241 | - id = i3GEOF.tabela.configura(parametros); | ||
242 | - // | ||
243 | - // se existir um elemento HTML com o mesmo ID da janela, a renderizacao ocorrera | ||
244 | - // nesse elemento, caso contrario, sera criada uma janela flutuante | ||
245 | - // | ||
246 | - if (!$i(id) && !$i(id + "_corpo")) { | ||
247 | - cabecalho = function() { | ||
248 | - i3GEOF.tabela.ativaFoco(id); | ||
249 | - }; | ||
250 | - minimiza = function() { | ||
251 | - i3GEO.janela.minimiza(id,200); | ||
252 | - }; | ||
253 | - duplica = function() { | ||
254 | - i3GEOF.tabela.iniciaJanelaFlutuante(); | ||
255 | - }; | ||
256 | - // cria a janela flutuante | ||
257 | - titulo = "<span class='i3GeoTituloJanelaBsNolink' >" | ||
258 | - + $trad('tabela', i3GEOF.tabela.dicionario) | ||
259 | - + " (" + id + " )" | ||
260 | - + "</span></div>"; | 366 | + // pega o indice correto |
367 | + tds = coluna.parentNode.parentNode.getElementsByTagName("td"); | ||
368 | + nt = tds.length; | ||
369 | + for (t = 0; t < nt; t++) { | ||
370 | + if (tds[t].accessKey == cid) { | ||
371 | + cid = t; | ||
372 | + break; | ||
373 | + } | ||
374 | + } | ||
375 | + for (t = 1; t < ntrs; t++) { | ||
376 | + c = trs[t].getElementsByTagName("td")[cid].innerHTML; | ||
377 | + psort.push( c + "@$" + t); | ||
378 | + if (c * 1) { | ||
379 | + numero = true; | ||
380 | + } | ||
381 | + } | ||
382 | + // recosntroi a tabela | ||
383 | + if(numero){ | ||
384 | + psortfim = psort.sort(function(a, b) { | ||
385 | + return a.split("@$")[0]*1 - b.split("@$")[0]*1; | ||
386 | + }); | ||
387 | + } else { | ||
388 | + psortfim = psort.sort(); | ||
389 | + } | ||
261 | 390 | ||
262 | - janela = i3GEO.janela.cria( | ||
263 | - "610px", | ||
264 | - "400px", | ||
265 | - "", | ||
266 | - "", | ||
267 | - "", | ||
268 | - titulo, | ||
269 | - id, | ||
270 | - false, | ||
271 | - "hd", | ||
272 | - cabecalho, | ||
273 | - minimiza, | ||
274 | - function() { i3GEO.guias.ajustaGuiaFerramenta(id, id + "i3GEOtabela");}, | ||
275 | - true, | ||
276 | - "", | ||
277 | - duplica, | ||
278 | - "", | ||
279 | - "", | ||
280 | - "39" | ||
281 | - ); | ||
282 | - divid = janela[2].id; | ||
283 | - if (i3GEOF.tabela.janelas.length > 1) { | ||
284 | - temp = janela[0].cfg.config; | ||
285 | - janela[0] | ||
286 | - .moveTo(temp.x.value + (i3GEOF.tabela.janelas.length * 50), temp.y.value + (i3GEOF.tabela.janelas.length * 15)); | ||
287 | - } | ||
288 | - $i(id + "_corpo").style.backgroundColor = "white"; | ||
289 | - | ||
290 | - temp = function() { | ||
291 | - i3GEOF.tabela.janelas.remove(id); | ||
292 | - i3GEOF.tabela.propJanelas[id] = null; | ||
293 | - if (i3GEOF.tabela.janelas.length === 0) { | ||
294 | - if (i3GEO.Interface.ATUAL === "openlayers") { | ||
295 | - i3GEO.eventos.removeEventos("NAVEGAMAPA", [ | ||
296 | - "i3GEOF.tabela.atualizaListaDeRegistros()" | ||
297 | - ]); | ||
298 | - } | ||
299 | - if (i3GEO.Interface.ATUAL === "googlemaps") { | ||
300 | - google.maps.event.removeListener(tabelaDragend); | ||
301 | - google.maps.event.removeListener(tabelaZoomend); | ||
302 | - } | ||
303 | - } | ||
304 | - }; | ||
305 | - YAHOO.util.Event.addListener(janela[0].close, "click", temp); | ||
306 | - janela[0].bringToTop(); | ||
307 | - } else { | ||
308 | - // sera renderizado em $i(id) | ||
309 | - temp = 'i3GEOF.tabela.propJanelas["' + id + '"].atualiza = this.checked'; | ||
310 | - $i(id + "_corpo").innerHTML = | ||
311 | - "<img src='../imagens/aguarde2.gif' style='visibility: hidden;' class='i3GeoAguardeJanela' id='" + id | ||
312 | - + "_imagemCabecalho'>" | ||
313 | - + "<div style=background-color:#F2F2F2; >" | ||
314 | - + "<input class='inputsb' checked style='cursor:pointer;position:relative;top:2px;' onclick='" | ||
315 | - + temp | ||
316 | - + "' type=checkbox /> " | ||
317 | - + $trad("atualizaNavegacao", i3GEOF.tabela.dicionario) | ||
318 | - + " (" | ||
319 | - + id | ||
320 | - + ")</div>"; | ||
321 | - | ||
322 | - divid = id + "_corpo"; | ||
323 | - } | ||
324 | - if ($i(id + "_imagemCabecalho")) { | ||
325 | - i3GEOF.tabela.aguarde = $i(id + "_imagemCabecalho").style; | ||
326 | - i3GEOF.tabela.propJanelas[id].aguarde = $i(id + "_imagemCabecalho").style; | ||
327 | - i3GEOF.tabela.propJanelas[id].atualiza = true; | ||
328 | - } | ||
329 | - i3GEOF.tabela.inicia(divid, id); | ||
330 | - // inicia os eventos | ||
331 | - if (i3GEO.Interface.ATUAL === "openlayers") { | ||
332 | - i3GEO.eventos.adicionaEventos("NAVEGAMAPA", [ | ||
333 | - "i3GEOF.tabela.atualizaListaDeRegistros()" | ||
334 | - ]); | ||
335 | - } | ||
336 | - if (i3GEO.Interface.ATUAL === "googlemaps" && !tabelaDragend) { | ||
337 | - tabelaDragend = google.maps.event.addListener(i3GeoMap, "dragend", function() { | ||
338 | - i3GEOF.tabela.atualizaListaDeRegistros(); | ||
339 | - }); | ||
340 | - tabelaZoomend = google.maps.event.addListener(i3GeoMap, "zoomend", function() { | ||
341 | - i3GEOF.tebela.atualizaListaDeRegistros(); | ||
342 | - }); | ||
343 | - } | ||
344 | - }, | ||
345 | - /** | ||
346 | - * Obtem os parametros de cada janela e converte em base64. Cada janela e inserida como um item em um objeto A compactacao e | ||
347 | - * utilizada para salvar as configuracoes no mapfile atual | ||
348 | - */ | ||
349 | - compactaConfig : function() { | ||
350 | - var c, g, par, janelas, i, n, novoid; | ||
351 | - par = []; | ||
352 | - janelas = i3GEOF.tabela.janelas; | ||
353 | - n = janelas.length; | ||
354 | - for (i = 0; i < n; i++) { | ||
355 | - novoid = window.prompt($trad('idDaTabela', i3GEOF.tabela.dicionario), janelas[i]); | ||
356 | - c = i3GEOF.tabela.retornaConfig(janelas[i], novoid); | ||
357 | - par.push(c); | ||
358 | - } | ||
359 | - g = YAHOO.lang.JSON.stringify(par); | ||
360 | - return i3GEO.util.base64encode(g); | ||
361 | - }, | ||
362 | - restauraTabelas : function(par) { | ||
363 | - i3GEOF.tabela.LISTAREGATIVO = false; | ||
364 | - var n, i; | ||
365 | - par = i3GEO.util.base64decode(par); | ||
366 | - par = JSON.parse(par); | ||
367 | - n = par.length; | ||
368 | - for (i = 0; i < n; i++) { | ||
369 | - i3GEOF.tabela.iniciaJanelaFlutuante(par[i]); | ||
370 | - } | ||
371 | - }, | ||
372 | - /** | ||
373 | - * Retorna um objeto contendo os valores de todos os parametros utilizados na tabela de tal forma que possa ser renderizado | ||
374 | - * novamente | ||
375 | - * | ||
376 | - * A funcao que salva o mapa no banco utiliza retornaConfig e cria um objeto que ira armazenar os parametros de cada janela | ||
377 | - */ | ||
378 | - retornaConfig : function(idjanela, novoid) { | ||
379 | - // as chaves do objeto correspondem ao ID de cada elemento | ||
380 | - var c, par; | ||
381 | - | ||
382 | - par = i3GEOF.tabela.propJanelas[idjanela]; | ||
383 | - c = $i(idjanela); | ||
384 | - // p = $i(idjanela+"i3GEOtabelaguia6obj"); | ||
385 | - if (!novoid) { | ||
386 | - novoid = idjanela; | ||
387 | - } | ||
388 | - // pega todos os elementos do tipo input | ||
389 | - /* | ||
390 | - * objs = p.getElementsByTagName("input"); for (obj in objs) { if (objs[obj].id && objs[obj].id != "") { tmpid = | ||
391 | - * objs[obj].id.replace(idjanela,novoid); if (objs[obj].type === "text") { par[tmpid] = objs[obj].value; } else { par[tmpid] = | ||
392 | - * objs[obj].checked; } } } // pega todos os elementos do tipo select objs = p.getElementsByTagName("select"); for (obj in objs) { | ||
393 | - * if (objs[obj].id && objs[obj].id != "") { tmpid = objs[obj].id.replace(idjanela,novoid); par[tmpid] = objs[obj].value; } } | ||
394 | - */ | ||
395 | - par.dados = ""; | ||
396 | - try { | ||
397 | - par["i3GEOtabelainicio"] = $i(idjanela + "i3GEOtabelainicio").value; | ||
398 | - par["i3GEOtabelafim"] = $i(idjanela + "i3GEOtabelafim").value; | ||
399 | - par["idjanela"] = novoid; | ||
400 | - par["w"] = c.style.width; | ||
401 | - par["h"] = c.style.height; | ||
402 | - } catch (e) { | ||
403 | - } | ||
404 | - return par; | ||
405 | - }, | ||
406 | - /* | ||
407 | - * Function: ativaFoco | ||
408 | - * | ||
409 | - * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado | ||
410 | - */ | ||
411 | - ativaFoco : function(id) { | ||
412 | - | ||
413 | - }, | ||
414 | - vinculos : { | ||
415 | - ligacoes : [], | ||
416 | - /** | ||
417 | - * Susbtitutos para o template | ||
418 | - */ | ||
419 | - mustacheHash : function() { | ||
420 | - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.tabela.dicionario); | ||
421 | - dicionario["locaplic"] = i3GEO.configura.locaplic; | ||
422 | - dicionario["comboJanelas1"] = i3GEOF.tabela.comboJanelas("i3GEOFTabelaOpcoesAdicionaVinculoT1", "i3GEOF.tabela.vinculos.comboColunasT1()"); | ||
423 | - dicionario["comboJanelas2"] = i3GEOF.tabela.comboJanelas("i3GEOFTabelaOpcoesAdicionaVinculoT2", "i3GEOF.tabela.vinculos.comboColunasT2()"); | ||
424 | - return dicionario; | ||
425 | - }, | ||
426 | - iniciaJanelaFlutuante : function() { | ||
427 | - var janela, titulo; | ||
428 | - // cria a janela flutuante | ||
429 | - titulo = "<span class='i3GeoTituloJanelaBsNolink' >" | ||
430 | - + $trad('vinculos', i3GEOF.tabela.dicionario) | ||
431 | - + "</span></div>"; | ||
432 | - janela = | ||
433 | - i3GEO.janela.cria( | ||
434 | - "400px", | ||
435 | - "350px", | ||
436 | - "", | ||
437 | - "", | ||
438 | - "", | ||
439 | - titulo, | ||
440 | - "i3GEOFtabelaVinculos", | ||
441 | - false, | ||
442 | - "hd", | ||
443 | - "", | ||
444 | - "", | ||
445 | - "", | ||
446 | - true, | ||
447 | - "", | ||
448 | - "", | ||
449 | - "", | ||
450 | - "", | ||
451 | - "120" | ||
452 | - ); | ||
453 | - divid = janela[2].id; | ||
454 | - if (i3GEOF.tabela.janelas.length > 1) { | ||
455 | - temp = janela[0].cfg.config; | ||
456 | - janela[0] | ||
457 | - .moveTo(temp.x.value + (i3GEOF.tabela.janelas.length * 50), temp.y.value + (i3GEOF.tabela.janelas.length * 15)); | ||
458 | - } | ||
459 | - $i("i3GEOFtabelaVinculos_corpo").style.backgroundColor = "white"; | ||
460 | - i3GEOF.tabela.vinculos.inicia(); | ||
461 | - }, | ||
462 | - html : function() { | ||
463 | - var ins = Mustache.render(i3GEOF.tabela.MUSTACHEVINCULO, i3GEOF.tabela.vinculos.mustacheHash()); | ||
464 | - return ins; | ||
465 | - }, | ||
466 | - vincular: function(){ | ||
467 | - var t1 = $i("i3GEOFTabelaOpcoesAdicionaVinculoT1").value, t2 = | ||
468 | - $i("i3GEOFTabelaOpcoesAdicionaVinculoT2").value, c1 = | ||
469 | - $i("i3GEOFTabelaOpcoesAdicionaVinculoColunaT1").value, c2 = | ||
470 | - $i("i3GEOFTabelaOpcoesAdicionaVinculoColunaT1").value; | ||
471 | - if (t1 != "" && t2 != "" && c1 != "" && c2 != "") { | ||
472 | - i3GEOF.tabela.vinculos.ligacoes.push({ | ||
473 | - "t1" : t1, | ||
474 | - "t2" : t2, | ||
475 | - "c1" : c1, | ||
476 | - "c2" : c2 | ||
477 | - }); | ||
478 | - } | ||
479 | - i3GEOF.tabela.vinculos.lista(); | ||
480 | - }, | ||
481 | - inicia : function() { | ||
482 | - var ins = i3GEOF.tabela.vinculos.html(); | ||
483 | - $i("i3GEOFtabelaVinculos_corpo").innerHTML = ins; | ||
484 | - i3GEOF.tabela.vinculos.lista(); | ||
485 | - }, | ||
486 | - comboColunasT1 : function() { | ||
487 | - var colunas = ""; | ||
488 | - if($i("i3GEOFTabelaOpcoesAdicionaVinculoT1").value != ""){ | ||
489 | - colunas = i3GEOF.tabela.comboColunas($i("i3GEOFTabelaOpcoesAdicionaVinculoT1").value, "i3GEOFTabelaOpcoesAdicionaVinculoColunaT1"); | ||
490 | - } | ||
491 | - $i("i3GEOFTabelaVinculoT1Colunas").innerHTML = colunas; | ||
492 | - }, | ||
493 | - comboColunasT2 : function() { | ||
494 | - var colunas = ""; | ||
495 | - if($i("i3GEOFTabelaOpcoesAdicionaVinculoT2").value != ""){ | ||
496 | - colunas = i3GEOF.tabela.comboColunas($i("i3GEOFTabelaOpcoesAdicionaVinculoT2").value, "i3GEOFTabelaOpcoesAdicionaVinculoColunaT2"); | ||
497 | - } | ||
498 | - $i("i3GEOFTabelaVinculoT2Colunas").innerHTML = colunas; | ||
499 | - }, | ||
500 | - lista : function() { | ||
501 | - var v = i3GEOF.tabela.vinculos.ligacoes, n = v.length, ins = | ||
502 | - "<h5>" + $trad('vinculos', i3GEOF.tabela.dicionario) + "</h5>", i; | ||
503 | - for (i = 0; i < n; i++) { | ||
504 | - ins += '<button title="excluir" onclick="i3GEOF.tabela.vinculos.excluir(\'' | ||
505 | - + i + '\')"' | ||
506 | - + ' class="btn btn-xs" style="vertical-align:top;margin: 2px; padding: 2px; display:inline-block;"><span class="material-icons">clear</span></button>' | ||
507 | - + "<h5 style='display:inline-block;vertical-align:top;'>" + v[i].t1 | ||
508 | - + " " | ||
509 | - + v[i].c1 | ||
510 | - + " -> <br>" | ||
511 | - + v[i].t2 | ||
512 | - + " " | ||
513 | - + v[i].c2 | ||
514 | - + "</h5>"; | ||
515 | - } | ||
516 | - $i("i3GEOFtabelaVinculosLista").innerHTML = ins; | ||
517 | - }, | ||
518 | - excluir : function(i) { | ||
519 | - i3GEOF.tabela.vinculos.ligacoes.splice(parseInt(i, 10), 1); | ||
520 | - i3GEOF.tabela.vinculos.lista(); | ||
521 | - }, | ||
522 | - atualizaVinculos : function(tabelaOrigem, registro, marcado) { | ||
523 | - var v = i3GEOF.tabela.vinculos.ligacoes, n = v.length, i, valor; | ||
524 | - if (n > 0) { | ||
525 | - for (i = 0; i < n; i++) { | ||
526 | - // verifica se o vinculo existe | ||
527 | - if (v[i].t1 === tabelaOrigem) { | ||
528 | - // pega o valor do registro na tabela origem | ||
529 | - valor = i3GEOF.tabela.vinculos.pegaValorRegistro(v[i].t1, v[i].c1, registro); | ||
530 | - // marca o registro na tabela destino | ||
531 | - i3GEOF.tabela.vinculos.registro(v[i].t2, v[i].c2, valor, marcado); | ||
532 | - } | ||
533 | - if (v[i].t2 === tabelaOrigem) { | ||
534 | - // pega o valor do registro na tabela origem | ||
535 | - valor = i3GEOF.tabela.vinculos.pegaValorRegistro(v[i].t2, v[i].c2, registro); | ||
536 | - // marca o registro na tabela destino | ||
537 | - i3GEOF.tabela.vinculos.registro(v[i].t1, v[i].c1, valor, marcado); | ||
538 | - } | ||
539 | - } | ||
540 | - } | ||
541 | - }, | ||
542 | - // verifica qtas colunas devem ser puladas em cada linha | ||
543 | - colunasVazias : function(idjanela) { | ||
544 | - var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), pular = 0, colunas, n, i; | ||
545 | - colunas = linhas[0].getElementsByTagName("td"); | ||
546 | - n = colunas.length; | ||
547 | - for (i = 0; i < n; i++) { | ||
548 | - if (colunas[i].innerHTML == "") { | ||
549 | - pular++; | ||
550 | - } | ||
551 | - } | ||
552 | - return pular; | ||
553 | - }, | ||
554 | - // pega o indice de uma coluna em uma tabela buscando no cabecalho | ||
555 | - // no valor de title em cada celula | ||
556 | - indiceColuna : function(idjanela, t) { | ||
557 | - var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), linha = linhas[0], colunas = | ||
558 | - linha.getElementsByTagName("td"), indice = 0, n = colunas.length, i, s; | ||
559 | - for (i = 0; i < n; i++) { | ||
560 | - s = colunas[i].getElementsByTagName("span"); | ||
561 | - if (s && s[0] && s[0].title && s[0].title == t) { | ||
562 | - return i; | ||
563 | - } | ||
564 | - } | ||
565 | - return indice; | ||
566 | - }, | ||
567 | - // retorna o indice de uma coluna que contem a tag input na tabela | ||
568 | - // com a lista de valores | ||
569 | - indiceColunaInput : function(idjanela) { | ||
570 | - var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), linha = linhas[1], colunas = | ||
571 | - linha.getElementsByTagName("td"), indice = 0, n = colunas.length, i; | ||
572 | - for (i = 0; i < n; i++) { | ||
573 | - if (colunas[i].getElementsByTagName("input").length > 0) { | ||
574 | - return i; | ||
575 | - } | ||
576 | - } | ||
577 | - return indice; | ||
578 | - }, | ||
579 | - // pega o valor da coluna em uma tabela com a lista de valores com | ||
580 | - // base no codigo do registro | ||
581 | - pegaValorRegistro : function(idjanela, coluna, registro) { | ||
582 | - var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), n = linhas.length, indiceColuna = | ||
583 | - i3GEOF.tabela.vinculos.indiceColuna(idjanela, coluna), indiceColunaInput = | ||
584 | - i3GEOF.tabela.vinculos.indiceColunaInput(idjanela), i, linha, colunas; | ||
585 | - for (i = 1; i < n; i++) { | ||
586 | - linha = linhas[i]; | ||
587 | - colunas = linha.getElementsByTagName("td"); | ||
588 | - if (colunas[indiceColunaInput].getElementsByTagName("input")[0].name == registro) { | ||
589 | - return colunas[indiceColuna].innerHTML; | ||
590 | - } | ||
591 | - } | ||
592 | - return ""; | ||
593 | - }, | ||
594 | - registro : function(idjanela, coluna, valor, marcado) { | ||
595 | - var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), n = linhas.length, indiceColuna = | ||
596 | - i3GEOF.tabela.vinculos.indiceColuna(idjanela, coluna), indiceColunaInput = | ||
597 | - i3GEOF.tabela.vinculos.indiceColunaInput(idjanela), i, linha, colunas, reg; | ||
598 | - for (i = 1; i < n; i++) { | ||
599 | - linha = linhas[i]; | ||
600 | - colunas = linha.getElementsByTagName("td"); | ||
601 | - if (colunas[indiceColuna].innerHTML == valor) { | ||
602 | - reg = colunas[indiceColunaInput].getElementsByTagName("input")[0]; | ||
603 | - reg.checked = marcado; | ||
604 | - i3GEOF.tabela.propJanelas[idjanela].registros[reg.name] = marcado; | ||
605 | - } | ||
606 | - } | ||
607 | - }, | ||
608 | - }, | ||
609 | - comboJanelas : function(idcombo, funcao, w) { | ||
610 | - var i, n = i3GEOF.tabela.janelas.length; | ||
611 | - if (!funcao) { | ||
612 | - funcao = ""; | ||
613 | - } | ||
614 | - if (!w) { | ||
615 | - w = 260; | ||
616 | - } | ||
617 | - ins = | ||
618 | - "" + " <select class='form-control' style='width:" | ||
619 | - + w | ||
620 | - + "px;' id='" | ||
621 | - + idcombo | ||
622 | - + "' onchange='" | ||
623 | - + funcao | ||
624 | - + "'>" | ||
625 | - + " <option value='' >---</option>"; | ||
626 | - for (i = 0; i < n; i++) { | ||
627 | - ins += "<option value='" + i3GEOF.tabela.janelas[i] + "' >" + i3GEOF.tabela.janelas[i] + "</option>"; | ||
628 | - } | ||
629 | - ins += "</select>"; | ||
630 | - return ins; | ||
631 | - }, | ||
632 | - comboColunas : function(idJanela, idcombo, funcao) { | ||
633 | - var i, c = i3GEOF.tabela.propJanelas[idJanela].colunas, n = c.itens.length; | ||
634 | - if (!funcao) { | ||
635 | - funcao = ""; | ||
636 | - } | ||
637 | - ins = "<select class='form-control' id='" | ||
638 | - + idcombo | ||
639 | - + "' onchange='" | ||
640 | - + funcao | ||
641 | - + "'>" | ||
642 | - + " <option value='' >---</option>"; | ||
643 | - for (i = 0; i < n; i++) { | ||
644 | - ins += "<option value='" + c.itens[i] + "' >" + c.alias[i] + "</option>"; | ||
645 | - } | ||
646 | - ins += "</select>"; | ||
647 | - return ins; | ||
648 | - }, | ||
649 | - /* | ||
650 | - * Function: ativaAutoAtualiza | ||
651 | - * | ||
652 | - * Ativa ou desativa a atualização automática da tabela quando o usuário navega no mapa | ||
653 | - */ | ||
654 | - atualizaListaDeRegistros : function() { | ||
655 | - var i, janelas = i3GEOF.tabela.janelas, propJanelas = i3GEOF.tabela.propJanelas, n = janelas.length; | ||
656 | - for (i = 0; i < n; i++) { | ||
657 | - if (propJanelas[janelas[i]].atualiza === true) { | ||
658 | - i3GEOF.tabela.pegaRegistros(janelas[i]); | ||
659 | - } | ||
660 | - } | ||
661 | - }, | ||
662 | - /* | ||
663 | - * Function: pegaRegistros | ||
664 | - * | ||
665 | - * Pega os registros da tabela de atributos do tema | ||
666 | - * | ||
667 | - * Veja: | ||
668 | - * | ||
669 | - * <LISTAREGISTROS> | ||
670 | - */ | ||
671 | - pegaRegistros : function(idjanela, tipolista, dadosDaClasse, inicio, fim, funcao) { | ||
672 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
673 | - return; | ||
674 | - } | ||
675 | - if (!idjanela) { | ||
676 | - idjanela = ""; | ||
677 | - } | ||
678 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
679 | - $i(idjanela + "i3GEOtabelaregistros").innerHTML = ""; | ||
680 | - var p, ext, tiporeg = "brasil", cp = new cpaint(); | ||
681 | - // verifica se esta no modo de atualizacao automatica | ||
682 | - if (i3GEOF.tabela.propJanelas[idjanela].atualiza === true) { | ||
683 | - tiporeg = "mapa"; | ||
684 | - } | ||
685 | - if (!tipolista) { | ||
686 | - if ($i(idjanela + "i3GEOtabelatipolista").checked) { | ||
687 | - tipolista = "selecionados"; | ||
688 | - } else { | ||
689 | - tipolista = "tudo"; | ||
690 | - } | ||
691 | - } | ||
692 | - if (!dadosDaClasse) { | ||
693 | - if ($i(idjanela + "i3GEOtabelalegenda").checked) { | ||
694 | - dadosDaClasse = "sim"; | ||
695 | - } else { | ||
696 | - dadosDaClasse = "nao"; | ||
697 | - } | ||
698 | - } | ||
699 | - if (!inicio) { | ||
700 | - inicio = $i(idjanela + "i3GEOtabelainicio").value - 1; | ||
701 | - } else { | ||
702 | - inicio = ""; | ||
703 | - } | ||
704 | - if (!fim) { | ||
705 | - fim = $i(idjanela + "i3GEOtabelafim").value - 1; | ||
706 | - } else { | ||
707 | - fim = ""; | ||
708 | - } | ||
709 | - if (!funcao) { | ||
710 | - funcao = function(retorno) { | ||
711 | - i3GEOF.tabela.propJanelas[idjanela].registros = []; | ||
712 | - i3GEOF.tabela.montaTabela(retorno, idjanela); | ||
713 | - }; | ||
714 | - } | ||
715 | - ext = i3GEO.parametros.mapexten; | ||
716 | - ext = i3GEO.util.extOSM2Geo(ext); | ||
717 | - p = | ||
718 | - i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid=" | ||
719 | - + i3GEO.configura.sid | ||
720 | - + "&funcao=listaregistros" | ||
721 | - + "&inicio=" | ||
722 | - + inicio | ||
723 | - + "&fim=" | ||
724 | - + fim | ||
725 | - + "&tema=" | ||
726 | - + i3GEOF.tabela.propJanelas[idjanela].tema | ||
727 | - + "&tipo=" | ||
728 | - + tiporeg | ||
729 | - + "&tipolista=" | ||
730 | - + tipolista | ||
731 | - + "&ext=" | ||
732 | - + ext | ||
733 | - + "&dadosDaClasse=" | ||
734 | - + dadosDaClasse; | ||
735 | - cp.set_response_type("JSON"); | ||
736 | - cp.call(p, "listaRegistros", funcao); | ||
737 | - }, | ||
738 | - /* | ||
739 | - * Function: montaTabela | ||
740 | - * | ||
741 | - * Monta a visualização da tabela de atributos | ||
742 | - */ | ||
743 | - montaTabela : function(retorno, idjanela) { | ||
744 | - if (retorno.data !== undefined) { | ||
745 | - var mustache = { | ||
746 | - "idjanela": "", | ||
747 | - "cabecalho": [{"classe":"hidden"},{"classe":"hidden"},{"classe":"hidden"},{"classe":"hidden"}], //4 colunas com icones | ||
748 | - "linhas": [], | ||
749 | - "ordena": $trad('ordena', i3GEOF.tabela.dicionario), | ||
750 | - "excluir": $trad("t12") | ||
751 | - }, | ||
752 | - linha = { | ||
753 | - "classezoom": "", | ||
754 | - "ext": "", | ||
755 | - "indice": "", | ||
756 | - "idjanela": "" | ||
757 | - }, | ||
758 | - ins, i, vals, cor, j, n, stat, imagem, registros = i3GEOF.tabela.propJanelas[idjanela].registros, i3GEOtabelalegenda = | ||
759 | - $i(idjanela + "i3GEOtabelalegenda").checked; | ||
760 | - // cabecalho da tabela | ||
761 | - mustache["idjanela"] = idjanela; | ||
762 | - i3GEOF.tabela.propJanelas[idjanela].colunas = { | ||
763 | - "itens" : retorno.data[0].itens, | ||
764 | - "alias" : retorno.data[0].alias | ||
765 | - }; | ||
766 | - n = retorno.data[0].itens.length; | ||
767 | - for (i = 0; i < n; i++) { | ||
768 | - mustache.cabecalho.push({ | ||
769 | - "idcoluna": i * 1 + 4, //pq tem 3 colunas com icones | ||
770 | - "idjanela": idjanela, | ||
771 | - "item": retorno.data[0].itens[i], | ||
772 | - "alias": retorno.data[0].alias[i], | ||
773 | - "classe": "" | ||
774 | - }); | ||
775 | - } | ||
776 | - n = retorno.data[1].registros.length; | ||
777 | - if ($i(idjanela + "i3GEOtabelafim").value === "") { | ||
778 | - $i(idjanela + "i3GEOtabelafim").value = n - 1; | ||
779 | - } | ||
780 | - for (i = 0; i < n; i++) { | ||
781 | - linha = {}; | ||
782 | - linha.classezoom = "hidden"; | ||
783 | - linha.ext = ""; | ||
784 | - linha.idjanela = idjanela; | ||
785 | - linha.indice = retorno.data[1].registros[i].indice; | ||
786 | - if (retorno.data[1].registros[i].ext && retorno.data[1].registros[i].ext != "") { | ||
787 | - linha.classezoom = ""; | ||
788 | - linha.ext = retorno.data[1].registros[i].ext; | ||
789 | - } | ||
790 | - linha.stat = ""; | ||
791 | - if (retorno.data[1].registros[i].status === "CHECKED") { | ||
792 | - linha.stat = "CHECKED"; | ||
793 | - } | ||
794 | - if (registros[retorno.data[1].registros[i].indice]) { | ||
795 | - if (registros[retorno.data[1].registros[i].indice] === true) { | ||
796 | - linha.stat = "CHECKED"; | ||
797 | - } else { | ||
798 | - linha.stat = ""; | ||
799 | - } | ||
800 | - } | ||
801 | - if (i3GEOtabelalegenda == true) { | ||
802 | - linha.classelegenda = ""; | ||
803 | - linha.nomeClasse = retorno.data[1].registros[i].classe["nome"]; | ||
804 | - linha.imagemClasse = retorno.data.legenda[retorno.data[1].registros[i].classe["indice"]]; | ||
805 | - imagem = retorno.data.legenda[retorno.data[1].registros[i].classe["indice"]]; | ||
806 | - } else { | ||
807 | - linha.classelegenda = "hidden"; | ||
808 | - linha.nomeClasse = ""; | ||
809 | - linha.imagemClasse = ""; | ||
810 | - } | ||
811 | - if (linha.stat === "CHECKED") { | ||
812 | - registros[retorno.data[1].registros[i].indice] = true; | ||
813 | - } | ||
814 | - vals = retorno.data[1].registros[i].valores; | ||
815 | - linha.colunas = ""; | ||
816 | - for (j = 0; j < vals.length; j++) { | ||
817 | - linha.colunas += "<td style='min-width: 150px;' title='" + vals[j].item + "' >" + vals[j].valor + "</td>"; | ||
818 | - } | ||
819 | - mustache.linhas.push(linha); | ||
820 | - } | ||
821 | - ins = Mustache.render(i3GEOF.tabela.MUSTACHELISTA, mustache); | ||
822 | - $i(idjanela + "i3GEOtabelaregistros").innerHTML = ins; | ||
823 | - } | ||
824 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
825 | - }, | ||
826 | - /* | ||
827 | - * Function: mais | ||
828 | - * | ||
829 | - * Avança o contador de registros para a listagem | ||
830 | - */ | ||
831 | - mais : function(idjanela) { | ||
832 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
833 | - return; | ||
834 | - } | ||
835 | - var i = $i(idjanela + "i3GEOtabelainicio").value * 1, f = $i(idjanela + "i3GEOtabelafim").value * 1, d = f - i; | ||
836 | - $i(idjanela + "i3GEOtabelainicio").value = f + 1; | ||
837 | - $i(idjanela + "i3GEOtabelafim").value = f + d + 1; | ||
838 | - i3GEOF.tabela.pegaRegistros(idjanela); | ||
839 | - }, | ||
840 | - /* | ||
841 | - * Function: todos | ||
842 | - * | ||
843 | - * Avança o contador de registros para o fim da listagem | ||
844 | - */ | ||
845 | - todos : function(idjanela) { | ||
846 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
847 | - return; | ||
848 | - } | ||
849 | - $i(idjanela + "i3GEOtabelainicio").value = 1; | ||
850 | - $i(idjanela + "i3GEOtabelafim").value = ""; | ||
851 | - i3GEOF.tabela.pegaRegistros(idjanela, false, false, false, 1, false); | ||
852 | - }, | ||
853 | - /* | ||
854 | - * Function: menos | ||
855 | - * | ||
856 | - * Retrocede o contador de registros para a listagem | ||
857 | - */ | ||
858 | - menos : function(idjanela) { | ||
859 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
860 | - return; | ||
861 | - } | ||
862 | - var i = $i(idjanela + "i3GEOtabelainicio").value * 1, f = $i(idjanela + "i3GEOtabelafim").value * 1, d = f - i; | ||
863 | - $i(idjanela + "i3GEOtabelainicio").value = i - d - 1; | ||
864 | - $i(idjanela + "i3GEOtabelafim").value = i - 1; | ||
865 | - if ($i(idjanela + "i3GEOtabelainicio").value < 1) { | ||
866 | - $i(idjanela + "i3GEOtabelainicio").value = 1; | ||
867 | - $i(idjanela + "i3GEOtabelafim").value = 1 + d; | ||
868 | - } | ||
869 | - i3GEOF.tabela.pegaRegistros(idjanela); | ||
870 | - }, | ||
871 | - /* | ||
872 | - * Function: excluiColuna | ||
873 | - * | ||
874 | - * Exclui uma coluna da visualização da tabela | ||
875 | - */ | ||
876 | - excluiColuna : function(coluna, cid, idjanela) { | ||
877 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
878 | - try { | ||
879 | - var tabela = $i(idjanela + "i3GEOtabelatabelai"), trs, tds, i, t, nt, ni; | ||
880 | - // pega o indice correto | ||
881 | - tds = coluna.parentNode.parentNode.getElementsByTagName("td"); | ||
882 | - nt = tds.length; | ||
883 | - for (t = 0; t < nt; t++) { | ||
884 | - if (tds[t].accessKey == cid) { | ||
885 | - cid = t; | ||
886 | - break; | ||
887 | - } | ||
888 | - } | ||
889 | - trs = tabela.getElementsByTagName("tr"); | ||
890 | - nt = trs.length; | ||
891 | - for (t = 0; t < nt; t++) { | ||
892 | - i = trs[t]; | ||
893 | - if (i.getElementsByTagName("td")[cid]) { | ||
894 | - ni = i.getElementsByTagName("td")[cid]; | ||
895 | - i.removeChild(ni); | ||
896 | - } | ||
897 | - } | ||
898 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
899 | - } catch (e) { | ||
900 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
901 | - if (typeof (console) !== 'undefined') { | ||
902 | - console.error(e); | ||
903 | - } | ||
904 | - } | ||
905 | - }, | ||
906 | - /* | ||
907 | - * Function: ordenaColuna | ||
908 | - * | ||
909 | - * Ordena uma coluna da tabela | ||
910 | - */ | ||
911 | - ordenaColuna : function(coluna, cid, idjanela) { | ||
912 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
913 | - try { | ||
914 | - var numero = false,tabela = $i(idjanela + "i3GEOtabelatabelai"), trs = tabela.getElementsByTagName("tr"), | ||
915 | - ntrs = trs.length, tds, nt, psort = [], t, psortfim, npsortfim, ins, p, e, c; | ||
916 | - | ||
917 | - // pega o indice correto | ||
918 | - tds = coluna.parentNode.parentNode.getElementsByTagName("td"); | ||
919 | - nt = tds.length; | ||
920 | - for (t = 0; t < nt; t++) { | ||
921 | - if (tds[t].accessKey == cid) { | ||
922 | - cid = t; | ||
923 | - break; | ||
924 | - } | ||
925 | - } | ||
926 | - for (t = 1; t < ntrs; t++) { | ||
927 | - c = trs[t].getElementsByTagName("td")[cid].innerHTML; | ||
928 | - psort.push( c + "@$" + t); | ||
929 | - if (c * 1) { | ||
930 | - numero = true; | ||
931 | - } | ||
932 | - } | ||
933 | - // recosntroi a tabela | ||
934 | - if(numero){ | ||
935 | - psortfim = psort.sort(function(a, b) { | ||
936 | - return a.split("@$")[0]*1 - b.split("@$")[0]*1; | ||
937 | - }); | ||
938 | - } else { | ||
939 | - psortfim = psort.sort(); | ||
940 | - } | ||
941 | - | ||
942 | - ins = "<table id=" + idjanela + "i3GEOtabelatabelai class=lista8 >"; | ||
943 | - ins += "<tr>" + trs[0].innerHTML + "</tr>"; | ||
944 | - npsortfim = psortfim.length; | ||
945 | - for (p = 0; p < npsortfim; p++) { | ||
946 | - e = psortfim[p].split("@$")[1] * 1; | ||
947 | - if (trs[e] !== undefined) { | ||
948 | - ins += "<tr>" + trs[e].innerHTML + "</tr>"; | ||
949 | - } | ||
950 | - } | ||
951 | - $i(idjanela + "i3GEOtabelaregistros").innerHTML = ins + "</table>"; | ||
952 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
953 | - } catch (e) { | ||
954 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
955 | - if (typeof (console) !== 'undefined') { | ||
956 | - console.error(e); | ||
957 | - } | ||
958 | - } | ||
959 | - }, | ||
960 | - excluiLinha : function(celula) { | ||
961 | - var p = celula.parentNode.parentNode; | ||
962 | - do { | ||
963 | - p.removeChild(p.childNodes[0]); | ||
964 | - } while (p.childNodes.length > 0); | ||
965 | - p.parentNode.removeChild(p); | ||
966 | - }, | ||
967 | - zoomExt : function(ext, idjanela) { | ||
968 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
969 | - return; | ||
970 | - } | ||
971 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
972 | - var funcao = function() { | ||
973 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
974 | - i3GEOF.tabela.pegaRegistros(idjanela); | ||
975 | - i3GEO.atualiza(); | ||
976 | - }; | ||
977 | - i3GEO.php.mudaext(funcao, "nenhum", ext); | ||
978 | - }, | ||
979 | - registraLinha : function(linha, idjanela) { | ||
980 | - i3GEOF.tabela.propJanelas[idjanela].registros[linha.name] = linha.checked; | ||
981 | - i3GEOF.tabela.vinculos.atualizaVinculos(idjanela, linha.name, linha.checked); | ||
982 | - }, | ||
983 | - /* | ||
984 | - * Function: listaMarcados | ||
985 | - * | ||
986 | - * Retorna um array com os índices dos registros que estão marcados. | ||
987 | - */ | ||
988 | - listaMarcados : function(idjanela) { | ||
989 | - var lista = [], registros = i3GEOF.tabela.propJanelas[idjanela].registros, i, n = registros.length; | ||
990 | - for (i = 0; i < n; i++) { | ||
991 | - if (registros[i] === true) { | ||
992 | - lista.push(i); | ||
993 | - } | ||
994 | - } | ||
995 | - return lista; | ||
996 | - }, | ||
997 | - /* | ||
998 | - * Function: ativaSelecao | ||
999 | - * | ||
1000 | - * Seleciona no mapa os elementos que estiverem marcados na guia 2 | ||
1001 | - * | ||
1002 | - * Veja: | ||
1003 | - * | ||
1004 | - * <INCLUISEL> | ||
1005 | - */ | ||
1006 | - ativaSelecao : function(idjanela) { | ||
1007 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1008 | - return; | ||
1009 | - } | ||
1010 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1011 | - var lista = i3GEOF.tabela.listaMarcados(idjanela), p, cp, temp = function(retorno) { | ||
1012 | - if (retorno) { | ||
1013 | - i3GEO.Interface.atualizaTema(retorno, i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1014 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1015 | - } | ||
1016 | - }; | ||
1017 | - p = | ||
1018 | - i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid=" | ||
1019 | - + i3GEO.configura.sid | ||
1020 | - + "&funcao=incluisel&tema=" | ||
1021 | - + i3GEOF.tabela.propJanelas[idjanela].tema | ||
1022 | - + "&ids=" | ||
1023 | - + lista.toString(); | ||
1024 | - cp = new cpaint(); | ||
1025 | - cp.set_response_type("JSON"); | ||
1026 | - cp.call(p, "incluiSel", temp); | ||
1027 | - }, | ||
1028 | - /* | ||
1029 | - * Function: limpaSelecao | ||
1030 | - * | ||
1031 | - * Limpa a seleção do tema da tabela | ||
1032 | - */ | ||
1033 | - limpaSelecao : function(idjanela) { | ||
1034 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1035 | - return; | ||
1036 | - } | ||
1037 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1038 | - i3GEO.tema.limpasel(i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1039 | - i3GEOF.tabela.propJanelas[idjanela].registros = []; | ||
1040 | - var lista = $i(idjanela + "i3GEOtabelatabelai").getElementsByTagName("input"), n = lista.length, i; | ||
1041 | - for (i = 0; i < n; i++) { | ||
1042 | - lista[i].checked = false; | ||
1043 | - } | ||
1044 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1045 | - }, | ||
1046 | - /* | ||
1047 | - * Function: criaNovoTema | ||
1048 | - * | ||
1049 | - * Cria um novo tema contendo a seleção existente | ||
1050 | - */ | ||
1051 | - criaNovoTema : function(idjanela) { | ||
1052 | - var camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1053 | - if(camada.nsel == 0){ | ||
1054 | - i3GEO.janela.tempoMsg($trad("selUmReg",i3GEOF.tabela.dicionario)); | ||
1055 | - return; | ||
1056 | - } | ||
1057 | - | ||
1058 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1059 | - return; | ||
1060 | - } | ||
1061 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1062 | - var temp = function(retorno) { | ||
1063 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1064 | - i3GEO.atualiza(retorno); | ||
1065 | - }; | ||
1066 | - i3GEO.php.criatemaSel(temp, i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1067 | - }, | ||
1068 | - /* | ||
1069 | - * Function: comboItens | ||
1070 | - * | ||
1071 | - * Cria um combo para selecionar um item do tema escolhido | ||
1072 | - */ | ||
1073 | - comboItensEstat : function(idjanela) { | ||
1074 | - var tema = i3GEOF.tabela.propJanelas[idjanela].tema; | ||
1075 | - i3GEO.util.comboItens(idjanela + "i3GEOtabelaComboItensGuia3", tema, function(retorno) { | ||
1076 | - if (retorno.tipo === "erro") { | ||
1077 | - $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML = | ||
1078 | - i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem2',i3GEOF.tabela.dicionario) + '</div>'); | ||
1079 | - } else { | ||
1080 | - $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML = retorno.dados; | ||
1081 | - } | ||
1082 | - }, idjanela + "i3GEOtabelaitensGuia3", "","sim","","form-control"); | ||
1083 | - }, | ||
1084 | - estatistica : function(idjanela) { | ||
1085 | - if ($i(idjanela + "i3GEOtabelaComboItensGuia3").value === "") { | ||
1086 | - i3GEO.janela.tempoMsg("Escolha um item!"); | ||
1087 | - return; | ||
1088 | - } | ||
1089 | - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1090 | - return; | ||
1091 | - } | ||
1092 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1093 | - try { | ||
1094 | - var monta = function(retorno) { | ||
1095 | - var ins = "", nome, valor, i, n; | ||
1096 | - if (retorno.data.indices !== undefined) { | ||
1097 | - if (retorno.data.indices) { | ||
1098 | - n = retorno.data.indices.length; | ||
1099 | - for (i = 0; i < n; i++) { | ||
1100 | - nome =retorno.data.variaveis[retorno.data.indices[i]]; | ||
1101 | - valor = retorno.data.valores[retorno.data.indices[i]]; | ||
1102 | - ins += '<div class="row-content"><h4 class="list-group-item-heading">'+nome+'</h4><p class="list-group-item-text">'+valor+'</p></div>'; | ||
1103 | - ins += '<div class="list-group-separator"> </div>'; | ||
1104 | - } | ||
1105 | - } | ||
1106 | - } else { | ||
1107 | - ins = retorno.data; | ||
1108 | - } | ||
1109 | - $i(idjanela + "i3GEOtabelaoperacoes").innerHTML = ins + "<br>"; | ||
1110 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1111 | - }, exclui = "", cp = new cpaint(), p; | ||
1112 | - if ($i(idjanela + "i3GEOtabelafiltro1").value !== "") { | ||
1113 | - exclui = $i("i3GEOtabelafiltro1").value; | ||
1114 | - } | ||
1115 | - p = | ||
1116 | - i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid=" | ||
1117 | - + i3GEO.configura.sid | ||
1118 | - + "&funcao=estatistica&item=" | ||
1119 | - + $i(idjanela + "i3GEOtabelaComboItensGuia3").value | ||
1120 | - + "&tema=" | ||
1121 | - + i3GEOF.tabela.propJanelas[idjanela].tema | ||
1122 | - + "&exclui=" | ||
1123 | - + exclui | ||
1124 | - + "&ext=" | ||
1125 | - + i3GEO.parametros.mapexten; | ||
1126 | - cp.set_response_type("JSON"); | ||
1127 | - cp.call(p, "estatDescritivas", monta); | ||
1128 | - } catch (e) { | ||
1129 | - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1130 | - $i("operacoes").innerHTML = "Ocorreu um erro: " + e; | ||
1131 | - } | ||
1132 | - }, | ||
1133 | - tabelaTexto : function() { | ||
1134 | - }, | ||
1135 | - /* | ||
1136 | - * Function: relatorioTabela | ||
1137 | - * | ||
1138 | - * Monta o relatório padrão em uma nova janela | ||
1139 | - */ | ||
1140 | - relatorioTabela : function(idjanela) { | ||
1141 | - try { | ||
1142 | - $i(idjanela + "i3GEOtabelatiporelh").value = ""; | ||
1143 | - $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked; | ||
1144 | - $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked; | ||
1145 | - $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value; | ||
1146 | - $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema; | ||
1147 | - $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid; | ||
1148 | - $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value; | ||
1149 | - var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listaordem = [], listanomes = | ||
1150 | - [], nome, ordem, i, temp, n = inputs.length; | ||
1151 | - for (i = 0; i < n; i++) { | ||
1152 | - if (inputs[i].type === "checkbox" && inputs[i].checked == true) { | ||
1153 | - listai.push(inputs[i].id + "|" + inputs[i].name); | ||
1154 | - nome = $i(inputs[i].id + inputs[i].name).value; | ||
1155 | - listanomes.push(nome); | ||
1156 | - ordem = $i("ordem_" + inputs[i].id + inputs[i].name).value; | ||
1157 | - if (ordem === "") { | ||
1158 | - ordem = 0; | ||
1159 | - } | ||
1160 | - listaordem.push(ordem); | ||
1161 | - } | ||
1162 | - } | ||
1163 | - $i(idjanela + "i3GEOtabelaordemrel").value = listaordem; | ||
1164 | - $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes; | ||
1165 | - $i(idjanela + "i3GEOtabelaitensrelh").value = listai; | ||
1166 | - temp = $i(idjanela + "i3GEOtabelarelatorio").action; | ||
1167 | - $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten; | ||
1168 | - $i(idjanela + "i3GEOtabelarelatorio").submit(); | ||
1169 | - $i(idjanela + "i3GEOtabelarelatorio").action = temp; | ||
1170 | - } catch (e) { | ||
1171 | - i3GEO.janela.tempoMsg(e); | ||
1172 | - } | ||
1173 | - }, | ||
1174 | - /* | ||
1175 | - * Function: relatorioTexto | ||
1176 | - * | ||
1177 | - * Gera o relatório no formato CSV | ||
1178 | - */ | ||
1179 | - relatorioTexto : function(idjanela) { | ||
1180 | - $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked; | ||
1181 | - $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked; | ||
1182 | - $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value; | ||
1183 | - $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema; | ||
1184 | - $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid; | ||
1185 | - $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value; | ||
1186 | - $i(idjanela + "i3GEOtabelatiporelh").value = "csv"; | ||
1187 | - var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listanomes = [], nome, i, temp, n = | ||
1188 | - inputs.length; | ||
1189 | - for (i = 0; i < n; i++) { | ||
1190 | - if (inputs[i].checked === true) { | ||
1191 | - listai.push(inputs[i].id + "|" + inputs[i].name); | ||
1192 | - nome = $i(inputs[i].id + inputs[i].name).value; | ||
1193 | - listanomes.push(nome); | ||
1194 | - } | ||
1195 | - } | ||
1196 | - $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes; | ||
1197 | - $i(idjanela + "i3GEOtabelaitensrelh").value = listai; | ||
1198 | - temp = $i(idjanela + "i3GEOtabelarelatorio").action; | ||
1199 | - $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten; | ||
1200 | - $i(idjanela + "i3GEOtabelarelatorio").submit(); | ||
1201 | - $i(idjanela + "i3GEOtabelarelatorio").action = temp; | ||
1202 | - } | 391 | + ins = "<table id=" + "i3GEOtabelatabelai class=lista8 >"; |
392 | + ins += "<tr>" + trs[0].innerHTML + "</tr>"; | ||
393 | + npsortfim = psortfim.length; | ||
394 | + for (p = 0; p < npsortfim; p++) { | ||
395 | + e = psortfim[p].split("@$")[1] * 1; | ||
396 | + if (trs[e] !== undefined) { | ||
397 | + ins += "<tr>" + trs[e].innerHTML + "</tr>"; | ||
398 | + } | ||
399 | + } | ||
400 | + $i("i3GEOtabelaregistros").innerHTML = ins + "</table>"; | ||
401 | + } catch (e) { | ||
402 | + if (typeof (console) !== 'undefined') { | ||
403 | + console.error(e); | ||
404 | + } | ||
405 | + } | ||
406 | + }, | ||
407 | + excluiLinha : function(celula) { | ||
408 | + var p = celula.parentNode.parentNode; | ||
409 | + do { | ||
410 | + p.removeChild(p.childNodes[0]); | ||
411 | + } while (p.childNodes.length > 0); | ||
412 | + p.parentNode.removeChild(p); | ||
413 | + }, | ||
414 | + zoomExt : function(ext, idjanela) { | ||
415 | + var funcao = function() { | ||
416 | + i3GEOF.tabela.pegaRegistros(); | ||
417 | + i3GEO.atualiza(); | ||
418 | + }; | ||
419 | + i3GEO.php.mudaext(funcao, "nenhum", ext); | ||
420 | + }, | ||
421 | + registraLinha : function(linha, idjanela) { | ||
422 | + i3GEOF.tabela._parameters.registros[linha.name] = linha.checked; | ||
423 | + }, | ||
424 | + /* | ||
425 | + * Function: listaMarcados | ||
426 | + * | ||
427 | + * Retorna um array com os índices dos registros que estão marcados. | ||
428 | + */ | ||
429 | + listaMarcados : function(idjanela) { | ||
430 | + var lista = [], registros = i3GEOF.tabela._parameters.registros, i, n = registros.length; | ||
431 | + for (i = 0; i < n; i++) { | ||
432 | + if (registros[i] === true) { | ||
433 | + lista.push(i); | ||
434 | + } | ||
435 | + } | ||
436 | + return lista; | ||
437 | + }, | ||
438 | + /* | ||
439 | + * Function: ativaSelecao | ||
440 | + * | ||
441 | + * Seleciona no mapa os elementos que estiverem marcados na guia 2 | ||
442 | + * | ||
443 | + * Veja: | ||
444 | + * | ||
445 | + * <INCLUISEL> | ||
446 | + */ | ||
447 | + ativaSelecao : function() { | ||
448 | + var lista = i3GEOF.tabela.listaMarcados(), p, cp, temp = function(retorno) { | ||
449 | + if (retorno) { | ||
450 | + i3GEO.Interface.atualizaTema(retorno, i3GEOF.tabela._parameters.tema); | ||
451 | + } | ||
452 | + }; | ||
453 | + p = | ||
454 | + i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid=" | ||
455 | + + i3GEO.configura.sid | ||
456 | + + "&funcao=incluisel&tema=" | ||
457 | + + i3GEOF.tabela._parameters.tema | ||
458 | + + "&ids=" | ||
459 | + + lista.toString(); | ||
460 | + cp = new cpaint(); | ||
461 | + cp.set_response_type("JSON"); | ||
462 | + cp.call(p, "incluiSel", temp); | ||
463 | + }, | ||
464 | + /* | ||
465 | + * Function: limpaSelecao | ||
466 | + * | ||
467 | + * Limpa a seleção do tema da tabela | ||
468 | + */ | ||
469 | + limpaSelecao : function() { | ||
470 | + i3GEO.tema.limpasel(i3GEOF.tabela._parameters.tema); | ||
471 | + i3GEOF.tabela._parameters.registros = []; | ||
472 | + var lista = $i("i3GEOtabelatabelai").getElementsByTagName("input"), n = lista.length, i; | ||
473 | + for (i = 0; i < n; i++) { | ||
474 | + lista[i].checked = false; | ||
475 | + } | ||
476 | + }, | ||
477 | + /* | ||
478 | + * Function: criaNovoTema | ||
479 | + * | ||
480 | + * Cria um novo tema contendo a seleção existente | ||
481 | + */ | ||
482 | + criaNovoTema : function(idjanela) { | ||
483 | + var camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.tabela._parameters.tema); | ||
484 | + if(camada.nsel == 0){ | ||
485 | + i3GEO.janela.tempoMsg($trad("selUmReg",i3GEOF.tabela.dicionario)); | ||
486 | + return; | ||
487 | + } | ||
488 | + var temp = function(retorno) { | ||
489 | + i3GEO.atualiza(retorno); | ||
490 | + }; | ||
491 | + i3GEO.php.criatemaSel(temp, i3GEOF.tabela._parameters.tema); | ||
492 | + }, | ||
493 | + /* | ||
494 | + * Function: comboItens | ||
495 | + * | ||
496 | + * Cria um combo para selecionar um item do tema escolhido | ||
497 | + */ | ||
498 | + comboItensEstat : function(idjanela) { | ||
499 | + var tema = i3GEOF.tabela._parameters.tema; | ||
500 | + i3GEO.util.comboItens("i3GEOtabelaComboItensGuia3", tema, function(retorno) { | ||
501 | + if (retorno.tipo === "erro") { | ||
502 | + $i("i3GEOtabelaitensGuia3").innerHTML = | ||
503 | + i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem2',i3GEOF.tabela.dicionario) + '</div>'); | ||
504 | + } else { | ||
505 | + $i("i3GEOtabelaitensGuia3").innerHTML = retorno.dados; | ||
506 | + } | ||
507 | + }, "i3GEOtabelaitensGuia3", "","sim","","form-control"); | ||
508 | + }, | ||
509 | + estatistica : function(idjanela) { | ||
510 | + if ($i("i3GEOtabelaComboItensGuia3").value === "") { | ||
511 | + i3GEO.janela.tempoMsg("Escolha um item!"); | ||
512 | + return; | ||
513 | + } | ||
514 | + try { | ||
515 | + var monta = function(retorno) { | ||
516 | + var ins = "", nome, valor, i, n; | ||
517 | + if (retorno.data.indices !== undefined) { | ||
518 | + if (retorno.data.indices) { | ||
519 | + n = retorno.data.indices.length; | ||
520 | + for (i = 0; i < n; i++) { | ||
521 | + nome =retorno.data.variaveis[retorno.data.indices[i]]; | ||
522 | + valor = retorno.data.valores[retorno.data.indices[i]]; | ||
523 | + ins += '<div class="row-content"><h4 class="list-group-item-heading">'+nome+'</h4><p class="list-group-item-text">'+valor+'</p></div>'; | ||
524 | + ins += '<div class="list-group-separator"> </div>'; | ||
525 | + } | ||
526 | + } | ||
527 | + } else { | ||
528 | + ins = retorno.data; | ||
529 | + } | ||
530 | + $i("i3GEOtabelaoperacoes").innerHTML = ins + "<br>"; | ||
531 | + }, exclui = "", cp = new cpaint(), p; | ||
532 | + if ($i("i3GEOtabelafiltro1").value !== "") { | ||
533 | + exclui = $i("i3GEOtabelafiltro1").value; | ||
534 | + } | ||
535 | + p = | ||
536 | + i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid=" | ||
537 | + + i3GEO.configura.sid | ||
538 | + + "&funcao=estatistica&item=" | ||
539 | + + $i("i3GEOtabelaComboItensGuia3").value | ||
540 | + + "&tema=" | ||
541 | + + i3GEOF.tabela._parameters.tema | ||
542 | + + "&exclui=" | ||
543 | + + exclui | ||
544 | + + "&ext=" | ||
545 | + + i3GEO.parametros.mapexten; | ||
546 | + cp.set_response_type("JSON"); | ||
547 | + cp.call(p, "estatDescritivas", monta); | ||
548 | + } catch (e) { | ||
549 | + $i("operacoes").innerHTML = "Ocorreu um erro: " + e; | ||
550 | + } | ||
551 | + }, | ||
552 | + tabelaTexto : function() { | ||
553 | + }, | ||
554 | + /* | ||
555 | + * Function: relatorioTabela | ||
556 | + * | ||
557 | + * Monta o relatório padrão em uma nova janela | ||
558 | + */ | ||
559 | + relatorioTabela : function() { | ||
560 | + try { | ||
561 | + $i("i3GEOtabelatiporelh").value = ""; | ||
562 | + $i("i3GEOtabelaarearelh").value = $i("i3GEOtabelacalculaarea").checked; | ||
563 | + $i("i3GEOtabelastatrelh").value = $i("i3GEOtabelacalculaestat").checked; | ||
564 | + $i("i3GEOtabelaexcluirvalorh").value = $i("i3GEOtabelaexcestat").value; | ||
565 | + $i("i3GEOtabelatemarelh").value = i3GEOF.tabela._parameters.tema; | ||
566 | + $i("i3GEOtabelag_sidh").value = i3GEO.configura.sid; | ||
567 | + $i("i3GEOtabelaitemagruparelh").value = $i("i3GEOtabelaagrupaItem").value; | ||
568 | + var inputs = $i("i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listaordem = [], listanomes = | ||
569 | + [], nome, ordem, i, temp, n = inputs.length; | ||
570 | + for (i = 0; i < n; i++) { | ||
571 | + if (inputs[i].type === "checkbox" && inputs[i].checked == true) { | ||
572 | + listai.push(inputs[i].id + "|" + inputs[i].name); | ||
573 | + nome = $i(inputs[i].id + inputs[i].name).value; | ||
574 | + listanomes.push(nome); | ||
575 | + ordem = $i("ordem_" + inputs[i].id + inputs[i].name).value; | ||
576 | + if (ordem === "") { | ||
577 | + ordem = 0; | ||
578 | + } | ||
579 | + listaordem.push(ordem); | ||
580 | + } | ||
581 | + } | ||
582 | + $i("i3GEOtabelaordemrel").value = listaordem; | ||
583 | + $i("i3GEOtabelanomesrelh").value = listanomes; | ||
584 | + $i("i3GEOtabelaitensrelh").value = listai; | ||
585 | + temp = $i("i3GEOtabelarelatorio").action; | ||
586 | + $i("i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten; | ||
587 | + $i("i3GEOtabelarelatorio").submit(); | ||
588 | + $i("i3GEOtabelarelatorio").action = temp; | ||
589 | + } catch (e) { | ||
590 | + i3GEO.janela.tempoMsg(e); | ||
591 | + } | ||
592 | + }, | ||
593 | + /* | ||
594 | + * Function: relatorioTexto | ||
595 | + * | ||
596 | + * Gera o relatório no formato CSV | ||
597 | + */ | ||
598 | + relatorioTexto : function(idjanela) { | ||
599 | + $i("i3GEOtabelaarearelh").value = $i("i3GEOtabelacalculaarea").checked; | ||
600 | + $i("i3GEOtabelastatrelh").value = $i("i3GEOtabelacalculaestat").checked; | ||
601 | + $i("i3GEOtabelaexcluirvalorh").value = $i("i3GEOtabelaexcestat").value; | ||
602 | + $i("i3GEOtabelatemarelh").value = i3GEOF.tabela._parameters.tema; | ||
603 | + $i("i3GEOtabelag_sidh").value = i3GEO.configura.sid; | ||
604 | + $i("i3GEOtabelaitemagruparelh").value = $i("i3GEOtabelaagrupaItem").value; | ||
605 | + $i("i3GEOtabelatiporelh").value = "csv"; | ||
606 | + var inputs = $i("i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listanomes = [], nome, i, temp, n = | ||
607 | + inputs.length; | ||
608 | + for (i = 0; i < n; i++) { | ||
609 | + if (inputs[i].checked === true) { | ||
610 | + listai.push(inputs[i].id + "|" + inputs[i].name); | ||
611 | + nome = $i(inputs[i].id + inputs[i].name).value; | ||
612 | + listanomes.push(nome); | ||
613 | + } | ||
614 | + } | ||
615 | + $i("i3GEOtabelanomesrelh").value = listanomes; | ||
616 | + $i("i3GEOtabelaitensrelh").value = listai; | ||
617 | + temp = $i("i3GEOtabelarelatorio").action; | ||
618 | + $i("i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten; | ||
619 | + $i("i3GEOtabelarelatorio").submit(); | ||
620 | + $i("i3GEOtabelarelatorio").action = temp; | ||
621 | + } | ||
1203 | }; | 622 | }; |
1204 | \ No newline at end of file | 623 | \ No newline at end of file |
ferramentas/tabela/templateLista_mst.html
1 | -<table id="{{{idjanela}}}i3GEOtabelatabelai"> | 1 | +<table id="i3GEOtabelatabelai"> |
2 | <tr> | 2 | <tr> |
3 | {{#cabecalho}} | 3 | {{#cabecalho}} |
4 | <td accessKey="{{idcoluna}}" > | 4 | <td accessKey="{{idcoluna}}" > |
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | </td> | 21 | </td> |
22 | <td> | 22 | <td> |
23 | <button title="zoom" onclick='i3GEOF.tabela.zoomExt("{{{ext}}}","{{idjanela}}")' class="{{classezoom}} btn btn-xs" style="margin: 2px; padding: 2px;"> | 23 | <button title="zoom" onclick='i3GEOF.tabela.zoomExt("{{{ext}}}","{{idjanela}}")' class="{{classezoom}} btn btn-xs" style="margin: 2px; padding: 2px;"> |
24 | - <span class="material-icons">gps_fixed</span> | 24 | + <span class="material-icons">search</span> |
25 | </button> | 25 | </button> |
26 | </td> | 26 | </td> |
27 | <td> | 27 | <td> |
ferramentas/tabela/template_mst.html
1 | <!-- Guias --> | 1 | <!-- Guias --> |
2 | -<div id='{{{idjanela}}}' class='yui-navset' style='height: 38px; top: 0px; cursor: pointer; margin-left: 2px;'> | ||
3 | - <ul class='yui-nav' style='border-width: 0pt 0pt 0px; border-color: rgb(240, 240, 240); border-bottom-color: white;'> | ||
4 | - <li> | ||
5 | - <div id='{{{idjanela}}}i3GEOtabelaguia6' style='text-align: center; left: 0px;'> | ||
6 | - <a title='{{{propriedades}}}'> | ||
7 | - <em><span class="material-icons">settings</span></em> | ||
8 | - </a> | ||
9 | - </div> | ||
10 | - </li> | ||
11 | - <li> | ||
12 | - <div id='{{{idjanela}}}i3GEOtabelaguia1' style='text-align: center; left: 0px;'> | ||
13 | - <a> | ||
14 | - <em>{{{registros}}}</em> | ||
15 | - </a> | ||
16 | - </div> | ||
17 | - </li> | ||
18 | - <li> | ||
19 | - <div id='{{{idjanela}}}i3GEOtabelaguia3' style='text-align: center; left: 0px;'> | ||
20 | - <a> | ||
21 | - <em>{{{estatisticas}}}</em> | ||
22 | - </a> | ||
23 | - </div> | ||
24 | - </li> | ||
25 | - <li> | ||
26 | - <div id='{{{idjanela}}}i3GEOtabelaguia5' style='text-align: center; left: 0px;'> | ||
27 | - <a> | ||
28 | - <em>{{{relat}}}</em> | ||
29 | - </a> | ||
30 | - </div> | ||
31 | - </li> | ||
32 | - </ul> | ||
33 | -</div> | ||
34 | -<!-- Guia Propriedades --> | ||
35 | -<div id='{{{idjanela}}}i3GEOtabelaguia6obj' class="container-fluid"> | ||
36 | - <div class="radio radio-primary condensed text-left"> | ||
37 | - <label> | ||
38 | - <input name="classOuSel" id='{{{idjanela}}}i3GEOtabelatipolista' type="radio" onclick="i3GEOF.tabela.pegaRegistros('{{{idjanela}}}')"> | ||
39 | - <span class="circle"></span> | ||
40 | - <span class="check"></span> | ||
41 | - {{{atuatab}}} | ||
42 | - </label> | ||
43 | - </div> | ||
44 | - <div class="radio radio-primary condensed text-left"> | ||
45 | - <label> | ||
46 | - <input name="classOuSel" id='{{{idjanela}}}i3GEOtabelalegenda' type="radio" onclick="i3GEOF.tabela.pegaRegistros('{{{idjanela}}}')"> | ||
47 | - <span class="circle"></span> | ||
48 | - <span class="check"></span> | ||
49 | - {{{colleg}}} | ||
50 | - </label> | ||
51 | - </div> | ||
52 | - <div class="checkbox text-left"> | ||
53 | - <label> | ||
54 | - <input checked id='i3GEOFtabelaRodape{{{idjanela}}}' type="checkbox" onclick="i3GEOF.tabela.propJanelas['{{{idjanela}}}'].atualiza = this.checked;"> | ||
55 | - <span class="checkbox-material noprint"> | ||
56 | - <span class="check"></span> | ||
57 | - </span> | ||
58 | - {{{atualizaAoNavegar}}} | ||
59 | - </label> | ||
60 | - </div> | ||
61 | -</div> | ||
62 | -<!-- Registros da tabela --> | ||
63 | -<div id='{{{idjanela}}}i3GEOtabelaguia1obj' class='container-fluid ' style="height: calc(100% - 200px);"> | ||
64 | - <div id='{{{idjanela}}}i3GEOFtabelaComboCabeca' class='form-group condensed' > | ||
65 | - | ||
66 | - </div> | ||
67 | -<div style="display: flex;overflow: hidden;"> | ||
68 | - <a href='javascript:void(0)' onclick="i3GEOF.tabela.ativaSelecao('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{atvsel}}}</a> | ||
69 | - <a title='{{{limpselmap}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.limpaSelecao('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{limpsel}}}</a> | ||
70 | - <a title='{{{criatemasel}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.criaNovoTema('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{criatema}}}</a> | ||
71 | - <a href='javascript:void(0)' onclick="i3GEO.mapa.ativaTema(i3GEOF.tabela.propJanelas['{{{idjanela}}}'].tema);i3GEO.analise.dialogo.graficoInterativo1();" class='btn btn-primary btn-sm btn-raised'>{{{grafico}}}</a> | ||
72 | - <a title='{{{vinctab}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.vinculos.iniciaJanelaFlutuante()" class='btn btn-primary btn-sm btn-raised'>{{{vinculos}}}</a> | ||
73 | -</div> | ||
74 | - <div class="form-group condensed"> | ||
75 | - {{{de}}} | ||
76 | - <input class="form-control" style="display: inline; width: 50px;" id="{{{idjanela}}}i3GEOtabelainicio" size="5" value="1" type="text"> | ||
77 | - {{{ate}}} | ||
78 | - <input class="form-control" style="display: inline; width: 50px;" id="{{{idjanela}}}i3GEOtabelafim" size="5" value="20" type="text"> | ||
79 | - | ||
80 | - <button onclick='i3GEOF.tabela.menos("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
81 | - <span class="material-icons">remove_circle_outline</span> | ||
82 | - </button> | ||
83 | - <button onclick='i3GEOF.tabela.mais("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
84 | - <span class="material-icons">add_circle_outline</span> | ||
85 | - </button> | ||
86 | - <button title='{{{vertodos}}}' onclick='i3GEOF.tabela.todos("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
87 | - <span class="material-icons">last_page</span> | ||
88 | - </button> | ||
89 | - <button title='{{{atuareg}}}' onclick='i3GEOF.tabela.pegaRegistros("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
90 | - <span class="material-icons">refresh</span> | ||
91 | - </button> | 2 | +<nav class='navbar navbar-default' style='margin-bottom: 0px; min-height: 35px'> |
3 | + <div class="container" style="margin: 0px;"> | ||
4 | + <div class="navbar-header"> | ||
5 | + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#i3GEO{{namespace}}guias" aria-expanded="false"> | ||
6 | + <span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span> | ||
7 | + </button> | ||
8 | + </div> | ||
9 | + <div id='i3GEO{{namespace}}guias' class="collapse navbar-collapse" style="padding: 0px;"> | ||
10 | + <ul class="nav navbar-nav "> | ||
11 | + <li role="presentation"><a id='i3GEO{{namespace}}guia6' href="javascript:void(0);"> | ||
12 | + <span class="material-icons">settings</span> | ||
13 | + </a></li> | ||
14 | + <li role="presentation"><a id='i3GEO{{namespace}}guia1' href="javascript:void(0);"> | ||
15 | + <em>{{{registros}}}</em> | ||
16 | + </a></li> | ||
17 | + <li role="presentation"><a id='i3GEO{{namespace}}guia3' href="javascript:void(0);"> | ||
18 | + <em>{{{estatisticas}}}</em> | ||
19 | + </a></li> | ||
20 | + <li role="presentation"><a id='i3GEO{{namespace}}guia5' href="javascript:void(0);"> | ||
21 | + <em>{{{relat}}}</em> | ||
22 | + </a></li> | ||
23 | + </ul> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | +</nav> | ||
27 | +<div id='{{idContainer}}' class='container-fluid' style='text-align:left;display: block; overflow: auto; height: calc(100% - 50px);''> | ||
28 | + <!-- Guia Propriedades --> | ||
29 | + <div id='i3GEOtabelaguia6obj' class="container-fluid"> | ||
30 | + <h5>{{{operReg}}}</h5> | ||
31 | + <div style="display: flex; overflow: hidden;"> | ||
32 | + <a href='javascript:void(0)' onclick="i3GEOF.tabela.ativaSelecao(this)" class='btn btn-primary btn-sm btn-raised'>{{{atvsel}}}</a> | ||
33 | + <a title='{{{limpselmap}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.limpaSelecao('')" class='btn btn-primary btn-sm btn-raised'>{{{limpsel}}}</a> | ||
34 | + <a title='{{{criatemasel}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.criaNovoTema('')" class='btn btn-primary btn-sm btn-raised'>{{{criatema}}}</a> | ||
35 | + </div> | ||
36 | + <h5>{{{opcoes}}}</h5> | ||
37 | + <div class="checkbox text-left"> | ||
38 | + <label> | ||
39 | + <input id='i3GEOtabelatipolista' type="checkbox" onclick="i3GEOF.tabela.pegaRegistros('')"> | ||
40 | + <span class="checkbox-material noprint"> <span class="check"></span> | ||
41 | + </span> {{{atuatab}}} | ||
42 | + </label> | ||
43 | + </div> | ||
44 | + <div class="checkbox text-left"> | ||
45 | + <label> | ||
46 | + <input id='i3GEOtabelalegenda' type="checkbox" onclick="i3GEOF.tabela.pegaRegistros('')"> | ||
47 | + <span class="checkbox-material noprint"> <span class="check"></span> | ||
48 | + </span> {{{colleg}}} | ||
49 | + </label> | ||
50 | + </div> | ||
51 | + <div class="checkbox text-left"> | ||
52 | + <label> | ||
53 | + <input checked id='i3GEOFtabelaRodape' type="checkbox" onclick="i3GEOF.tabela.refreshOnNavigate = this.checked;"> | ||
54 | + <span class="checkbox-material noprint"> <span class="check"></span> | ||
55 | + </span> {{{atualizaAoNavegar}}} | ||
56 | + </label> | ||
57 | + </div> | ||
58 | + </div> | ||
59 | + <!-- Registros da tabela --> | ||
60 | + <div id='i3GEOtabelaguia1obj' class='container-fluid '> | ||
61 | + <div class="form-group condensed" style="text-align: left"> | ||
62 | + {{{de}}} | ||
63 | + <input class="form-control" style="display: inline; width: 50px;" id="i3GEOtabelainicio" size="5" value="1" type="text"> | ||
64 | + {{{ate}}} | ||
65 | + <input class="form-control" style="display: inline; width: 50px;" id="i3GEOtabelafim" size="5" value="20" type="text"> | ||
66 | + | ||
67 | + <button onclick='i3GEOF.tabela.menos("")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
68 | + <span class="material-icons">remove_circle_outline</span> | ||
69 | + </button> | ||
70 | + <button onclick='i3GEOF.tabela.mais("")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
71 | + <span class="material-icons">add_circle_outline</span> | ||
72 | + </button> | ||
73 | + <button title='{{{vertodos}}}' onclick='i3GEOF.tabela.todos("")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
74 | + <span class="material-icons">last_page</span> | ||
75 | + </button> | ||
76 | + <button title='{{{atuareg}}}' onclick='i3GEOF.tabela.pegaRegistros("")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
77 | + <span class="material-icons">refresh</span> | ||
78 | + </button> | ||
79 | + </div> | ||
80 | + <div id='{{{idRegistros}}}' class='container-fluid ' style='margin-top: 20px;'></div> | ||
81 | + </div> | ||
82 | + <!-- Estatisticas --> | ||
83 | + <div id='i3GEOtabelaguia3obj' style='width: 98%; height: calc(100% - 50px); display: none;' class='container-fluid '> | ||
84 | + <div class='form-group condensed'> | ||
85 | + <label class="control-label">{{{itemcalc}}}</label> | ||
86 | + <div id='i3GEOtabelaitensGuia3'></div> | ||
87 | + </div> | ||
88 | + <!-- label-floating --> | ||
89 | + <div class='form-group label-floating is-empty'> | ||
90 | + <label class="control-label" for="i3GEOtabelafiltro1">{{{excluicalc}}}</label> | ||
91 | + <input class="form-control input-lg" type='text' id='i3GEOtabelafiltro1' value='' /> | ||
92 | </div> | 92 | </div> |
93 | 93 | ||
94 | - <div id='{{{idjanela}}}i3GEOtabelaregistros' class='container-fluid ' style='top: 10px; display: flex;overflow: auto;height: 100%;'></div> | ||
95 | -</div> | ||
96 | -<!-- Estatisticas --> | ||
97 | -<div id='{{{idjanela}}}i3GEOtabelaguia3obj' style='width:98%; height: calc(100% - 50px);display: none;' class='container-fluid '> | ||
98 | - <div class='form-group condensed'> | ||
99 | - <label class="control-label">{{{itemcalc}}}</label> | ||
100 | - <div id='{{{idjanela}}}i3GEOtabelaitensGuia3'></div> | ||
101 | - </div> | ||
102 | - <!-- label-floating --> | ||
103 | - <div class='form-group label-floating is-empty'> | ||
104 | - <label class="control-label" for="{{{idjanela}}}i3GEOtabelafiltro1">{{{excluicalc}}}</label> | ||
105 | - <input class="form-control input-lg" type='text' id='{{{idjanela}}}i3GEOtabelafiltro1' value='' /> | ||
106 | - </div> | ||
107 | - | ||
108 | - <button onclick="i3GEOF.tabela.estatistica('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{calc}}}</button> | 94 | + <button onclick="i3GEOF.tabela.estatistica('')" class='btn btn-primary btn-sm btn-raised'>{{{calc}}}</button> |
109 | 95 | ||
110 | - <div id='{{{idjanela}}}i3GEOtabelaoperacoes' style='font-size: 12px; text-align: left; position: relative; top: 15px; left: 0px;'></div> | 96 | + <div id='i3GEOtabelaoperacoes' style='font-size: 12px; text-align: left; position: relative; top: 15px; left: 0px;'></div> |
111 | 97 | ||
112 | - <h5 class="alert alert-info">{{{paraqueas}}}</h5> | ||
113 | -</div> | ||
114 | -<!-- Relatorio --> | ||
115 | -<div id='{{{idjanela}}}i3GEOtabelaguia5obj' class='container-fluid ' style="width:98%; height: calc(100% - 50px); overflow:auto;"> | ||
116 | - <div class='form-group condensed'> | ||
117 | - <label>{{{itensrel}}}</label> | ||
118 | - <div id='{{{idjanela}}}i3GEOtabelaitensrelatorio' style='top: 10px;'></div> | ||
119 | - </div> | ||
120 | - <div class='form-group condensed'> | ||
121 | - <label class="control-label">{{{itensagr}}}</label> | ||
122 | - <div id='{{{idjanela}}}i3GEOtabelaagrupamento'></div> | ||
123 | - </div> | 98 | + <h5 class="alert alert-info">{{{paraqueas}}}</h5> |
99 | + </div> | ||
100 | + <!-- Relatorio --> | ||
101 | + <div id='i3GEOtabelaguia5obj' class='container-fluid ' style="width: 98%; height: calc(100% - 50px); overflow: auto;"> | ||
102 | + <div class='form-group condensed'> | ||
103 | + <label>{{{itensrel}}}</label> | ||
104 | + <div id='i3GEOtabelaitensrelatorio' style='top: 10px;'></div> | ||
105 | + </div> | ||
106 | + <div class='form-group condensed'> | ||
107 | + <label class="control-label">{{{itensagr}}}</label> | ||
108 | + <div id='i3GEOtabelaagrupamento'></div> | ||
109 | + </div> | ||
124 | 110 | ||
125 | - <div class='form-group label-floating is-empty'> | ||
126 | - <label class="control-label" for="{{{idjanela}}}i3GEOtabelaexcestat">{{{excvalor}}}</label> | ||
127 | - <input class="form-control input-lg" type='text' id='{{{idjanela}}}i3GEOtabelaexcestat' value='' /> | ||
128 | - </div> | 111 | + <div class='form-group label-floating is-empty'> |
112 | + <label class="control-label" for="i3GEOtabelaexcestat">{{{excvalor}}}</label> | ||
113 | + <input class="form-control input-lg" type='text' id='i3GEOtabelaexcestat' value='' /> | ||
114 | + </div> | ||
129 | 115 | ||
130 | - <div class="checkbox text-left"> | ||
131 | - <label> | ||
132 | - <input id='{{{idjanela}}}i3GEOtabelacalculaarea' type="checkbox"> | ||
133 | - <span class="checkbox-material noprint"> | ||
134 | - <span class="check"></span> | ||
135 | - </span> | ||
136 | - {{{incarea}}} | ||
137 | - </label> | ||
138 | - </div> | 116 | + <div class="checkbox text-left"> |
117 | + <label> | ||
118 | + <input id='i3GEOtabelacalculaarea' type="checkbox"> | ||
119 | + <span class="checkbox-material noprint"> <span class="check"></span> | ||
120 | + </span> {{{incarea}}} | ||
121 | + </label> | ||
122 | + </div> | ||
139 | 123 | ||
140 | - <div class="checkbox text-left"> | ||
141 | - <label> | ||
142 | - <input id='{{{idjanela}}}i3GEOtabelacalculaestat' type="checkbox"> | ||
143 | - <span class="checkbox-material noprint"> | ||
144 | - <span class="check"></span> | ||
145 | - </span> | ||
146 | - {{{incestat}}} | ||
147 | - </label> | ||
148 | - </div> | 124 | + <div class="checkbox text-left"> |
125 | + <label> | ||
126 | + <input id='i3GEOtabelacalculaestat' type="checkbox"> | ||
127 | + <span class="checkbox-material noprint"> <span class="check"></span> | ||
128 | + </span> {{{incestat}}} | ||
129 | + </label> | ||
130 | + </div> | ||
149 | 131 | ||
150 | - <button onclick="i3GEOF.tabela.relatorioTabela('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{relat}}}</button> | ||
151 | - <button onclick="i3GEOF.tabela.relatorioTexto('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{relattext}}}</button> | 132 | + <button onclick="i3GEOF.tabela.relatorioTabela('')" class='btn btn-primary btn-sm btn-raised'>{{{relat}}}</button> |
133 | + <button onclick="i3GEOF.tabela.relatorioTexto('')" class='btn btn-primary btn-sm btn-raised'>{{{relattext}}}</button> | ||
152 | 134 | ||
153 | - <form method='post' style='display: none' id='{{{idjanela}}}i3GEOtabelarelatorio' action='{{{locaplic}}}/ferramentas/tabela/relatorio.php' target='_blank'> | ||
154 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelaarearelh' name='arearel' value='nao' /> | ||
155 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelastatrelh' name='statrel' value='nao' /> | ||
156 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelatemarelh' name='temarel' value='' /> | ||
157 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelag_sidh' name='g_sid' value='' /> | ||
158 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelaitemagruparelh' name='itemagruparel' value='' /> | ||
159 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelaitensrelh' name='itensrel' value='' /> | ||
160 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelanomesrelh' name='nomesrel' value='' /> | ||
161 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelaordemrel' name='ordemrel' value='' /> | ||
162 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelaexcluirvalorh' name='excluirvalor' value='' /> | ||
163 | - <input type='hidden' id='{{{idjanela}}}i3GEOtabelatiporelh' name='tiporel' value='' /> | ||
164 | - </form> | ||
165 | -</div> | 135 | + <form method='post' style='display: none' id='i3GEOtabelarelatorio' action='{{{locaplic}}}/ferramentas/tabela/relatorio.php' target='_blank'> |
136 | + <input type='hidden' id='i3GEOtabelaarearelh' name='arearel' value='nao' /> | ||
137 | + <input type='hidden' id='i3GEOtabelastatrelh' name='statrel' value='nao' /> | ||
138 | + <input type='hidden' id='i3GEOtabelatemarelh' name='temarel' value='' /> | ||
139 | + <input type='hidden' id='i3GEOtabelag_sidh' name='g_sid' value='' /> | ||
140 | + <input type='hidden' id='i3GEOtabelaitemagruparelh' name='itemagruparel' value='' /> | ||
141 | + <input type='hidden' id='i3GEOtabelaitensrelh' name='itensrel' value='' /> | ||
142 | + <input type='hidden' id='i3GEOtabelanomesrelh' name='nomesrel' value='' /> | ||
143 | + <input type='hidden' id='i3GEOtabelaordemrel' name='ordemrel' value='' /> | ||
144 | + <input type='hidden' id='i3GEOtabelaexcluirvalorh' name='excluirvalor' value='' /> | ||
145 | + <input type='hidden' id='i3GEOtabelatiporelh' name='tiporel' value='' /> | ||
146 | + </form> | ||
147 | + </div> | ||
166 | \ No newline at end of file | 148 | \ No newline at end of file |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +<?php | ||
2 | +include(dirname(__FILE__)."/../blacklist.php"); | ||
3 | +verificaBlFerramentas(basename(dirname(__FILE__))); | ||
4 | + | ||
5 | + | ||
6 | +/** | ||
7 | + * Carrega os programas javascript necessarios para a ferramenta | ||
8 | + * Esse programa e usado na tag <script> ou com a funcao scripttag do i3Geo | ||
9 | + * Alem de carregar os scripts, carrega tambem o template no formato MUSTACHE, definindo a variavel | ||
10 | + * javascript i3GEOF.tabela.MUSTACHE | ||
11 | + * O template e substituido pelos valores definidos em index.js no momento da inicializacao da ferramenta | ||
12 | + */ | ||
13 | +if(extension_loaded('zlib')){ | ||
14 | + ob_start('ob_gzhandler'); | ||
15 | +} | ||
16 | +header("Content-type: text/javascript"); | ||
17 | +include("index.js"); | ||
18 | +include("dicionario.js"); | ||
19 | +echo "\n"; | ||
20 | + | ||
21 | +if(extension_loaded('zlib')){ | ||
22 | + ob_end_flush(); | ||
23 | +} | ||
24 | +?> | ||
0 | \ No newline at end of file | 25 | \ No newline at end of file |
@@ -0,0 +1,253 @@ | @@ -0,0 +1,253 @@ | ||
1 | +//+$trad(1,i3GEOF.tabela.dicionario)+ | ||
2 | +i3GEOF.tabela.dicionario = { | ||
3 | + 'tabela' : [ { | ||
4 | + pt : "Tabela", | ||
5 | + en : "Table", | ||
6 | + es : "Tabla" | ||
7 | + } ], | ||
8 | + 'erroTemaOrigem' : [ { | ||
9 | + pt : "erro ao ler os itens do tema de origem", | ||
10 | + en : "error reading fields from source theme", | ||
11 | + es : "error al leer los campos del tema de origen" | ||
12 | + } ], | ||
13 | + "registros" : [ { | ||
14 | + pt : "Registros", | ||
15 | + en : "Records", | ||
16 | + es : "Registros" | ||
17 | + } ], | ||
18 | + "estatisticas" : [ { | ||
19 | + pt : "Estatísticas", | ||
20 | + en : "Statistics", | ||
21 | + es : "Estadísticas" | ||
22 | + } ], | ||
23 | + "relat" : [ { | ||
24 | + pt : "Relatórios", | ||
25 | + en : "Reports", | ||
26 | + es : "Informes" | ||
27 | + } ], | ||
28 | + 6 : [ { | ||
29 | + pt : "Considerar na listagem a região mostrada no mapa (se essa opção for desmarcada, será considerada a extensão geográfica do mapa inicial)", | ||
30 | + en : "The area shown on the map will be included in the list (the geographic extent of the initial map will be used if this option is disabled)", | ||
31 | + es : "Considerar en la lista el área que se muestra en el mapa (si esta opción es desactivada se considerará la extensión geográfica del mapa inicial)" | ||
32 | + } ], | ||
33 | + 7 : [ { | ||
34 | + pt : "Atualiza a tabela após navegar no mapa", | ||
35 | + en : "Refreshes the table after browsing the map", | ||
36 | + es : "Actualiza la tabla después de navegar en el mapa" | ||
37 | + } ], | ||
38 | + "atuatab" : [ { | ||
39 | + pt : "Mostrar na listagem apenas os selecionados", | ||
40 | + en : "Show selected only", | ||
41 | + es : "Mostrar solo los seleccionados" | ||
42 | + } ], | ||
43 | + "colleg" : [ { | ||
44 | + pt : "Mostrar coluna com a legenda da classe", | ||
45 | + en : "Show column with class legend", | ||
46 | + es : "Mostrar columna con la leyenda de la clase" | ||
47 | + } ], | ||
48 | + "sellinhas" : [ { | ||
49 | + pt : "Seleciona no mapa as linhas marcadas", | ||
50 | + en : "Selects marked lines on the map", | ||
51 | + es : "Selecciona en el mapa las líneas marcadas" | ||
52 | + } ], | ||
53 | + "atvsel" : [ { | ||
54 | + pt : "Selecionar", | ||
55 | + en : "Select", | ||
56 | + es : "Seleccionar" | ||
57 | + } ], | ||
58 | + "limpselmap" : [ { | ||
59 | + pt : "Limpa a seleção do mapa", | ||
60 | + en : "Clear selection from map", | ||
61 | + es : "Limpia la selección del mapa" | ||
62 | + } ], | ||
63 | + "limpsel" : [ { | ||
64 | + pt : "Limpar", | ||
65 | + en : "Clear", | ||
66 | + es : "Limpiar" | ||
67 | + } ], | ||
68 | + "criatemasel" : [ { | ||
69 | + pt : "Cria um novo tema no mapa contendo a seleção", | ||
70 | + en : "Creates a new theme on the map containing the selection", | ||
71 | + es : "Crea un tema nuevo en el mapa que contiene la selección" | ||
72 | + } ], | ||
73 | + "criatema" : [ { | ||
74 | + pt : "Criar tema", | ||
75 | + en : "Create theme", | ||
76 | + es : "Crear tema" | ||
77 | + } ], | ||
78 | + "de" : [ { | ||
79 | + pt : "de", | ||
80 | + en : "from", | ||
81 | + es : "de" | ||
82 | + } ], | ||
83 | + "ate" : [ { | ||
84 | + pt : "até", | ||
85 | + en : "until", | ||
86 | + es : "hasta" | ||
87 | + } ], | ||
88 | + "atuareg" : [ { | ||
89 | + pt : "Atualiza a lista de registros", | ||
90 | + en : "Updates record list", | ||
91 | + es : "Actualiza la lista de registros" | ||
92 | + } ], | ||
93 | + "listar" : [ { | ||
94 | + pt : "Listar", | ||
95 | + en : "List", | ||
96 | + es : "Crear lista" | ||
97 | + } ], | ||
98 | + "itemcalc" : [ { | ||
99 | + pt : "Item para aplicar os cálculos", | ||
100 | + en : "Field to apply calculations", | ||
101 | + es : "Campo para aplicar los cálculos" | ||
102 | + } ], | ||
103 | + "excluicalc" : [ { | ||
104 | + pt : "Excluir dos cálculos o valor", | ||
105 | + en : "Exclude from calculations the value", | ||
106 | + es : "Excluir de los cálculos el valor" | ||
107 | + } ], | ||
108 | + "calc" : [ { | ||
109 | + pt : "Calcular", | ||
110 | + en : "Calculate", | ||
111 | + es : "Calcular" | ||
112 | + } ], | ||
113 | + "paraqueas" : [ { | ||
114 | + pt : "Para que as operações atuem apenas sobre os elementos selecionados ative a seleção no mapa, para isso utilize, na guia <i>Registros</i> a opção <i>Ativa a seleção</i>", | ||
115 | + en : "In order that operations execute only on selected features, enable selection on the map. To do that use <i>Enable selection</i> option on the <i>Record</i> tab", | ||
116 | + es : "Para que las operaciones actúen solo sobre las entidades seleccionadas, active la selección en el mapa, para ello utilice la opción <i>Activa la selección</i> en la pestaña <i>Registros</i>" | ||
117 | + } ], | ||
118 | + "itensrel" : [ { | ||
119 | + pt : "Escolha os itens que deverão constar no relatório. Você pode alterar os nomes originais das colunas para melhorar o cabeçalho do relatório e também definir a ordem das colunas no relatório", | ||
120 | + en : "Select fields that should appear in the report. You can change column order and names to improve the report header", | ||
121 | + es : "Seleccione los campos que deben estar presente en el informe. Usted puede cambiar los nombres originales de las columnas para mejorar el encabezado del informe y cambiar también el orden de las columnas en el informe" | ||
122 | + } ], | ||
123 | + "itensagr" : [ { | ||
124 | + pt : "Escolha o item que você quer utilizar para agrupar valores (opcional)", | ||
125 | + en : "Select a field you want to use to group values (optional)", | ||
126 | + es : "Seleccione el campo que desea utilizar para agrupar valores (opcional)" | ||
127 | + } ], | ||
128 | + "incarea" : [ { | ||
129 | + pt : "Incluir cálculo de área", | ||
130 | + en : "Include area calculation", | ||
131 | + es : "Incluir cálculo de área" | ||
132 | + } ], | ||
133 | + "incestat" : [ { | ||
134 | + pt : "Incluir cálculo de estatísticas", | ||
135 | + en : "Include statistics calculation", | ||
136 | + es : "Incluir cálculo de estadísticas" | ||
137 | + } ], | ||
138 | + "excvalor" : [ { | ||
139 | + pt : "Excluir das estatísticas o valor", | ||
140 | + en : "Delete value from statistics", | ||
141 | + es : "Excluir de las estadísticas el valor" | ||
142 | + } ], | ||
143 | + "relattext" : [ { | ||
144 | + pt : "Relatório no formato texto", | ||
145 | + en : "Report in text format", | ||
146 | + es : "Informe en formato de texto" | ||
147 | + } ], | ||
148 | + 'temaNaoExisteMais' : [ { | ||
149 | + pt : "O tema já não existe mais no mapa", | ||
150 | + en : "El tema ya no está disponible en el mapa", | ||
151 | + es : "El tema ya no existe en el mapa" | ||
152 | + } ], | ||
153 | + 'ordena' : [ { | ||
154 | + pt : "ordena", | ||
155 | + en : "sort", | ||
156 | + es : "ordenar" | ||
157 | + } ], | ||
158 | + 'erroTemaOrigem2' : [ { | ||
159 | + pt : "erro ao ler os itens do tema de origem", | ||
160 | + en : "error reading fields from source theme", | ||
161 | + es : "error al leer los campos del tema de origen" | ||
162 | + } ], | ||
163 | + 33 : [ { | ||
164 | + pt : "A representação gráfica dos dados tabulares utiliza todos os elementos da tabela ou os selecionados, se estiverem ativos no mapa", | ||
165 | + en : "Graphical representation of tabular data uses all or selected fields if they are active on the map", | ||
166 | + es : "La representación gráfica de los datos en tablas utiliza todos los campos de la tabla o los seleccionados si están activos en el mapa" | ||
167 | + } ], | ||
168 | + 34 : [ { | ||
169 | + pt : "Os gráficos são gerados com o software R,</a> mas vc pode optar por usar a ferramenta de gráficos interativos que possuem outras opções e geram gráficos em Flash.", | ||
170 | + en : "Charts are generated with R software</a>, but you can use the interactive chart tool that has other options and allows you to create Flash charts.", | ||
171 | + es : "Los gráficos se generan con el software R</a>, pero usted puede optar por usar la herramienta de gráficos interactivos que tienen otras opciones que crean gráficos en Flash." | ||
172 | + } ], | ||
173 | + 35 : [ { | ||
174 | + pt : "Se você optar por usar o R, nas telas seguintes defina o tipo e as opções do gráfico", | ||
175 | + en : "If you choose to use R, in the following screens define a chart type and options", | ||
176 | + es : "Si opta por utilizar R, en las siguientes pantallas defina el tipo y las opciones del gráfico" | ||
177 | + } ], | ||
178 | + 36 : [ { | ||
179 | + pt : "abrir em uma janela separada", | ||
180 | + en : "open in a detached window", | ||
181 | + es : "abrir en una ventana separada" | ||
182 | + } ], | ||
183 | + 37 : [ { | ||
184 | + pt : "Marque uma coluna para vincular com outras tabelas. Marque uma linha para localizar em todas as tabelas abertas", | ||
185 | + en : "Check a column to link to other tables. Check one line to search in all open tables", | ||
186 | + es : "Marque una columna para enlazar con otras tablas. Marque una línea para buscar en todas las tablas abiertas" | ||
187 | + } ], | ||
188 | + 'msgDadosRegiaoAtual' : [ { | ||
189 | + pt : "Os dados utilizados referem-se apenas à região atual mostrada no mapa", | ||
190 | + en : "Data in use is only related to the current region shown on the map", | ||
191 | + es : "Los datos utilizados se relacionan solo con la región actual mostrada en el mapa" | ||
192 | + } ], | ||
193 | + 39 : [ { | ||
194 | + pt : "Marque uma coluna primeiro", | ||
195 | + en : "Check first a column", | ||
196 | + es : "Marque una columna primero" | ||
197 | + } ], | ||
198 | + "vertodos" : [ { | ||
199 | + pt : "Ver todos", | ||
200 | + en : "See all", | ||
201 | + es : "Ver todos" | ||
202 | + } ], | ||
203 | + 'atualizaAoNavegar' : [ { | ||
204 | + pt : "Atualiza a listagem ao navegar", | ||
205 | + en : "Refresh listing when browsing", | ||
206 | + es : "Actualiza la lista al navegar" | ||
207 | + } ], | ||
208 | + "grafico" : [ { | ||
209 | + pt : "Gráfico", | ||
210 | + en : "Chart", | ||
211 | + es : "Gráfico" | ||
212 | + } ], | ||
213 | + "vinctab" : [ { | ||
214 | + pt : "Vínculos entre as tabelas abertas", | ||
215 | + en : "Links between open tables", | ||
216 | + es : "Vínculos entre las tablas abiertas" | ||
217 | + } ], | ||
218 | + "vinculos" : [ { | ||
219 | + pt : "Vínculos", | ||
220 | + en : "Links", | ||
221 | + es : "Vínculos" | ||
222 | + } ], | ||
223 | + "selecionaTabela" : [ { | ||
224 | + pt : "Escolha uma tabela", | ||
225 | + en : "Select a table", | ||
226 | + es : "Seleccione una tabla" | ||
227 | + } ], | ||
228 | + "selecionaSegundaTabela" : [ { | ||
229 | + pt : "Escolha uma segunda tabela", | ||
230 | + en : "Select a second table", | ||
231 | + es : "Seleccione una segunda tabla" | ||
232 | + } ], | ||
233 | + "criaVinculo" : [ { | ||
234 | + pt : "Criar vínculo", | ||
235 | + en : "Create link", | ||
236 | + es : "Crear vínculo" | ||
237 | + } ], | ||
238 | + 'colunaLigacao' : [ { | ||
239 | + pt : "Coluna de ligação", | ||
240 | + en : "Connection column", | ||
241 | + es : "Columna de conexión" | ||
242 | + } ], | ||
243 | + 'idDaTabela' : [ { | ||
244 | + pt : "Identificador da tabela", | ||
245 | + en : "Table identifier", | ||
246 | + es : "Identificador de tabla" | ||
247 | + } ], | ||
248 | + 'selUmReg' : [ { | ||
249 | + pt : "Selecione pelo menos um registro", | ||
250 | + en : "Select at least one record", | ||
251 | + es : "Seleccione al menos un registro" | ||
252 | + } ] | ||
253 | +}; |
@@ -0,0 +1,145 @@ | @@ -0,0 +1,145 @@ | ||
1 | +<?php | ||
2 | +include_once(dirname(__FILE__)."/../safe.php"); | ||
3 | +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); | ||
4 | +// | ||
5 | +//faz a busca da função que deve ser executada | ||
6 | +// | ||
7 | +$retorno = ""; //string que será retornada ao browser via JSON | ||
8 | +switch (strtoupper($funcao)) | ||
9 | +{ | ||
10 | +/* | ||
11 | +Valor: INCLUISEL | ||
12 | + | ||
13 | +Incluí elementos em uma seleção. | ||
14 | + | ||
15 | +<Selecao->incluiSel> | ||
16 | +*/ | ||
17 | + case "INCLUISEL": | ||
18 | + include_once(dirname(__FILE__)."/../../classesphp/classe_selecao.php"); | ||
19 | + $m = new Selecao($map_file,$tema); | ||
20 | + $retorno = $m->incluiSel($_GET["ids"]); | ||
21 | + // | ||
22 | + //é necessário obter os parâmetros do mapa para remontar a árvore de camadas | ||
23 | + // | ||
24 | + $_SESSION["contadorsalva"]++; | ||
25 | + redesenhaMapa(); | ||
26 | + break; | ||
27 | +/* | ||
28 | +Valor: ESTATISTICA | ||
29 | + | ||
30 | +Calcula estatísticas básicas de uma tabela de um tema. | ||
31 | + | ||
32 | +<Atributos->estatDescritivas> | ||
33 | +*/ | ||
34 | + case "ESTATISTICA": | ||
35 | + include_once(dirname(__FILE__)."/../../classesphp/classe_atributos.php"); | ||
36 | + $m = new Atributos($map_file,$tema,$locaplic,$ext); | ||
37 | + $retorno = $m->estatDescritivas($_GET["item"],$_GET["exclui"]); | ||
38 | + break; | ||
39 | +/* | ||
40 | +Valor: GRAFICOPIZZA | ||
41 | + | ||
42 | +Cria um gráfico de pizza. | ||
43 | + | ||
44 | +<graficoPizza> | ||
45 | +*/ | ||
46 | + case "GRAFICOPIZZA": | ||
47 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
48 | + $retorno = graficoPizza(); | ||
49 | + break; | ||
50 | +/* | ||
51 | +Valor: GRAFICOESTRELA | ||
52 | + | ||
53 | +Cria um gráfico do tipo estrela. | ||
54 | + | ||
55 | +<graficoEstrela> | ||
56 | +*/ | ||
57 | + case "GRAFICOESTRELA": | ||
58 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
59 | + $retorno = graficoEstrela(); | ||
60 | + break; | ||
61 | +/* | ||
62 | +Valor: GRAFICOSCATTER | ||
63 | + | ||
64 | +Cria um gráfico de distribuição de pontos. | ||
65 | + | ||
66 | +<graficoScatter> | ||
67 | +*/ | ||
68 | + case "GRAFICOSCATTER": | ||
69 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
70 | + $retorno = graficoScatter(); | ||
71 | + break; | ||
72 | +/* | ||
73 | +Valor: GRAFICOSCATTERBINS | ||
74 | + | ||
75 | +Cria um gráfico de distribuição de pontos com agrupamento em pixels (bins). | ||
76 | + | ||
77 | +<graficoScatterBins> | ||
78 | +*/ | ||
79 | + case "GRAFICOSCATTERBINS": | ||
80 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
81 | + $retorno = graficoScatterBins(); | ||
82 | + break; | ||
83 | +/* | ||
84 | +Valor: GRAFICOLINHAS | ||
85 | + | ||
86 | +Cria um gráfico de linhas. | ||
87 | + | ||
88 | +<graficoLinhas> | ||
89 | +*/ | ||
90 | + case "GRAFICOLINHAS": | ||
91 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
92 | + $retorno = graficoLinhas(); | ||
93 | + break; | ||
94 | +/* | ||
95 | +Valor: GRAFICOHIST | ||
96 | + | ||
97 | +Cria um gráfico de histograma. | ||
98 | + | ||
99 | +<graficoHist> | ||
100 | +*/ | ||
101 | + case "GRAFICOHIST": | ||
102 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
103 | + $retorno = graficoHist(); | ||
104 | + break; | ||
105 | +/* | ||
106 | +Valor: GRAFICOBARRAS | ||
107 | + | ||
108 | +Cria um gráfico de barras. | ||
109 | + | ||
110 | +<graficoBarras> | ||
111 | +*/ | ||
112 | + case "GRAFICOBARRAS": | ||
113 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
114 | + $retorno = graficoBarras(); | ||
115 | + break; | ||
116 | +/* | ||
117 | +Valor: FUSAOGRAFICO | ||
118 | + | ||
119 | +Faz a fusão da imagem de um gráfico com a imagem do mapa atual. | ||
120 | + | ||
121 | +<fusaoGrafico> | ||
122 | +*/ | ||
123 | + case "FUSAOGRAFICO": | ||
124 | + include_once(dirname(__FILE__)."/../../classesphp/graficos.php"); | ||
125 | + restauraCon($map_file,$postgis_mapa); | ||
126 | + include_once(dirname(__FILE__)."/../../classesphp/classe_imagem.php"); | ||
127 | + if($map_file != "") | ||
128 | + { | ||
129 | + $mapa = ms_newMapObj($map_file); | ||
130 | + $imgo = $mapa->draw(); | ||
131 | + $nome = ($imgo->imagepath).nomeRandomico().".png"; | ||
132 | + $imgo->saveImage($nome); | ||
133 | + $imagem = ($imgo->imageurl).basename($nome); | ||
134 | + } | ||
135 | + $m = new Imagem(dirname($dir_tmp).$imagem); | ||
136 | + $i = $m->fundeIm(dirname($dir_tmp).$grafico); | ||
137 | + imagepng($i,dirname($dir_tmp).$imagem); | ||
138 | + $retorno = $imagem; | ||
139 | + break; | ||
140 | +} | ||
141 | +if(isset($map_file) && isset($postgis_mapa) && $map_file != ""){ | ||
142 | + restauraCon($map_file,$postgis_mapa); | ||
143 | +} | ||
144 | +cpjson($retorno); | ||
145 | +?> | ||
0 | \ No newline at end of file | 146 | \ No newline at end of file |
@@ -0,0 +1,1203 @@ | @@ -0,0 +1,1203 @@ | ||
1 | +if (typeof (i3GEOF) === 'undefined') { | ||
2 | + var i3GEOF = {}; | ||
3 | +} | ||
4 | +/* | ||
5 | + * Classe: i3GEOF.tabela | ||
6 | + */ | ||
7 | +i3GEOF.tabela = | ||
8 | +{ | ||
9 | + /** | ||
10 | + * Controla se o evento de atualizacao da lista de registros esta ativo ou nao E utilizado quando os graficos sao recuperados de um | ||
11 | + * mapa que foi salvo | ||
12 | + */ | ||
13 | + LISTAREGATIVO : true, | ||
14 | + /** | ||
15 | + * Array com os ids das janelas ja criadas | ||
16 | + */ | ||
17 | + janelas : [], | ||
18 | + /** | ||
19 | + * Objeto com as propriedades de cada janela. A chave e o id da janela armazenado em i3GEO.tabela.janelas | ||
20 | + */ | ||
21 | + propJanelas : {}, | ||
22 | + /** | ||
23 | + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | ||
24 | + */ | ||
25 | + MUSTACHE : "", | ||
26 | + MUSTACHELISTA : "", | ||
27 | + MUSTACHEVINCULO: "", | ||
28 | + /** | ||
29 | + * Susbtitutos para o template | ||
30 | + */ | ||
31 | + mustacheHash : function(idjanela) { | ||
32 | + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.tabela.dicionario); | ||
33 | + dicionario["idjanela"] = idjanela; | ||
34 | + dicionario["idjanelaA"] = '"' + idjanela + '"'; | ||
35 | + dicionario["locaplic"] = i3GEO.configura.locaplic; | ||
36 | + dicionario["propriedades"] = $trad('p13'); | ||
37 | + dicionario["ini"] = $inputText("", "", idjanela + 'i3GEOtabelainicio', "", 5, "1"); | ||
38 | + dicionario["fim"] = $inputText("", "", idjanela + 'i3GEOtabelafim', "", 5, "20"); | ||
39 | + return dicionario; | ||
40 | + }, | ||
41 | + /** | ||
42 | + * Configura a tabela conforme um objeto contendo parametros. Alguns parametros possuem definicoes padrao, usadas quando o valor nao | ||
43 | + * e passado | ||
44 | + * | ||
45 | + * Qualquer outro campo de formulario pode ter seu valor passado como parametro, desde que use o mesmo ID, excluindo-se do nome do | ||
46 | + * ID o prefixo (codigo da janela) | ||
47 | + * | ||
48 | + * parametros {objeto} com os seguintes elementos: | ||
49 | + * | ||
50 | + * idjanela - id da tabela. Usado como prefixo para inserir os identificadores dos elementos DOM que fazem parte da interface do | ||
51 | + * tabela. Se existir um elemento dom esse id, a tabela sera inserido nesse elemento | ||
52 | + * | ||
53 | + * tema - codigo do tema existente no mapa e que sera a fonte para os dados | ||
54 | + * | ||
55 | + * atualiza true|false - a janela sera atualizada na navegacao do mapa ou nao | ||
56 | + * | ||
57 | + */ | ||
58 | + configura : function(parametros) { | ||
59 | + var idjanela; | ||
60 | + if (!parametros.idjanela) { | ||
61 | + idjanela = "tabela" + parseInt(Math.random() * 1000000, 10); | ||
62 | + } else { | ||
63 | + idjanela = parametros.idjanela; | ||
64 | + } | ||
65 | + i3GEOF.tabela.janelas.push(idjanela); | ||
66 | + if (parametros) { | ||
67 | + i3GEOF.tabela.propJanelas[idjanela] = parametros; | ||
68 | + } else { | ||
69 | + i3GEOF.tabela.propJanelas[idjanela] = {}; | ||
70 | + } | ||
71 | + if (!parametros.tema || parametros.tema == undefined) { | ||
72 | + i3GEOF.tabela.propJanelas[idjanela].tema = i3GEO.temaAtivo; | ||
73 | + } | ||
74 | + if (!parametros.atualiza || parametros.atualiza == undefined) { | ||
75 | + i3GEOF.tabela.propJanelas[idjanela].atualiza = true; | ||
76 | + } | ||
77 | + // guarda para essa tabela alguns valores default obtidos dos | ||
78 | + // parametros gerais da ferramenta | ||
79 | + if (!parametros.w || parametros.w == undefined) { | ||
80 | + i3GEOF.tabela.propJanelas[idjanela].w = i3GEOF.tabela.w; | ||
81 | + } | ||
82 | + if (!parametros.h || parametros.h == undefined) { | ||
83 | + i3GEOF.tabela.propJanelas[idjanela].h = i3GEOF.tabela.h; | ||
84 | + } | ||
85 | + i3GEOF.tabela.propJanelas[idjanela].colunas = { | ||
86 | + "itens" : [], | ||
87 | + "alias" : [] | ||
88 | + }; | ||
89 | + i3GEOF.tabela.propJanelas[idjanela].registros = []; | ||
90 | + return idjanela; | ||
91 | + }, | ||
92 | + /** | ||
93 | + * Aplica a tabela os parametros de configuracao definidos para cada interface que controla a tabela. Os parametros de configuracao | ||
94 | + * sao obtidos na inicializacao, passados como parametros. Essa funcao deve ser executada apos os elementos html terem sido | ||
95 | + * renderizados | ||
96 | + */ | ||
97 | + aplicaConfig : function(idjanela) { | ||
98 | + var config, nomesIds, i, o, n, j; | ||
99 | + config = i3GEOF.tabela.propJanelas[idjanela]; | ||
100 | + nomesIds = i3GEO.util.listaChaves(config); | ||
101 | + n = nomesIds.length; | ||
102 | + for (j = 0; j < n; j++) { | ||
103 | + i = nomesIds[j]; | ||
104 | + if (config[i]) { | ||
105 | + o = $i(i); | ||
106 | + if (o && o.type) { | ||
107 | + if (o.type.toLowerCase() === "radio" || o.type.toLowerCase() === "checkbox") { | ||
108 | + o.checked = config[i]; | ||
109 | + } else { | ||
110 | + o.value = config[i]; | ||
111 | + } | ||
112 | + } | ||
113 | + } | ||
114 | + } | ||
115 | + }, | ||
116 | + /* | ||
117 | + * Function: inicia | ||
118 | + * | ||
119 | + * Inicia a ferramenta. É chamado por criaJanelaFlutuante | ||
120 | + * | ||
121 | + * Parametro: | ||
122 | + * | ||
123 | + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | ||
124 | + */ | ||
125 | + inicia : function(iddiv, idjanela) { | ||
126 | + if(i3GEOF.tabela.MUSTACHE == ""){ | ||
127 | + var t1 = i3GEO.configura.locaplic + "/ferramentas/tabela/template_mst.html", | ||
128 | + t2 = i3GEO.configura.locaplic + "/ferramentas/tabela/templateLista_mst.html", | ||
129 | + t3 = i3GEO.configura.locaplic + "/ferramentas/tabela/templateVinculo_mst.html"; | ||
130 | + | ||
131 | + $.when( $.get(t1),$.get(t2),$.get(t3) ).done(function(r1,r2,r3) { | ||
132 | + i3GEOF.tabela.MUSTACHE = r1[0]; | ||
133 | + i3GEOF.tabela.MUSTACHELISTA = r2[0]; | ||
134 | + i3GEOF.tabela.MUSTACHEVINCULO = r3[0]; | ||
135 | + i3GEOF.tabela.inicia(iddiv, idjanela); | ||
136 | + }).fail(function() { | ||
137 | + i3GEO.janela.closeMsg($trad("erroTpl")); | ||
138 | + return; | ||
139 | + }); | ||
140 | + return; | ||
141 | + } | ||
142 | + $i(iddiv).innerHTML = i3GEOF.tabela.html(idjanela); | ||
143 | + | ||
144 | + //i3GEO.janela.applyScrollBar(iddiv,".customScrollBar",{advanced:{ autoExpandHorizontalScroll: 2 }}); | ||
145 | + | ||
146 | + var b, onButtonClick = function(evt) { | ||
147 | + var botao = evt.target; | ||
148 | + if (botao) { | ||
149 | + if (botao.value != "") { | ||
150 | + i3GEO.mapa.ativaTema(botao.value); | ||
151 | + i3GEOF.tabela.propJanelas[idjanela].tema = botao.value; | ||
152 | + i3GEOF.tabela.inicia(iddiv, idjanela); | ||
153 | + } | ||
154 | + } | ||
155 | + }; | ||
156 | + if (!$i(idjanela + "i3GEOFtabelaComboCabecaSel")) { | ||
157 | + i3GEO.janela.comboCabecalhoTemasBs( | ||
158 | + idjanela + "i3GEOFtabelaComboCabeca", | ||
159 | + idjanela + "i3GEOFtabelaComboCabecaSel", | ||
160 | + "tabela", | ||
161 | + "comTabela", | ||
162 | + onButtonClick); | ||
163 | + } | ||
164 | + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia1", idjanela + "i3GEOtabelaguia"); | ||
165 | + // eventos das guias | ||
166 | + $i(idjanela + "i3GEOtabelaguia6").onclick = function() { | ||
167 | + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia6", idjanela + "i3GEOtabelaguia"); | ||
168 | + }; | ||
169 | + $i(idjanela + "i3GEOtabelaguia1").onclick = function() { | ||
170 | + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia1", idjanela + "i3GEOtabelaguia"); | ||
171 | + }; | ||
172 | + $i(idjanela + "i3GEOtabelaguia3").onclick = function() { | ||
173 | + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia3", idjanela + "i3GEOtabelaguia"); | ||
174 | + if (!$i(idjanela + "i3GEOtabelaComboItensGuia3")) { | ||
175 | + i3GEOF.tabela.comboItensEstat(idjanela); | ||
176 | + } | ||
177 | + }; | ||
178 | + // relatorio | ||
179 | + $i(idjanela + "i3GEOtabelaguia5").onclick = | ||
180 | + function() { | ||
181 | + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOtabelaguia5", idjanela + "i3GEOtabelaguia"); | ||
182 | + i3GEO.util.checkItensEditaveis(i3GEOF.tabela.propJanelas[idjanela].tema, function(retorno) { | ||
183 | + if (retorno.tipo === "dados") { | ||
184 | + $i(idjanela + "i3GEOtabelaitensrelatorio").innerHTML = retorno.dados; | ||
185 | + } | ||
186 | + }, idjanela + "i3GEOtabelaitensrelatorio", "320px", "", "sim"); | ||
187 | + i3GEO.util.comboItens(idjanela + "i3GEOtabelaagrupaItem", i3GEOF.tabela.propJanelas[idjanela].tema, function( | ||
188 | + retorno) { | ||
189 | + if (retorno.tipo === "erro") { | ||
190 | + i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem',i3GEOF.tabela.dicionario) + '</div>'); | ||
191 | + } else { | ||
192 | + $i(idjanela + "i3GEOtabelaagrupamento").innerHTML = retorno.dados; | ||
193 | + } | ||
194 | + }, idjanela + "i3GEOtabelaagrupamento", "","sim","","form-control"); | ||
195 | + }; | ||
196 | + | ||
197 | + | ||
198 | + if (i3GEO.parametros.r.toLowerCase() !== "sim") { | ||
199 | + $i(idjanela + "i3GEOtabelaguia4obj").innerHTML = $trad("x22"); | ||
200 | + } | ||
201 | + i3GEOF.tabela.pegaRegistros(idjanela); | ||
202 | + i3GEO.guias.ajustaGuiaFerramenta(idjanela, idjanela + "i3GEOtabela"); | ||
203 | + // | ||
204 | + // Apos todos os elementos HTML da ferramenta terem sido renderizados | ||
205 | + // aplicam-se os parametros armazenados nas propriedades da janela atual | ||
206 | + // Isso e necessario pois os parametros podem ter sido enviados na inicializacao da ferramenta, | ||
207 | + // por exemplo, quando um mapa e salvo, os parametros sao armazenados e depois recuperados | ||
208 | + // | ||
209 | + i3GEOF.tabela.aplicaConfig(idjanela); | ||
210 | + if ($i(idjanela)) { | ||
211 | + $i(idjanela).style.visibility = "visible"; | ||
212 | + } | ||
213 | + }, | ||
214 | + /* | ||
215 | + * Function: html | ||
216 | + * | ||
217 | + * Gera o código html para apresentação das opções da ferramenta | ||
218 | + * | ||
219 | + * Retorno: | ||
220 | + * | ||
221 | + * String com o código html | ||
222 | + */ | ||
223 | + html : function(idjanela) { | ||
224 | + var ins = Mustache.render(i3GEOF.tabela.MUSTACHE, i3GEOF.tabela.mustacheHash(idjanela)); | ||
225 | + return ins; | ||
226 | + }, | ||
227 | + /* | ||
228 | + * Function: criaJanelaFlutuante | ||
229 | + * | ||
230 | + * Cria a janela flutuante para controle da ferramenta. | ||
231 | + */ | ||
232 | + iniciaJanelaFlutuante : function(parametros) { | ||
233 | + var duplica, minimiza, cabecalho, janela, divid, temp, titulo, id; | ||
234 | + if (!parametros) { | ||
235 | + parametros = {}; | ||
236 | + } | ||
237 | + // | ||
238 | + // configura a tabela baseado no objeto parametros | ||
239 | + // se em parametros existir um idjanela, o mesmo e retornado, caso contrario, e criado | ||
240 | + // | ||
241 | + id = i3GEOF.tabela.configura(parametros); | ||
242 | + // | ||
243 | + // se existir um elemento HTML com o mesmo ID da janela, a renderizacao ocorrera | ||
244 | + // nesse elemento, caso contrario, sera criada uma janela flutuante | ||
245 | + // | ||
246 | + if (!$i(id) && !$i(id + "_corpo")) { | ||
247 | + cabecalho = function() { | ||
248 | + i3GEOF.tabela.ativaFoco(id); | ||
249 | + }; | ||
250 | + minimiza = function() { | ||
251 | + i3GEO.janela.minimiza(id,200); | ||
252 | + }; | ||
253 | + duplica = function() { | ||
254 | + i3GEOF.tabela.iniciaJanelaFlutuante(); | ||
255 | + }; | ||
256 | + // cria a janela flutuante | ||
257 | + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" | ||
258 | + + $trad('tabela', i3GEOF.tabela.dicionario) | ||
259 | + + " (" + id + " )" | ||
260 | + + "</span></div>"; | ||
261 | + | ||
262 | + janela = i3GEO.janela.cria( | ||
263 | + "610px", | ||
264 | + "400px", | ||
265 | + "", | ||
266 | + "", | ||
267 | + "", | ||
268 | + titulo, | ||
269 | + id, | ||
270 | + false, | ||
271 | + "hd", | ||
272 | + cabecalho, | ||
273 | + minimiza, | ||
274 | + function() { i3GEO.guias.ajustaGuiaFerramenta(id, id + "i3GEOtabela");}, | ||
275 | + true, | ||
276 | + "", | ||
277 | + duplica, | ||
278 | + "", | ||
279 | + "", | ||
280 | + "39" | ||
281 | + ); | ||
282 | + divid = janela[2].id; | ||
283 | + if (i3GEOF.tabela.janelas.length > 1) { | ||
284 | + temp = janela[0].cfg.config; | ||
285 | + janela[0] | ||
286 | + .moveTo(temp.x.value + (i3GEOF.tabela.janelas.length * 50), temp.y.value + (i3GEOF.tabela.janelas.length * 15)); | ||
287 | + } | ||
288 | + $i(id + "_corpo").style.backgroundColor = "white"; | ||
289 | + | ||
290 | + temp = function() { | ||
291 | + i3GEOF.tabela.janelas.remove(id); | ||
292 | + i3GEOF.tabela.propJanelas[id] = null; | ||
293 | + if (i3GEOF.tabela.janelas.length === 0) { | ||
294 | + if (i3GEO.Interface.ATUAL === "openlayers") { | ||
295 | + i3GEO.eventos.removeEventos("NAVEGAMAPA", [ | ||
296 | + "i3GEOF.tabela.atualizaListaDeRegistros()" | ||
297 | + ]); | ||
298 | + } | ||
299 | + if (i3GEO.Interface.ATUAL === "googlemaps") { | ||
300 | + google.maps.event.removeListener(tabelaDragend); | ||
301 | + google.maps.event.removeListener(tabelaZoomend); | ||
302 | + } | ||
303 | + } | ||
304 | + }; | ||
305 | + YAHOO.util.Event.addListener(janela[0].close, "click", temp); | ||
306 | + janela[0].bringToTop(); | ||
307 | + } else { | ||
308 | + // sera renderizado em $i(id) | ||
309 | + temp = 'i3GEOF.tabela.propJanelas["' + id + '"].atualiza = this.checked'; | ||
310 | + $i(id + "_corpo").innerHTML = | ||
311 | + "<img src='../imagens/aguarde2.gif' style='visibility: hidden;' class='i3GeoAguardeJanela' id='" + id | ||
312 | + + "_imagemCabecalho'>" | ||
313 | + + "<div style=background-color:#F2F2F2; >" | ||
314 | + + "<input class='inputsb' checked style='cursor:pointer;position:relative;top:2px;' onclick='" | ||
315 | + + temp | ||
316 | + + "' type=checkbox /> " | ||
317 | + + $trad("atualizaNavegacao", i3GEOF.tabela.dicionario) | ||
318 | + + " (" | ||
319 | + + id | ||
320 | + + ")</div>"; | ||
321 | + | ||
322 | + divid = id + "_corpo"; | ||
323 | + } | ||
324 | + if ($i(id + "_imagemCabecalho")) { | ||
325 | + i3GEOF.tabela.aguarde = $i(id + "_imagemCabecalho").style; | ||
326 | + i3GEOF.tabela.propJanelas[id].aguarde = $i(id + "_imagemCabecalho").style; | ||
327 | + i3GEOF.tabela.propJanelas[id].atualiza = true; | ||
328 | + } | ||
329 | + i3GEOF.tabela.inicia(divid, id); | ||
330 | + // inicia os eventos | ||
331 | + if (i3GEO.Interface.ATUAL === "openlayers") { | ||
332 | + i3GEO.eventos.adicionaEventos("NAVEGAMAPA", [ | ||
333 | + "i3GEOF.tabela.atualizaListaDeRegistros()" | ||
334 | + ]); | ||
335 | + } | ||
336 | + if (i3GEO.Interface.ATUAL === "googlemaps" && !tabelaDragend) { | ||
337 | + tabelaDragend = google.maps.event.addListener(i3GeoMap, "dragend", function() { | ||
338 | + i3GEOF.tabela.atualizaListaDeRegistros(); | ||
339 | + }); | ||
340 | + tabelaZoomend = google.maps.event.addListener(i3GeoMap, "zoomend", function() { | ||
341 | + i3GEOF.tebela.atualizaListaDeRegistros(); | ||
342 | + }); | ||
343 | + } | ||
344 | + }, | ||
345 | + /** | ||
346 | + * Obtem os parametros de cada janela e converte em base64. Cada janela e inserida como um item em um objeto A compactacao e | ||
347 | + * utilizada para salvar as configuracoes no mapfile atual | ||
348 | + */ | ||
349 | + compactaConfig : function() { | ||
350 | + var c, g, par, janelas, i, n, novoid; | ||
351 | + par = []; | ||
352 | + janelas = i3GEOF.tabela.janelas; | ||
353 | + n = janelas.length; | ||
354 | + for (i = 0; i < n; i++) { | ||
355 | + novoid = window.prompt($trad('idDaTabela', i3GEOF.tabela.dicionario), janelas[i]); | ||
356 | + c = i3GEOF.tabela.retornaConfig(janelas[i], novoid); | ||
357 | + par.push(c); | ||
358 | + } | ||
359 | + g = YAHOO.lang.JSON.stringify(par); | ||
360 | + return i3GEO.util.base64encode(g); | ||
361 | + }, | ||
362 | + restauraTabelas : function(par) { | ||
363 | + i3GEOF.tabela.LISTAREGATIVO = false; | ||
364 | + var n, i; | ||
365 | + par = i3GEO.util.base64decode(par); | ||
366 | + par = JSON.parse(par); | ||
367 | + n = par.length; | ||
368 | + for (i = 0; i < n; i++) { | ||
369 | + i3GEOF.tabela.iniciaJanelaFlutuante(par[i]); | ||
370 | + } | ||
371 | + }, | ||
372 | + /** | ||
373 | + * Retorna um objeto contendo os valores de todos os parametros utilizados na tabela de tal forma que possa ser renderizado | ||
374 | + * novamente | ||
375 | + * | ||
376 | + * A funcao que salva o mapa no banco utiliza retornaConfig e cria um objeto que ira armazenar os parametros de cada janela | ||
377 | + */ | ||
378 | + retornaConfig : function(idjanela, novoid) { | ||
379 | + // as chaves do objeto correspondem ao ID de cada elemento | ||
380 | + var c, par; | ||
381 | + | ||
382 | + par = i3GEOF.tabela.propJanelas[idjanela]; | ||
383 | + c = $i(idjanela); | ||
384 | + // p = $i(idjanela+"i3GEOtabelaguia6obj"); | ||
385 | + if (!novoid) { | ||
386 | + novoid = idjanela; | ||
387 | + } | ||
388 | + // pega todos os elementos do tipo input | ||
389 | + /* | ||
390 | + * objs = p.getElementsByTagName("input"); for (obj in objs) { if (objs[obj].id && objs[obj].id != "") { tmpid = | ||
391 | + * objs[obj].id.replace(idjanela,novoid); if (objs[obj].type === "text") { par[tmpid] = objs[obj].value; } else { par[tmpid] = | ||
392 | + * objs[obj].checked; } } } // pega todos os elementos do tipo select objs = p.getElementsByTagName("select"); for (obj in objs) { | ||
393 | + * if (objs[obj].id && objs[obj].id != "") { tmpid = objs[obj].id.replace(idjanela,novoid); par[tmpid] = objs[obj].value; } } | ||
394 | + */ | ||
395 | + par.dados = ""; | ||
396 | + try { | ||
397 | + par["i3GEOtabelainicio"] = $i(idjanela + "i3GEOtabelainicio").value; | ||
398 | + par["i3GEOtabelafim"] = $i(idjanela + "i3GEOtabelafim").value; | ||
399 | + par["idjanela"] = novoid; | ||
400 | + par["w"] = c.style.width; | ||
401 | + par["h"] = c.style.height; | ||
402 | + } catch (e) { | ||
403 | + } | ||
404 | + return par; | ||
405 | + }, | ||
406 | + /* | ||
407 | + * Function: ativaFoco | ||
408 | + * | ||
409 | + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado | ||
410 | + */ | ||
411 | + ativaFoco : function(id) { | ||
412 | + | ||
413 | + }, | ||
414 | + vinculos : { | ||
415 | + ligacoes : [], | ||
416 | + /** | ||
417 | + * Susbtitutos para o template | ||
418 | + */ | ||
419 | + mustacheHash : function() { | ||
420 | + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.tabela.dicionario); | ||
421 | + dicionario["locaplic"] = i3GEO.configura.locaplic; | ||
422 | + dicionario["comboJanelas1"] = i3GEOF.tabela.comboJanelas("i3GEOFTabelaOpcoesAdicionaVinculoT1", "i3GEOF.tabela.vinculos.comboColunasT1()"); | ||
423 | + dicionario["comboJanelas2"] = i3GEOF.tabela.comboJanelas("i3GEOFTabelaOpcoesAdicionaVinculoT2", "i3GEOF.tabela.vinculos.comboColunasT2()"); | ||
424 | + return dicionario; | ||
425 | + }, | ||
426 | + iniciaJanelaFlutuante : function() { | ||
427 | + var janela, titulo; | ||
428 | + // cria a janela flutuante | ||
429 | + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" | ||
430 | + + $trad('vinculos', i3GEOF.tabela.dicionario) | ||
431 | + + "</span></div>"; | ||
432 | + janela = | ||
433 | + i3GEO.janela.cria( | ||
434 | + "400px", | ||
435 | + "350px", | ||
436 | + "", | ||
437 | + "", | ||
438 | + "", | ||
439 | + titulo, | ||
440 | + "i3GEOFtabelaVinculos", | ||
441 | + false, | ||
442 | + "hd", | ||
443 | + "", | ||
444 | + "", | ||
445 | + "", | ||
446 | + true, | ||
447 | + "", | ||
448 | + "", | ||
449 | + "", | ||
450 | + "", | ||
451 | + "120" | ||
452 | + ); | ||
453 | + divid = janela[2].id; | ||
454 | + if (i3GEOF.tabela.janelas.length > 1) { | ||
455 | + temp = janela[0].cfg.config; | ||
456 | + janela[0] | ||
457 | + .moveTo(temp.x.value + (i3GEOF.tabela.janelas.length * 50), temp.y.value + (i3GEOF.tabela.janelas.length * 15)); | ||
458 | + } | ||
459 | + $i("i3GEOFtabelaVinculos_corpo").style.backgroundColor = "white"; | ||
460 | + i3GEOF.tabela.vinculos.inicia(); | ||
461 | + }, | ||
462 | + html : function() { | ||
463 | + var ins = Mustache.render(i3GEOF.tabela.MUSTACHEVINCULO, i3GEOF.tabela.vinculos.mustacheHash()); | ||
464 | + return ins; | ||
465 | + }, | ||
466 | + vincular: function(){ | ||
467 | + var t1 = $i("i3GEOFTabelaOpcoesAdicionaVinculoT1").value, t2 = | ||
468 | + $i("i3GEOFTabelaOpcoesAdicionaVinculoT2").value, c1 = | ||
469 | + $i("i3GEOFTabelaOpcoesAdicionaVinculoColunaT1").value, c2 = | ||
470 | + $i("i3GEOFTabelaOpcoesAdicionaVinculoColunaT1").value; | ||
471 | + if (t1 != "" && t2 != "" && c1 != "" && c2 != "") { | ||
472 | + i3GEOF.tabela.vinculos.ligacoes.push({ | ||
473 | + "t1" : t1, | ||
474 | + "t2" : t2, | ||
475 | + "c1" : c1, | ||
476 | + "c2" : c2 | ||
477 | + }); | ||
478 | + } | ||
479 | + i3GEOF.tabela.vinculos.lista(); | ||
480 | + }, | ||
481 | + inicia : function() { | ||
482 | + var ins = i3GEOF.tabela.vinculos.html(); | ||
483 | + $i("i3GEOFtabelaVinculos_corpo").innerHTML = ins; | ||
484 | + i3GEOF.tabela.vinculos.lista(); | ||
485 | + }, | ||
486 | + comboColunasT1 : function() { | ||
487 | + var colunas = ""; | ||
488 | + if($i("i3GEOFTabelaOpcoesAdicionaVinculoT1").value != ""){ | ||
489 | + colunas = i3GEOF.tabela.comboColunas($i("i3GEOFTabelaOpcoesAdicionaVinculoT1").value, "i3GEOFTabelaOpcoesAdicionaVinculoColunaT1"); | ||
490 | + } | ||
491 | + $i("i3GEOFTabelaVinculoT1Colunas").innerHTML = colunas; | ||
492 | + }, | ||
493 | + comboColunasT2 : function() { | ||
494 | + var colunas = ""; | ||
495 | + if($i("i3GEOFTabelaOpcoesAdicionaVinculoT2").value != ""){ | ||
496 | + colunas = i3GEOF.tabela.comboColunas($i("i3GEOFTabelaOpcoesAdicionaVinculoT2").value, "i3GEOFTabelaOpcoesAdicionaVinculoColunaT2"); | ||
497 | + } | ||
498 | + $i("i3GEOFTabelaVinculoT2Colunas").innerHTML = colunas; | ||
499 | + }, | ||
500 | + lista : function() { | ||
501 | + var v = i3GEOF.tabela.vinculos.ligacoes, n = v.length, ins = | ||
502 | + "<h5>" + $trad('vinculos', i3GEOF.tabela.dicionario) + "</h5>", i; | ||
503 | + for (i = 0; i < n; i++) { | ||
504 | + ins += '<button title="excluir" onclick="i3GEOF.tabela.vinculos.excluir(\'' | ||
505 | + + i + '\')"' | ||
506 | + + ' class="btn btn-xs" style="vertical-align:top;margin: 2px; padding: 2px; display:inline-block;"><span class="material-icons">clear</span></button>' | ||
507 | + + "<h5 style='display:inline-block;vertical-align:top;'>" + v[i].t1 | ||
508 | + + " " | ||
509 | + + v[i].c1 | ||
510 | + + " -> <br>" | ||
511 | + + v[i].t2 | ||
512 | + + " " | ||
513 | + + v[i].c2 | ||
514 | + + "</h5>"; | ||
515 | + } | ||
516 | + $i("i3GEOFtabelaVinculosLista").innerHTML = ins; | ||
517 | + }, | ||
518 | + excluir : function(i) { | ||
519 | + i3GEOF.tabela.vinculos.ligacoes.splice(parseInt(i, 10), 1); | ||
520 | + i3GEOF.tabela.vinculos.lista(); | ||
521 | + }, | ||
522 | + atualizaVinculos : function(tabelaOrigem, registro, marcado) { | ||
523 | + var v = i3GEOF.tabela.vinculos.ligacoes, n = v.length, i, valor; | ||
524 | + if (n > 0) { | ||
525 | + for (i = 0; i < n; i++) { | ||
526 | + // verifica se o vinculo existe | ||
527 | + if (v[i].t1 === tabelaOrigem) { | ||
528 | + // pega o valor do registro na tabela origem | ||
529 | + valor = i3GEOF.tabela.vinculos.pegaValorRegistro(v[i].t1, v[i].c1, registro); | ||
530 | + // marca o registro na tabela destino | ||
531 | + i3GEOF.tabela.vinculos.registro(v[i].t2, v[i].c2, valor, marcado); | ||
532 | + } | ||
533 | + if (v[i].t2 === tabelaOrigem) { | ||
534 | + // pega o valor do registro na tabela origem | ||
535 | + valor = i3GEOF.tabela.vinculos.pegaValorRegistro(v[i].t2, v[i].c2, registro); | ||
536 | + // marca o registro na tabela destino | ||
537 | + i3GEOF.tabela.vinculos.registro(v[i].t1, v[i].c1, valor, marcado); | ||
538 | + } | ||
539 | + } | ||
540 | + } | ||
541 | + }, | ||
542 | + // verifica qtas colunas devem ser puladas em cada linha | ||
543 | + colunasVazias : function(idjanela) { | ||
544 | + var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), pular = 0, colunas, n, i; | ||
545 | + colunas = linhas[0].getElementsByTagName("td"); | ||
546 | + n = colunas.length; | ||
547 | + for (i = 0; i < n; i++) { | ||
548 | + if (colunas[i].innerHTML == "") { | ||
549 | + pular++; | ||
550 | + } | ||
551 | + } | ||
552 | + return pular; | ||
553 | + }, | ||
554 | + // pega o indice de uma coluna em uma tabela buscando no cabecalho | ||
555 | + // no valor de title em cada celula | ||
556 | + indiceColuna : function(idjanela, t) { | ||
557 | + var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), linha = linhas[0], colunas = | ||
558 | + linha.getElementsByTagName("td"), indice = 0, n = colunas.length, i, s; | ||
559 | + for (i = 0; i < n; i++) { | ||
560 | + s = colunas[i].getElementsByTagName("span"); | ||
561 | + if (s && s[0] && s[0].title && s[0].title == t) { | ||
562 | + return i; | ||
563 | + } | ||
564 | + } | ||
565 | + return indice; | ||
566 | + }, | ||
567 | + // retorna o indice de uma coluna que contem a tag input na tabela | ||
568 | + // com a lista de valores | ||
569 | + indiceColunaInput : function(idjanela) { | ||
570 | + var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), linha = linhas[1], colunas = | ||
571 | + linha.getElementsByTagName("td"), indice = 0, n = colunas.length, i; | ||
572 | + for (i = 0; i < n; i++) { | ||
573 | + if (colunas[i].getElementsByTagName("input").length > 0) { | ||
574 | + return i; | ||
575 | + } | ||
576 | + } | ||
577 | + return indice; | ||
578 | + }, | ||
579 | + // pega o valor da coluna em uma tabela com a lista de valores com | ||
580 | + // base no codigo do registro | ||
581 | + pegaValorRegistro : function(idjanela, coluna, registro) { | ||
582 | + var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), n = linhas.length, indiceColuna = | ||
583 | + i3GEOF.tabela.vinculos.indiceColuna(idjanela, coluna), indiceColunaInput = | ||
584 | + i3GEOF.tabela.vinculos.indiceColunaInput(idjanela), i, linha, colunas; | ||
585 | + for (i = 1; i < n; i++) { | ||
586 | + linha = linhas[i]; | ||
587 | + colunas = linha.getElementsByTagName("td"); | ||
588 | + if (colunas[indiceColunaInput].getElementsByTagName("input")[0].name == registro) { | ||
589 | + return colunas[indiceColuna].innerHTML; | ||
590 | + } | ||
591 | + } | ||
592 | + return ""; | ||
593 | + }, | ||
594 | + registro : function(idjanela, coluna, valor, marcado) { | ||
595 | + var tabela = $i(idjanela + "i3GEOtabelatabelai"), linhas = tabela.getElementsByTagName("tr"), n = linhas.length, indiceColuna = | ||
596 | + i3GEOF.tabela.vinculos.indiceColuna(idjanela, coluna), indiceColunaInput = | ||
597 | + i3GEOF.tabela.vinculos.indiceColunaInput(idjanela), i, linha, colunas, reg; | ||
598 | + for (i = 1; i < n; i++) { | ||
599 | + linha = linhas[i]; | ||
600 | + colunas = linha.getElementsByTagName("td"); | ||
601 | + if (colunas[indiceColuna].innerHTML == valor) { | ||
602 | + reg = colunas[indiceColunaInput].getElementsByTagName("input")[0]; | ||
603 | + reg.checked = marcado; | ||
604 | + i3GEOF.tabela.propJanelas[idjanela].registros[reg.name] = marcado; | ||
605 | + } | ||
606 | + } | ||
607 | + }, | ||
608 | + }, | ||
609 | + comboJanelas : function(idcombo, funcao, w) { | ||
610 | + var i, n = i3GEOF.tabela.janelas.length; | ||
611 | + if (!funcao) { | ||
612 | + funcao = ""; | ||
613 | + } | ||
614 | + if (!w) { | ||
615 | + w = 260; | ||
616 | + } | ||
617 | + ins = | ||
618 | + "" + " <select class='form-control' style='width:" | ||
619 | + + w | ||
620 | + + "px;' id='" | ||
621 | + + idcombo | ||
622 | + + "' onchange='" | ||
623 | + + funcao | ||
624 | + + "'>" | ||
625 | + + " <option value='' >---</option>"; | ||
626 | + for (i = 0; i < n; i++) { | ||
627 | + ins += "<option value='" + i3GEOF.tabela.janelas[i] + "' >" + i3GEOF.tabela.janelas[i] + "</option>"; | ||
628 | + } | ||
629 | + ins += "</select>"; | ||
630 | + return ins; | ||
631 | + }, | ||
632 | + comboColunas : function(idJanela, idcombo, funcao) { | ||
633 | + var i, c = i3GEOF.tabela.propJanelas[idJanela].colunas, n = c.itens.length; | ||
634 | + if (!funcao) { | ||
635 | + funcao = ""; | ||
636 | + } | ||
637 | + ins = "<select class='form-control' id='" | ||
638 | + + idcombo | ||
639 | + + "' onchange='" | ||
640 | + + funcao | ||
641 | + + "'>" | ||
642 | + + " <option value='' >---</option>"; | ||
643 | + for (i = 0; i < n; i++) { | ||
644 | + ins += "<option value='" + c.itens[i] + "' >" + c.alias[i] + "</option>"; | ||
645 | + } | ||
646 | + ins += "</select>"; | ||
647 | + return ins; | ||
648 | + }, | ||
649 | + /* | ||
650 | + * Function: ativaAutoAtualiza | ||
651 | + * | ||
652 | + * Ativa ou desativa a atualização automática da tabela quando o usuário navega no mapa | ||
653 | + */ | ||
654 | + atualizaListaDeRegistros : function() { | ||
655 | + var i, janelas = i3GEOF.tabela.janelas, propJanelas = i3GEOF.tabela.propJanelas, n = janelas.length; | ||
656 | + for (i = 0; i < n; i++) { | ||
657 | + if (propJanelas[janelas[i]].atualiza === true) { | ||
658 | + i3GEOF.tabela.pegaRegistros(janelas[i]); | ||
659 | + } | ||
660 | + } | ||
661 | + }, | ||
662 | + /* | ||
663 | + * Function: pegaRegistros | ||
664 | + * | ||
665 | + * Pega os registros da tabela de atributos do tema | ||
666 | + * | ||
667 | + * Veja: | ||
668 | + * | ||
669 | + * <LISTAREGISTROS> | ||
670 | + */ | ||
671 | + pegaRegistros : function(idjanela, tipolista, dadosDaClasse, inicio, fim, funcao) { | ||
672 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
673 | + return; | ||
674 | + } | ||
675 | + if (!idjanela) { | ||
676 | + idjanela = ""; | ||
677 | + } | ||
678 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
679 | + $i(idjanela + "i3GEOtabelaregistros").innerHTML = ""; | ||
680 | + var p, ext, tiporeg = "brasil", cp = new cpaint(); | ||
681 | + // verifica se esta no modo de atualizacao automatica | ||
682 | + if (i3GEOF.tabela.propJanelas[idjanela].atualiza === true) { | ||
683 | + tiporeg = "mapa"; | ||
684 | + } | ||
685 | + if (!tipolista) { | ||
686 | + if ($i(idjanela + "i3GEOtabelatipolista").checked) { | ||
687 | + tipolista = "selecionados"; | ||
688 | + } else { | ||
689 | + tipolista = "tudo"; | ||
690 | + } | ||
691 | + } | ||
692 | + if (!dadosDaClasse) { | ||
693 | + if ($i(idjanela + "i3GEOtabelalegenda").checked) { | ||
694 | + dadosDaClasse = "sim"; | ||
695 | + } else { | ||
696 | + dadosDaClasse = "nao"; | ||
697 | + } | ||
698 | + } | ||
699 | + if (!inicio) { | ||
700 | + inicio = $i(idjanela + "i3GEOtabelainicio").value - 1; | ||
701 | + } else { | ||
702 | + inicio = ""; | ||
703 | + } | ||
704 | + if (!fim) { | ||
705 | + fim = $i(idjanela + "i3GEOtabelafim").value - 1; | ||
706 | + } else { | ||
707 | + fim = ""; | ||
708 | + } | ||
709 | + if (!funcao) { | ||
710 | + funcao = function(retorno) { | ||
711 | + i3GEOF.tabela.propJanelas[idjanela].registros = []; | ||
712 | + i3GEOF.tabela.montaTabela(retorno, idjanela); | ||
713 | + }; | ||
714 | + } | ||
715 | + ext = i3GEO.parametros.mapexten; | ||
716 | + ext = i3GEO.util.extOSM2Geo(ext); | ||
717 | + p = | ||
718 | + i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid=" | ||
719 | + + i3GEO.configura.sid | ||
720 | + + "&funcao=listaregistros" | ||
721 | + + "&inicio=" | ||
722 | + + inicio | ||
723 | + + "&fim=" | ||
724 | + + fim | ||
725 | + + "&tema=" | ||
726 | + + i3GEOF.tabela.propJanelas[idjanela].tema | ||
727 | + + "&tipo=" | ||
728 | + + tiporeg | ||
729 | + + "&tipolista=" | ||
730 | + + tipolista | ||
731 | + + "&ext=" | ||
732 | + + ext | ||
733 | + + "&dadosDaClasse=" | ||
734 | + + dadosDaClasse; | ||
735 | + cp.set_response_type("JSON"); | ||
736 | + cp.call(p, "listaRegistros", funcao); | ||
737 | + }, | ||
738 | + /* | ||
739 | + * Function: montaTabela | ||
740 | + * | ||
741 | + * Monta a visualização da tabela de atributos | ||
742 | + */ | ||
743 | + montaTabela : function(retorno, idjanela) { | ||
744 | + if (retorno.data !== undefined) { | ||
745 | + var mustache = { | ||
746 | + "idjanela": "", | ||
747 | + "cabecalho": [{"classe":"hidden"},{"classe":"hidden"},{"classe":"hidden"},{"classe":"hidden"}], //4 colunas com icones | ||
748 | + "linhas": [], | ||
749 | + "ordena": $trad('ordena', i3GEOF.tabela.dicionario), | ||
750 | + "excluir": $trad("t12") | ||
751 | + }, | ||
752 | + linha = { | ||
753 | + "classezoom": "", | ||
754 | + "ext": "", | ||
755 | + "indice": "", | ||
756 | + "idjanela": "" | ||
757 | + }, | ||
758 | + ins, i, vals, cor, j, n, stat, imagem, registros = i3GEOF.tabela.propJanelas[idjanela].registros, i3GEOtabelalegenda = | ||
759 | + $i(idjanela + "i3GEOtabelalegenda").checked; | ||
760 | + // cabecalho da tabela | ||
761 | + mustache["idjanela"] = idjanela; | ||
762 | + i3GEOF.tabela.propJanelas[idjanela].colunas = { | ||
763 | + "itens" : retorno.data[0].itens, | ||
764 | + "alias" : retorno.data[0].alias | ||
765 | + }; | ||
766 | + n = retorno.data[0].itens.length; | ||
767 | + for (i = 0; i < n; i++) { | ||
768 | + mustache.cabecalho.push({ | ||
769 | + "idcoluna": i * 1 + 4, //pq tem 3 colunas com icones | ||
770 | + "idjanela": idjanela, | ||
771 | + "item": retorno.data[0].itens[i], | ||
772 | + "alias": retorno.data[0].alias[i], | ||
773 | + "classe": "" | ||
774 | + }); | ||
775 | + } | ||
776 | + n = retorno.data[1].registros.length; | ||
777 | + if ($i(idjanela + "i3GEOtabelafim").value === "") { | ||
778 | + $i(idjanela + "i3GEOtabelafim").value = n - 1; | ||
779 | + } | ||
780 | + for (i = 0; i < n; i++) { | ||
781 | + linha = {}; | ||
782 | + linha.classezoom = "hidden"; | ||
783 | + linha.ext = ""; | ||
784 | + linha.idjanela = idjanela; | ||
785 | + linha.indice = retorno.data[1].registros[i].indice; | ||
786 | + if (retorno.data[1].registros[i].ext && retorno.data[1].registros[i].ext != "") { | ||
787 | + linha.classezoom = ""; | ||
788 | + linha.ext = retorno.data[1].registros[i].ext; | ||
789 | + } | ||
790 | + linha.stat = ""; | ||
791 | + if (retorno.data[1].registros[i].status === "CHECKED") { | ||
792 | + linha.stat = "CHECKED"; | ||
793 | + } | ||
794 | + if (registros[retorno.data[1].registros[i].indice]) { | ||
795 | + if (registros[retorno.data[1].registros[i].indice] === true) { | ||
796 | + linha.stat = "CHECKED"; | ||
797 | + } else { | ||
798 | + linha.stat = ""; | ||
799 | + } | ||
800 | + } | ||
801 | + if (i3GEOtabelalegenda == true) { | ||
802 | + linha.classelegenda = ""; | ||
803 | + linha.nomeClasse = retorno.data[1].registros[i].classe["nome"]; | ||
804 | + linha.imagemClasse = retorno.data.legenda[retorno.data[1].registros[i].classe["indice"]]; | ||
805 | + imagem = retorno.data.legenda[retorno.data[1].registros[i].classe["indice"]]; | ||
806 | + } else { | ||
807 | + linha.classelegenda = "hidden"; | ||
808 | + linha.nomeClasse = ""; | ||
809 | + linha.imagemClasse = ""; | ||
810 | + } | ||
811 | + if (linha.stat === "CHECKED") { | ||
812 | + registros[retorno.data[1].registros[i].indice] = true; | ||
813 | + } | ||
814 | + vals = retorno.data[1].registros[i].valores; | ||
815 | + linha.colunas = ""; | ||
816 | + for (j = 0; j < vals.length; j++) { | ||
817 | + linha.colunas += "<td style='min-width: 150px;' title='" + vals[j].item + "' >" + vals[j].valor + "</td>"; | ||
818 | + } | ||
819 | + mustache.linhas.push(linha); | ||
820 | + } | ||
821 | + ins = Mustache.render(i3GEOF.tabela.MUSTACHELISTA, mustache); | ||
822 | + $i(idjanela + "i3GEOtabelaregistros").innerHTML = ins; | ||
823 | + } | ||
824 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
825 | + }, | ||
826 | + /* | ||
827 | + * Function: mais | ||
828 | + * | ||
829 | + * Avança o contador de registros para a listagem | ||
830 | + */ | ||
831 | + mais : function(idjanela) { | ||
832 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
833 | + return; | ||
834 | + } | ||
835 | + var i = $i(idjanela + "i3GEOtabelainicio").value * 1, f = $i(idjanela + "i3GEOtabelafim").value * 1, d = f - i; | ||
836 | + $i(idjanela + "i3GEOtabelainicio").value = f + 1; | ||
837 | + $i(idjanela + "i3GEOtabelafim").value = f + d + 1; | ||
838 | + i3GEOF.tabela.pegaRegistros(idjanela); | ||
839 | + }, | ||
840 | + /* | ||
841 | + * Function: todos | ||
842 | + * | ||
843 | + * Avança o contador de registros para o fim da listagem | ||
844 | + */ | ||
845 | + todos : function(idjanela) { | ||
846 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
847 | + return; | ||
848 | + } | ||
849 | + $i(idjanela + "i3GEOtabelainicio").value = 1; | ||
850 | + $i(idjanela + "i3GEOtabelafim").value = ""; | ||
851 | + i3GEOF.tabela.pegaRegistros(idjanela, false, false, false, 1, false); | ||
852 | + }, | ||
853 | + /* | ||
854 | + * Function: menos | ||
855 | + * | ||
856 | + * Retrocede o contador de registros para a listagem | ||
857 | + */ | ||
858 | + menos : function(idjanela) { | ||
859 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
860 | + return; | ||
861 | + } | ||
862 | + var i = $i(idjanela + "i3GEOtabelainicio").value * 1, f = $i(idjanela + "i3GEOtabelafim").value * 1, d = f - i; | ||
863 | + $i(idjanela + "i3GEOtabelainicio").value = i - d - 1; | ||
864 | + $i(idjanela + "i3GEOtabelafim").value = i - 1; | ||
865 | + if ($i(idjanela + "i3GEOtabelainicio").value < 1) { | ||
866 | + $i(idjanela + "i3GEOtabelainicio").value = 1; | ||
867 | + $i(idjanela + "i3GEOtabelafim").value = 1 + d; | ||
868 | + } | ||
869 | + i3GEOF.tabela.pegaRegistros(idjanela); | ||
870 | + }, | ||
871 | + /* | ||
872 | + * Function: excluiColuna | ||
873 | + * | ||
874 | + * Exclui uma coluna da visualização da tabela | ||
875 | + */ | ||
876 | + excluiColuna : function(coluna, cid, idjanela) { | ||
877 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
878 | + try { | ||
879 | + var tabela = $i(idjanela + "i3GEOtabelatabelai"), trs, tds, i, t, nt, ni; | ||
880 | + // pega o indice correto | ||
881 | + tds = coluna.parentNode.parentNode.getElementsByTagName("td"); | ||
882 | + nt = tds.length; | ||
883 | + for (t = 0; t < nt; t++) { | ||
884 | + if (tds[t].accessKey == cid) { | ||
885 | + cid = t; | ||
886 | + break; | ||
887 | + } | ||
888 | + } | ||
889 | + trs = tabela.getElementsByTagName("tr"); | ||
890 | + nt = trs.length; | ||
891 | + for (t = 0; t < nt; t++) { | ||
892 | + i = trs[t]; | ||
893 | + if (i.getElementsByTagName("td")[cid]) { | ||
894 | + ni = i.getElementsByTagName("td")[cid]; | ||
895 | + i.removeChild(ni); | ||
896 | + } | ||
897 | + } | ||
898 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
899 | + } catch (e) { | ||
900 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
901 | + if (typeof (console) !== 'undefined') { | ||
902 | + console.error(e); | ||
903 | + } | ||
904 | + } | ||
905 | + }, | ||
906 | + /* | ||
907 | + * Function: ordenaColuna | ||
908 | + * | ||
909 | + * Ordena uma coluna da tabela | ||
910 | + */ | ||
911 | + ordenaColuna : function(coluna, cid, idjanela) { | ||
912 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
913 | + try { | ||
914 | + var numero = false,tabela = $i(idjanela + "i3GEOtabelatabelai"), trs = tabela.getElementsByTagName("tr"), | ||
915 | + ntrs = trs.length, tds, nt, psort = [], t, psortfim, npsortfim, ins, p, e, c; | ||
916 | + | ||
917 | + // pega o indice correto | ||
918 | + tds = coluna.parentNode.parentNode.getElementsByTagName("td"); | ||
919 | + nt = tds.length; | ||
920 | + for (t = 0; t < nt; t++) { | ||
921 | + if (tds[t].accessKey == cid) { | ||
922 | + cid = t; | ||
923 | + break; | ||
924 | + } | ||
925 | + } | ||
926 | + for (t = 1; t < ntrs; t++) { | ||
927 | + c = trs[t].getElementsByTagName("td")[cid].innerHTML; | ||
928 | + psort.push( c + "@$" + t); | ||
929 | + if (c * 1) { | ||
930 | + numero = true; | ||
931 | + } | ||
932 | + } | ||
933 | + // recosntroi a tabela | ||
934 | + if(numero){ | ||
935 | + psortfim = psort.sort(function(a, b) { | ||
936 | + return a.split("@$")[0]*1 - b.split("@$")[0]*1; | ||
937 | + }); | ||
938 | + } else { | ||
939 | + psortfim = psort.sort(); | ||
940 | + } | ||
941 | + | ||
942 | + ins = "<table id=" + idjanela + "i3GEOtabelatabelai class=lista8 >"; | ||
943 | + ins += "<tr>" + trs[0].innerHTML + "</tr>"; | ||
944 | + npsortfim = psortfim.length; | ||
945 | + for (p = 0; p < npsortfim; p++) { | ||
946 | + e = psortfim[p].split("@$")[1] * 1; | ||
947 | + if (trs[e] !== undefined) { | ||
948 | + ins += "<tr>" + trs[e].innerHTML + "</tr>"; | ||
949 | + } | ||
950 | + } | ||
951 | + $i(idjanela + "i3GEOtabelaregistros").innerHTML = ins + "</table>"; | ||
952 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
953 | + } catch (e) { | ||
954 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
955 | + if (typeof (console) !== 'undefined') { | ||
956 | + console.error(e); | ||
957 | + } | ||
958 | + } | ||
959 | + }, | ||
960 | + excluiLinha : function(celula) { | ||
961 | + var p = celula.parentNode.parentNode; | ||
962 | + do { | ||
963 | + p.removeChild(p.childNodes[0]); | ||
964 | + } while (p.childNodes.length > 0); | ||
965 | + p.parentNode.removeChild(p); | ||
966 | + }, | ||
967 | + zoomExt : function(ext, idjanela) { | ||
968 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
969 | + return; | ||
970 | + } | ||
971 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
972 | + var funcao = function() { | ||
973 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
974 | + i3GEOF.tabela.pegaRegistros(idjanela); | ||
975 | + i3GEO.atualiza(); | ||
976 | + }; | ||
977 | + i3GEO.php.mudaext(funcao, "nenhum", ext); | ||
978 | + }, | ||
979 | + registraLinha : function(linha, idjanela) { | ||
980 | + i3GEOF.tabela.propJanelas[idjanela].registros[linha.name] = linha.checked; | ||
981 | + i3GEOF.tabela.vinculos.atualizaVinculos(idjanela, linha.name, linha.checked); | ||
982 | + }, | ||
983 | + /* | ||
984 | + * Function: listaMarcados | ||
985 | + * | ||
986 | + * Retorna um array com os índices dos registros que estão marcados. | ||
987 | + */ | ||
988 | + listaMarcados : function(idjanela) { | ||
989 | + var lista = [], registros = i3GEOF.tabela.propJanelas[idjanela].registros, i, n = registros.length; | ||
990 | + for (i = 0; i < n; i++) { | ||
991 | + if (registros[i] === true) { | ||
992 | + lista.push(i); | ||
993 | + } | ||
994 | + } | ||
995 | + return lista; | ||
996 | + }, | ||
997 | + /* | ||
998 | + * Function: ativaSelecao | ||
999 | + * | ||
1000 | + * Seleciona no mapa os elementos que estiverem marcados na guia 2 | ||
1001 | + * | ||
1002 | + * Veja: | ||
1003 | + * | ||
1004 | + * <INCLUISEL> | ||
1005 | + */ | ||
1006 | + ativaSelecao : function(idjanela) { | ||
1007 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1008 | + return; | ||
1009 | + } | ||
1010 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1011 | + var lista = i3GEOF.tabela.listaMarcados(idjanela), p, cp, temp = function(retorno) { | ||
1012 | + if (retorno) { | ||
1013 | + i3GEO.Interface.atualizaTema(retorno, i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1014 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1015 | + } | ||
1016 | + }; | ||
1017 | + p = | ||
1018 | + i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid=" | ||
1019 | + + i3GEO.configura.sid | ||
1020 | + + "&funcao=incluisel&tema=" | ||
1021 | + + i3GEOF.tabela.propJanelas[idjanela].tema | ||
1022 | + + "&ids=" | ||
1023 | + + lista.toString(); | ||
1024 | + cp = new cpaint(); | ||
1025 | + cp.set_response_type("JSON"); | ||
1026 | + cp.call(p, "incluiSel", temp); | ||
1027 | + }, | ||
1028 | + /* | ||
1029 | + * Function: limpaSelecao | ||
1030 | + * | ||
1031 | + * Limpa a seleção do tema da tabela | ||
1032 | + */ | ||
1033 | + limpaSelecao : function(idjanela) { | ||
1034 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1035 | + return; | ||
1036 | + } | ||
1037 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1038 | + i3GEO.tema.limpasel(i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1039 | + i3GEOF.tabela.propJanelas[idjanela].registros = []; | ||
1040 | + var lista = $i(idjanela + "i3GEOtabelatabelai").getElementsByTagName("input"), n = lista.length, i; | ||
1041 | + for (i = 0; i < n; i++) { | ||
1042 | + lista[i].checked = false; | ||
1043 | + } | ||
1044 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1045 | + }, | ||
1046 | + /* | ||
1047 | + * Function: criaNovoTema | ||
1048 | + * | ||
1049 | + * Cria um novo tema contendo a seleção existente | ||
1050 | + */ | ||
1051 | + criaNovoTema : function(idjanela) { | ||
1052 | + var camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1053 | + if(camada.nsel == 0){ | ||
1054 | + i3GEO.janela.tempoMsg($trad("selUmReg",i3GEOF.tabela.dicionario)); | ||
1055 | + return; | ||
1056 | + } | ||
1057 | + | ||
1058 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1059 | + return; | ||
1060 | + } | ||
1061 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1062 | + var temp = function(retorno) { | ||
1063 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1064 | + i3GEO.atualiza(retorno); | ||
1065 | + }; | ||
1066 | + i3GEO.php.criatemaSel(temp, i3GEOF.tabela.propJanelas[idjanela].tema); | ||
1067 | + }, | ||
1068 | + /* | ||
1069 | + * Function: comboItens | ||
1070 | + * | ||
1071 | + * Cria um combo para selecionar um item do tema escolhido | ||
1072 | + */ | ||
1073 | + comboItensEstat : function(idjanela) { | ||
1074 | + var tema = i3GEOF.tabela.propJanelas[idjanela].tema; | ||
1075 | + i3GEO.util.comboItens(idjanela + "i3GEOtabelaComboItensGuia3", tema, function(retorno) { | ||
1076 | + if (retorno.tipo === "erro") { | ||
1077 | + $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML = | ||
1078 | + i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem2',i3GEOF.tabela.dicionario) + '</div>'); | ||
1079 | + } else { | ||
1080 | + $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML = retorno.dados; | ||
1081 | + } | ||
1082 | + }, idjanela + "i3GEOtabelaitensGuia3", "","sim","","form-control"); | ||
1083 | + }, | ||
1084 | + estatistica : function(idjanela) { | ||
1085 | + if ($i(idjanela + "i3GEOtabelaComboItensGuia3").value === "") { | ||
1086 | + i3GEO.janela.tempoMsg("Escolha um item!"); | ||
1087 | + return; | ||
1088 | + } | ||
1089 | + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") { | ||
1090 | + return; | ||
1091 | + } | ||
1092 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible"; | ||
1093 | + try { | ||
1094 | + var monta = function(retorno) { | ||
1095 | + var ins = "", nome, valor, i, n; | ||
1096 | + if (retorno.data.indices !== undefined) { | ||
1097 | + if (retorno.data.indices) { | ||
1098 | + n = retorno.data.indices.length; | ||
1099 | + for (i = 0; i < n; i++) { | ||
1100 | + nome =retorno.data.variaveis[retorno.data.indices[i]]; | ||
1101 | + valor = retorno.data.valores[retorno.data.indices[i]]; | ||
1102 | + ins += '<div class="row-content"><h4 class="list-group-item-heading">'+nome+'</h4><p class="list-group-item-text">'+valor+'</p></div>'; | ||
1103 | + ins += '<div class="list-group-separator"> </div>'; | ||
1104 | + } | ||
1105 | + } | ||
1106 | + } else { | ||
1107 | + ins = retorno.data; | ||
1108 | + } | ||
1109 | + $i(idjanela + "i3GEOtabelaoperacoes").innerHTML = ins + "<br>"; | ||
1110 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1111 | + }, exclui = "", cp = new cpaint(), p; | ||
1112 | + if ($i(idjanela + "i3GEOtabelafiltro1").value !== "") { | ||
1113 | + exclui = $i("i3GEOtabelafiltro1").value; | ||
1114 | + } | ||
1115 | + p = | ||
1116 | + i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid=" | ||
1117 | + + i3GEO.configura.sid | ||
1118 | + + "&funcao=estatistica&item=" | ||
1119 | + + $i(idjanela + "i3GEOtabelaComboItensGuia3").value | ||
1120 | + + "&tema=" | ||
1121 | + + i3GEOF.tabela.propJanelas[idjanela].tema | ||
1122 | + + "&exclui=" | ||
1123 | + + exclui | ||
1124 | + + "&ext=" | ||
1125 | + + i3GEO.parametros.mapexten; | ||
1126 | + cp.set_response_type("JSON"); | ||
1127 | + cp.call(p, "estatDescritivas", monta); | ||
1128 | + } catch (e) { | ||
1129 | + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
1130 | + $i("operacoes").innerHTML = "Ocorreu um erro: " + e; | ||
1131 | + } | ||
1132 | + }, | ||
1133 | + tabelaTexto : function() { | ||
1134 | + }, | ||
1135 | + /* | ||
1136 | + * Function: relatorioTabela | ||
1137 | + * | ||
1138 | + * Monta o relatório padrão em uma nova janela | ||
1139 | + */ | ||
1140 | + relatorioTabela : function(idjanela) { | ||
1141 | + try { | ||
1142 | + $i(idjanela + "i3GEOtabelatiporelh").value = ""; | ||
1143 | + $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked; | ||
1144 | + $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked; | ||
1145 | + $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value; | ||
1146 | + $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema; | ||
1147 | + $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid; | ||
1148 | + $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value; | ||
1149 | + var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listaordem = [], listanomes = | ||
1150 | + [], nome, ordem, i, temp, n = inputs.length; | ||
1151 | + for (i = 0; i < n; i++) { | ||
1152 | + if (inputs[i].type === "checkbox" && inputs[i].checked == true) { | ||
1153 | + listai.push(inputs[i].id + "|" + inputs[i].name); | ||
1154 | + nome = $i(inputs[i].id + inputs[i].name).value; | ||
1155 | + listanomes.push(nome); | ||
1156 | + ordem = $i("ordem_" + inputs[i].id + inputs[i].name).value; | ||
1157 | + if (ordem === "") { | ||
1158 | + ordem = 0; | ||
1159 | + } | ||
1160 | + listaordem.push(ordem); | ||
1161 | + } | ||
1162 | + } | ||
1163 | + $i(idjanela + "i3GEOtabelaordemrel").value = listaordem; | ||
1164 | + $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes; | ||
1165 | + $i(idjanela + "i3GEOtabelaitensrelh").value = listai; | ||
1166 | + temp = $i(idjanela + "i3GEOtabelarelatorio").action; | ||
1167 | + $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten; | ||
1168 | + $i(idjanela + "i3GEOtabelarelatorio").submit(); | ||
1169 | + $i(idjanela + "i3GEOtabelarelatorio").action = temp; | ||
1170 | + } catch (e) { | ||
1171 | + i3GEO.janela.tempoMsg(e); | ||
1172 | + } | ||
1173 | + }, | ||
1174 | + /* | ||
1175 | + * Function: relatorioTexto | ||
1176 | + * | ||
1177 | + * Gera o relatório no formato CSV | ||
1178 | + */ | ||
1179 | + relatorioTexto : function(idjanela) { | ||
1180 | + $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked; | ||
1181 | + $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked; | ||
1182 | + $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value; | ||
1183 | + $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema; | ||
1184 | + $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid; | ||
1185 | + $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value; | ||
1186 | + $i(idjanela + "i3GEOtabelatiporelh").value = "csv"; | ||
1187 | + var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listanomes = [], nome, i, temp, n = | ||
1188 | + inputs.length; | ||
1189 | + for (i = 0; i < n; i++) { | ||
1190 | + if (inputs[i].checked === true) { | ||
1191 | + listai.push(inputs[i].id + "|" + inputs[i].name); | ||
1192 | + nome = $i(inputs[i].id + inputs[i].name).value; | ||
1193 | + listanomes.push(nome); | ||
1194 | + } | ||
1195 | + } | ||
1196 | + $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes; | ||
1197 | + $i(idjanela + "i3GEOtabelaitensrelh").value = listai; | ||
1198 | + temp = $i(idjanela + "i3GEOtabelarelatorio").action; | ||
1199 | + $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten; | ||
1200 | + $i(idjanela + "i3GEOtabelarelatorio").submit(); | ||
1201 | + $i(idjanela + "i3GEOtabelarelatorio").action = temp; | ||
1202 | + } | ||
1203 | +}; | ||
0 | \ No newline at end of file | 1204 | \ No newline at end of file |
@@ -0,0 +1,339 @@ | @@ -0,0 +1,339 @@ | ||
1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
2 | + | ||
3 | +<html> | ||
4 | +<head> | ||
5 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | ||
6 | +<title>i3Geo</title> | ||
7 | +</head> | ||
8 | +<?php | ||
9 | +session_name("i3GeoPHP"); | ||
10 | + | ||
11 | +include_once (dirname(__FILE__)."/../../classesphp/sani_request.php"); | ||
12 | +$_GET = array_merge($_GET,$_POST); | ||
13 | +error_reporting(0); | ||
14 | +$nomesrel = $_GET["nomesrel"]; | ||
15 | +$temarel = $_GET["temarel"]; | ||
16 | +$ordemrel = $_GET["ordemrel"]; | ||
17 | +$itensrel = $_GET["itensrel"]; | ||
18 | +$itemagruparel = $_GET["itemagruparel"]; | ||
19 | + | ||
20 | +if (isset($_GET["g_sid"])){ | ||
21 | + session_id($_GET["g_sid"]); | ||
22 | +} | ||
23 | +session_start(); | ||
24 | + | ||
25 | +$map_file = $_SESSION["map_file"]; | ||
26 | +$postgis_mapa = $_SESSION["postgis_mapa"]; | ||
27 | + | ||
28 | +include (dirname(__FILE__)."/../../ms_configura.php"); | ||
29 | +include(dirname(__FILE__)."/../blacklist.php"); | ||
30 | +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); | ||
31 | +include(dirname(__FILE__)."/../../classesphp/carrega_ext.php"); | ||
32 | +include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | ||
33 | +$versao = versao(); | ||
34 | +$versao = $versao["principal"]; | ||
35 | +error_reporting(0); | ||
36 | +$temp = explode(",",$nomesrel); | ||
37 | +$colunasTemp = array(); | ||
38 | +foreach($temp as $t){ | ||
39 | + $t1Temp=explode("|",$t); | ||
40 | + $colunasTemp[] = $t1Temp[0]; | ||
41 | +} | ||
42 | +//reordena as colunas | ||
43 | +$ordem = explode(",",$ordemrel); | ||
44 | +if(count($ordem) > 0){ | ||
45 | + $itensrelTemp = explode(",",$itensrel); | ||
46 | + $itensrel = array(); | ||
47 | + $colunas = array(); | ||
48 | + $n = count($colunasTemp); | ||
49 | + for($i=0;$i<$n;$i++){ | ||
50 | + $colunas[$ordem[$i]] = $colunasTemp[$i]; | ||
51 | + $t1[$ordem[$i]] = $t1Temp[$i]; | ||
52 | + $itensrel[$ordem[$i]] = $itensrelTemp[$i]; | ||
53 | + } | ||
54 | + if(count($colunas) == count($colunasTemp)){ | ||
55 | + ksort($colunas); | ||
56 | + ksort($t1); | ||
57 | + ksort($itensrel); | ||
58 | + $itensrel = implode(",",$itensrel); | ||
59 | + } | ||
60 | +} | ||
61 | +else{ | ||
62 | + $colunas = $colunasTemp; | ||
63 | + $t1 = $t1Temp; | ||
64 | +} | ||
65 | + | ||
66 | +if($itemagruparel != "" && !in_array($itemagruparel,$colunas)){ | ||
67 | + $colunas[] = $itemagruparel; | ||
68 | +} | ||
69 | + | ||
70 | +$temp = explode(",",$itensrel); | ||
71 | +$itensrel = array(); | ||
72 | +foreach($temp as $t) | ||
73 | +{ | ||
74 | + $t1=explode("|",$t); | ||
75 | + $itensrel[] = $t1[0]; | ||
76 | +} | ||
77 | +if($itemagruparel != "" && !in_array($itemagruparel,$itensrel)) | ||
78 | +{$itensrel[] = $itemagruparel;} | ||
79 | + | ||
80 | +$mapa = ms_newMapObj($map_file); | ||
81 | +substituiConObj($mapa,$postgis_mapa); | ||
82 | +if($ext && $ext != ""){ | ||
83 | + $e = explode(" ",$ext); | ||
84 | + $extatual = $mapa->extent; | ||
85 | + $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); | ||
86 | +} | ||
87 | + | ||
88 | +$layer = $mapa->getlayerbyname($temarel); | ||
89 | +$layer->set("template","none.html"); | ||
90 | +//$layer->set("data",$layer->data."options='-c client_encoding=LATIN1'"); | ||
91 | +$existesel = "nao"; | ||
92 | + | ||
93 | +/* | ||
94 | +if (file_exists($map_file."qy")) | ||
95 | +{$mapa->loadquery($map_file."qy");} | ||
96 | +*/ | ||
97 | +carregaquery2($map_file,$layer,$mapa); | ||
98 | + | ||
99 | +if ($layer->getNumresults() > 0){ | ||
100 | + $existesel = "sim"; | ||
101 | +} | ||
102 | +if ($existesel == "nao"){ | ||
103 | + $layer->querybyrect($mapa->extent); | ||
104 | +} | ||
105 | + | ||
106 | +$layer->open(); | ||
107 | +if(strtoupper($layer->getmetadata("convcaracter")) == "NAO"){ | ||
108 | + $convC = false; | ||
109 | +} | ||
110 | +else{ | ||
111 | + $convC = true; | ||
112 | +} | ||
113 | + | ||
114 | +//$registros[] = array(); | ||
115 | +$res_count = $layer->getNumresults(); | ||
116 | +for ($i = 0; $i < $res_count; $i++){ | ||
117 | + $valitem = array(); | ||
118 | + if($versao >= 6){ | ||
119 | + $shape = $layer->getShape($layer->getResult($i)); | ||
120 | + } | ||
121 | + else{ | ||
122 | + $shape = $layer->getFeature($layer->getResult($i)->shapeindex); | ||
123 | + } | ||
124 | + $grupo = ""; | ||
125 | + foreach ($itensrel as $item){ | ||
126 | + $v = trim($shape->values[$item]); | ||
127 | + //$v = mb_convert_encoding($v,mb_detect_encoding($v),"ISO-8859-1"); | ||
128 | + if (function_exists("mb_convert_encoding") && $convC == true){ | ||
129 | + //$v = mb_convert_encoding($v,"UTF-8","ISO-8859-1"); | ||
130 | + } | ||
131 | + $valitem[$item] = $v; | ||
132 | + } | ||
133 | + | ||
134 | + if ($itemagruparel != ""){ | ||
135 | + $grupo = $valitem[$itemagruparel]; | ||
136 | + } | ||
137 | + if($arearel == "true"){ | ||
138 | + $valitem["area"] = calculaarea($shape); | ||
139 | + } | ||
140 | + if ($itemagruparel == "") | ||
141 | + $registros[] = $valitem; | ||
142 | + else{ | ||
143 | + if(!$registros[$grupo]) | ||
144 | + $registros[$grupo]=array($valitem); | ||
145 | + else | ||
146 | + array_push($registros[$grupo],$valitem); | ||
147 | + } | ||
148 | +} | ||
149 | +$fechou = $layer->close(); | ||
150 | + | ||
151 | +restauraCon($map_file,$postgis_mapa); | ||
152 | + | ||
153 | +if(isset($_GET["tiporel"]) && $_GET["tiporel"] == "csv"){ | ||
154 | + ob_end_clean(); | ||
155 | + header("Content-type: text/csv"); | ||
156 | + echo implode(";",explode(",",$nomesrel)); | ||
157 | + if($arearel == "true"){ | ||
158 | + echo ";área em ha \n"; | ||
159 | + } | ||
160 | + else{ | ||
161 | + echo "\n"; | ||
162 | + } | ||
163 | + foreach ($registros as $linhas){ | ||
164 | + echo converte(implode(";",$linhas))."\n"; | ||
165 | + } | ||
166 | + exit; | ||
167 | +} | ||
168 | +?> | ||
169 | + | ||
170 | +<style> | ||
171 | +body,td | ||
172 | +{ | ||
173 | + text-align:left; | ||
174 | + border: 0px solid #FFFFFF; | ||
175 | + font-family: Verdana, Arial, Helvetica, sans-serif; | ||
176 | + position:relative; | ||
177 | + font-size:10pt; | ||
178 | + padding:10px; | ||
179 | +} | ||
180 | + | ||
181 | +</style> | ||
182 | +<body> | ||
183 | +<?php | ||
184 | +echo "<span style=font-size:18px; >Relatório do tema: <b>".converte($layer->getmetadata("TEMA"))."</b><br></span>"; | ||
185 | +$ocorrencias = count($registros); | ||
186 | +echo "ocorrências: ".$ocorrencias."<br>"; | ||
187 | +if ($itemagruparel == "") | ||
188 | +{ | ||
189 | + echo "<table>"; | ||
190 | + $cor = "rgb(240,240,240)"; | ||
191 | + echo "<tr style=background-color:yellow >"; | ||
192 | + if($statrel == "true"){echo "<td></td>";} | ||
193 | + foreach ($colunas as $c) | ||
194 | + {echo "<td>$c</td>";} | ||
195 | + if($arearel == "true") | ||
196 | + {echo "<td>área em ha</td>";} | ||
197 | + foreach ($registros as $linhas) | ||
198 | + { | ||
199 | + if(count($linhas)>0){ | ||
200 | + echo "<tr style=background-color:$cor >"; | ||
201 | + if ($statrel == "true") | ||
202 | + echo "<td></td>"; | ||
203 | + $conta = 0; | ||
204 | + foreach($linhas as $v){ | ||
205 | + if(is_numeric(trim($v))){ | ||
206 | + echo "<td style='text-align:right'>".number_format($v,2,",",".")."</td>"; | ||
207 | + } | ||
208 | + else{ | ||
209 | + echo "<td style='text-align:left'>".converte($v)."</td>"; | ||
210 | + } | ||
211 | + if ($statrel == "true"){ | ||
212 | + $v = trim($v); | ||
213 | + if(!is_numeric($v)){$v = 0;} | ||
214 | + if ($v == $excluirvalor){$v = 0;} | ||
215 | + $soma[$conta] = $soma[$conta] + $v; | ||
216 | + } | ||
217 | + $conta++; | ||
218 | + } | ||
219 | + echo "<tr>"; | ||
220 | + if ($cor == "rgb(240,240,240)") | ||
221 | + {$cor = "rgb(220,220,220)";} | ||
222 | + else | ||
223 | + {$cor = "rgb(240,240,240)";} | ||
224 | + } | ||
225 | + } | ||
226 | + if ($statrel == "true") | ||
227 | + { | ||
228 | + echo "<tr style=background-color:orange >"; | ||
229 | + echo "<td>soma</td>"; | ||
230 | + foreach($soma as $s) | ||
231 | + echo "<td style='text-align:right'>".number_format($s,2,",",".")."</td>"; | ||
232 | + echo "</tr>"; | ||
233 | + echo "<tr style=background-color:orange >"; | ||
234 | + echo "<td>média</td>"; | ||
235 | + foreach($soma as $s) | ||
236 | + echo "<td style='text-align:right'>".number_format(($s / $ocorrencias),2,",",".")."</td>"; | ||
237 | + echo "</tr>"; | ||
238 | + } | ||
239 | + echo "</table>"; | ||
240 | +} | ||
241 | +else | ||
242 | +{ | ||
243 | + $conta = -1; | ||
244 | + $chaves = array_keys($registros); | ||
245 | + sort($chaves); | ||
246 | + foreach ($chaves as $chave) | ||
247 | + { | ||
248 | + //if(count($registro) < 1){continue;} | ||
249 | + //var_dump($registros[$conta]); | ||
250 | + $ocorrencias = count($registros[$chave]); | ||
251 | + echo "<br><br><b>".$itemagruparel.": ".$chave."<br>ocorrências: ".$ocorrencias."<br></b>"; | ||
252 | + //echo "<pre>";var_dump($registro); | ||
253 | + echo "<table>"; | ||
254 | + $cor = "rgb(240,240,240)"; | ||
255 | + echo "<tr style=background-color:yellow >"; | ||
256 | + if ($statrel == "true") | ||
257 | + echo "<td></td>"; | ||
258 | + foreach ($colunas as $c) | ||
259 | + { | ||
260 | + echo "<td>$c</td>"; | ||
261 | + } | ||
262 | + $soma = array(); | ||
263 | + if($arearel == "true") | ||
264 | + {echo "<td>área em ha</td>";} | ||
265 | + echo "<tr>"; | ||
266 | + foreach ($registros[$chave] as $linhas) | ||
267 | + { | ||
268 | + if (count($linhas) > 0 ) | ||
269 | + { | ||
270 | + //echo "<pre>";var_dump($linhas); | ||
271 | + echo "<tr style=background-color:$cor >"; | ||
272 | + if ($statrel == "true") | ||
273 | + echo "<td></td>"; | ||
274 | + $conta = 0; | ||
275 | + foreach($linhas as $v) | ||
276 | + { | ||
277 | + if(is_numeric(trim($v))) | ||
278 | + {echo "<td style='text-align:right'>".number_format($v,2,",",".")."</td>";} | ||
279 | + else | ||
280 | + {echo "<td style='text-align:left'>".converte($v)."</td>";} | ||
281 | + if ($statrel == "true") | ||
282 | + { | ||
283 | + $v = trim($v); | ||
284 | + if(!is_numeric($v)){$v = 0;} | ||
285 | + if ($v == $excluirvalor){$v = 0;} | ||
286 | + $soma[$conta] = $soma[$conta] + $v; | ||
287 | + } | ||
288 | + $conta++; | ||
289 | + } | ||
290 | + echo "<tr>"; | ||
291 | + if ($cor == "rgb(240,240,240)") | ||
292 | + {$cor = "rgb(220,220,220)";} | ||
293 | + else | ||
294 | + {$cor = "rgb(240,240,240)";} | ||
295 | + } | ||
296 | + } | ||
297 | + if ($statrel == "true" && $ocorrencias>1 ) | ||
298 | + { | ||
299 | + echo "<tr style=background-color:orange >"; | ||
300 | + echo "<td>soma</td>"; | ||
301 | + foreach($soma as $s) | ||
302 | + echo "<td style='text-align:right'>".number_format($s,2,",",".")."</td>"; | ||
303 | + echo "</tr>"; | ||
304 | + echo "<tr style=background-color:orange >"; | ||
305 | + echo "<td>média</td>"; | ||
306 | + foreach($soma as $s) | ||
307 | + echo "<td style='text-align:right'>".number_format(($s / $ocorrencias),2,",",".")."</td>"; | ||
308 | + echo "</tr>"; | ||
309 | + } | ||
310 | + echo "</table>"; | ||
311 | + } | ||
312 | + | ||
313 | +} | ||
314 | +function calculaarea($geo) | ||
315 | +{ | ||
316 | + global $postgis_con; | ||
317 | + $v = versao(); | ||
318 | + if (($v["principal"] < 5) && ($postgis_con == "")) | ||
319 | + {return ("erro. É necessária uma versão maior que 5.0 do Mapserver.");} | ||
320 | + $g = $geo->towkt(); | ||
321 | + $shape = ms_shapeObjFromWkt($g); | ||
322 | + $rect = $shape->bounds; | ||
323 | + $projInObj = ms_newprojectionobj("proj=longlat,ellps=WGS84,datum=WGS84,no_defs"); | ||
324 | + $projOutObj = ms_newprojectionobj("proj=laea,lat_0=".$rect->miny.",lon_0=".$rect->minx.",x_0=500000,y_0=10000000,ellps=GRS67,units=m,no_defs"); | ||
325 | + $shape->project($projInObj, $projOutObj); | ||
326 | + $s = $shape->towkt(); | ||
327 | + $shape = ms_shapeObjFromWkt($s); | ||
328 | + $area = $shape->getArea(); | ||
329 | + return $area / 10000; | ||
330 | +} | ||
331 | +function converte($texto) | ||
332 | +{ | ||
333 | + if (!mb_detect_encoding($texto,"UTF-8",true)) | ||
334 | + { | ||
335 | + $texto = mb_convert_encoding($texto,"UTF-8","ISO-8859-1"); | ||
336 | + } | ||
337 | + return $texto; | ||
338 | +} | ||
339 | +?> | ||
0 | \ No newline at end of file | 340 | \ No newline at end of file |
@@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
1 | +<table id="{{{idjanela}}}i3GEOtabelatabelai"> | ||
2 | + <tr> | ||
3 | + {{#cabecalho}} | ||
4 | + <td accessKey="{{idcoluna}}" > | ||
5 | + <button title="{{{t12}}}" onclick='i3GEOF.tabela.excluiColuna(this,"{{idcoluna}}","{{idjanela}}")' class="{{classe}} btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
6 | + <span class="material-icons">clear</span> | ||
7 | + </button> | ||
8 | + <button title="{{{ordena}}}" onclick='i3GEOF.tabela.ordenaColuna(this,"{{idcoluna}}","{{idjanela}}")' class="{{classe}} btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
9 | + <span class="material-icons">sort</span> | ||
10 | + </button><br> | ||
11 | + <span class="{{classe}}" title="{{{item}}}">{{{alias}}}</span> | ||
12 | + </td> | ||
13 | + {{/cabecalho}} | ||
14 | + </tr> | ||
15 | + {{#linhas}} | ||
16 | + <tr> | ||
17 | + <td> | ||
18 | + <button onclick='i3GEOF.tabela.excluiLinha(this,"{{idjanela}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
19 | + <span class="material-icons">clear</span> | ||
20 | + </button> | ||
21 | + </td> | ||
22 | + <td> | ||
23 | + <button title="zoom" onclick='i3GEOF.tabela.zoomExt("{{{ext}}}","{{idjanela}}")' class="{{classezoom}} btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
24 | + <span class="material-icons">gps_fixed</span> | ||
25 | + </button> | ||
26 | + </td> | ||
27 | + <td> | ||
28 | + <div class="checkbox text-left" style="margin-right:15px;"> | ||
29 | + <label style="margin:0px;"> | ||
30 | + <input {{stat}} onclick='i3GEOF.tabela.registraLinha(this,"{{idjanela}}")' type="checkbox" name="{{indice}}" > | ||
31 | + <span class="checkbox-material noprint"> | ||
32 | + <span class="check"></span> | ||
33 | + </span> | ||
34 | + </label> | ||
35 | + </div> | ||
36 | + </td> | ||
37 | + <td> | ||
38 | + <img class="{{classelegenda}}" style="margin:10px;" title="{{{nomeClasse}}}" src="{{{imagemClasse}}}" /> | ||
39 | + </td> | ||
40 | + {{{colunas}}} | ||
41 | + </tr> | ||
42 | + {{/linhas}} | ||
43 | +</table> | ||
0 | \ No newline at end of file | 44 | \ No newline at end of file |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +<div class="container-fluid"> | ||
2 | + <div style="width: 100%;" class='form-group label-fixed condensed'> | ||
3 | + <label class="control-label" for="">{{{selecionaTabela}}}</label> | ||
4 | + <div style="width: 100%;" class="input-group">{{{comboJanelas1}}}</div> | ||
5 | + </div> | ||
6 | + <div style="width: 100%;" class='form-group label-fixed condensed'> | ||
7 | + <label class="control-label" for="">{{{colunaLigacao}}}</label> | ||
8 | + <div style="width: 100%;" class="input-group"> | ||
9 | + <div id="i3GEOFTabelaVinculoT1Colunas" ></div> | ||
10 | + </div> | ||
11 | + </div> | ||
12 | + <div style="width: 100%;" class='form-group label-fixed condensed'> | ||
13 | + <label class="control-label" for="">{{{selecionaSegundaTabela}}}</label> | ||
14 | + <div style="width: 100%;" class="input-group">{{{comboJanelas2}}}</div> | ||
15 | + </div> | ||
16 | + <div style="width: 100%;" class='form-group label-fixed condensed'> | ||
17 | + <label class="control-label" for="">{{{colunaLigacao}}}</label> | ||
18 | + <div style="width: 100%;" class="input-group"> | ||
19 | + <div id="i3GEOFTabelaVinculoT2Colunas" ></div> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + <button onclick="i3GEOF.tabela.vinculos.vincular()" class='btn btn-primary btn-sm btn-raised'>{{{criaVinculo}}}</button> | ||
23 | + <div id=i3GEOFtabelaVinculosLista></div> | ||
24 | +</div> | ||
0 | \ No newline at end of file | 25 | \ No newline at end of file |
@@ -0,0 +1,165 @@ | @@ -0,0 +1,165 @@ | ||
1 | +<!-- Guias --> | ||
2 | +<div id='{{{idjanela}}}' class='yui-navset' style='height: 38px; top: 0px; cursor: pointer; margin-left: 2px;'> | ||
3 | + <ul class='yui-nav' style='border-width: 0pt 0pt 0px; border-color: rgb(240, 240, 240); border-bottom-color: white;'> | ||
4 | + <li> | ||
5 | + <div id='{{{idjanela}}}i3GEOtabelaguia6' style='text-align: center; left: 0px;'> | ||
6 | + <a title='{{{propriedades}}}'> | ||
7 | + <em><span class="material-icons">settings</span></em> | ||
8 | + </a> | ||
9 | + </div> | ||
10 | + </li> | ||
11 | + <li> | ||
12 | + <div id='{{{idjanela}}}i3GEOtabelaguia1' style='text-align: center; left: 0px;'> | ||
13 | + <a> | ||
14 | + <em>{{{registros}}}</em> | ||
15 | + </a> | ||
16 | + </div> | ||
17 | + </li> | ||
18 | + <li> | ||
19 | + <div id='{{{idjanela}}}i3GEOtabelaguia3' style='text-align: center; left: 0px;'> | ||
20 | + <a> | ||
21 | + <em>{{{estatisticas}}}</em> | ||
22 | + </a> | ||
23 | + </div> | ||
24 | + </li> | ||
25 | + <li> | ||
26 | + <div id='{{{idjanela}}}i3GEOtabelaguia5' style='text-align: center; left: 0px;'> | ||
27 | + <a> | ||
28 | + <em>{{{relat}}}</em> | ||
29 | + </a> | ||
30 | + </div> | ||
31 | + </li> | ||
32 | + </ul> | ||
33 | +</div> | ||
34 | +<!-- Guia Propriedades --> | ||
35 | +<div id='{{{idjanela}}}i3GEOtabelaguia6obj' class="container-fluid"> | ||
36 | + <div class="radio radio-primary condensed text-left"> | ||
37 | + <label> | ||
38 | + <input name="classOuSel" id='{{{idjanela}}}i3GEOtabelatipolista' type="radio" onclick="i3GEOF.tabela.pegaRegistros('{{{idjanela}}}')"> | ||
39 | + <span class="circle"></span> | ||
40 | + <span class="check"></span> | ||
41 | + {{{atuatab}}} | ||
42 | + </label> | ||
43 | + </div> | ||
44 | + <div class="radio radio-primary condensed text-left"> | ||
45 | + <label> | ||
46 | + <input name="classOuSel" id='{{{idjanela}}}i3GEOtabelalegenda' type="radio" onclick="i3GEOF.tabela.pegaRegistros('{{{idjanela}}}')"> | ||
47 | + <span class="circle"></span> | ||
48 | + <span class="check"></span> | ||
49 | + {{{colleg}}} | ||
50 | + </label> | ||
51 | + </div> | ||
52 | + <div class="checkbox text-left"> | ||
53 | + <label> | ||
54 | + <input checked id='i3GEOFtabelaRodape{{{idjanela}}}' type="checkbox" onclick="i3GEOF.tabela.propJanelas['{{{idjanela}}}'].atualiza = this.checked;"> | ||
55 | + <span class="checkbox-material noprint"> | ||
56 | + <span class="check"></span> | ||
57 | + </span> | ||
58 | + {{{atualizaAoNavegar}}} | ||
59 | + </label> | ||
60 | + </div> | ||
61 | +</div> | ||
62 | +<!-- Registros da tabela --> | ||
63 | +<div id='{{{idjanela}}}i3GEOtabelaguia1obj' class='container-fluid ' style="height: calc(100% - 200px);"> | ||
64 | + <div id='{{{idjanela}}}i3GEOFtabelaComboCabeca' class='form-group condensed' > | ||
65 | + | ||
66 | + </div> | ||
67 | +<div style="display: flex;overflow: hidden;"> | ||
68 | + <a href='javascript:void(0)' onclick="i3GEOF.tabela.ativaSelecao('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{atvsel}}}</a> | ||
69 | + <a title='{{{limpselmap}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.limpaSelecao('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{limpsel}}}</a> | ||
70 | + <a title='{{{criatemasel}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.criaNovoTema('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{criatema}}}</a> | ||
71 | + <a href='javascript:void(0)' onclick="i3GEO.mapa.ativaTema(i3GEOF.tabela.propJanelas['{{{idjanela}}}'].tema);i3GEO.analise.dialogo.graficoInterativo1();" class='btn btn-primary btn-sm btn-raised'>{{{grafico}}}</a> | ||
72 | + <a title='{{{vinctab}}}' href='javascript:void(0)' onclick="i3GEOF.tabela.vinculos.iniciaJanelaFlutuante()" class='btn btn-primary btn-sm btn-raised'>{{{vinculos}}}</a> | ||
73 | +</div> | ||
74 | + <div class="form-group condensed"> | ||
75 | + {{{de}}} | ||
76 | + <input class="form-control" style="display: inline; width: 50px;" id="{{{idjanela}}}i3GEOtabelainicio" size="5" value="1" type="text"> | ||
77 | + {{{ate}}} | ||
78 | + <input class="form-control" style="display: inline; width: 50px;" id="{{{idjanela}}}i3GEOtabelafim" size="5" value="20" type="text"> | ||
79 | + | ||
80 | + <button onclick='i3GEOF.tabela.menos("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
81 | + <span class="material-icons">remove_circle_outline</span> | ||
82 | + </button> | ||
83 | + <button onclick='i3GEOF.tabela.mais("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
84 | + <span class="material-icons">add_circle_outline</span> | ||
85 | + </button> | ||
86 | + <button title='{{{vertodos}}}' onclick='i3GEOF.tabela.todos("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
87 | + <span class="material-icons">last_page</span> | ||
88 | + </button> | ||
89 | + <button title='{{{atuareg}}}' onclick='i3GEOF.tabela.pegaRegistros("{{{idjanela}}}")' class="btn btn-xs" style="margin: 2px; padding: 2px;"> | ||
90 | + <span class="material-icons">refresh</span> | ||
91 | + </button> | ||
92 | + </div> | ||
93 | + | ||
94 | + <div id='{{{idjanela}}}i3GEOtabelaregistros' class='container-fluid ' style='top: 10px; display: flex;overflow: auto;height: 100%;'></div> | ||
95 | +</div> | ||
96 | +<!-- Estatisticas --> | ||
97 | +<div id='{{{idjanela}}}i3GEOtabelaguia3obj' style='width:98%; height: calc(100% - 50px);display: none;' class='container-fluid '> | ||
98 | + <div class='form-group condensed'> | ||
99 | + <label class="control-label">{{{itemcalc}}}</label> | ||
100 | + <div id='{{{idjanela}}}i3GEOtabelaitensGuia3'></div> | ||
101 | + </div> | ||
102 | + <!-- label-floating --> | ||
103 | + <div class='form-group label-floating is-empty'> | ||
104 | + <label class="control-label" for="{{{idjanela}}}i3GEOtabelafiltro1">{{{excluicalc}}}</label> | ||
105 | + <input class="form-control input-lg" type='text' id='{{{idjanela}}}i3GEOtabelafiltro1' value='' /> | ||
106 | + </div> | ||
107 | + | ||
108 | + <button onclick="i3GEOF.tabela.estatistica('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{calc}}}</button> | ||
109 | + | ||
110 | + <div id='{{{idjanela}}}i3GEOtabelaoperacoes' style='font-size: 12px; text-align: left; position: relative; top: 15px; left: 0px;'></div> | ||
111 | + | ||
112 | + <h5 class="alert alert-info">{{{paraqueas}}}</h5> | ||
113 | +</div> | ||
114 | +<!-- Relatorio --> | ||
115 | +<div id='{{{idjanela}}}i3GEOtabelaguia5obj' class='container-fluid ' style="width:98%; height: calc(100% - 50px); overflow:auto;"> | ||
116 | + <div class='form-group condensed'> | ||
117 | + <label>{{{itensrel}}}</label> | ||
118 | + <div id='{{{idjanela}}}i3GEOtabelaitensrelatorio' style='top: 10px;'></div> | ||
119 | + </div> | ||
120 | + <div class='form-group condensed'> | ||
121 | + <label class="control-label">{{{itensagr}}}</label> | ||
122 | + <div id='{{{idjanela}}}i3GEOtabelaagrupamento'></div> | ||
123 | + </div> | ||
124 | + | ||
125 | + <div class='form-group label-floating is-empty'> | ||
126 | + <label class="control-label" for="{{{idjanela}}}i3GEOtabelaexcestat">{{{excvalor}}}</label> | ||
127 | + <input class="form-control input-lg" type='text' id='{{{idjanela}}}i3GEOtabelaexcestat' value='' /> | ||
128 | + </div> | ||
129 | + | ||
130 | + <div class="checkbox text-left"> | ||
131 | + <label> | ||
132 | + <input id='{{{idjanela}}}i3GEOtabelacalculaarea' type="checkbox"> | ||
133 | + <span class="checkbox-material noprint"> | ||
134 | + <span class="check"></span> | ||
135 | + </span> | ||
136 | + {{{incarea}}} | ||
137 | + </label> | ||
138 | + </div> | ||
139 | + | ||
140 | + <div class="checkbox text-left"> | ||
141 | + <label> | ||
142 | + <input id='{{{idjanela}}}i3GEOtabelacalculaestat' type="checkbox"> | ||
143 | + <span class="checkbox-material noprint"> | ||
144 | + <span class="check"></span> | ||
145 | + </span> | ||
146 | + {{{incestat}}} | ||
147 | + </label> | ||
148 | + </div> | ||
149 | + | ||
150 | + <button onclick="i3GEOF.tabela.relatorioTabela('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{relat}}}</button> | ||
151 | + <button onclick="i3GEOF.tabela.relatorioTexto('{{{idjanela}}}')" class='btn btn-primary btn-sm btn-raised'>{{{relattext}}}</button> | ||
152 | + | ||
153 | + <form method='post' style='display: none' id='{{{idjanela}}}i3GEOtabelarelatorio' action='{{{locaplic}}}/ferramentas/tabela/relatorio.php' target='_blank'> | ||
154 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelaarearelh' name='arearel' value='nao' /> | ||
155 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelastatrelh' name='statrel' value='nao' /> | ||
156 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelatemarelh' name='temarel' value='' /> | ||
157 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelag_sidh' name='g_sid' value='' /> | ||
158 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelaitemagruparelh' name='itemagruparel' value='' /> | ||
159 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelaitensrelh' name='itensrel' value='' /> | ||
160 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelanomesrelh' name='nomesrel' value='' /> | ||
161 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelaordemrel' name='ordemrel' value='' /> | ||
162 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelaexcluirvalorh' name='excluirvalor' value='' /> | ||
163 | + <input type='hidden' id='{{{idjanela}}}i3GEOtabelatiporelh' name='tiporel' value='' /> | ||
164 | + </form> | ||
165 | +</div> |
js/janela.js
@@ -679,7 +679,10 @@ i3GEO.janela = | @@ -679,7 +679,10 @@ i3GEO.janela = | ||
679 | }, | 679 | }, |
680 | _formModal: false, | 680 | _formModal: false, |
681 | //utilizado para mensagens de ferramentas com botao de close e outros parametros | 681 | //utilizado para mensagens de ferramentas com botao de close e outros parametros |
682 | - formModal : function({texto = false, footer = false, header = false, onclose = false, backdrop = false, draggable = "enable", css = {'cursor': 'pointer', 'width': '', 'height': '','position': 'fixed','top': 0, 'left': 0, 'right': 0, 'margin': 'auto'}} = {}) { | 682 | + formModal : function({resizable = {disabled: true, ghost: true, handles: "se"}, texto = false, footer = false, header = false, onclose = false, backdrop = false, draggable = "enable", css = false} = {}) { |
683 | + if(css == false){ | ||
684 | + css = {'cursor': 'pointer', 'width': '', 'height': '','position': 'fixed','top': 0, 'left': 0, 'right': 0, 'margin': 'auto'}; | ||
685 | + } | ||
683 | if(draggable == "enable"){ | 686 | if(draggable == "enable"){ |
684 | css.cursor = "move"; | 687 | css.cursor = "move"; |
685 | } | 688 | } |
@@ -691,15 +694,16 @@ i3GEO.janela = | @@ -691,15 +694,16 @@ i3GEO.janela = | ||
691 | $("#i3GEOToolFormModal").html(""); | 694 | $("#i3GEOToolFormModal").html(""); |
692 | $("#i3GEOToolFormModalHeader").html(""); | 695 | $("#i3GEOToolFormModalHeader").html(""); |
693 | }); | 696 | }); |
694 | - i3GEO.janela._formModal.resizable({ | ||
695 | - ghost: true, | ||
696 | - handles: "se" | ||
697 | - }); | 697 | + i3GEO.janela._formModal.resizable(resizable); |
698 | + if(resizable.disabled == true){ | ||
699 | + i3GEO.janela._formModal.resizable( "destroy" ); | ||
700 | + } | ||
698 | i3GEO.janela._formModal.draggable({ | 701 | i3GEO.janela._formModal.draggable({ |
699 | handle: ".handleDraggable" | 702 | handle: ".handleDraggable" |
700 | }); | 703 | }); |
704 | + i3GEO.janela._formModal.css(css); | ||
701 | i3GEO.janela._formModal.draggable(draggable); | 705 | i3GEO.janela._formModal.draggable(draggable); |
702 | - $(i3GEO.janela._formModal).appendTo("body"); | 706 | + $(i3GEO.janela._formModal).appendTo("#" + i3GEO.Interface.IDCORPO); |
703 | } | 707 | } |
704 | if(texto == false){ | 708 | if(texto == false){ |
705 | i3GEO.janela._formModal.modal("hide"); | 709 | i3GEO.janela._formModal.modal("hide"); |
@@ -716,13 +720,16 @@ i3GEO.janela = | @@ -716,13 +720,16 @@ i3GEO.janela = | ||
716 | backdrop: backdrop | 720 | backdrop: backdrop |
717 | }); | 721 | }); |
718 | i3GEO.janela._formModal.draggable(draggable); | 722 | i3GEO.janela._formModal.draggable(draggable); |
723 | + i3GEO.janela._formModal.resizable(resizable); | ||
724 | + if(resizable.disabled == true){ | ||
725 | + i3GEO.janela._formModal.resizable( "destroy" ); | ||
726 | + } | ||
719 | } | 727 | } |
720 | //fecha as guias em dispositivos com tela pequena | 728 | //fecha as guias em dispositivos com tela pequena |
721 | if(i3GEO.parametros.w < 420){ | 729 | if(i3GEO.parametros.w < 420){ |
722 | i3GEO.guias.abreFecha("fecha"); | 730 | i3GEO.guias.abreFecha("fecha"); |
723 | } | 731 | } |
724 | if(onclose != false){ | 732 | if(onclose != false){ |
725 | - | ||
726 | if (typeof (console) !== 'undefined') | 733 | if (typeof (console) !== 'undefined') |
727 | console.info("onclose janela._formModal"); | 734 | console.info("onclose janela._formModal"); |
728 | 735 |
js/tema.js
@@ -737,13 +737,15 @@ i3GEO.tema = | @@ -737,13 +737,15 @@ i3GEO.tema = | ||
737 | return; | 737 | return; |
738 | } | 738 | } |
739 | } | 739 | } |
740 | - i3GEO.mapa.ativaTema(idtema); | 740 | + var temp = function(){ |
741 | + i3GEOF.tabela.start(idtema); | ||
742 | + }; | ||
741 | i3GEO.util.dialogoFerramenta( | 743 | i3GEO.util.dialogoFerramenta( |
742 | "i3GEO.tema.dialogo.tabela()", | 744 | "i3GEO.tema.dialogo.tabela()", |
743 | "tabela", | 745 | "tabela", |
744 | "tabela", | 746 | "tabela", |
745 | "dependencias.php", | 747 | "dependencias.php", |
746 | - "i3GEOF.tabela.iniciaJanelaFlutuante()"); | 748 | + temp); |
747 | }, | 749 | }, |
748 | /** | 750 | /** |
749 | * Function: etiquetas | 751 | * Function: etiquetas |
js/template.js
@@ -24,7 +24,7 @@ i3GEO.template = { | @@ -24,7 +24,7 @@ i3GEO.template = { | ||
24 | aguarde: "<div id='{{id}}_imagemCabecalho' class='i3GeoAguardeJanela progress' style='visibility:hidden; '><span class='progress-bar progress-bar-striped active' role='progressbar' style='width: 100%'></span></div>", | 24 | aguarde: "<div id='{{id}}_imagemCabecalho' class='i3GeoAguardeJanela progress' style='visibility:hidden; '><span class='progress-bar progress-bar-striped active' role='progressbar' style='width: 100%'></span></div>", |
25 | msg: "<div class='modal fade' data-keyboard='false' tabindex='-1' role='dialog' aria-hidden='true' style='z-index:500000;overflow-y:visible;'><div class='modal-dialog' ><div class='modal-content'><div class='modal-header' style='padding-top: 5px;'><button type='button' class='closeModal close pull-right' data-dismiss='modal' aria-label='Close'><i class='material-icons'>highlight_off</i></button></div><div class='modal-body' style='padding-top: 0px;'><div id='i3GEOMensagemTempoModal' > {{{texto}}} </div></div></div></div></div>", | 25 | msg: "<div class='modal fade' data-keyboard='false' tabindex='-1' role='dialog' aria-hidden='true' style='z-index:500000;overflow-y:visible;'><div class='modal-dialog' ><div class='modal-content'><div class='modal-header' style='padding-top: 5px;'><button type='button' class='closeModal close pull-right' data-dismiss='modal' aria-label='Close'><i class='material-icons'>highlight_off</i></button></div><div class='modal-body' style='padding-top: 0px;'><div id='i3GEOMensagemTempoModal' > {{{texto}}} </div></div></div></div></div>", |
26 | closemsg: "<div class='modal fade' data-keyboard='false' tabindex='-1' role='dialog' aria-hidden='true' style='z-index:500000;overflow-y:visible;'><div class='modal-dialog'><div class='modal-content'><div class='modal-header' style='padding-top: 5px;'><button type='button' class='closeModal close pull-right' data-dismiss='modal' aria-label='Close'><i class='material-icons'>highlight_off</i></button></div><div class='modal-body' style='padding-top: 0px;'><div id='i3GEOMensagemCloseModal' > {{{texto}}} </div></div></div></div></div>", | 26 | closemsg: "<div class='modal fade' data-keyboard='false' tabindex='-1' role='dialog' aria-hidden='true' style='z-index:500000;overflow-y:visible;'><div class='modal-dialog'><div class='modal-content'><div class='modal-header' style='padding-top: 5px;'><button type='button' class='closeModal close pull-right' data-dismiss='modal' aria-label='Close'><i class='material-icons'>highlight_off</i></button></div><div class='modal-body' style='padding-top: 0px;'><div id='i3GEOMensagemCloseModal' > {{{texto}}} </div></div></div></div></div>", |
27 | - formModal: "<div class='modal-dialog' role='document' style='z-Index:100;'><div class='modal-content' style='height:100%;max-height: 99vh;'><div class='modal-header handleDraggable' style='padding-top: 5px;height:30px;'><span class='pull-left' id='i3GEOToolFormModalHeader' style='text-align:left;'>{{{header}}}</span><button type='button' class='closeModal close pull-right' data-dismiss='modal' aria-label='Close'><i class='material-icons'>highlight_off</i></button></div><div class='modal-body' style='padding-top: 0px;cursor:default;'><div id='i3GEOToolFormModal' > {{{texto}}} </div></div><div id='i3GEOToolFormModalFooter' class='modal-footer'></div></div></div>" | 27 | + formModal: "<div class='modal-dialog' role='document' style='z-Index:100;'><div class='modal-content' style='height:100%;max-height: 100vh;'><div class='modal-header handleDraggable' style='padding-top: 5px;height:30px;'><span class='pull-left' id='i3GEOToolFormModalHeader' style='text-align:left;'>{{{header}}}</span><button type='button' class='closeModal close pull-right' data-dismiss='modal' aria-label='Close'><i class='material-icons'>highlight_off</i></button></div><div class='modal-body' style='height:100%;padding-top: 0px;cursor:default;'><div id='i3GEOToolFormModal' style='height:100%'> {{{texto}}} </div></div><div id='i3GEOToolFormModalFooter' class='modal-footer'></div></div></div>" |
28 | }, | 28 | }, |
29 | //lista generica de opcoes | 29 | //lista generica de opcoes |
30 | listaopcoes: '<div class="list-group condensed"><div class="row-content text-left">{{{opcional}}}<label class="nomeTemaCurto" style="margin-bottom: 0px;"><a href="{{{url}}}" target="{{{target}}}" ><h4>{{{nome}}}</h4></a><h6>{{{descricao}}}</h6></label></div></div><hr>', | 30 | listaopcoes: '<div class="list-group condensed"><div class="row-content text-left">{{{opcional}}}<label class="nomeTemaCurto" style="margin-bottom: 0px;"><a href="{{{url}}}" target="{{{target}}}" ><h4>{{{nome}}}</h4></a><h6>{{{descricao}}}</h6></label></div></div><hr>', |