Commit e3f347b23a60e2b45e7abadbf8ec9ad41bdc7f53

Authored by Edmar Moretti
1 parent fd73735f

Correção na operação de ordenação de colunas na ferramenta Tabela e Gráfico Inte…

…rativo, permitindo ordenar números
Showing 58 changed files with 1191 additions and 1187 deletions   Show diff stats
css/i3geo7.css.php 100644 → 100755
ferramentas/editorgm/editorgm_compacto.js 100644 → 100755
ferramentas/editorol/editorol_compacto.js 100644 → 100755
ferramentas/graficointerativo1/index.js
... ... @@ -1331,13 +1331,12 @@ i3GEOF.graficointerativo1 =
1331 1331 ntrs = trs.length;
1332 1332  
1333 1333 function sortNumber(a, b) {
1334   - return a - b;
  1334 + return a.split("@$")[0]*1 - b.split("@$")[0]*1;;
1335 1335 }
1336 1336 for (t = 1; t < ntrs; t++) {
1337 1337 temp = trs[t].getElementsByTagName("input");
1338 1338 if (temp) {
1339   - psort.push(temp[cid].value);
1340   - chaves[temp[cid].value] = t;
  1339 + psort.push(temp[cid].value + "@$" + t);
1341 1340 if (temp[cid].value * 1) {
1342 1341 numero = true;
1343 1342 }
... ... @@ -1352,7 +1351,7 @@ i3GEOF.graficointerativo1 =
1352 1351 ins = "<tr>" + trs[0].innerHTML + "</tr>";
1353 1352 ntrs = psort.length;
1354 1353 for (p = 0; p < ntrs; p++) {
1355   - e = chaves[psort[p]];
  1354 + e = psort[p].split("@$")[1]*1;
1356 1355 if (trs[e] !== undefined) {
1357 1356 ins += "<tr>" + trs[e].innerHTML + "</tr>";
1358 1357 }
... ...
ferramentas/tabela/index.js
1 1 if (typeof (i3GEOF) === 'undefined') {
2   - var i3GEOF = {};
  2 + var i3GEOF = {};
3 3 }
4 4 /*
5 5 * Classe: i3GEOF.tabela
6 6 */
7 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. &Eacute; chamado por criaJanelaFlutuante
120   - *
121   - * Parametro:
122   - *
123   - * iddiv {String} - id do div que receber&aacute; 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";
  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. &Eacute; chamado por criaJanelaFlutuante
  120 + *
  121 + * Parametro:
  122 + *
  123 + * iddiv {String} - id do div que receber&aacute; 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 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);
  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 143  
144   - //i3GEO.janela.applyScrollBar(iddiv,".customScrollBar",{advanced:{ autoExpandHorizontalScroll: 2 }});
  144 + //i3GEO.janela.applyScrollBar(iddiv,".customScrollBar",{advanced:{ autoExpandHorizontalScroll: 2 }});
145 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   - };
  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 196  
197 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&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
218   - *
219   - * Retorno:
220   - *
221   - * String com o c&oacute;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>";
  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&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  218 + *
  219 + * Retorno:
  220 + *
  221 + * String com o c&oacute;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 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";
  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 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 />&nbsp;"
317   - + $trad("atualizaNavegacao", i3GEOF.tabela.dicionario)
318   - + " ("
319   - + id
320   - + ")</div>";
  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 />&nbsp;"
  317 + + $trad("atualizaNavegacao", i3GEOF.tabela.dicionario)
  318 + + " ("
  319 + + id
  320 + + ")</div>";
321 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 i3GEO.php.salvaMapaBanco 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;
  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 i3GEO.php.salvaMapaBanco 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 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) {
  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 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&ccedil;&atilde;o autom&aacute;tica da tabela quando o usu&aacute;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&ccedil;&atilde;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&ccedil;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&ccedil;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&ccedil;&atilde;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 tabela = $i(idjanela + "i3GEOtabelatabelai"), trs = tabela.getElementsByTagName("tr"),
915   - ntrs = trs.length, tds, nt, conta = 0, psort = [], t, psortfim, npsortfim, ins, p, e;
916   - // pega o indice correto
917   - tds = coluna.parentNode.parentNode.getElementsByTagName("td");
918   - nt = tds.length;
919   - for (t = 0; t < nt; t++) {
920   - if (tds[t].accessKey == cid) {
921   - cid = t;
922   - break;
923   - }
924   - }
925   - for (t = 0; t < ntrs; t++) {
926   - if (t < ntrs) {
927   - //if (trs[t].childNodes[cid].innerHTML) {
928   - //if (trs[t].getElementsByTagName("td")[cid].innerHTML !== "undefined") {
929   - psort[conta] = trs[t].getElementsByTagName("td")[cid].innerHTML + "@$" + conta;
930   - conta = conta + 1;
931   - //}
932   - //}
933   - }
934   - }
  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&ccedil;&atilde;o autom&aacute;tica da tabela quando o usu&aacute;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&ccedil;&atilde;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&ccedil;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&ccedil;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&ccedil;&atilde;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;
935 916  
936   - // recosntroi a tabela
937   - psortfim = psort.sort();
938   - ins = "<table id=" + idjanela + "i3GEOtabelatabelai class=lista8 >";
939   - npsortfim = psortfim.length;
940   - for (p = 0; p < npsortfim; p++) {
941   - e = psortfim[p].split("@$")[1] * 1;
942   - if (trs[e] !== undefined) {
943   - ins += "<tr>" + trs[e].innerHTML + "</tr>";
944   - }
945   - }
946   - $i(idjanela + "i3GEOtabelaregistros").innerHTML = ins + "</table>";
947   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
948   - } catch (e) {
949   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
950   - if (typeof (console) !== 'undefined') {
951   - console.error(e);
952   - }
953   - }
954   - },
955   - excluiLinha : function(celula) {
956   - var p = celula.parentNode.parentNode;
957   - do {
958   - p.removeChild(p.childNodes[0]);
959   - } while (p.childNodes.length > 0);
960   - p.parentNode.removeChild(p);
961   - },
962   - zoomExt : function(ext, idjanela) {
963   - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
964   - return;
965   - }
966   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
967   - var funcao = function() {
968   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
969   - i3GEOF.tabela.pegaRegistros(idjanela);
970   - i3GEO.atualiza();
971   - };
972   - i3GEO.php.mudaext(funcao, "nenhum", ext);
973   - },
974   - registraLinha : function(linha, idjanela) {
975   - i3GEOF.tabela.propJanelas[idjanela].registros[linha.name] = linha.checked;
976   - i3GEOF.tabela.vinculos.atualizaVinculos(idjanela, linha.name, linha.checked);
977   - },
978   - /*
979   - * Function: listaMarcados
980   - *
981   - * Retorna um array com os &iacute;ndices dos registros que est&atilde;o marcados.
982   - */
983   - listaMarcados : function(idjanela) {
984   - var lista = [], registros = i3GEOF.tabela.propJanelas[idjanela].registros, i, n = registros.length;
985   - for (i = 0; i < n; i++) {
986   - if (registros[i] === true) {
987   - lista.push(i);
988   - }
989   - }
990   - return lista;
991   - },
992   - /*
993   - * Function: ativaSelecao
994   - *
995   - * Seleciona no mapa os elementos que estiverem marcados na guia 2
996   - *
997   - * Veja:
998   - *
999   - * <INCLUISEL>
1000   - */
1001   - ativaSelecao : function(idjanela) {
1002   - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
1003   - return;
1004   - }
1005   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
1006   - var lista = i3GEOF.tabela.listaMarcados(idjanela), p, cp, temp = function(retorno) {
1007   - if (retorno) {
1008   - i3GEO.Interface.atualizaTema(retorno, i3GEOF.tabela.propJanelas[idjanela].tema);
1009   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
1010   - }
1011   - };
1012   - p =
1013   - i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid="
1014   - + i3GEO.configura.sid
1015   - + "&funcao=incluisel&tema="
1016   - + i3GEOF.tabela.propJanelas[idjanela].tema
1017   - + "&ids="
1018   - + lista.toString();
1019   - cp = new cpaint();
1020   - cp.set_response_type("JSON");
1021   - cp.call(p, "incluiSel", temp);
1022   - },
1023   - /*
1024   - * Function: limpaSelecao
1025   - *
1026   - * Limpa a sele&ccedil;&atilde;o do tema da tabela
1027   - */
1028   - limpaSelecao : function(idjanela) {
1029   - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
1030   - return;
1031   - }
1032   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
1033   - i3GEO.tema.limpasel(i3GEOF.tabela.propJanelas[idjanela].tema);
1034   - i3GEOF.tabela.propJanelas[idjanela].registros = [];
1035   - var lista = $i(idjanela + "i3GEOtabelatabelai").getElementsByTagName("input"), n = lista.length, i;
1036   - for (i = 0; i < n; i++) {
1037   - lista[i].checked = false;
1038   - }
1039   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
1040   - },
1041   - /*
1042   - * Function: criaNovoTema
1043   - *
1044   - * Cria um novo tema contendo a sele&ccedil;&atilde;o existente
1045   - */
1046   - criaNovoTema : function(idjanela) {
1047   - var camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.tabela.propJanelas[idjanela].tema);
1048   - if(camada.nsel == 0){
1049   - i3GEO.janela.tempoMsg($trad("selUmReg",i3GEOF.tabela.dicionario));
1050   - return;
1051   - }
  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 + }
