Commit a99f2613234b88eba7d2038b4416ff19288e8594
1 parent
77c8aa92
Exists in
master
and in
7 other branches
Criação da variável de configuração $i3geoEsquemasWL, utilizada para restringir …
…a montagem de listas de opções no sistema de administração
Showing
8 changed files
with
127 additions
and
1664 deletions
Show diff stats
... | ... | @@ -0,0 +1,54 @@ |
1 | +if (typeof (i3GEOadmin) === 'undefined') { | |
2 | + var i3GEOadmin = {}; | |
3 | +} | |
4 | +i3GEOadmin.bdExplorer = { | |
5 | + popOverTemplate: '<div class="popover" style="width:100%; color: black; background-color:white;" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>', | |
6 | + templateListaPopOver: '<a href="javascript:void(0)" data-name="{{{destino}}}" data-value="{{{valor}}}" class="list-group-item">{{{valor}}}</a>', | |
7 | + popOver: function(destino, conteudo){ | |
8 | + var pop = $("#modalGeral input[name='" + destino + "']").popover({ | |
9 | + "content": conteudo, | |
10 | + "placement": function(a){a.style.left = "0px";}, | |
11 | + "title": "", | |
12 | + "template": i3GEOadmin.bdExplorer.popOverTemplate, | |
13 | + "html": true, | |
14 | + "animation": false | |
15 | + }); | |
16 | + pop.popover('toggle'); | |
17 | + $(".popover").css("left","0px"); | |
18 | + $(".popover").css("top","45px") | |
19 | + $(".popover").on('click', function (e) { | |
20 | + $("#modalGeral input[name='" + e.target.getAttribute('data-name') + "']").val(e.target.getAttribute('data-value')); | |
21 | + $(".popover").popover("destroy"); | |
22 | + }) | |
23 | + }, | |
24 | + listaEsquemas: function(destino){ | |
25 | + if($(".popover").length == 0){ | |
26 | + $.post( | |
27 | + i3GEO.configura.locaplic + "/admin1/php/bdexplorer.php?funcao=listarEsquemas" | |
28 | + ) | |
29 | + .done( | |
30 | + function(data, status){ | |
31 | + var c = "", json = jQuery.parseJSON(data); | |
32 | + c = Mustache.to_html( | |
33 | + "{{#data}}" + i3GEOadmin.bdExplorer.templateListaPopOver + "{{/data}}", | |
34 | + { | |
35 | + "data":json, | |
36 | + "destino": destino, | |
37 | + "valor": function() { | |
38 | + return this; | |
39 | + } | |
40 | + } | |
41 | + ); | |
42 | + i3GEOadmin.bdExplorer.popOver(destino,c); | |
43 | + } | |
44 | + ) | |
45 | + .fail( | |
46 | + function(data){ | |
47 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | |
48 | + } | |
49 | + ); | |
50 | + } else { | |
51 | + $(".popover").popover("destroy"); | |
52 | + } | |
53 | + } | |
54 | +}; | |
0 | 55 | \ No newline at end of file | ... | ... |
admin1/js/core.js
... | ... | @@ -157,7 +157,12 @@ if(typeof jQuery != 'undefined' ){ |
157 | 157 | } |
158 | 158 | } |
159 | 159 | }; |
160 | - | |
160 | + function core_parseMustacheBody (hashMustache){ | |
161 | + var re = new RegExp("&", "g"), m; | |
162 | + m = Mustache.render(document.body.innerHTML, i3GEO.idioma.objetoIdioma(hashMustache)); | |
163 | + m = m.replace(re, '&'); | |
164 | + document.body.innerHTML = m; | |
165 | + } | |
161 | 166 | //autocomlete |
162 | 167 | (function( $ ) { |
163 | 168 | $.widget( "custom.combobox", $.ui.autocomplete, { |
... | ... | @@ -269,1662 +274,4 @@ if(typeof jQuery != 'undefined' ){ |
269 | 274 | } |
270 | 275 | }); |
271 | 276 | })( jQuery ); |
272 | -} | |
273 | - | |
274 | -function cabecalhoMetaestat(id,excluir){ | |
275 | - var botao,i,n,temp, | |
276 | - ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", | |
277 | - u = i3GEO.util.pegaCookie("i3geousuarionome"), | |
278 | - botoes = [ | |
279 | - {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:"../principal.html"}, | |
280 | - {id:"arvore",titulo:$trad("arvoreCompleta",i3GEOadmin.core.dicionario),link:"estat_variavel.html"}, | |
281 | - {id:"conexao",titulo:$trad("conexoes",i3GEOadmin.core.dicionario),link:"estat_conexao.html"}, | |
282 | - {id:"tipo_regiao",titulo:$trad("regioes",i3GEOadmin.core.dicionario),link:"estat_tipo_regiao.html"}, | |
283 | - {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | |
284 | - ]; | |
285 | - n = botoes.length; | |
286 | - for(i=0;i<n;i++){ | |
287 | - if(botoes[i].id !== excluir){ | |
288 | - ins += '<input type=button id="'+botoes[i].id+'" value="'+botoes[i].titulo+'" />'; | |
289 | - } | |
290 | - } | |
291 | - if(!u){ | |
292 | - u = "-"; | |
293 | - } | |
294 | - ins += "<div id='i3GEONomeLogin' style=width:100%; > Login: "+u+"</div>"; | |
295 | - ins += "</fieldset>"; | |
296 | - temp = $i(id); | |
297 | - if(temp){ | |
298 | - temp.innerHTML = ins; | |
299 | - for(i=0;i<n;i++){ | |
300 | - if(excluir === "principal" && botoes[i].link) | |
301 | - {botoes[i].link = "html/"+botoes[i].link;} | |
302 | - if(botoes[i].id !== excluir){ | |
303 | - botao = new YAHOO.widget.Button(botoes[i].id); | |
304 | - botao.addClass("abrir150"); | |
305 | - if(botoes[i].link){ | |
306 | - eval('$i("'+botoes[i].id+'-button'+'").onclick = function(){window.location = \''+botoes[i].link+'\';}'); | |
307 | - } | |
308 | - else{ | |
309 | - eval('$i("'+botoes[i].id+'-button'+'").onclick = function(){'+botoes[i].js+';}'); | |
310 | - } | |
311 | - | |
312 | - } | |
313 | - } | |
314 | - } | |
315 | - try{ | |
316 | - i3GEO.login.recarrega = true; | |
317 | - } | |
318 | - catch(e){ } | |
319 | -} | |
320 | - | |
321 | -function cabecalhoUsuarios(id,excluir){ | |
322 | - var botao,i,n,temp, | |
323 | - ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", | |
324 | - u = i3GEO.util.pegaCookie("i3geousuarionome"), | |
325 | - botoes = [ | |
326 | - {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:"../principal.html"}, | |
327 | - {id:"operacoes",titulo:$trad("operacoes",i3GEOadmin.core.dicionario),link:"operacoes.html"}, | |
328 | - {id:"usuarios",titulo:$trad("usuarios",i3GEOadmin.core.dicionario),link:"usuarios.html"}, | |
329 | - {id:"gruposusuarios",titulo:$trad("gruposUsuarios",i3GEOadmin.core.dicionario),link:"gruposusuarios.html"}, | |
330 | - {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | |
331 | - ]; | |
332 | - n = botoes.length; | |
333 | - for(i=0;i<n;i++){ | |
334 | - if(botoes[i].id !== excluir){ | |
335 | - ins += '<input type=button id="'+botoes[i].id+'" value="'+botoes[i].titulo+'" />'; | |
336 | - } | |
337 | - } | |
338 | - if(!u){ | |
339 | - u = "-"; | |
340 | - } | |
341 | - ins += "<div id='i3GEONomeLogin' style=width:100%; > Login: "+u+"</div>"; | |
342 | - ins += "</fieldset>"; | |
343 | - temp = $i(id); | |
344 | - if(temp){ | |
345 | - temp.innerHTML = ins; | |
346 | - for(i=0;i<n;i++){ | |
347 | - if(excluir === "principal" && botoes[i].link) | |
348 | - {botoes[i].link = "html/"+botoes[i].link;} | |
349 | - if(botoes[i].id !== excluir){ | |
350 | - botao = new YAHOO.widget.Button(botoes[i].id); | |
351 | - botao.addClass("abrir150"); | |
352 | - if(botoes[i].link){ | |
353 | - eval('$i("'+botoes[i].id+'-button'+'").onclick = function(){window.location = \''+botoes[i].link+'\';}'); | |
354 | - } | |
355 | - else{ | |
356 | - eval('$i("'+botoes[i].id+'-button'+'").onclick = function(){'+botoes[i].js+';}'); | |
357 | - } | |
358 | - | |
359 | - } | |
360 | - } | |
361 | - } | |
362 | - try{ | |
363 | - i3GEO.login.recarrega = true; | |
364 | - } | |
365 | - catch(e){ } | |
366 | - //temp.style.border = "solid 1px gray"; | |
367 | - //temp.style.padding = "10px"; | |
368 | -} | |
369 | -function cabecalhoGeral(id,excluir,prefixo){ | |
370 | - if(!prefixo){ | |
371 | - prefixo = ""; | |
372 | - } | |
373 | - var botao,i,n,temp, | |
374 | - ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", | |
375 | - u = i3GEO.util.pegaCookie("i3geousuarionome"), | |
376 | - botoes = [ | |
377 | - {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:prefixo+"../principal.html"}, | |
378 | - {id:"menus",titulo:$trad("menus",i3GEOadmin.core.dicionario),link:prefixo+"menus.html"}, | |
379 | - {id:"arvore",titulo:$trad("arvore",i3GEOadmin.core.dicionario),link:prefixo+"arvore.html"}, | |
380 | - {id:"editormapfile",titulo:$trad("mapfiles",i3GEOadmin.core.dicionario),link:prefixo+"editormapfile.html"}, | |
381 | - {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | |
382 | - ]; | |
383 | - n = botoes.length; | |
384 | - for(i=0;i<n;i++){ | |
385 | - if(botoes[i].id !== excluir){ | |
386 | - ins += '<input type=button id="'+botoes[i].id+'" value="'+botoes[i].titulo+'" />'; | |
387 | - } | |
388 | - } | |
389 | - if(!u){ | |
390 | - u = "-"; | |
391 | - } | |
392 | - ins += "<div id='i3GEONomeLogin' style=width:100%; > Login: "+u+"</div>"; | |
393 | - ins += "</fieldset>"; | |
394 | - temp = $i(id); | |
395 | - temp.innerHTML = ins; | |
396 | - for(i=0;i<n;i++){ | |
397 | - if(excluir === "principal" && botoes[i].link) | |
398 | - {botoes[i].link = "html/"+botoes[i].link;} | |
399 | - if(botoes[i].id !== excluir){ | |
400 | - botao = new YAHOO.widget.Button(botoes[i].id); | |
401 | - botao.addClass("abrir150"); | |
402 | - if(botoes[i].link){ | |
403 | - eval('$i("'+botoes[i].id+'-button'+'").onclick = function(){window.location = \''+botoes[i].link+'\';}'); | |
404 | - } | |
405 | - else{ | |
406 | - eval('$i("'+botoes[i].id+'-button'+'").onclick = function(){'+botoes[i].js+';}'); | |
407 | - } | |
408 | - | |
409 | - } | |
410 | - } | |
411 | - try{ | |
412 | - i3GEO.login.recarrega = true; | |
413 | - } | |
414 | - catch(e){ } | |
415 | -} | |
416 | -/* | |
417 | -Function: core_arvore | |
418 | - | |
419 | -Cria uma arvore com base em um objeto contendo as propriedades. | |
420 | - | |
421 | -No objeto com as propriedades, se "url" for igual a "", sera incluido o texto original definido em "text". | |
422 | - | |
423 | -Parametros: | |
424 | - | |
425 | -titulo - {String} cabecalho da arvore | |
426 | - | |
427 | -onde - {String} nome do id doelemento que contera a arvore | |
428 | - | |
429 | -obj - {Object} objeto contendo os parametros, exemplo | |
430 | - | |
431 | - g_listaPropriedades = { | |
432 | - | |
433 | - "propriedades": [ | |
434 | - | |
435 | - { text: "p2", url: "javascript:tipoimagem()" } | |
436 | - | |
437 | - ]} | |
438 | - | |
439 | - */ | |
440 | -function core_arvore(titulo,onde,obj){ | |
441 | - var arvore,root,tempNode,d,c,i,linha,conteudo,j,temaNode; | |
442 | - if(!$i(onde)){return;} | |
443 | - arvore = new YAHOO.widget.TreeView(onde); | |
444 | - root = arvore.getRoot(); | |
445 | - try{ | |
446 | - tempNode = new YAHOO.widget.TextNode('', root, false); | |
447 | - tempNode.isLeaf = false; | |
448 | - tempNode.enableHighlight = false; | |
449 | - } | |
450 | - catch(e){ | |
451 | - if(typeof(console) !== 'undefined'){console.error(e);} | |
452 | - } | |
453 | - titulo = "<table><tr><td><b>"+titulo+"</b></td><td></td></tr></table>"; | |
454 | - d = {html:titulo}; | |
455 | - tempNode = new YAHOO.widget.HTMLNode(d, root, true,true); | |
456 | - tempNode.enableHighlight = false; | |
457 | - c = obj.propriedades.length; | |
458 | - for (i=0, j=c; i<j; i++){ | |
459 | - linha = obj.propriedades[i]; | |
460 | - if(linha.url !== "") | |
461 | - {conteudo = "<a href='#' onclick='"+linha.url+"'>"+linha.text+"</a>";} | |
462 | - else | |
463 | - {conteudo = linha.text;} | |
464 | - d = {html:conteudo}; | |
465 | - temaNode = new YAHOO.widget.HTMLNode(d, tempNode, false,true); | |
466 | - temaNode.enableHighlight = false; | |
467 | - } | |
468 | - arvore.collapseAll(); | |
469 | - arvore.draw(); | |
470 | -} | |
471 | -/* | |
472 | -Function: core_movimentaNo | |
473 | - | |
474 | -Movimenta um no para cima ou para baixo na árvore. | |
475 | - | |
476 | -Essa função utiliza uma árvore que deve estar armazenada no objeto tree | |
477 | - | |
478 | -Parameters: | |
479 | - | |
480 | -tipo - sobe|desce | |
481 | - | |
482 | -no - objeto no que será movimentado | |
483 | - | |
484 | -Return: | |
485 | - | |
486 | -true|false - se o movimento ocorreu | |
487 | - */ | |
488 | -function core_movimentaNo(tipo,no) | |
489 | -{ | |
490 | - var movimenta = false; | |
491 | - if(tipo == "sobe") | |
492 | - { | |
493 | - var noanterior = no.previousSibling; | |
494 | - if(noanterior) | |
495 | - { | |
496 | - if(noanterior.previousSibling && noanterior.data.tipo != "etiqueta") | |
497 | - { | |
498 | - tree.popNode(no); | |
499 | - no.insertBefore(noanterior); | |
500 | - tree.draw(); | |
501 | - movimenta = true; | |
502 | - } | |
503 | - } | |
504 | - } | |
505 | - if(tipo == "desce") | |
506 | - { | |
507 | - var noseguinte = no.nextSibling; | |
508 | - if(noseguinte) | |
509 | - { | |
510 | - tree.popNode(no); | |
511 | - no.insertAfter(noseguinte); | |
512 | - tree.draw(); | |
513 | - movimenta = true; | |
514 | - } | |
515 | - } | |
516 | - return movimenta; | |
517 | -} | |
518 | -/* | |
519 | -Function: core_handleSuccess | |
520 | - | |
521 | -Processa o retorno da chamada em ajax quando tiver sucesso. Esta é uma | |
522 | -função genérica, pouco usada. | |
523 | - | |
524 | -Parameters: | |
525 | - | |
526 | -o - string retornada pelo ajax | |
527 | - */ | |
528 | -function core_handleSuccess(o) | |
529 | -{ | |
530 | - //div onde será mostrado o log | |
531 | - if(!$i('logajax')) | |
532 | - {document.body.innerHTML += "<div id=logajax ></div>";} | |
533 | - log = $i('logajax'); | |
534 | - YAHOO.log("The success handler was called. tId: " + o.tId + ".", "info", "example"); | |
535 | - if(o.responseText !== undefined) | |
536 | - { | |
537 | - log.innerHTML = "<li>Transaction id: " + o.tId + "</li>"; | |
538 | - log.innerHTML += "<li>HTTP status: " + o.status + "</li>"; | |
539 | - log.innerHTML += "<li>Status code message: " + o.statusText + "</li>"; | |
540 | - log.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders + "</ul></li>"; | |
541 | - log.innerHTML += "<li>Server response: " + o.responseText + "</li>"; | |
542 | - log.innerHTML += "<li>Argument object: Object ( [foo] => " + o.argument.foo + " [bar] => " + o.argument.bar +" )</li>"; | |
543 | - } | |
544 | -} | |
545 | -/* | |
546 | -Function: core_handleFailure | |
547 | - | |
548 | -Processa o retorno da chamada em ajax quando tiver falhado. | |
549 | - | |
550 | -Parameters: | |
551 | - | |
552 | -o - string retornada pelo ajax | |
553 | - */ | |
554 | -function core_handleFailure(o,texto) | |
555 | -{ | |
556 | - //div onde será mostrado o log | |
557 | - //alert(texto) | |
558 | - if(!$i('logajax')) | |
559 | - {return;} | |
560 | - log = $i('logajax'); | |
561 | - //YAHOO.log("The failure handler was called. tId: " + o.tId + ".", "info", "example"); | |
562 | - if(o.responseText !== undefined) | |
563 | - { | |
564 | - if(o.statusText != "OK"){ | |
565 | - log.innerHTML = "<ul><li>Transaction id: " + o.tId + "</li>"; | |
566 | - log.innerHTML += "<li>HTTP status: " + o.status + "</li>"; | |
567 | - log.innerHTML += "<li>Status code message: " + o.statusText + "</li>"; | |
568 | - log.innerHTML += "<li>PHP message: " + texto + "</li></ul>"; | |
569 | - } | |
570 | - } | |
571 | - if (!YAHOO.carregando.container.wait) | |
572 | - { | |
573 | - YAHOO.carregando.container.wait = new YAHOO.widget.Panel("wait",{width: "240px",fixedcenter: true,close: true,draggable: false,zindex:4,modal: true,visible: false}); | |
574 | - YAHOO.carregando.container.wait.setHeader("Aguarde..."); | |
575 | - YAHOO.carregando.container.wait.render(document.body); | |
576 | - } | |
577 | - else | |
578 | - {YAHOO.carregando.container.wait.setBody(log.innerHTML);} | |
579 | -} | |
580 | -/* | |
581 | -Function: core_makeRequest | |
582 | - | |
583 | -Executa uma chamada em ajax. | |
584 | - | |
585 | -Parameters: | |
586 | - | |
587 | -sUrl - url que será executada | |
588 | - | |
589 | -callback - função que processará o retorno | |
590 | - | |
591 | -tipo - GET ou POST | |
592 | - | |
593 | -postpar - parametros quando o tipo for post | |
594 | - */ | |
595 | -function core_makeRequest(sUrl,callback,tipo,postpar) | |
596 | -{ | |
597 | - sUrl = escape(sUrl); | |
598 | - re = new RegExp("%3F", "g"); | |
599 | - sUrl = sUrl.replace(re,'?'); | |
600 | - re = new RegExp("%3D", "g"); | |
601 | - sUrl = sUrl.replace(re,'='); | |
602 | - re = new RegExp("%26", "g"); | |
603 | - sUrl = sUrl.replace(re,'&'); | |
604 | - | |
605 | - re = new RegExp("%3A", "g"); | |
606 | - sUrl = sUrl.replace(re,':'); | |
607 | - | |
608 | - if(arguments.length == 2) | |
609 | - {tipo = "GET";} | |
610 | - if(postpar){ | |
611 | - //YAHOO.util.Connect.setDefaultPostHeader('application/json;charset=ISO-8859-1'); | |
612 | - YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postpar); | |
613 | - } | |
614 | - else{ | |
615 | - YAHOO.util.Connect.asyncRequest(tipo, sUrl, callback); | |
616 | - } | |
617 | -} | |
618 | -/* | |
619 | -Function: core_carregando | |
620 | - | |
621 | -Mostra uma janela de aguarde | |
622 | - | |
623 | -Parameters: | |
624 | - | |
625 | -tipo - ativa|desativa|string com uma mensagem | |
626 | - */ | |
627 | -function core_carregando(tipo) | |
628 | -{ | |
629 | -} | |
630 | -/* | |
631 | -Function: core_dialogoContinua | |
632 | - | |
633 | -Mostra um diálogo do tipo sim não | |
634 | - | |
635 | -Parameters: | |
636 | - | |
637 | -handleYes - função para sim | |
638 | - | |
639 | -handleNo - função para não | |
640 | - | |
641 | -mensagem - mensagem do diálogo | |
642 | - | |
643 | -largura - largura do diálogo em px | |
644 | - */ | |
645 | -function core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho) | |
646 | -{ | |
647 | - if(!cabecalho || cabecalho === ""){ | |
648 | - cabecalho = "Tem certeza?"; | |
649 | - } | |
650 | - // Instantiate the Dialog | |
651 | - YAHOO.namespace("continua.container"); | |
652 | - YAHOO.continua.container.simpledialog1 = | |
653 | - new YAHOO.widget.SimpleDialog("simpledialog1", | |
654 | - { width: largura+"px", | |
655 | - fixedcenter: true, | |
656 | - visible: false, | |
657 | - draggable: false, | |
658 | - close: true, | |
659 | - text: mensagem, | |
660 | - icon: YAHOO.widget.SimpleDialog.ICON_HELP, | |
661 | - modal: true, | |
662 | - constraintoviewport: true, | |
663 | - buttons: [ { text:"Sim", handler:handleYes, isDefault:true }, | |
664 | - { text:"Não", handler:handleNo } ] | |
665 | - } ); | |
666 | - YAHOO.continua.container.simpledialog1.setHeader(cabecalho); | |
667 | - YAHOO.continua.container.simpledialog1.render(document.body); | |
668 | - YAHOO.continua.container.simpledialog1.show(); | |
669 | -} | |
670 | -/* | |
671 | -Function: core_dialogoPergunta | |
672 | - | |
673 | -Mostra um diálogo do tipo sim não com uma pergunta | |
674 | - | |
675 | -Parameters: | |
676 | - | |
677 | -handleYes - função para sim | |
678 | - | |
679 | -handleNo - função para não | |
680 | - | |
681 | -mensagem - mensagem do diálogo | |
682 | - | |
683 | -largura - largura do diálogo em px | |
684 | - */ | |
685 | -function core_dialogoPergunta(handleYes,handleNo,mensagem,largura) | |
686 | -{ | |
687 | - // Instantiate the Dialog | |
688 | - YAHOO.namespace("continua.container"); | |
689 | - YAHOO.continua.container.simpledialog1 = | |
690 | - new YAHOO.widget.SimpleDialog("simpledialog1", | |
691 | - { width: largura+"px", | |
692 | - fixedcenter: true, | |
693 | - visible: false, | |
694 | - draggable: false, | |
695 | - close: true, | |
696 | - text: mensagem, | |
697 | - icon: "", | |
698 | - modal: true, | |
699 | - constraintoviewport: true, | |
700 | - buttons: [ { text:"Continua", handler:handleYes, isDefault:true }, | |
701 | - { text:"Cancela", handler:handleNo } ] | |
702 | - } ); | |
703 | - //YAHOO.continua.container.simpledialog1.setHeader("Tem certeza?"); | |
704 | - YAHOO.continua.container.simpledialog1.render(document.body); | |
705 | - YAHOO.continua.container.simpledialog1.show(); | |
706 | -} | |
707 | -/* | |
708 | -Function: core_ativaPainelAjuda | |
709 | - | |
710 | -Parameters: | |
711 | - | |
712 | -id - id do elemento que receberá o painel | |
713 | - | |
714 | -botao - id do elemento que deverá ser lcicado para abrir o painel | |
715 | - */ | |
716 | -function core_ativaPainelAjuda(id,botao) | |
717 | -{ | |
718 | - $i(id).style.display = "block"; | |
719 | - if(!YAHOO.admin.container.panelAjuda) | |
720 | - { | |
721 | - YAHOO.admin.container.panelAjuda = new YAHOO.widget.Panel(id, { width:"350px", height:"200px",overflow:"auto", visible:false,constraintoviewport:true } ); | |
722 | - YAHOO.admin.container.panelAjuda.render(); | |
723 | - } | |
724 | - if(arguments.length == 2) | |
725 | - YAHOO.util.Event.addListener(botao, "click", YAHOO.admin.container.panelAjuda.show, YAHOO.admin.container.panelAjuda, true); | |
726 | - else | |
727 | - YAHOO.admin.container.panelAjuda.show(); | |
728 | -} | |
729 | -/* | |
730 | -Function: core_ativaPainelTexto | |
731 | - | |
732 | -Parameters: | |
733 | - | |
734 | -id - id do elemento que receberá o painel | |
735 | - */ | |
736 | -function core_ativaPainelTexto(id) | |
737 | -{ | |
738 | - YAHOO.admin.container.panelTexto = new YAHOO.widget.Panel(id, { width:"350px", height:"200px",overflow:"auto", visible:false,constraintoviewport:true } ); | |
739 | - YAHOO.admin.container.panelTexto.render(); | |
740 | - YAHOO.admin.container.panelTexto.show(); | |
741 | -} | |
742 | -/* | |
743 | -function: core_pegaPerfis | |
744 | - | |
745 | -Pega a lista de perfis | |
746 | - | |
747 | -<PEGAPERFIS> | |
748 | - | |
749 | -Parameters: | |
750 | - | |
751 | -funcao - (opcional) string com o nome da funcao que será executada apos a chamada ajax ter tido sucesso | |
752 | - | |
753 | -Return | |
754 | - | |
755 | -$perfis - variável global com o objeto perfis | |
756 | - | |
757 | -$perfisArray - array com a lista de perfis | |
758 | - */ | |
759 | -function core_pegaPerfis(funcao) | |
760 | -{ | |
761 | - if(arguments.length == 0) | |
762 | - {funcao = "";} | |
763 | - //pega a lista de perfis | |
764 | - var sUrl = "../php/menutemas.php?funcao=pegaPerfis"; | |
765 | - var callback = | |
766 | - { | |
767 | - success:function(o) | |
768 | - { | |
769 | - try | |
770 | - { | |
771 | - $perfis = YAHOO.lang.JSON.parse(o.responseText); | |
772 | - $perfisArray = new Array(); | |
773 | - for (var i=0;i<$perfis.length;i++) | |
774 | - {$perfisArray.push($perfis[i].perfil);} | |
775 | - if(funcao != "") | |
776 | - eval(funcao); | |
777 | - } | |
778 | - catch(e){core_handleFailure(o,o.responseText);} | |
779 | - }, | |
780 | - failure:core_handleFailure, | |
781 | - argument: { foo:"foo", bar:"bar" } | |
782 | - }; | |
783 | - core_makeRequest(sUrl,callback); | |
784 | -} | |
785 | -/* | |
786 | -function: core_pegaMapfiles | |
787 | - | |
788 | -Pega a lista de mapfiles | |
789 | - | |
790 | -<LISTAMAPSTEMAS> | |
791 | - | |
792 | -Parameters: | |
793 | - | |
794 | -funcaoM - (opcional) nome da funcao que será executada ao terminar a busca pelos dados | |
795 | - | |
796 | -letra - (opcional) letra inicial utilizada para filtrar a lista | |
797 | - | |
798 | -filtro - (opcional) string com o filtro, por exemplo, "'download_tema' = 'SIM'" | |
799 | - | |
800 | -checaNomes - (0pcional) bate o nome do mapfile (tema) com o registro no banco | |
801 | - | |
802 | -checaNames - (opcional) bate o nome do mapfile com o nome do layer | |
803 | - */ | |
804 | -function core_pegaMapfiles(funcaoM,letra,filtro,checaNomes,checaNames) | |
805 | -{ | |
806 | - if(!letra){ | |
807 | - letra = ""; | |
808 | - } | |
809 | - if(!filtro){ | |
810 | - filtro = ""; | |
811 | - } | |
812 | - if(!funcaoM){ | |
813 | - funcaoM = ""; | |
814 | - } | |
815 | - if(!checaNomes){ | |
816 | - checaNomes = "false"; | |
817 | - } | |
818 | - if(!checaNames){ | |
819 | - checaNames = "false"; | |
820 | - } | |
821 | - if($i("iniciaisLetras")){ | |
822 | - $i("iniciaisLetras").value = letra; | |
823 | - } | |
824 | - var sUrl = "../php/menutemas.php?funcao=listaMapsTemas&letra="+letra+"&filtro="+filtro+"&checaNomes="+checaNomes+"&checaNames="+checaNames; | |
825 | - var callbackM = | |
826 | - { | |
827 | - success:function(o) | |
828 | - { | |
829 | - try | |
830 | - { | |
831 | - $mapfiles = YAHOO.lang.JSON.parse(o.responseText); | |
832 | - if(funcaoM != "") | |
833 | - eval(funcaoM); | |
834 | - } | |
835 | - catch(e){core_handleFailure(o,o.responseText);} | |
836 | - }, | |
837 | - failure:core_handleFailure, | |
838 | - argument: { foo:"foo", bar:"bar" } | |
839 | - }; | |
840 | - core_makeRequest(sUrl,callbackM); | |
841 | -} | |
842 | -/* | |
843 | -Function: core_comboMapfiles | |
844 | - | |
845 | -Cria um combo para escolha do mapfile | |
846 | - | |
847 | -Parameters: | |
848 | - | |
849 | -onde - id do elemento que receberá o combo | |
850 | - | |
851 | -id - id do combo que será criado | |
852 | - | |
853 | -marcar - valor que será marcado como selecionado | |
854 | - | |
855 | -funcao - string com o nome da função que será executada no evento onchange | |
856 | - | |
857 | -recarrega {booblean} - força recarregar o combo de mapfiles | |
858 | - */ | |
859 | -function core_comboMapfiles(onde,id,marcar,funcao,recarrega) | |
860 | -{ | |
861 | - if(arguments.length == 3) | |
862 | - {funcao = "";} | |
863 | - if(!recarrega) | |
864 | - {recarrega = false;} | |
865 | - if($mapfiles == "" || recarrega === true) | |
866 | - { | |
867 | - core_pegaMapfiles("core_comboMapfiles('"+onde+"','"+id+"','"+marcar+"','"+funcao+"')"); | |
868 | - } | |
869 | - else | |
870 | - { | |
871 | - if (funcao != "") | |
872 | - {funcao = "onchange='"+funcao+"'";} | |
873 | - ins = "<div class='styled-select'><select id='"+id+"' "+funcao+" >"; | |
874 | - ins += core_comboObjeto($mapfiles,"codigo","codigo",marcar); | |
875 | - ins += "</select></div>"; | |
876 | - $i(onde).innerHTML = ins; | |
877 | - } | |
878 | -} | |
879 | -/* | |
880 | -Function: core_comboPerfis | |
881 | - | |
882 | -Cria um combo para escolha de perfil | |
883 | - | |
884 | -Parameters: | |
885 | - | |
886 | -onde - id do elemento que receberá o combo | |
887 | - | |
888 | -id - id do combo que será criado | |
889 | - | |
890 | -marcar - valor que será marcado como selecionado | |
891 | - | |
892 | -funcao - string com o nome da função que será executada no evento onchange | |
893 | - */ | |
894 | -function core_comboPerfis(onde,id,marcar,funcao) | |
895 | -{ | |
896 | - if(arguments.length == 3) | |
897 | - {funcao = "";} | |
898 | - if($perfis == "") | |
899 | - { | |
900 | - core_pegaPerfis("core_comboPerfis('"+onde+"','"+id+"','"+marcar+"','"+funcao+"')"); | |
901 | - } | |
902 | - else | |
903 | - { | |
904 | - if (funcao != "") | |
905 | - {funcao = "onchange='"+funcao+"'";} | |
906 | - ins = "<div class='styled-select150'><select id='"+id+"' "+funcao+" >"; | |
907 | - ins += core_comboObjeto($perfis,"perfil","perfil",marcar); | |
908 | - ins += "</select></div>"; | |
909 | - $i(onde).innerHTML = ins; | |
910 | - } | |
911 | -} | |
912 | -/* | |
913 | -Function: core_comboPranchas | |
914 | - | |
915 | -Cria um combo para escolha de pranchas de um atlas | |
916 | - | |
917 | -<PEGAPRANCHAS> | |
918 | - | |
919 | -Parameters: | |
920 | - | |
921 | -onde - id do elemento que receberá o combo | |
922 | - | |
923 | -id - id do combo que será criado | |
924 | - | |
925 | -marcar - valor que será marcado como selecionado | |
926 | - | |
927 | -funcao - string com o nome da função que será executada no evento onchange | |
928 | - */ | |
929 | -function core_comboPranchas(onde,id,marcar,funcao,id_atlas) | |
930 | -{ | |
931 | - var sUrl = "../php/atlas.php?funcao=pegaPranchas&id_atlas="+id_atlas; | |
932 | - var callback = | |
933 | - { | |
934 | - success:function(o) | |
935 | - { | |
936 | - try | |
937 | - { | |
938 | - var valores = YAHOO.lang.JSON.parse(o.responseText); | |
939 | - if(arguments.length == 3) | |
940 | - {funcao = "";} | |
941 | - if (funcao != "") | |
942 | - {funcao = "onchange='"+funcao+"'";} | |
943 | - ins = "<div class='styled-select150'><select id='"+id+"' "+funcao+" >"; | |
944 | - ins += core_comboObjeto(valores,"id_prancha","titulo_prancha",marcar); | |
945 | - ins += "</select></div>"; | |
946 | - $i(onde).innerHTML = ins; | |
947 | - } | |
948 | - catch(e){core_handleFailure(e,o.responseText);} | |
949 | - }, | |
950 | - failure:core_handleFailure, | |
951 | - argument: { foo:"foo", bar:"bar" } | |
952 | - }; | |
953 | - core_makeRequest(sUrl,callback); | |
954 | -} | |
955 | -/* | |
956 | -Function: core_comboGrupos | |
957 | - | |
958 | -Cria um combo para escolha de um grupo | |
959 | - | |
960 | -<PEGAGRUPOS> | |
961 | - | |
962 | -Parameters: | |
963 | - | |
964 | -onde - id do elemento que receberá o combo | |
965 | - | |
966 | -id - id do combo que será criado | |
967 | - | |
968 | -marcar - valor que será marcado como selecionado | |
969 | - | |
970 | -funcao - string com o nome da função que será executada no evento onchange | |
971 | - */ | |
972 | -function core_comboGrupos(onde,id,marcar,funcao) | |
973 | -{ | |
974 | - var sUrl = "../php/menutemas.php?funcao=pegaGrupos"; | |
975 | - var callback = | |
976 | - { | |
977 | - success:function(o) | |
978 | - { | |
979 | - try | |
980 | - { | |
981 | - var valores = YAHOO.lang.JSON.parse(o.responseText); | |
982 | - if(arguments.length == 3) | |
983 | - {funcao = "";} | |
984 | - if (funcao != "") | |
985 | - {funcao = "onchange='"+funcao+"'";} | |
986 | - ins = "<select size=6 style='width:370px;font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | |
987 | - ins += core_comboObjeto(valores,"id_grupo","nome_grupo",marcar); | |
988 | - ins += "</select>"; | |
989 | - $i(onde).innerHTML = ins; | |
990 | - } | |
991 | - catch(e){core_handleFailure(e,o.responseText);} | |
992 | - }, | |
993 | - failure:core_handleFailure, | |
994 | - argument: { foo:"foo", bar:"bar" } | |
995 | - }; | |
996 | - core_makeRequest(sUrl,callback); | |
997 | -} | |
998 | -/* | |
999 | -Function: core_comboSubGrupos | |
1000 | - | |
1001 | -Cria um combo para escolha de um sub-grupo | |
1002 | - | |
1003 | -<PEGASUBGRUPOS> | |
1004 | - | |
1005 | -Parameters: | |
1006 | - | |
1007 | -onde - id do elemento que receberá o combo | |
1008 | - | |
1009 | -id - id do combo que será criado | |
1010 | - | |
1011 | -marcar - valor que será marcado como selecionado | |
1012 | - | |
1013 | -funcao - string com o nome da função que será executada no evento onchange | |
1014 | - */ | |
1015 | -function core_comboSubGrupos(onde,id,marcar,funcao) | |
1016 | -{ | |
1017 | - var sUrl = "../php/menutemas.php?funcao=pegaSubGrupos"; | |
1018 | - var callback = | |
1019 | - { | |
1020 | - success:function(o) | |
1021 | - { | |
1022 | - try | |
1023 | - { | |
1024 | - var valores = YAHOO.lang.JSON.parse(o.responseText); | |
1025 | - if(arguments.length == 3) | |
1026 | - {funcao = "";} | |
1027 | - if (funcao != "") | |
1028 | - {funcao = "onchange='"+funcao+"'";} | |
1029 | - ins = "<select size=6 style='width:370px; font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | |
1030 | - ins += core_comboObjeto(valores,"id_subgrupo","nome_subgrupo",marcar); | |
1031 | - ins += "</select>"; | |
1032 | - $i(onde).innerHTML = ins; | |
1033 | - } | |
1034 | - catch(e){core_handleFailure(e,o.responseText);} | |
1035 | - }, | |
1036 | - failure:core_handleFailure, | |
1037 | - argument: { foo:"foo", bar:"bar" } | |
1038 | - }; | |
1039 | - core_makeRequest(sUrl,callback); | |
1040 | -} | |
1041 | -/* | |
1042 | -Function: core_comboTemas | |
1043 | - | |
1044 | -Cria um combo para escolha de um tema | |
1045 | - | |
1046 | -<PEGATEMAS2> | |
1047 | - | |
1048 | -Parameters: | |
1049 | - | |
1050 | -onde - id do elemento que receberá o combo | |
1051 | - | |
1052 | -id - id do combo que será criado | |
1053 | - | |
1054 | -marcar - valor que será marcado como selecionado | |
1055 | - | |
1056 | -funcao - string com o nome da função que será executada no evento onchange | |
1057 | - */ | |
1058 | -function core_comboTemas(onde,id,marcar,funcao) | |
1059 | -{ | |
1060 | - var sUrl = "../php/menutemas.php?funcao=pegaTemas2"; | |
1061 | - var callback = | |
1062 | - { | |
1063 | - success:function(o) | |
1064 | - { | |
1065 | - try | |
1066 | - { | |
1067 | - var valores = YAHOO.lang.JSON.parse(o.responseText); | |
1068 | - if(arguments.length == 3) | |
1069 | - {funcao = "";} | |
1070 | - if (funcao != "") | |
1071 | - {funcao = "onchange='"+funcao+"'";} | |
1072 | - ins = "<select size=6 style='width:355px;font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | |
1073 | - ins += core_comboObjeto(valores,"id_tema","nome_tema",marcar,"codigo_tema"); | |
1074 | - ins += "</select>"; | |
1075 | - $i(onde).innerHTML = ins; | |
1076 | - } | |
1077 | - catch(e){core_handleFailure(e,o.responseText);} | |
1078 | - }, | |
1079 | - failure:core_handleFailure, | |
1080 | - argument: { foo:"foo", bar:"bar" } | |
1081 | - }; | |
1082 | - core_makeRequest(sUrl,callback); | |
1083 | -} | |
1084 | - | |
1085 | -/* | |
1086 | -function: core_pegaTags | |
1087 | - | |
1088 | -Pega a lista de tags | |
1089 | - | |
1090 | -<PEGATAGS> | |
1091 | - | |
1092 | -Parameters: | |
1093 | - | |
1094 | -funcao - (opcional) nome da funcao que será executada ao terminar a busca pelos dados | |
1095 | - */ | |
1096 | -function core_pegaTags(funcao) | |
1097 | -{ | |
1098 | - if(arguments.length == 0) | |
1099 | - {funcao = "";} | |
1100 | - var sUrl = "../php/menutemas.php?funcao=pegaTags"; | |
1101 | - var callback = | |
1102 | - { | |
1103 | - success:function(o) | |
1104 | - { | |
1105 | - try | |
1106 | - { | |
1107 | - $tags = YAHOO.lang.JSON.parse(o.responseText); | |
1108 | - if($tags == ""){$tags = " ";} | |
1109 | - if(funcao != "") | |
1110 | - eval(funcao); | |
1111 | - } | |
1112 | - catch(e){core_handleFailure(e,o.responseText);} | |
1113 | - }, | |
1114 | - failure:core_handleFailure, | |
1115 | - argument: { foo:"foo", bar:"bar" } | |
1116 | - }; | |
1117 | - core_makeRequest(sUrl,callback); | |
1118 | -} | |
1119 | -/* | |
1120 | -Function: core_comboTags | |
1121 | - | |
1122 | -Cria um combo para escolha de tags | |
1123 | - | |
1124 | -Parameters: | |
1125 | - | |
1126 | -onde - id do elemento que receberá o combo | |
1127 | - | |
1128 | -id - id do combo que será criado | |
1129 | - | |
1130 | -marcar - valor que será marcado como selecionado | |
1131 | - | |
1132 | -change - nome da função do evento onchange | |
1133 | - */ | |
1134 | -function core_comboTags(onde,id,change) | |
1135 | -{ | |
1136 | - if($tags == "") | |
1137 | - { | |
1138 | - core_pegaTags("core_comboTags('"+onde+"','"+id+"','"+change+"')"); | |
1139 | - } | |
1140 | - else | |
1141 | - { | |
1142 | - ins = "<div class='styled-select'><select onchange=\""+change+"(this.value)\" id='"+id+"' >"; | |
1143 | - ins += core_comboObjeto($tags,"nome","nome",""); | |
1144 | - ins += "</select></div>"; | |
1145 | - $i(onde).innerHTML = ins; | |
1146 | - } | |
1147 | -} | |
1148 | -/* | |
1149 | -Function: gera uma janela flutuante com opções de escolha baseadas em checkbox | |
1150 | - | |
1151 | -Parameters: | |
1152 | - | |
1153 | -valores - array com os valores de cada checkbox | |
1154 | - | |
1155 | -textos - array com os nomes de cada checkbox | |
1156 | - | |
1157 | -selecionados - array com os valores marcados | |
1158 | - | |
1159 | -target - objeto para receber o resultado | |
1160 | - | |
1161 | -record - objeto record (utilize "" para escapar) | |
1162 | - | |
1163 | -key - chave (nome do item) (utilize "" para escapar) | |
1164 | - | |
1165 | -unico - sim|nao indicando se apenas um pode ser escolhido | |
1166 | - | |
1167 | -funcaoFinal - (opcional) funcao que sera executada no final do processo | |
1168 | - */ | |
1169 | -function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,funcaoFinal){ | |
1170 | - if(!unico){ | |
1171 | - unico = "nao"; | |
1172 | - } | |
1173 | - function on_menuCheckBoxChange(p_oEvent){ | |
1174 | - var cks,i, | |
1175 | - ins = [], | |
1176 | - status = "OK"; | |
1177 | - if(p_oEvent && p_oEvent.newValue){ | |
1178 | - status = p_oEvent.newValue.get("value"); | |
1179 | - } | |
1180 | - if(status == "OK") { | |
1181 | - cks = $i("core_menuCK_bd").getElementsByTagName("input"); | |
1182 | - ins = []; | |
1183 | - for (i=0;i<cks.length;i++){ | |
1184 | - if(cks[i].checked){ | |
1185 | - ins.push(cks[i].value); | |
1186 | - } | |
1187 | - } | |
1188 | - if(record && record != ""){ | |
1189 | - target.innerHTML = "<pre ><p>"+ins.toString()+"</pre>"; | |
1190 | - record.setData(key,ins.toString()); | |
1191 | - } | |
1192 | - else{ | |
1193 | - target.value = ins.toString(); | |
1194 | - } | |
1195 | - } | |
1196 | - YAHOO.admin.container.panelCK.destroy(); | |
1197 | - YAHOO.admin.container.panelCK = null; | |
1198 | - if(funcaoFinal){ | |
1199 | - funcaoFinal.call(); | |
1200 | - } | |
1201 | - }; | |
1202 | - var novoel,ndiv,og_core,onde,ins,i,novoCK,ck,j; | |
1203 | - if(!YAHOO.admin.container.panelCK){ | |
1204 | - novoel = document.createElement("div"); | |
1205 | - novoel.id = "core_menuCK"; | |
1206 | - ndiv = document.createElement("div"); | |
1207 | - ndiv.className= "yui-dt-editor"; | |
1208 | - ndiv.style.backgroundColor = "white"; | |
1209 | - ndiv.style.height = "144px"; | |
1210 | - ndiv.style.width = "100%"; | |
1211 | - ndiv.style.overflow = "auto"; | |
1212 | - ndiv.innerHTML = "<div id='core_botoesCabecalho' ></div><br>" + | |
1213 | - "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>"; | |
1214 | - novoel.appendChild(ndiv); | |
1215 | - document.body.appendChild(novoel); | |
1216 | - og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_botoesCabecalho" }); | |
1217 | - og_core.addButtons([ | |
1218 | - { label: "OK", value: "OK", checked: false}, | |
1219 | - { label: "Fecha", value: "CANCEL", checked: false } | |
1220 | - ]); | |
1221 | - og_core.on("checkedButtonChange", on_menuCheckBoxChange); | |
1222 | - YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:false,zindex:"100",close:false,underlay:false,width:"200px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } ); | |
1223 | - YAHOO.admin.container.panelCK.render(); | |
1224 | - } | |
1225 | - onde = $i("core_menuCK_bd"); | |
1226 | - ins = []; | |
1227 | - onde.innerHTML = ""; | |
1228 | - for (i=0;i<valores.length;i++){ | |
1229 | - novoCK = document.createElement("div"); | |
1230 | - novoCK.onclick = on_menuCheckBoxChange; | |
1231 | - ck = ""; | |
1232 | - for(j=0;j<selecionados.length;j++){ | |
1233 | - if(selecionados[j] == valores[i]) | |
1234 | - ck = "CHECKED"; | |
1235 | - } | |
1236 | - if(unico === "nao"){ | |
1237 | - ins.push("<input style='cursor:pointer;' type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); | |
1238 | - } | |
1239 | - else{ | |
1240 | - ins.push("<input style='position:relative;top:2px;cursor:pointer;' type=radio name=escolha_core_menuCheckBox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); | |
1241 | - } | |
1242 | - } | |
1243 | - if(valores.length > 0){ | |
1244 | - ins.push("<br>"); | |
1245 | - novoCK.innerHTML = ins.join(" "); | |
1246 | - novoCK.style.width = "100%"; | |
1247 | - onde.appendChild(novoCK); | |
1248 | - } | |
1249 | - YAHOO.admin.container.panelCK.moveTo(YAHOO.util.Dom.getX(target),YAHOO.util.Dom.getY(target)); | |
1250 | - YAHOO.admin.container.panelCK.show(); | |
1251 | - $i("core_menuCK_bd").getElementsByTagName("div")[0].style.textAlign = "left"; | |
1252 | -} | |
1253 | -/* | |
1254 | -Function: core_combosimnao | |
1255 | - | |
1256 | -Retorna os itens option de um combo sim nao | |
1257 | - */ | |
1258 | -function core_combosimnao(marcar) | |
1259 | -{ | |
1260 | - var ins = "<option value='' "; | |
1261 | - if (marcar == ""){ins += "selected";} | |
1262 | - ins += ">---</option>"; | |
1263 | - ins += "<option value='SIM' "; | |
1264 | - if (marcar == "sim" || marcar == "SIM"){ins += "selected";} | |
1265 | - ins += ">sim</option>"; | |
1266 | - ins += "<option value='NAO' "; | |
1267 | - if (marcar == "nao" || marcar == "NAO"){ins += "selected";} | |
1268 | - ins += ">nao</option>"; | |
1269 | - return(ins); | |
1270 | -} | |
1271 | -/* | |
1272 | -Function: core_comboObjeto | |
1273 | - | |
1274 | -Retorna os itens option de um combo baseado em um objeto json | |
1275 | - */ | |
1276 | -function core_comboObjeto(obj,valor,texto,marcar,texto2,texto3) | |
1277 | -{ | |
1278 | - var ins = "<option value='' "; | |
1279 | - var v; | |
1280 | - var t; | |
1281 | - if(!marcar && marcar != ""){ | |
1282 | - marcar = 0; | |
1283 | - } | |
1284 | - ins += ">---</option>"; | |
1285 | - for (var k=0;k<obj.length;k++){ | |
1286 | - if(valor != ""){ | |
1287 | - v = obj[k][valor]; | |
1288 | - } | |
1289 | - else{ | |
1290 | - v = obj[k]; | |
1291 | - } | |
1292 | - if(texto != ""){ | |
1293 | - t = obj[k][texto]; | |
1294 | - } | |
1295 | - else{ | |
1296 | - t = obj[k]; | |
1297 | - } | |
1298 | - if(texto2){ | |
1299 | - t += " ("+eval("obj[k]."+texto2)+")"; | |
1300 | - } | |
1301 | - if(texto3){ | |
1302 | - t += " ("+eval("obj[k]."+texto3)+")"; | |
1303 | - } | |
1304 | - ins += "<option value='"+v+"' "; | |
1305 | - if (marcar == v){ | |
1306 | - ins += "selected"; | |
1307 | - } | |
1308 | - ins += " title='"+t+"' >"+t+"</option>"; | |
1309 | - } | |
1310 | - return(ins); | |
1311 | -} | |
1312 | -/* | |
1313 | -Function: core_geraLinhas | |
1314 | - | |
1315 | -Gera campos de formulário | |
1316 | - | |
1317 | -Parameters: | |
1318 | - | |
1319 | -dados - objeto no formato {"linhas":[{titulo:"Nome do tema:",size:"50",id:"Enome_tema",value:i.nome_tema,tipo:"text",div:""}]} | |
1320 | - */ | |
1321 | -function core_geraLinhas(dados) | |
1322 | -{ | |
1323 | - var nparam = dados.linhas.length; | |
1324 | - var contaParam = 0; | |
1325 | - var resultado = ""; | |
1326 | - core_geralinhasEscondeAjuda = function(id){ | |
1327 | - var a = $i(id+"_ajuda"), | |
1328 | - i = $i(id+"_imgajuda"); | |
1329 | - | |
1330 | - if(a.style.display == "block"){ | |
1331 | - a.style.display = "none"; | |
1332 | - i. src = "../../imagens/oxygen/16x16/help-about.png"; | |
1333 | - } | |
1334 | - else{ | |
1335 | - a.style.display = "block"; | |
1336 | - i. src = "../../imagens/oxygen/16x16/help-about.png"; | |
1337 | - } | |
1338 | - }; | |
1339 | - do{ | |
1340 | - var p = dados.linhas[contaParam]; | |
1341 | - if(p.tipo == "text" || p.tipo == "cor" || p.tipo == "textarea"){ | |
1342 | - if(!p.size){ | |
1343 | - p.size = "50"; | |
1344 | - } | |
1345 | - if(p.ajuda){ | |
1346 | - var idajuda; | |
1347 | - if(p.id !== ""){ | |
1348 | - idajuda = p.id + contaParam; | |
1349 | - } | |
1350 | - else{ | |
1351 | - idajuda = "a"+parseInt(255*(Math.random()),10); | |
1352 | - } | |
1353 | - resultado += "<div onclick='core_geralinhasEscondeAjuda(\""+idajuda+"\")' style='margin-bottom:6px;cursor:pointer' title='ajuda' ><p><img style='position:relative;top:3px;' id='"+idajuda+"_imgajuda' src='../../imagens/oxygen/16x16/help-about.png' >"+p.titulo+"</p></div>"; | |
1354 | - resultado += "<div id='"+idajuda+"_ajuda' style=display:none >"+p.ajuda+"</div>"; | |
1355 | - } | |
1356 | - else{ | |
1357 | - resultado += "<div><p>"+p.titulo+"</p>"; | |
1358 | - } | |
1359 | - if(p.texto){ | |
1360 | - resultado += "<span style=color:gray ><p>"+p.texto+"</p></span>"; | |
1361 | - } | |
1362 | - if(p.id != ""){ | |
1363 | - if(!p.value){ | |
1364 | - p.value = ""; | |
1365 | - } | |
1366 | - if(p.tipo == "textarea"){ | |
1367 | - resultado += "<textarea style=width:90%; id="+p.id+" >"+p.value+"</textarea>"; | |
1368 | - } | |
1369 | - else{ | |
1370 | - if(p.tipo == "cor"){ | |
1371 | - resultado += "<div class='i3geoForm i3geoFormSemIcone'><input type=text id="+p.id+" value=\""+p.value+"\" style='width:90%;'/>"; | |
1372 | - } | |
1373 | - else{ | |
1374 | - resultado += "<div class='i3geoForm i3geoFormSemIcone'><input type=text id="+p.id+" value=\""+p.value+"\" />"; | |
1375 | - } | |
1376 | - } | |
1377 | - if(p.tipo == "cor"){ | |
1378 | - resultado += " <img class='lupaBuscar' src='../../imagens/aquarela.gif' style='cursor:pointer;' onclick='core_abreCor(\"\",\""+p.id+"\");' />"; | |
1379 | - } | |
1380 | - resultado += "</div>"; | |
1381 | - } | |
1382 | - if(p.div){ | |
1383 | - resultado += p.div; | |
1384 | - } | |
1385 | - resultado += "</div>"; | |
1386 | - } | |
1387 | - contaParam++; | |
1388 | - } | |
1389 | - while(contaParam < nparam); | |
1390 | - return(resultado); | |
1391 | -} | |
1392 | -/* | |
1393 | -Function: core_ativaBotaoAdicionaLinha | |
1394 | - | |
1395 | -Ativa o botão que adiciona uma linha em uma tabela no banco de dados e na interface HTML | |
1396 | - | |
1397 | -Essa função utiliza o objeto datatable que deve estar armazenado na variável myDataTable | |
1398 | - | |
1399 | -Parameters: | |
1400 | - | |
1401 | -myDataTable - objeto dataTable do YUI | |
1402 | - | |
1403 | -sUrl - url com o programa que será executado no servidor | |
1404 | - | |
1405 | -idBotao - id do elemento com o botão | |
1406 | - | |
1407 | -nomeFuncao - nome da função que será executada ao concluir a adição da linha | |
1408 | - */ | |
1409 | -function core_ativaBotaoAdicionaLinha(sUrl,idBotao,nomeFuncao) | |
1410 | -{ | |
1411 | - if(arguments.length == 1){ | |
1412 | - idBotao = "adiciona"; | |
1413 | - } | |
1414 | - if(arguments.length < 3){ | |
1415 | - nomeFuncao = ""; | |
1416 | - } | |
1417 | - var botao, adicionalinha = function(){ | |
1418 | - core_carregando("ativa"); | |
1419 | - core_carregando(" adicionando um novo registro"); | |
1420 | - var callback = { | |
1421 | - success:function(o){ | |
1422 | - var texto = ""; | |
1423 | - try{ | |
1424 | - core_carregando("desativa"); | |
1425 | - if(nomeFuncao != ""){ | |
1426 | - if(YAHOO.lang.isFunction(nomeFuncao)){ | |
1427 | - nomeFuncao.call(o); | |
1428 | - } | |
1429 | - else{ | |
1430 | - eval(nomeFuncao+"()"); | |
1431 | - } | |
1432 | - } | |
1433 | - else{ | |
1434 | - texto = YAHOO.lang.JSON.parse(o.responseText)[0]; | |
1435 | - if(texto === ""){ | |
1436 | - texto = "Clique para editar"; | |
1437 | - } | |
1438 | - myDataTable.addRow(texto,0); | |
1439 | - } | |
1440 | - } | |
1441 | - catch(e){ | |
1442 | - core_handleFailure(e,o.responseText); | |
1443 | - } | |
1444 | - }, | |
1445 | - failure:core_handleFailure, | |
1446 | - argument: { foo:"foo", bar:"bar" } | |
1447 | - }; | |
1448 | - core_makeRequest(sUrl,callback); | |
1449 | - }; | |
1450 | - //cria o botão de adição de um novo menu | |
1451 | - botao = new YAHOO.widget.Button(idBotao,{ onclick: { fn: adicionalinha } }); | |
1452 | - botao.addClass("rodar"); | |
1453 | -} | |
1454 | -/* | |
1455 | -Function: core_pegaDados | |
1456 | - | |
1457 | -Busca dados no servidor via Ajax e executa uma função de retorno com os daods | |
1458 | - | |
1459 | -Parameters: | |
1460 | - | |
1461 | -mensagem - mensagem que será mostrada na tela | |
1462 | - | |
1463 | -sUrl - url do programa que será executado no servidor | |
1464 | - | |
1465 | -funcaoRetorno - funcao que será executada ao terminar a busca pelos dados | |
1466 | - */ | |
1467 | -function core_pegaDados(mensagem,sUrl,funcaoRetorno) | |
1468 | -{ | |
1469 | - if("mensagem" != "") | |
1470 | - core_carregando(mensagem); | |
1471 | - var callback = | |
1472 | - { | |
1473 | - success:function(o) | |
1474 | - { | |
1475 | - try | |
1476 | - { | |
1477 | - if(funcaoRetorno != ""){ | |
1478 | - if(YAHOO.lang.isFunction(funcaoRetorno)){ | |
1479 | - funcaoRetorno.call("",YAHOO.lang.JSON.parse(o.responseText)); | |
1480 | - } | |
1481 | - else{ | |
1482 | - eval(funcaoRetorno+"(YAHOO.lang.JSON.parse(o.responseText))"); | |
1483 | - } | |
1484 | - } | |
1485 | - core_carregando("desativa"); | |
1486 | - } | |
1487 | - catch(e) | |
1488 | - { | |
1489 | - if("mensagem" != "") | |
1490 | - {core_carregando("desativa");} | |
1491 | - core_handleFailure(o,o.responseText); | |
1492 | - } | |
1493 | - }, | |
1494 | - failure:core_handleFailure, | |
1495 | - argument: { foo:"foo", bar:"bar" } | |
1496 | - }; | |
1497 | - core_makeRequest(sUrl,callback); | |
1498 | -} | |
1499 | -/* | |
1500 | -Function: core_gravaLinha | |
1501 | - | |
1502 | -Grava um registro no banco de dados e atualiza o datatable atual | |
1503 | - | |
1504 | -Essa função utiliza o objeto datatable que deve estar armazenado na variável myDataTable | |
1505 | - | |
1506 | -Parameters: | |
1507 | - | |
1508 | -mensagem - mensagem que será mostrada na tela | |
1509 | - | |
1510 | -row - objeto row que foi clicado pelo usuário. Utilizado para se obter os daods do recordset | |
1511 | - | |
1512 | -sUrl - url do programa que será executado | |
1513 | - | |
1514 | -nomeFuncao - nome da funcao que sera executada apos gravar os dados (opcional) | |
1515 | - */ | |
1516 | -function core_gravaLinha(mensagem,row,sUrl,nomeFuncao) | |
1517 | -{ | |
1518 | - core_carregando("ativa"); | |
1519 | - core_carregando(mensagem); | |
1520 | - if(arguments.length < 4) | |
1521 | - nomeFuncao = ""; | |
1522 | - var callback = | |
1523 | - { | |
1524 | - success:function(o) | |
1525 | - { | |
1526 | - core_carregando("desativa"); | |
1527 | - var rec = myDataTable.getRecordSet().getRecord(row); | |
1528 | - var linha = myDataTable.getTrEl(rec); | |
1529 | - if(nomeFuncao != "") | |
1530 | - { | |
1531 | - eval(nomeFuncao+"()"); | |
1532 | - try | |
1533 | - {myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]);} | |
1534 | - catch(e){} | |
1535 | - } | |
1536 | - else | |
1537 | - { | |
1538 | - myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]); | |
1539 | - } | |
1540 | - linha.style.color = ""; | |
1541 | - linha.style.textDecoration = "none"; | |
1542 | - }, | |
1543 | - failure:core_handleFailure, | |
1544 | - argument: { foo:"foo", bar:"bar" } | |
1545 | - }; | |
1546 | - core_makeRequest(sUrl,callback); | |
1547 | -} | |
1548 | -/* | |
1549 | -Function: core_excluiLinha | |
1550 | - | |
1551 | -Excluí um registro no banco de dados e atualiza o datatable. | |
1552 | - | |
1553 | -Essa função utiliza o objeto datatable que deve estar armazenado na variável myDataTable | |
1554 | - | |
1555 | -Parameters: | |
1556 | - | |
1557 | -sUrl - url do programa que será executado | |
1558 | - | |
1559 | -row - objeto row de um datatable | |
1560 | - | |
1561 | -mensagem - | |
1562 | - */ | |
1563 | -function core_excluiLinha(sUrl,row,mensagem,cabecalho,tabela) | |
1564 | -{ | |
1565 | - if(!cabecalho){ | |
1566 | - cabecalho = ""; | |
1567 | - } | |
1568 | - //dialogo | |
1569 | - // Define various event handlers for Dialog | |
1570 | - var handleYes = function() | |
1571 | - { | |
1572 | - this.hide(); | |
1573 | - core_carregando("ativa"); | |
1574 | - core_carregando(mensagem); | |
1575 | - var callback = | |
1576 | - { | |
1577 | - success:function(o) | |
1578 | - { | |
1579 | - try | |
1580 | - { | |
1581 | - if(YAHOO.lang.JSON.parse(o.responseText) == "erro") | |
1582 | - { | |
1583 | - core_carregando("<span style=color:red >Não foi possível excluir. Verifique se não existem outras tabelas com registros vinculados a este</span>"); | |
1584 | - setTimeout("core_carregando('desativa')",3000); | |
1585 | - } | |
1586 | - else | |
1587 | - { | |
1588 | - if(tabela){ | |
1589 | - tabela.deleteRow(row); | |
1590 | - } | |
1591 | - else{ | |
1592 | - myDataTable.deleteRow(row); | |
1593 | - } | |
1594 | - core_carregando("desativa"); | |
1595 | - } | |
1596 | - } | |
1597 | - catch(e){core_handleFailure(o,o.responseText);} | |
1598 | - }, | |
1599 | - failure:core_handleFailure, | |
1600 | - argument: { foo:"foo", bar:"bar" } | |
1601 | - }; | |
1602 | - core_makeRequest(sUrl,callback); | |
1603 | - }; | |
1604 | - var handleNo = function(){ | |
1605 | - this.hide(); | |
1606 | - }; | |
1607 | - var mensagem = "Exclui o registro?"; | |
1608 | - var largura = "300"; | |
1609 | - core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho); | |
1610 | -} | |
1611 | -/* | |
1612 | -Function: core_excluiNoTree | |
1613 | - | |
1614 | -Excluí um registro no banco de dados e atualiza o treeview. | |
1615 | - | |
1616 | -Essa função utiliza o objeto treeview que deve estar armazenado na variável tree | |
1617 | - | |
1618 | -Parameters: | |
1619 | - | |
1620 | -sUrl - url do programa que será executado | |
1621 | - | |
1622 | -no - objeto no de um treeview | |
1623 | - | |
1624 | -mensagem - | |
1625 | - */ | |
1626 | -function core_excluiNoTree(sUrl,no,mensagem,cabecalho) | |
1627 | -{ | |
1628 | - if(!cabecalho){ | |
1629 | - cabecalho = ""; | |
1630 | - } | |
1631 | - //dialogo | |
1632 | - // Define various event handlers for Dialog | |
1633 | - var handleYes = function() | |
1634 | - { | |
1635 | - this.hide(); | |
1636 | - core_carregando("ativa"); | |
1637 | - core_carregando(mensagem); | |
1638 | - var callback = | |
1639 | - { | |
1640 | - success:function(o) | |
1641 | - { | |
1642 | - try | |
1643 | - { | |
1644 | - if(YAHOO.lang.JSON.parse(o.responseText) == "erro") | |
1645 | - { | |
1646 | - core_carregando("<span style=color:red >Não foi possível excluir. Verifique se não existem outras tabelas com registros vinculados a este</span>"); | |
1647 | - setTimeout("core_carregando('desativa')",3000); | |
1648 | - } | |
1649 | - else | |
1650 | - { | |
1651 | - if(no){ | |
1652 | - tree.removeNode(no); | |
1653 | - tree.draw(); | |
1654 | - } | |
1655 | - core_carregando("desativa"); | |
1656 | - } | |
1657 | - } | |
1658 | - catch(e){core_handleFailure(o,o.responseText);} | |
1659 | - }, | |
1660 | - failure:core_handleFailure, | |
1661 | - argument: { foo:"foo", bar:"bar" } | |
1662 | - }; | |
1663 | - core_makeRequest(sUrl,callback); | |
1664 | - }; | |
1665 | - var handleNo = function() | |
1666 | - { | |
1667 | - this.hide(); | |
1668 | - }; | |
1669 | - var mensagem = "Exclui o registro?"; | |
1670 | - var largura = "300"; | |
1671 | - core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho); | |
1672 | -} | |
1673 | -/** | |
1674 | -Function: core_montaEditor | |
1675 | - | |
1676 | -Monta uma janela flutuante com um formulário. | |
1677 | - | |
1678 | -O editor possui um div com id=editor_bd que deve ser usado para incluir o formulário. | |
1679 | - | |
1680 | -Parameters: | |
1681 | - | |
1682 | -funcaoOK - string com o nome da função que será executada quando o botão OK for pressionado. | |
1683 | - | |
1684 | -funcaoClose - nome da funcao que será executada quando a janela for fechada. Pode ser "" para escapar. | |
1685 | - | |
1686 | -titulo - titulo da janela | |
1687 | - | |
1688 | -modal - boolean | |
1689 | - | |
1690 | -bsalva - boolean botao salvar | |
1691 | - | |
1692 | -bcancela - boolean botao cancelar | |
1693 | - */ | |
1694 | -function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | |
1695 | -{ | |
1696 | - if(!funcaoOK){ | |
1697 | - funcaoOK = ""; | |
1698 | - } | |
1699 | - if(!w){ | |
1700 | - w = "400px"; | |
1701 | - } | |
1702 | - if(!h){ | |
1703 | - h = "354px"; | |
1704 | - } | |
1705 | - if(modal == undefined){ | |
1706 | - modal = false; | |
1707 | - } | |
1708 | - if(bsalva == undefined){ | |
1709 | - bsalva = true; | |
1710 | - } | |
1711 | - if(bcancela == undefined){ | |
1712 | - bcancela = true; | |
1713 | - } | |
1714 | - if(!titulo){ | |
1715 | - titulo = "Editor"; | |
1716 | - } | |
1717 | - if(!funcaoClose){ | |
1718 | - funcaoClose = ""; | |
1719 | - } | |
1720 | - if(!$i("janela_editor")) | |
1721 | - { | |
1722 | - var ins = "", temp = "", lb, | |
1723 | - salvai = "<input id=okcancel_checkboxOK type='buttom' value='Salva' />", | |
1724 | - cancelai = "<input id=okcancel_checkboxCANCEL type='buttom' value='Cancela' />", | |
1725 | - novoel = document.createElement("div"); | |
1726 | - novoel.id = "janela_editor"; | |
1727 | - ins = '<div class="hd"><div id="okcancel_checkbox" ></div></div>' + | |
1728 | - "<div class='bd' style='height:"+h+";overflow:auto'>" + | |
1729 | - "<div id='editor_bd'></div>"; | |
1730 | - novoel.innerHTML = ins; | |
1731 | - document.body.appendChild(novoel); | |
1732 | - if(funcaoOK != "") | |
1733 | - { | |
1734 | - lb = $i("okcancel_checkbox"); | |
1735 | - if(bsalva === true){ | |
1736 | - temp += salvai; | |
1737 | - } | |
1738 | - if(bcancela === true){ | |
1739 | - temp += cancelai; | |
1740 | - } | |
1741 | - lb.innerHTML = temp + '<span style="margin-left:10px;position:relative;top:-5px">'+titulo+'</span>'; | |
1742 | - if(bsalva === true){ | |
1743 | - new YAHOO.widget.Button( | |
1744 | - "okcancel_checkboxOK", | |
1745 | - {onclick:{fn: function(){ | |
1746 | - if(YAHOO.lang.isFunction(funcaoOK)){ | |
1747 | - funcaoOK.call(); | |
1748 | - } | |
1749 | - else{ | |
1750 | - eval(funcaoOK); | |
1751 | - } | |
1752 | - }}} | |
1753 | - ); | |
1754 | - var temp = $i("okcancel_checkbox"); | |
1755 | - temp.style.top = "2px"; | |
1756 | - temp.style.position = "relative"; | |
1757 | - var temp = $i("okcancel_checkboxOK-button"); | |
1758 | - temp.style.height = "23px"; | |
1759 | - } | |
1760 | - if(bcancela === true){ | |
1761 | - new YAHOO.widget.Button( | |
1762 | - "okcancel_checkboxCANCEL", | |
1763 | - {onclick:{fn: function(){ | |
1764 | - YAHOO.admin.container.panelEditor.destroy(); | |
1765 | - YAHOO.admin.container.panelEditor = null; | |
1766 | - }}} | |
1767 | - ); | |
1768 | - } | |
1769 | - } | |
1770 | - YAHOO.admin.container.panelEditor = new YAHOO.widget.Panel("janela_editor", { fixedcenter:"contained",close:true,width:w, overflow:"auto",modal: modal,visible:false,constraintoviewport:true } ); | |
1771 | - YAHOO.admin.container.panelEditor.render(); | |
1772 | - } | |
1773 | - else | |
1774 | - { | |
1775 | - if($i("editor_bd")) | |
1776 | - {$i("editor_bd").innerHTML == "?";} | |
1777 | - } | |
1778 | - var fecha = function() | |
1779 | - { | |
1780 | - try{ | |
1781 | - YAHOO.admin.container.panelEditor.destroy(); | |
1782 | - YAHOO.admin.container.panelEditor = null; | |
1783 | - } | |
1784 | - catch(e){} | |
1785 | - try{ | |
1786 | - if(YAHOO.lang.isFunction(funcaoClose)){ | |
1787 | - funcaoClose.call(); | |
1788 | - } | |
1789 | - else if(funcaoClose != ""){ | |
1790 | - eval(funcaoClose+"()"); | |
1791 | - } | |
1792 | - } | |
1793 | - catch(e){}; | |
1794 | - }; | |
1795 | - YAHOO.util.Event.addListener(YAHOO.admin.container.panelEditor.close, "click", fecha); | |
1796 | - YAHOO.admin.container.panelEditor.show(); | |
1797 | - //registra a janela no gerenciador de janelas default da classe i3GEO.janela caso ela exista | |
1798 | - try{ | |
1799 | - YAHOO.i3GEO.janela.manager.register(YAHOO.admin.container.panelEditor); | |
1800 | - } | |
1801 | - catch(e){} | |
1802 | -} | |
1803 | -/* | |
1804 | -Function idiomaSel | |
1805 | - | |
1806 | -Retorna o idioma selecionado pesquisando no elemento select com id = "idioma" | |
1807 | - */ | |
1808 | -function idiomaSel(){ | |
1809 | - var idioma = "pt"; | |
1810 | - if($i("idioma")) | |
1811 | - {idioma = $i("idioma").value;} | |
1812 | - return idioma; | |
1813 | -} | |
1814 | -function core_abreCor(janela,elemento) | |
1815 | -{ | |
1816 | - if(i3GEO.configura == undefined ) | |
1817 | - {i3GEO.configura = {locaplic: "../.."};} | |
1818 | - i3GEO.util.abreCor("",elemento,"rgb"); | |
1819 | - $i("i3geo_janelaCori").style.width = "350px"; | |
1820 | - $i("i3geo_janelaCori").style.height = "290px"; | |
1821 | - //i3GEO.janela.cria("350px","250px","../../ferramentas/colorpicker/index.htm?doc=&elemento="+elemento+"&tipo=rgb","","","Cor","i3geo_janelaCor",true); | |
1822 | -} | |
1823 | -function core_desativaforms(lista){ | |
1824 | - var n = lista.length, | |
1825 | - i,t; | |
1826 | - for (i=0;i<n;i++){ | |
1827 | - t = $i(lista[i]); | |
1828 | - if(t){ | |
1829 | - //t.style.background = "pink"; | |
1830 | - t.disabled = true; | |
1831 | - } | |
1832 | - } | |
1833 | -} | |
1834 | -function core_ativaforms(lista){ | |
1835 | - var n = lista.length, | |
1836 | - i,t; | |
1837 | - for (i=0;i<n;i++){ | |
1838 | - t = $i(lista[i]); | |
1839 | - if(t){ | |
1840 | - //t.style.background = "white"; | |
1841 | - t.disabled = false; | |
1842 | - } | |
1843 | - } | |
1844 | -} | |
1845 | - | |
1846 | -function core_filtraLetrasCombo(id,letra){ | |
1847 | - if (letra == "Todos") { | |
1848 | - letra = ""; | |
1849 | - } | |
1850 | - i3GEO.util.insereCookie("I3GEOletraAdmin", letra); | |
1851 | - if($i("iniciaisLetras")){ | |
1852 | - $i("iniciaisLetras").value = letra; | |
1853 | - } | |
1854 | - var combo = $i(id), | |
1855 | - n, i, o, v; | |
1856 | - if(combo){ | |
1857 | - o = combo.options; | |
1858 | - n = o.length; | |
1859 | - letra = letra.toLowerCase(); | |
1860 | - for(i = 0; i < n; i++){ | |
1861 | - v = o[i].text.toLowerCase(); | |
1862 | - o[i].style.display = "block"; | |
1863 | - if(v.search(letra) < 0 && o[i].value != combo.value ){ | |
1864 | - o[i].style.display = "none"; | |
1865 | - } | |
1866 | - } | |
1867 | - } | |
1868 | -} | |
1869 | - | |
1870 | -function core_listaDeLetras(onde,nomeFuncao,semLetras,w){ | |
1871 | - //letraAtual guarda a ultima letra clicada | |
1872 | - if(!w){ | |
1873 | - w = 40; | |
1874 | - } | |
1875 | - var o,i,ins= "<p><b>", | |
1876 | - letras = ["Todos","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z","_","1","2","3","4","5","6","7","8","9"], | |
1877 | - nletras = letras.length; | |
1878 | - if(!i3GEO.util){ | |
1879 | - alert("Erro i3GEO.util ???"); | |
1880 | - return; | |
1881 | - } | |
1882 | - letraAtual = ""; | |
1883 | - if(i3GEO.util.pegaCookie("I3GEOletraAdmin")) { | |
1884 | - letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin"); | |
1885 | - } | |
1886 | - if(!semLetras){ | |
1887 | - for (i = 0; i < nletras; i++) { | |
1888 | - ins += "<span onclick='"+nomeFuncao+"(\"" | |
1889 | - + letras[i] | |
1890 | - + "\")' style='color:blue;cursor:pointer;padding:1px;border: 1px solid #C8C8FA'>" | |
1891 | - + letras[i] + "</span> "; | |
1892 | - } | |
1893 | - } | |
1894 | - else{ | |
1895 | - ins = ""; | |
1896 | - } | |
1897 | - if(onde && onde != ""){ | |
1898 | - o = document.getElementById(onde); | |
1899 | - if(o){ | |
1900 | - if(!semLetras){ | |
1901 | - o.innerHTML = "<fieldset style='padding:2px;margin-left: 0px;' class=letras ><form id=forminiciais ><p><b>Iniciais: <input name='' onchange='' value='"+letraAtual+"' id=iniciaisLetras type=text style=width:" + w + "px;cursor:pointer /></form><div style=position:relative;top:1px; id='_listaDeLetras' >"+ins+"</div></b></fieldset>"; | |
1902 | - } | |
1903 | - else{ | |
1904 | - o.innerHTML = "<form id=forminiciais >Iniciais: <input name='' onchange='' value='' id=iniciaisLetras type=text style=width:40px;cursor:pointer /></form>"; | |
1905 | - } | |
1906 | - if(document.getElementById("forminiciais")){ | |
1907 | - document.getElementById("forminiciais").onsubmit = function(){ | |
1908 | - var v = document.getElementById("iniciaisLetras").value; | |
1909 | - i3GEO.util.insereCookie("I3GEOletraAdmin", v); | |
1910 | - eval(nomeFuncao+"('"+v+"');"); | |
1911 | - return false; | |
1912 | - }; | |
1913 | - } | |
1914 | - if(!semLetras){ | |
1915 | - document.getElementById("_listaDeLetras").onclick = function(){ | |
1916 | - document.getElementById("iniciaisLetras").value = letraAtual; | |
1917 | - }; | |
1918 | - } | |
1919 | - } | |
1920 | - } | |
1921 | - else{ | |
1922 | - return ins; | |
1923 | - } | |
1924 | -} | |
1925 | -function core_parseMustacheBody (hashMustache){ | |
1926 | - var re = new RegExp("&", "g"), m; | |
1927 | - m = Mustache.render(document.body.innerHTML, i3GEO.idioma.objetoIdioma(hashMustache)); | |
1928 | - m = m.replace(re, '&'); | |
1929 | - document.body.innerHTML = m; | |
1930 | -} | |
277 | +} | |
1931 | 278 | \ No newline at end of file | ... | ... |
admin1/metaestat/regioes/index.js
... | ... | @@ -256,5 +256,8 @@ Obt&eacute;m a lista de regioes |
256 | 256 | //window.history.replaceState(null,null,u); |
257 | 257 | //abre a pagina de edicao |
258 | 258 | window.location.href = "hierarquia/index.php?codigo_tipo_regiao=" + codigo_tipo_regiao; |
259 | + }, | |
260 | + listaEsquemas: function(destino){ | |
261 | + i3GEOadmin.bdExplorer.listaEsquemas(destino); | |
259 | 262 | } |
260 | 263 | }; |
261 | 264 | \ No newline at end of file | ... | ... |
admin1/metaestat/regioes/index.php
... | ... | @@ -59,6 +59,7 @@ include("templates/templateFormLista.php"); |
59 | 59 | ?> |
60 | 60 | <script type="text/javascript" src="index.js"></script> |
61 | 61 | <script type="text/javascript" src="../../dicionario/estat_tipo_regiao.js"></script> |
62 | +<script type="text/javascript" src="../../js/bdexplorer.js"></script> | |
62 | 63 | <script> |
63 | 64 | $(document).ready(function(){ |
64 | 65 | //vem de admin1/index.js | ... | ... |
admin1/metaestat/regioes/templates/templateFormLista.php
... | ... | @@ -35,9 +35,15 @@ |
35 | 35 | <div class="form-group form-group-lg"> |
36 | 36 | <label class="col-md-5 control-label" for="esquemadb" >{{{esquemadbTxt}}}</label> |
37 | 37 | <div class="col-md-7"> |
38 | - <input title="{{{esquemadbTxt}}}" type="text" value="{{{esquemadb}}}" class="form-control" name="esquemadb" > | |
39 | - </div> | |
40 | - </div> | |
38 | + <div class="input-group"> | |
39 | + <input title="{{{esquemadbTxt}}}" type="text" value="{{{esquemadb}}}" class="form-control" name="esquemadb" > | |
40 | + <div class="input-group-btn"> | |
41 | + <a role="button" class="btn btn-danger btn-fab btn-fab-mini" style="height: 20px;min-width: 20px;width: 20px;" onclick="i3GEOadmin.regioes.listaEsquemas('esquemadb')" href="javascript:void(0)"> | |
42 | + <i class="material-icons md-18">list</i> | |
43 | + </a> | |
44 | + </div> | |
45 | + </div> | |
46 | + </div> | |
41 | 47 | </div> |
42 | 48 | </div> |
43 | 49 | <div class="row"> | ... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +<?php | |
2 | +/****************************************************************/ | |
3 | +////include (dirname ( __FILE__ ) . "/../../../ms_configura.php"); | |
4 | +// | |
5 | +//checa login | |
6 | +//valida _GET e _POST, juntando em _GET | |
7 | +//pega algumas variaveis de uso mais comum | |
8 | +//session_start | |
9 | +// | |
10 | +include ("checaLogin.php"); | |
11 | +\admin\php\login\checaLogin(); | |
12 | +//funcoes de administracao | |
13 | +include ($_SESSION["locaplic"]."/admin1/php/funcoesAdmin.php"); | |
14 | +// | |
15 | +//carrega outras funcoes e extensoes do PHP | |
16 | +// | |
17 | +include ($_SESSION["locaplic"]."/classesphp/carrega_ext.php"); | |
18 | +include ($_SESSION["locaplic"]."/classesphp/classe_bdexplorer.php"); | |
19 | +/***************************************************************/ | |
20 | +$funcao = strtoupper ( $funcao ); | |
21 | +switch ($funcao) { | |
22 | + case "LISTARESQUEMAS" : | |
23 | + $bd = new \i3geo\classesphp\bdexplorer\Bdexplorer($_SESSION["locaplic"]); | |
24 | + $dados = $bd->listaDeEsquemas(); | |
25 | + if ($dados === false) { | |
26 | + header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
27 | + } else { | |
28 | + \admin\php\funcoesAdmin\retornaJSON ( $dados ); | |
29 | + } | |
30 | + break; | |
31 | + default: | |
32 | + if(!empty ($funcao)) header ( "HTTP/1.1 500 erro funcao nao existe" ); | |
33 | + break; | |
34 | +} | |
35 | +?> | |
0 | 36 | \ No newline at end of file | ... | ... |
classesphp/classe_bdexplorer.php
ms_configura.php
... | ... | @@ -118,6 +118,22 @@ false |
118 | 118 | |
119 | 119 | */ |
120 | 120 | $logTransacoes = false; |
121 | +/* | |
122 | + Variale: $i3geoEsquemasWL | |
123 | + | |
124 | + Lista com nomes dos esquemas, nos bancos de dados acessiveis pelo sistema de administracao, que podem ser utilizados nas listagens de tabelas e colunas. | |
125 | + | |
126 | + O sistema de administracao do i3Geo possui formularios com campos que referem-se a objetos no banco de dados Postgres. | |
127 | + Essa variavel e uma lista branca, ou seja, permite o acesso apenas aos esquemas e seus objetos que constam na lista. | |
128 | + Essa lista nao impede o uso desses objetos, apenas evita que os mesmos sejam utilizados para gerar opcoes de selecao para o preenchimento dos formularios. | |
129 | + | |
130 | + O usuario dos formularios ainda poderao inserir manualmente os nomes dos objetos mesmo que os esquemas nao constem nessa lista. | |
131 | + | |
132 | + Tipo: | |
133 | + {array} | |
134 | +*/ | |
135 | +$i3geoEsquemasWL = array("public","i3geosaude"); | |
136 | + | |
121 | 137 | //TODO documentar moodle |
122 | 138 | /* |
123 | 139 | Variale: $logExec |
... | ... | @@ -134,7 +150,7 @@ $logExec = array( |
134 | 150 | "init" => false, //ms_criamapa mapa_inicia |
135 | 151 | "ogc" => false, //servico ogc |
136 | 152 | "upload" => false, //ferramentas de upload |
137 | - "ferramentas" => false, //todas asferramentas que usam safe.php | |
153 | + "ferramentas" => false, //todas as ferramentas que usam safe.php | |
138 | 154 | "controle" => false //tudo que passa por mapa_controle.php |
139 | 155 | ); |
140 | 156 | /* | ... | ... |