Commit f8a8d8bca4246630e38f611308ffe8c13471ff1d

Authored by Edmar Moretti
1 parent 8acbe5f7

Melhoria no código, evitando a busca da lista de sistemas de forma redundante

Showing 1 changed file with 37 additions and 31 deletions   Show diff stats
ferramentas/identifica/index.js
@@ -218,14 +218,14 @@ i3GEOF.identifica = { @@ -218,14 +218,14 @@ i3GEOF.identifica = {
218 col1 = null, 218 col1 = null,
219 col2 = null; 219 col2 = null;
220 220
221 - col1 = Dom.get('i3GEOidentificatemaativo');  
222 - col2 = Dom.get('i3GEOidentificaocorrencia');  
223 - var resize = new YAHOO.util.Resize('i3GEOidentificatemaativo', {  
224 - handles: ['r'], 221 + col1 = Dom.get('i3GEOidentificatemaativo');
  222 + col2 = Dom.get('i3GEOidentificaocorrencia');
  223 + var resize = new YAHOO.util.Resize('i3GEOidentificatemaativo', {
  224 + handles: ['r'],
225 maxWidth: 180 225 maxWidth: 180
226 - });  
227 - resize.on('resize', function(ev) {  
228 - Dom.setStyle(col1, 'height', ''); 226 + });
  227 + resize.on('resize', function(ev) {
  228 + Dom.setStyle(col1, 'height', '');
229 //150 é o tamanho inicial da parte esquerda, corresponde a 40% 229 //150 é o tamanho inicial da parte esquerda, corresponde a 40%
230 var w1 = parseInt(col1.style.width); 230 var w1 = parseInt(col1.style.width);
231 var dif = parseInt((w1 * 40) / 150,10); 231 var dif = parseInt((w1 * 40) / 150,10);
@@ -235,13 +235,18 @@ i3GEOF.identifica = { @@ -235,13 +235,18 @@ i3GEOF.identifica = {
235 $i("yui-gen6").style.height = "250px"; 235 $i("yui-gen6").style.height = "250px";
236 $i("yui-gen6").style.width = "5px"; 236 $i("yui-gen6").style.width = "5px";
237 } 237 }
238 - });  
239 - resize.resize(null, null, null, 0, 0, true); 238 + });
  239 + resize.resize(null, null, null, 0, 0, true);
240 }, 240 },
241 atualizaSistemas: function(){ 241 atualizaSistemas: function(){
242 if(i3GEOF.identifica.mostraSistemasAdicionais === true){ 242 if(i3GEOF.identifica.mostraSistemasAdicionais === true){
243 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=pegaSistemasIdentificacao&g_sid="+i3GEO.configura.sid;  
244 - cpJSON.call(p,"foo",i3GEOF.identifica.montaListaSistemas); 243 + if(i3GEOF.identifica.sistemasAdicionais.length == 0){
  244 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=pegaSistemasIdentificacao&g_sid="+i3GEO.configura.sid;
  245 + cpJSON.call(p,"foo",i3GEOF.identifica.montaListaSistemas);
  246 + }
  247 + else{
  248 + i3GEOF.identifica.montaListaSistemas("");
  249 + }
245 } 250 }
246 }, 251 },
247 /* 252 /*
@@ -487,30 +492,31 @@ i3GEOF.identifica = { @@ -487,30 +492,31 @@ i3GEOF.identifica = {
487 if (retorno !== undefined) 492 if (retorno !== undefined)
488 { 493 {
489 divins = $i("i3GEOidentificalistaSistemas"); 494 divins = $i("i3GEOidentificalistaSistemas");
490 - sis = retorno.data;  
491 - for (ig=0;ig<sis.length;ig++)  
492 - {  
493 - sistema = sis[ig].NOME;  
494 - if(sis[ig].PUBLICADO)  
495 - { 495 + if(i3GEOF.identifica.sistemasAdicionais.length == 0){
  496 + sis = retorno.data;
  497 + for (ig=0;ig<sis.length;ig++){
  498 + sistema = sis[ig].NOME;
496 if(sis[ig].PUBLICADO) 499 if(sis[ig].PUBLICADO)
497 { 500 {
498 - pub = sis[ig].PUBLICADO;  
499 - if(pub === "NAO" || pub === "nao")  
500 - {sistema = "<s>"+sistema+"</s>";} 501 + if(sis[ig].PUBLICADO)
  502 + {
  503 + pub = sis[ig].PUBLICADO;
  504 + if(pub === "NAO" || pub === "nao")
  505 + {sistema = "<s>"+sistema+"</s>";}
  506 + }
501 } 507 }
  508 + exec = sis[ig].ABRIR;
  509 + temp = exec.split('"');
  510 + if(temp.length === 1)
  511 + {exec = '"'+exec+'"';}
  512 + temp = exec.split("?");
  513 + if(temp.length !== 2)
  514 + {exec += '+"?"';}
  515 + t = "blank";
  516 + if (sis[ig].TARGET)
  517 + {t = sis[ig].TARGET;}
  518 + i3GEOF.identifica.sistemasAdicionais.push(sistema+","+exec+","+t);
502 } 519 }
503 - exec = sis[ig].ABRIR;  
504 - temp = exec.split('"');  
505 - if(temp.length === 1)  
506 - {exec = '"'+exec+'"';}  
507 - temp = exec.split("?");  
508 - if(temp.length !== 2)  
509 - {exec += '+"?"';}  
510 - t = "blank";  
511 - if (sis[ig].TARGET)  
512 - {t = sis[ig].TARGET;}  
513 - i3GEOF.identifica.sistemasAdicionais.push(sistema+","+exec+","+t);  
514 } 520 }
515 if (i3GEOF.identifica.sistemasAdicionais.length > 0) 521 if (i3GEOF.identifica.sistemasAdicionais.length > 0)
516 { 522 {