1052 941  
1053   - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
1054   - return;
1055   - }
1056   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
1057   - var temp = function(retorno) {
1058   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
1059   - i3GEO.atualiza(retorno);
1060   - };
1061   - i3GEO.php.criatemaSel(temp, i3GEOF.tabela.propJanelas[idjanela].tema);
1062   - },
1063   - /*
1064   - * Function: comboItens
1065   - *
1066   - * Cria um combo para selecionar um item do tema escolhido
1067   - */
1068   - comboItensEstat : function(idjanela) {
1069   - var tema = i3GEOF.tabela.propJanelas[idjanela].tema;
1070   - i3GEO.util.comboItens(idjanela + "i3GEOtabelaComboItensGuia3", tema, function(retorno) {
1071   - if (retorno.tipo === "erro") {
1072   - $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML =
1073   - i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem2',i3GEOF.tabela.dicionario) + '</div>');
1074   - } else {
1075   - $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML = retorno.dados;
1076   - }
1077   - }, idjanela + "i3GEOtabelaitensGuia3", "","sim","","form-control");
1078   - },
1079   - estatistica : function(idjanela) {
1080   - if ($i(idjanela + "i3GEOtabelaComboItensGuia3").value === "") {
1081   - i3GEO.janela.tempoMsg("Escolha um item!");
1082   - return;
1083   - }
1084   - if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
1085   - return;
1086   - }
1087   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
1088   - try {
1089   - var monta = function(retorno) {
1090   - var ins = "", nome, valor, i, n;
1091   - if (retorno.data.indices !== undefined) {
1092   - if (retorno.data.indices) {
1093   - n = retorno.data.indices.length;
1094   - for (i = 0; i < n; i++) {
1095   - nome =retorno.data.variaveis[retorno.data.indices[i]];
1096   - valor = retorno.data.valores[retorno.data.indices[i]];
1097   - ins += '<div class="row-content"><h4 class="list-group-item-heading">'+nome+'</h4><p class="list-group-item-text">'+valor+'</p></div>';
1098   - ins += '<div class="list-group-separator">&nbsp;</div>';
1099   - }
1100   - }
1101   - } else {
1102   - ins = retorno.data;
1103   - }
1104   - $i(idjanela + "i3GEOtabelaoperacoes").innerHTML = ins + "<br>";
1105   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
1106   - }, exclui = "", cp = new cpaint(), p;
1107   - if ($i(idjanela + "i3GEOtabelafiltro1").value !== "") {
1108   - exclui = $i("i3GEOtabelafiltro1").value;
1109   - }
1110   - p =
1111   - i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid="
1112   - + i3GEO.configura.sid
1113   - + "&funcao=estatistica&item="
1114   - + $i(idjanela + "i3GEOtabelaComboItensGuia3").value
1115   - + "&tema="
1116   - + i3GEOF.tabela.propJanelas[idjanela].tema
1117   - + "&exclui="
1118   - + exclui
1119   - + "&ext="
1120   - + i3GEO.parametros.mapexten;
1121   - cp.set_response_type("JSON");
1122   - cp.call(p, "estatDescritivas", monta);
1123   - } catch (e) {
1124   - i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
1125   - $i("operacoes").innerHTML = "Ocorreu um erro: " + e;
1126   - }
1127   - },
1128   - tabelaTexto : function() {
1129   - },
1130   - /*
1131   - * Function: relatorioTabela
1132   - *
1133   - * Monta o relat&oacute;rio padr&atilde;o em uma nova janela
1134   - */
1135   - relatorioTabela : function(idjanela) {
1136   - try {
1137   - $i(idjanela + "i3GEOtabelatiporelh").value = "";
1138   - $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked;
1139   - $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked;
1140   - $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value;
1141   - $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema;
1142   - $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid;
1143   - $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value;
1144   - var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listaordem = [], listanomes =
1145   - [], nome, ordem, i, temp, n = inputs.length;
1146   - for (i = 0; i < n; i++) {
1147   - if (inputs[i].type === "checkbox" && inputs[i].checked == true) {
1148   - listai.push(inputs[i].id + "|" + inputs[i].name);
1149   - nome = $i(inputs[i].id + inputs[i].name).value;
1150   - listanomes.push(nome);
1151   - ordem = $i("ordem_" + inputs[i].id + inputs[i].name).value;
1152   - if (ordem === "") {
1153   - ordem = 0;
1154   - }
1155   - listaordem.push(ordem);
1156   - }
1157   - }
1158   - $i(idjanela + "i3GEOtabelaordemrel").value = listaordem;
1159   - $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes;
1160   - $i(idjanela + "i3GEOtabelaitensrelh").value = listai;
1161   - temp = $i(idjanela + "i3GEOtabelarelatorio").action;
1162   - $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten;
1163   - $i(idjanela + "i3GEOtabelarelatorio").submit();
1164   - $i(idjanela + "i3GEOtabelarelatorio").action = temp;
1165   - } catch (e) {
1166   - i3GEO.janela.tempoMsg(e);
1167   - }
1168   - },
1169   - /*
1170   - * Function: relatorioTexto
1171   - *
1172   - * Gera o relat&oacute;rio no formato CSV
1173   - */
1174   - relatorioTexto : function(idjanela) {
1175   - $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked;
1176   - $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked;
1177   - $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value;
1178   - $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema;
1179   - $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid;
1180   - $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value;
1181   - $i(idjanela + "i3GEOtabelatiporelh").value = "csv";
1182   - var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listanomes = [], nome, i, temp, n =
1183   - inputs.length;
1184   - for (i = 0; i < n; i++) {
1185   - if (inputs[i].checked === true) {
1186   - listai.push(inputs[i].id + "|" + inputs[i].name);
1187   - nome = $i(inputs[i].id + inputs[i].name).value;
1188   - listanomes.push(nome);
1189   - }
1190   - }
1191   - $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes;
1192   - $i(idjanela + "i3GEOtabelaitensrelh").value = listai;
1193   - temp = $i(idjanela + "i3GEOtabelarelatorio").action;
1194   - $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten;
1195   - $i(idjanela + "i3GEOtabelarelatorio").submit();
1196   - $i(idjanela + "i3GEOtabelarelatorio").action = temp;
1197   - }
1198   - };
1199 942 \ No newline at end of file
  943 + ins = "<table id=" + idjanela + "i3GEOtabelatabelai class=lista8 >";
  944 + ins += "<tr>" + trs[0].innerHTML + "</tr>";
  945 + npsortfim = psortfim.length;
  946 + for (p = 0; p < npsortfim; p++) {
  947 + e = psortfim[p].split("@$")[1] * 1;
  948 + if (trs[e] !== undefined) {
  949 + ins += "<tr>" + trs[e].innerHTML + "</tr>";
  950 + }
  951 + }
  952 + $i(idjanela + "i3GEOtabelaregistros").innerHTML = ins + "</table>";
  953 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  954 + } catch (e) {
  955 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  956 + if (typeof (console) !== 'undefined') {
  957 + console.error(e);
  958 + }
  959 + }
  960 + },
  961 + excluiLinha : function(celula) {
  962 + var p = celula.parentNode.parentNode;
  963 + do {
  964 + p.removeChild(p.childNodes[0]);
  965 + } while (p.childNodes.length > 0);
  966 + p.parentNode.removeChild(p);
  967 + },
  968 + zoomExt : function(ext, idjanela) {
  969 + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
  970 + return;
  971 + }
  972 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
  973 + var funcao = function() {
  974 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  975 + i3GEOF.tabela.pegaRegistros(idjanela);
  976 + i3GEO.atualiza();
  977 + };
  978 + i3GEO.php.mudaext(funcao, "nenhum", ext);
  979 + },
  980 + registraLinha : function(linha, idjanela) {
  981 + i3GEOF.tabela.propJanelas[idjanela].registros[linha.name] = linha.checked;
  982 + i3GEOF.tabela.vinculos.atualizaVinculos(idjanela, linha.name, linha.checked);
  983 + },
  984 + /*
  985 + * Function: listaMarcados
  986 + *
  987 + * Retorna um array com os &iacute;ndices dos registros que est&atilde;o marcados.
  988 + */
  989 + listaMarcados : function(idjanela) {
  990 + var lista = [], registros = i3GEOF.tabela.propJanelas[idjanela].registros, i, n = registros.length;
  991 + for (i = 0; i < n; i++) {
  992 + if (registros[i] === true) {
  993 + lista.push(i);
  994 + }
  995 + }
  996 + return lista;
  997 + },
  998 + /*
  999 + * Function: ativaSelecao
  1000 + *
  1001 + * Seleciona no mapa os elementos que estiverem marcados na guia 2
  1002 + *
  1003 + * Veja:
  1004 + *
  1005 + * <INCLUISEL>
  1006 + */
  1007 + ativaSelecao : function(idjanela) {
  1008 + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
  1009 + return;
  1010 + }
  1011 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
  1012 + var lista = i3GEOF.tabela.listaMarcados(idjanela), p, cp, temp = function(retorno) {
  1013 + if (retorno) {
  1014 + i3GEO.Interface.atualizaTema(retorno, i3GEOF.tabela.propJanelas[idjanela].tema);
  1015 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  1016 + }
  1017 + };
  1018 + p =
  1019 + i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid="
  1020 + + i3GEO.configura.sid
  1021 + + "&funcao=incluisel&tema="
  1022 + + i3GEOF.tabela.propJanelas[idjanela].tema
  1023 + + "&ids="
  1024 + + lista.toString();
  1025 + cp = new cpaint();
  1026 + cp.set_response_type("JSON");
  1027 + cp.call(p, "incluiSel", temp);
  1028 + },
  1029 + /*
  1030 + * Function: limpaSelecao
  1031 + *
  1032 + * Limpa a sele&ccedil;&atilde;o do tema da tabela
  1033 + */
  1034 + limpaSelecao : function(idjanela) {
  1035 + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
  1036 + return;
  1037 + }
  1038 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
  1039 + i3GEO.tema.limpasel(i3GEOF.tabela.propJanelas[idjanela].tema);
  1040 + i3GEOF.tabela.propJanelas[idjanela].registros = [];
  1041 + var lista = $i(idjanela + "i3GEOtabelatabelai").getElementsByTagName("input"), n = lista.length, i;
  1042 + for (i = 0; i < n; i++) {
  1043 + lista[i].checked = false;
  1044 + }
  1045 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  1046 + },
  1047 + /*
  1048 + * Function: criaNovoTema
  1049 + *
  1050 + * Cria um novo tema contendo a sele&ccedil;&atilde;o existente
  1051 + */
  1052 + criaNovoTema : function(idjanela) {
  1053 + var camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.tabela.propJanelas[idjanela].tema);
  1054 + if(camada.nsel == 0){
  1055 + i3GEO.janela.tempoMsg($trad("selUmReg",i3GEOF.tabela.dicionario));
  1056 + return;
  1057 + }
  1058 +
  1059 + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
  1060 + return;
  1061 + }
  1062 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
  1063 + var temp = function(retorno) {
  1064 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  1065 + i3GEO.atualiza(retorno);
  1066 + };
  1067 + i3GEO.php.criatemaSel(temp, i3GEOF.tabela.propJanelas[idjanela].tema);
  1068 + },
  1069 + /*
  1070 + * Function: comboItens
  1071 + *
  1072 + * Cria um combo para selecionar um item do tema escolhido
  1073 + */
  1074 + comboItensEstat : function(idjanela) {
  1075 + var tema = i3GEOF.tabela.propJanelas[idjanela].tema;
  1076 + i3GEO.util.comboItens(idjanela + "i3GEOtabelaComboItensGuia3", tema, function(retorno) {
  1077 + if (retorno.tipo === "erro") {
  1078 + $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML =
  1079 + i3GEO.janela.closeMsg('<div class="alert alert-danger" role="alert">' + $trad('erroTemaOrigem2',i3GEOF.tabela.dicionario) + '</div>');
  1080 + } else {
  1081 + $i(idjanela + "i3GEOtabelaitensGuia3").innerHTML = retorno.dados;
  1082 + }
  1083 + }, idjanela + "i3GEOtabelaitensGuia3", "","sim","","form-control");
  1084 + },
  1085 + estatistica : function(idjanela) {
  1086 + if ($i(idjanela + "i3GEOtabelaComboItensGuia3").value === "") {
  1087 + i3GEO.janela.tempoMsg("Escolha um item!");
  1088 + return;
  1089 + }
  1090 + if (i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility === "visible") {
  1091 + return;
  1092 + }
  1093 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "visible";
  1094 + try {
  1095 + var monta = function(retorno) {
  1096 + var ins = "", nome, valor, i, n;
  1097 + if (retorno.data.indices !== undefined) {
  1098 + if (retorno.data.indices) {
  1099 + n = retorno.data.indices.length;
  1100 + for (i = 0; i < n; i++) {
  1101 + nome =retorno.data.variaveis[retorno.data.indices[i]];
  1102 + valor = retorno.data.valores[retorno.data.indices[i]];
  1103 + ins += '<div class="row-content"><h4 class="list-group-item-heading">'+nome+'</h4><p class="list-group-item-text">'+valor+'</p></div>';
  1104 + ins += '<div class="list-group-separator">&nbsp;</div>';
  1105 + }
  1106 + }
  1107 + } else {
  1108 + ins = retorno.data;
  1109 + }
  1110 + $i(idjanela + "i3GEOtabelaoperacoes").innerHTML = ins + "<br>";
  1111 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  1112 + }, exclui = "", cp = new cpaint(), p;
  1113 + if ($i(idjanela + "i3GEOtabelafiltro1").value !== "") {
  1114 + exclui = $i("i3GEOtabelafiltro1").value;
  1115 + }
  1116 + p =
  1117 + i3GEO.configura.locaplic + "/ferramentas/tabela/exec.php?g_sid="
  1118 + + i3GEO.configura.sid
  1119 + + "&funcao=estatistica&item="
  1120 + + $i(idjanela + "i3GEOtabelaComboItensGuia3").value
  1121 + + "&tema="
  1122 + + i3GEOF.tabela.propJanelas[idjanela].tema
  1123 + + "&exclui="
  1124 + + exclui
  1125 + + "&ext="
  1126 + + i3GEO.parametros.mapexten;
  1127 + cp.set_response_type("JSON");
  1128 + cp.call(p, "estatDescritivas", monta);
  1129 + } catch (e) {
  1130 + i3GEOF.tabela.propJanelas[idjanela].aguarde.visibility = "hidden";
  1131 + $i("operacoes").innerHTML = "Ocorreu um erro: " + e;
  1132 + }
  1133 + },
  1134 + tabelaTexto : function() {
  1135 + },
  1136 + /*
  1137 + * Function: relatorioTabela
  1138 + *
  1139 + * Monta o relat&oacute;rio padr&atilde;o em uma nova janela
  1140 + */
  1141 + relatorioTabela : function(idjanela) {
  1142 + try {
  1143 + $i(idjanela + "i3GEOtabelatiporelh").value = "";
  1144 + $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked;
  1145 + $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked;
  1146 + $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value;
  1147 + $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema;
  1148 + $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid;
  1149 + $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value;
  1150 + var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listaordem = [], listanomes =
  1151 + [], nome, ordem, i, temp, n = inputs.length;
  1152 + for (i = 0; i < n; i++) {
  1153 + if (inputs[i].type === "checkbox" && inputs[i].checked == true) {
  1154 + listai.push(inputs[i].id + "|" + inputs[i].name);
  1155 + nome = $i(inputs[i].id + inputs[i].name).value;
  1156 + listanomes.push(nome);
  1157 + ordem = $i("ordem_" + inputs[i].id + inputs[i].name).value;
  1158 + if (ordem === "") {
  1159 + ordem = 0;
  1160 + }
  1161 + listaordem.push(ordem);
  1162 + }
  1163 + }
  1164 + $i(idjanela + "i3GEOtabelaordemrel").value = listaordem;
  1165 + $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes;
  1166 + $i(idjanela + "i3GEOtabelaitensrelh").value = listai;
  1167 + temp = $i(idjanela + "i3GEOtabelarelatorio").action;
  1168 + $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten;
  1169 + $i(idjanela + "i3GEOtabelarelatorio").submit();
  1170 + $i(idjanela + "i3GEOtabelarelatorio").action = temp;
  1171 + } catch (e) {
  1172 + i3GEO.janela.tempoMsg(e);
  1173 + }
  1174 + },
  1175 + /*
  1176 + * Function: relatorioTexto
  1177 + *
  1178 + * Gera o relat&oacute;rio no formato CSV
  1179 + */
  1180 + relatorioTexto : function(idjanela) {
  1181 + $i(idjanela + "i3GEOtabelaarearelh").value = $i(idjanela + "i3GEOtabelacalculaarea").checked;
  1182 + $i(idjanela + "i3GEOtabelastatrelh").value = $i(idjanela + "i3GEOtabelacalculaestat").checked;
  1183 + $i(idjanela + "i3GEOtabelaexcluirvalorh").value = $i(idjanela + "i3GEOtabelaexcestat").value;
  1184 + $i(idjanela + "i3GEOtabelatemarelh").value = i3GEOF.tabela.propJanelas[idjanela].tema;
  1185 + $i(idjanela + "i3GEOtabelag_sidh").value = i3GEO.configura.sid;
  1186 + $i(idjanela + "i3GEOtabelaitemagruparelh").value = $i(idjanela + "i3GEOtabelaagrupaItem").value;
  1187 + $i(idjanela + "i3GEOtabelatiporelh").value = "csv";
  1188 + var inputs = $i(idjanela + "i3GEOtabelaitensrelatorio").getElementsByTagName("input"), listai = [], listanomes = [], nome, i, temp, n =
  1189 + inputs.length;
  1190 + for (i = 0; i < n; i++) {
  1191 + if (inputs[i].checked === true) {
  1192 + listai.push(inputs[i].id + "|" + inputs[i].name);
  1193 + nome = $i(inputs[i].id + inputs[i].name).value;
  1194 + listanomes.push(nome);
  1195 + }
  1196 + }
  1197 + $i(idjanela + "i3GEOtabelanomesrelh").value = listanomes;
  1198 + $i(idjanela + "i3GEOtabelaitensrelh").value = listai;
  1199 + temp = $i(idjanela + "i3GEOtabelarelatorio").action;
  1200 + $i(idjanela + "i3GEOtabelarelatorio").action += "?ext=" + i3GEO.parametros.mapexten;
  1201 + $i(idjanela + "i3GEOtabelarelatorio").submit();
  1202 + $i(idjanela + "i3GEOtabelarelatorio").action = temp;
  1203 + }
  1204 +};
1200 1205 \ No newline at end of file
... ...
js/compactados/ajuda_compacto.js 100644 → 100755
js/compactados/analise_compacto.js 100644 → 100755
js/compactados/arvoredecamadas_compacto.js 100644 → 100755
js/compactados/arvoredetemas_compacto.js 100644 → 100755
js/compactados/base64_compacto.js 100644 → 100755
js/compactados/busca_compacto.js 100644 → 100755
js/compactados/caixaDeFerramentas_compacto.js 100644 → 100755
js/compactados/calculo_compacto.js 100644 → 100755
js/compactados/catalogoDir_compacto.js 100644 → 100755
js/compactados/catalogoEstrelas_compacto.js 100644 → 100755
js/compactados/catalogoInde_compacto.js 100644 → 100755
js/compactados/catalogoMapas_compacto.js 100644 → 100755
js/compactados/catalogoMenus_compacto.js 100644 → 100755
js/compactados/catalogoMetaestat_compacto.js 100644 → 100755
js/compactados/catalogoOgc_compacto.js 100644 → 100755
js/compactados/catalogoRegioes_compacto.js 100644 → 100755
js/compactados/catalogoSistemas_compacto.js 100644 → 100755
js/compactados/configura_compacto.js 100644 → 100755
js/compactados/coordenadas_compacto.js 100644 → 100755
js/compactados/desenho_compacto.js 100644 → 100755
js/compactados/dicionario_ajuda_compacto.js 100644 → 100755
js/compactados/dicionario_compacto.js 100644 → 100755
js/compactados/editor_compacto.js 100644 → 100755
js/compactados/eventos_compacto.js 100644 → 100755
js/compactados/guias_compacto.js 100644 → 100755
js/compactados/idioma_compacto.js 100644 → 100755
js/compactados/ini_i3geo_compacto.js 100644 → 100755
js/compactados/interface_compacto.js 100644 → 100755
js/compactados/janela_compacto.js 100644 → 100755
js/compactados/legenda_compacto.js 100644 → 100755
js/compactados/login_compacto.js 100644 → 100755
js/compactados/mapa_compacto.js 100644 → 100755
js/compactados/maparef_compacto.js 100644 → 100755
js/compactados/marcador_compacto.js 100644 → 100755
js/compactados/mustache.js 100644 → 100755
js/compactados/navega_compacto.js 100644 → 100755
js/compactados/php_compacto.js 100644 → 100755
js/compactados/plugini3geo_compacto.js 100644 → 100755
js/compactados/proj4js.js 100644 → 100755
js/compactados/social_compacto.js 100644 → 100755
js/compactados/tema_compacto.js 100644 → 100755
js/compactados/util_compacto.js 100644 → 100755
js/compactados/wicket.js 100644 → 100755
js/dicionario.js
... ... @@ -2480,9 +2480,9 @@ g_traducao =
2480 2480 ],
2481 2481 "selum" : [
2482 2482 {
2483   - pt : "Selecione pelo menos um elemento",
2484   - en : "Select at least one element",
2485   - es : "Seleccione al menos un elemento"
  2483 + pt : "Selecione pelo um elemento",
  2484 + en : "Select one element",
  2485 + es : "Seleccione un elemento"
2486 2486 }
2487 2487 ],
2488 2488 "atrib" : [
... ...
js/i3geo_tudo_compacto7.js.php 100644 → 100755
pacotes/cpaint/cpaint2_compacto.inc.js 100644 → 100755
pacotes/mobileesp/mdetect_compacto.js 100644 → 100755
pacotes/yui290/build/carousel/carousel_compacto.js 100644 → 100755
pacotes/yui290/build/container/container_compacto.js 100644 → 100755
pacotes/yui290/build/container/container_core_compacto.js 100644 → 100755
pacotes/yui290/build/resize/resize_compacto.js 100644 → 100755
pacotes/yui290/build/treeview/treeview_compacto.js 100644 → 100755
pacotes/yui290/build/utilities/utilities_compacto.js 100644 → 100755