Commit a6c97bf6599a37a3ab1f3dae53c50d97f22bebfc

Authored by Edmar Moretti
1 parent dc1d7eec

Inclusão de uma árvore como forma de escolha de temas no publicador de aplicações (metaestat)

admin/js/core.js
... ... @@ -209,6 +209,61 @@ function cabecalhoGeral(id,excluir){
209 209 //temp.style.padding = "10px";
210 210 }
211 211 /*
  212 +Function: core_arvore
  213 +
  214 +Cria uma arvore com base em um objeto contendo as propriedades.
  215 +
  216 +No objeto com as propriedades, se "url" for igual a "", sera incluido o texto original definido em "text".
  217 +
  218 +Parametros:
  219 +
  220 +titulo - {String} cabecalho da arvore
  221 +
  222 +onde - {String} nome do id doelemento que contera a arvore
  223 +
  224 +obj - {Object} objeto contendo os parametros, exemplo
  225 +
  226 + g_listaPropriedades = {
  227 +
  228 + "propriedades": [
  229 +
  230 + { text: "p2", url: "javascript:tipoimagem()" }
  231 +
  232 + ]}
  233 +
  234 +*/
  235 +function core_arvore(titulo,onde,obj){
  236 + var arvore,root,tempNode,d,c,i,linha,conteudo,j,temaNode;
  237 + if(!$i(onde)){return;}
  238 + arvore = new YAHOO.widget.TreeView(onde);
  239 + root = arvore.getRoot();
  240 + try{
  241 + tempNode = new YAHOO.widget.TextNode('', root, false);
  242 + tempNode.isLeaf = false;
  243 + tempNode.enableHighlight = false;
  244 + }
  245 + catch(e){
  246 + if(typeof(console) !== 'undefined'){console.error(e);}
  247 + }
  248 + titulo = "<table><tr><td><b>"+titulo+"</b></td><td></td></tr></table>";
  249 + d = {html:titulo};
  250 + tempNode = new YAHOO.widget.HTMLNode(d, root, true,true);
  251 + tempNode.enableHighlight = false;
  252 + c = obj.propriedades.length;
  253 + for (i=0, j=c; i<j; i++){
  254 + linha = obj.propriedades[i];
  255 + if(linha.url !== "")
  256 + {conteudo = "<a href='#' onclick='"+linha.url+"'>"+linha.text+"</a>";}
  257 + else
  258 + {conteudo = linha.text;}
  259 + d = {html:conteudo};
  260 + temaNode = new YAHOO.widget.HTMLNode(d, tempNode, false,true);
  261 + temaNode.enableHighlight = false;
  262 + }
  263 + arvore.collapseAll();
  264 + arvore.draw();
  265 +}
  266 +/*
212 267 Function: core_movimentaNo
213 268  
214 269 Movimenta um nó para cima ou para baixo na &aacute;rvore.
... ... @@ -413,17 +468,17 @@ function core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho)
413 468 YAHOO.namespace("continua.container");
414 469 YAHOO.continua.container.simpledialog1 =
415 470 new YAHOO.widget.SimpleDialog("simpledialog1",
416   - { width: largura+"px",
417   - fixedcenter: true,
418   - visible: false,
419   - draggable: false,
420   - close: true,
421   - text: mensagem,
422   - icon: YAHOO.widget.SimpleDialog.ICON_HELP,
423   - modal: true,
424   - constraintoviewport: true,
425   - buttons: [ { text:"Sim", handler:handleYes, isDefault:true },
426   - { text:"N&atilde;o", handler:handleNo } ]
  471 + { width: largura+"px",
  472 + fixedcenter: true,
  473 + visible: false,
  474 + draggable: false,
  475 + close: true,
  476 + text: mensagem,
  477 + icon: YAHOO.widget.SimpleDialog.ICON_HELP,
  478 + modal: true,
  479 + constraintoviewport: true,
  480 + buttons: [ { text:"Sim", handler:handleYes, isDefault:true },
  481 + { text:"N&atilde;o", handler:handleNo } ]
427 482 } );
428 483 YAHOO.continua.container.simpledialog1.setHeader(cabecalho);
429 484 YAHOO.continua.container.simpledialog1.render(document.body);
... ... @@ -450,17 +505,17 @@ function core_dialogoPergunta(handleYes,handleNo,mensagem,largura)
450 505 YAHOO.namespace("continua.container");
451 506 YAHOO.continua.container.simpledialog1 =
452 507 new YAHOO.widget.SimpleDialog("simpledialog1",
453   - { width: largura+"px",
454   - fixedcenter: true,
455   - visible: false,
456   - draggable: false,
457   - close: true,
458   - text: mensagem,
459   - icon: "",
460   - modal: true,
461   - constraintoviewport: true,
462   - buttons: [ { text:"Continua", handler:handleYes, isDefault:true },
463   - { text:"Cancela", handler:handleNo } ]
  508 + { width: largura+"px",
  509 + fixedcenter: true,
  510 + visible: false,
  511 + draggable: false,
  512 + close: true,
  513 + text: mensagem,
  514 + icon: "",
  515 + modal: true,
  516 + constraintoviewport: true,
  517 + buttons: [ { text:"Continua", handler:handleYes, isDefault:true },
  518 + { text:"Cancela", handler:handleNo } ]
464 519 } );
465 520 //YAHOO.continua.container.simpledialog1.setHeader("Tem certeza?");
466 521 YAHOO.continua.container.simpledialog1.render(document.body);
... ... @@ -526,21 +581,21 @@ function core_pegaPerfis(funcao)
526 581 var sUrl = "../php/menutemas.php?funcao=pegaPerfis";
527 582 var callback =
528 583 {
529   - success:function(o)
530   - {
531   - try
532   - {
533   - $perfis = YAHOO.lang.JSON.parse(o.responseText);
534   - $perfisArray = new Array();
535   - for (var i=0;i<$perfis.length;i++)
536   - {$perfisArray.push($perfis[i].perfil);}
537   - if(funcao != "")
538   - eval(funcao);
539   - }
540   - catch(e){core_handleFailure(o,o.responseText);}
541   - },
542   - failure:core_handleFailure,
543   - argument: { foo:"foo", bar:"bar" }
  584 + success:function(o)
  585 + {
  586 + try
  587 + {
  588 + $perfis = YAHOO.lang.JSON.parse(o.responseText);
  589 + $perfisArray = new Array();
  590 + for (var i=0;i<$perfis.length;i++)
  591 + {$perfisArray.push($perfis[i].perfil);}
  592 + if(funcao != "")
  593 + eval(funcao);
  594 + }
  595 + catch(e){core_handleFailure(o,o.responseText);}
  596 + },
  597 + failure:core_handleFailure,
  598 + argument: { foo:"foo", bar:"bar" }
544 599 };
545 600 core_makeRequest(sUrl,callback);
546 601 }
... ... @@ -576,18 +631,18 @@ function core_pegaMapfiles(funcaoM,letra,filtro)
576 631 var sUrl = "../php/menutemas.php?funcao=listaMapsTemas&letra="+letra+"&filtro="+filtro;
577 632 var callbackM =
578 633 {
579   - success:function(o)
580   - {
581   - try
582   - {
583   - $mapfiles = YAHOO.lang.JSON.parse(o.responseText);
584   - if(funcaoM != "")
585   - eval(funcaoM);
586   - }
587   - catch(e){core_handleFailure(o,o.responseText);}
588   - },
589   - failure:core_handleFailure,
590   - argument: { foo:"foo", bar:"bar" }
  634 + success:function(o)
  635 + {
  636 + try
  637 + {
  638 + $mapfiles = YAHOO.lang.JSON.parse(o.responseText);
  639 + if(funcaoM != "")
  640 + eval(funcaoM);
  641 + }
  642 + catch(e){core_handleFailure(o,o.responseText);}
  643 + },
  644 + failure:core_handleFailure,
  645 + argument: { foo:"foo", bar:"bar" }
591 646 };
592 647 core_makeRequest(sUrl,callbackM);
593 648 }
... ... @@ -683,11 +738,11 @@ function core_comboPranchas(onde,id,marcar,funcao,id_atlas)
683 738 var sUrl = "../php/atlas.php?funcao=pegaPranchas&id_atlas="+id_atlas;
684 739 var callback =
685 740 {
686   - success:function(o)
687   - {
688   - try
689   - {
690   - var valores = YAHOO.lang.JSON.parse(o.responseText);
  741 + success:function(o)
  742 + {
  743 + try
  744 + {
  745 + var valores = YAHOO.lang.JSON.parse(o.responseText);
691 746 if(arguments.length == 3)
692 747 {funcao = "";}
693 748 if (funcao != "")
... ... @@ -696,11 +751,11 @@ function core_comboPranchas(onde,id,marcar,funcao,id_atlas)
696 751 ins += core_comboObjeto(valores,"id_prancha","titulo_prancha",marcar);
697 752 ins += "</select></p>";
698 753 $i(onde).innerHTML = ins;
699   - }
700   - catch(e){core_handleFailure(e,o.responseText);}
701   - },
702   - failure:core_handleFailure,
703   - argument: { foo:"foo", bar:"bar" }
  754 + }
  755 + catch(e){core_handleFailure(e,o.responseText);}
  756 + },
  757 + failure:core_handleFailure,
  758 + argument: { foo:"foo", bar:"bar" }
704 759 };
705 760 core_makeRequest(sUrl,callback);
706 761 }
... ... @@ -726,11 +781,11 @@ function core_comboGrupos(onde,id,marcar,funcao)
726 781 var sUrl = "../php/menutemas.php?funcao=pegaGrupos";
727 782 var callback =
728 783 {
729   - success:function(o)
730   - {
731   - try
732   - {
733   - var valores = YAHOO.lang.JSON.parse(o.responseText);
  784 + success:function(o)
  785 + {
  786 + try
  787 + {
  788 + var valores = YAHOO.lang.JSON.parse(o.responseText);
734 789 if(arguments.length == 3)
735 790 {funcao = "";}
736 791 if (funcao != "")
... ... @@ -739,11 +794,11 @@ function core_comboGrupos(onde,id,marcar,funcao)
739 794 ins += core_comboObjeto(valores,"id_grupo","nome_grupo",marcar);
740 795 ins += "</select></p>";
741 796 $i(onde).innerHTML = ins;
742   - }
743   - catch(e){core_handleFailure(e,o.responseText);}
744   - },
745   - failure:core_handleFailure,
746   - argument: { foo:"foo", bar:"bar" }
  797 + }
  798 + catch(e){core_handleFailure(e,o.responseText);}
  799 + },
  800 + failure:core_handleFailure,
  801 + argument: { foo:"foo", bar:"bar" }
747 802 };
748 803 core_makeRequest(sUrl,callback);
749 804 }
... ... @@ -769,11 +824,11 @@ function core_comboSubGrupos(onde,id,marcar,funcao)
769 824 var sUrl = "../php/menutemas.php?funcao=pegaSubGrupos";
770 825 var callback =
771 826 {
772   - success:function(o)
773   - {
774   - try
775   - {
776   - var valores = YAHOO.lang.JSON.parse(o.responseText);
  827 + success:function(o)
  828 + {
  829 + try
  830 + {
  831 + var valores = YAHOO.lang.JSON.parse(o.responseText);
777 832 if(arguments.length == 3)
778 833 {funcao = "";}
779 834 if (funcao != "")
... ... @@ -782,11 +837,11 @@ function core_comboSubGrupos(onde,id,marcar,funcao)
782 837 ins += core_comboObjeto(valores,"id_subgrupo","nome_subgrupo",marcar);
783 838 ins += "</select></p>";
784 839 $i(onde).innerHTML = ins;
785   - }
786   - catch(e){core_handleFailure(e,o.responseText);}
787   - },
788   - failure:core_handleFailure,
789   - argument: { foo:"foo", bar:"bar" }
  840 + }
  841 + catch(e){core_handleFailure(e,o.responseText);}
  842 + },
  843 + failure:core_handleFailure,
  844 + argument: { foo:"foo", bar:"bar" }
790 845 };
791 846 core_makeRequest(sUrl,callback);
792 847 }
... ... @@ -812,11 +867,11 @@ function core_comboTemas(onde,id,marcar,funcao)
812 867 var sUrl = "../php/menutemas.php?funcao=pegaTemas2";
813 868 var callback =
814 869 {
815   - success:function(o)
816   - {
817   - try
818   - {
819   - var valores = YAHOO.lang.JSON.parse(o.responseText);
  870 + success:function(o)
  871 + {
  872 + try
  873 + {
  874 + var valores = YAHOO.lang.JSON.parse(o.responseText);
820 875 if(arguments.length == 3)
821 876 {funcao = "";}
822 877 if (funcao != "")
... ... @@ -825,11 +880,11 @@ function core_comboTemas(onde,id,marcar,funcao)
825 880 ins += core_comboObjeto(valores,"id_tema","nome_tema",marcar,"codigo_tema");
826 881 ins += "</select></p>";
827 882 $i(onde).innerHTML = ins;
828   - }
829   - catch(e){core_handleFailure(e,o.responseText);}
830   - },
831   - failure:core_handleFailure,
832   - argument: { foo:"foo", bar:"bar" }
  883 + }
  884 + catch(e){core_handleFailure(e,o.responseText);}
  885 + },
  886 + failure:core_handleFailure,
  887 + argument: { foo:"foo", bar:"bar" }
833 888 };
834 889 core_makeRequest(sUrl,callback);
835 890 }
... ... @@ -852,19 +907,19 @@ function core_pegaTags(funcao)
852 907 var sUrl = "../php/menutemas.php?funcao=pegaTags";
853 908 var callback =
854 909 {
855   - success:function(o)
856   - {
857   - try
858   - {
859   - $tags = YAHOO.lang.JSON.parse(o.responseText);
860   - if($tags == ""){$tags = " ";}
861   - if(funcao != "")
862   - eval(funcao);
863   - }
864   - catch(e){core_handleFailure(e,o.responseText);}
865   - },
866   - failure:core_handleFailure,
867   - argument: { foo:"foo", bar:"bar" }
  910 + success:function(o)
  911 + {
  912 + try
  913 + {
  914 + $tags = YAHOO.lang.JSON.parse(o.responseText);
  915 + if($tags == ""){$tags = " ";}
  916 + if(funcao != "")
  917 + eval(funcao);
  918 + }
  919 + catch(e){core_handleFailure(e,o.responseText);}
  920 + },
  921 + failure:core_handleFailure,
  922 + argument: { foo:"foo", bar:"bar" }
868 923 };
869 924 core_makeRequest(sUrl,callback);
870 925 }
... ... @@ -1144,25 +1199,25 @@ function core_ativaBotaoAdicionaLinha(sUrl,idBotao,nomeFuncao)
1144 1199 core_carregando(" adicionando um novo registro");
1145 1200 var callback =
1146 1201 {
1147   - success:function(o)
1148   - {
1149   - var texto = "";
  1202 + success:function(o)
  1203 + {
  1204 + var texto = "";
1150 1205 try
1151   - {
1152   - core_carregando("desativa");
1153   - if(nomeFuncao != "")
1154   - {eval(nomeFuncao+"()");}
1155   - else{
  1206 + {
  1207 + core_carregando("desativa");
  1208 + if(nomeFuncao != "")
  1209 + {eval(nomeFuncao+"()");}
  1210 + else{
1156 1211 texto = YAHOO.lang.JSON.parse(o.responseText)[0];
1157 1212 if(texto === "")
1158 1213 {texto = "Clique para editar";}
1159 1214 myDataTable.addRow(texto,0);
1160 1215 }
1161   - }
1162   - catch(e){core_handleFailure(e,o.responseText);}
1163   - },
1164   - failure:core_handleFailure,
1165   - argument: { foo:"foo", bar:"bar" }
  1216 + }
  1217 + catch(e){core_handleFailure(e,o.responseText);}
  1218 + },
  1219 + failure:core_handleFailure,
  1220 + argument: { foo:"foo", bar:"bar" }
1166 1221 };
1167 1222 core_makeRequest(sUrl,callback);
1168 1223 };
... ... @@ -1188,23 +1243,23 @@ function core_pegaDados(mensagem,sUrl,funcaoRetorno)
1188 1243 core_carregando(mensagem);
1189 1244 var callback =
1190 1245 {
1191   - success:function(o)
1192   - {
1193   - try
1194   - {
1195   - if(funcaoRetorno != "")
1196   - {eval(funcaoRetorno+"(YAHOO.lang.JSON.parse(o.responseText))");}
1197   - core_carregando("desativa");
1198   - }
1199   - catch(e)
1200   - {
1201   - if("mensagem" != "")
1202   - {core_carregando("desativa");}
1203   - core_handleFailure(o,o.responseText);
1204   - }
1205   - },
1206   - failure:core_handleFailure,
1207   - argument: { foo:"foo", bar:"bar" }
  1246 + success:function(o)
  1247 + {
  1248 + try
  1249 + {
  1250 + if(funcaoRetorno != "")
  1251 + {eval(funcaoRetorno+"(YAHOO.lang.JSON.parse(o.responseText))");}
  1252 + core_carregando("desativa");
  1253 + }
  1254 + catch(e)
  1255 + {
  1256 + if("mensagem" != "")
  1257 + {core_carregando("desativa");}
  1258 + core_handleFailure(o,o.responseText);
  1259 + }
  1260 + },
  1261 + failure:core_handleFailure,
  1262 + argument: { foo:"foo", bar:"bar" }
1208 1263 };
1209 1264 core_makeRequest(sUrl,callback);
1210 1265 }
... ... @@ -1233,8 +1288,8 @@ function core_gravaLinha(mensagem,row,sUrl,nomeFuncao)
1233 1288 nomeFuncao = "";
1234 1289 var callback =
1235 1290 {
1236   - success:function(o)
1237   - {
  1291 + success:function(o)
  1292 + {
1238 1293 core_carregando("desativa");
1239 1294 var rec = myDataTable.getRecordSet().getRecord(row);
1240 1295 var linha = myDataTable.getTrEl(rec);
... ... @@ -1248,12 +1303,12 @@ function core_gravaLinha(mensagem,row,sUrl,nomeFuncao)
1248 1303 else
1249 1304 {
1250 1305 myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]);
1251   - }
  1306 + }
1252 1307 linha.style.color = "";
1253 1308 linha.style.textDecoration = "none";
1254   - },
1255   - failure:core_handleFailure,
1256   - argument: { foo:"foo", bar:"bar" }
  1309 + },
  1310 + failure:core_handleFailure,
  1311 + argument: { foo:"foo", bar:"bar" }
1257 1312 };
1258 1313 core_makeRequest(sUrl,callback);
1259 1314 }
... ... @@ -1286,30 +1341,30 @@ function core_excluiLinha(sUrl,row,mensagem,cabecalho,tabela)
1286 1341 core_carregando(mensagem);
1287 1342 var callback =
1288 1343 {
1289   - success:function(o)
1290   - {
1291   - try
1292   - {
1293   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
1294   - {
1295   - core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel excluir. Verifique se n&atilde;o existem outras tabelas com registros vinculados a este</span>");
1296   - setTimeout("core_carregando('desativa')",3000);
1297   - }
1298   - else
1299   - {
1300   - if(tabela){
1301   - tabela.deleteRow(row);
1302   - }
1303   - else{
1304   - myDataTable.deleteRow(row);
1305   - }
1306   - core_carregando("desativa");
1307   - }
1308   - }
1309   - catch(e){core_handleFailure(o,o.responseText);}
1310   - },
1311   - failure:core_handleFailure,
1312   - argument: { foo:"foo", bar:"bar" }
  1344 + success:function(o)
  1345 + {
  1346 + try
  1347 + {
  1348 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  1349 + {
  1350 + core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel excluir. Verifique se n&atilde;o existem outras tabelas com registros vinculados a este</span>");
  1351 + setTimeout("core_carregando('desativa')",3000);
  1352 + }
  1353 + else
  1354 + {
  1355 + if(tabela){
  1356 + tabela.deleteRow(row);
  1357 + }
  1358 + else{
  1359 + myDataTable.deleteRow(row);
  1360 + }
  1361 + core_carregando("desativa");
  1362 + }
  1363 + }
  1364 + catch(e){core_handleFailure(o,o.responseText);}
  1365 + },
  1366 + failure:core_handleFailure,
  1367 + argument: { foo:"foo", bar:"bar" }
1313 1368 };
1314 1369 core_makeRequest(sUrl,callback);
1315 1370 };
... ... @@ -1349,28 +1404,28 @@ function core_excluiNoTree(sUrl,no,mensagem,cabecalho)
1349 1404 core_carregando(mensagem);
1350 1405 var callback =
1351 1406 {
1352   - success:function(o)
1353   - {
1354   - try
1355   - {
1356   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
1357   - {
1358   - core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel excluir. Verifique se n&atilde;o existem outras tabelas com registros vinculados a este</span>");
1359   - setTimeout("core_carregando('desativa')",3000);
1360   - }
1361   - else
1362   - {
  1407 + success:function(o)
  1408 + {
  1409 + try
  1410 + {
  1411 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  1412 + {
  1413 + core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel excluir. Verifique se n&atilde;o existem outras tabelas com registros vinculados a este</span>");
  1414 + setTimeout("core_carregando('desativa')",3000);
  1415 + }
  1416 + else
  1417 + {
1363 1418 if(no){
1364 1419 tree.removeNode(no);
1365 1420 tree.draw();
1366   - }
  1421 + }
1367 1422 core_carregando("desativa");
1368   - }
1369   - }
1370   - catch(e){core_handleFailure(o,o.responseText);}
1371   - },
1372   - failure:core_handleFailure,
1373   - argument: { foo:"foo", bar:"bar" }
  1423 + }
  1424 + }
  1425 + catch(e){core_handleFailure(o,o.responseText);}
  1426 + },
  1427 + failure:core_handleFailure,
  1428 + argument: { foo:"foo", bar:"bar" }
1374 1429 };
1375 1430 core_makeRequest(sUrl,callback);
1376 1431 };
... ...
admin/js/estat_mapa.js
... ... @@ -46,19 +46,19 @@ function ativaBotaoAdiciona(sUrl,idBotao)
46 46 core_carregando(" adicionando um novo registro");
47 47 var callback =
48 48 {
49   - success:function(o)
50   - {
51   - try
52   - {
53   - var j = YAHOO.lang.JSON.parse(o.responseText);
  49 + success:function(o)
  50 + {
  51 + try
  52 + {
  53 + var j = YAHOO.lang.JSON.parse(o.responseText);
54 54 adicionaNosMapa([j],true);
55 55 editar("mapa",j.id_mapa);
56   - core_carregando("desativa");
57   - }
58   - catch(e){core_handleFailure(e,o.responseText);}
59   - },
60   - failure:core_handleFailure,
61   - argument: { foo:"foo", bar:"bar" }
  56 + core_carregando("desativa");
  57 + }
  58 + catch(e){core_handleFailure(e,o.responseText);}
  59 + },
  60 + failure:core_handleFailure,
  61 + argument: { foo:"foo", bar:"bar" }
62 62 };
63 63 core_makeRequest(sUrl,callback);
64 64 };
... ... @@ -125,8 +125,8 @@ function montaArvore(dados)
125 125 }
126 126 buildTree();
127 127 }();
128   - adicionaNosMapa(dados);
129   - tree.draw();
  128 + adicionaNosMapa(dados);
  129 + tree.draw();
130 130 }
131 131 function testarMapfile(codigoMap)
132 132 {
... ... @@ -290,14 +290,35 @@ function editar(tipo,id)
290 290 if(sUrl)
291 291 {core_makeRequest(sUrl,callback);}
292 292 }
293   -function montaDivTema(i)
294   -{
295   - var sUrl = "../php/metaestat.php?funcao=relatorioCompleto&dadosGerenciais=nao&detalhes=nao",
  293 +function montaDivTema(i){
  294 + var sUrl = "../php/metaestat.php?funcao=arvoreVar&dadosGerenciais=nao&detalhes=nao",
296 295 ins = "",
297 296 callback = {
298 297 success:function(o){
299   - ins += "<br><div>"+YAHOO.lang.JSON.parse(o.responseText)+"</div>";
  298 + var o = YAHOO.lang.JSON.parse(o.responseText),
  299 + n = o.length,
  300 + m,i,j,filhos,a,b;
  301 + //monta os divs onde entrarao as arvores
  302 + for(i=0;i<n;i++){
  303 + ins += "<div id=arvore_"+i+" >"+o[i].titulo+"</div>";
  304 + }
300 305 $i("editor_bd").innerHTML = ins;
  306 + //monta as arvores
  307 + for(i=0;i<n;i++){
  308 + a = [];
  309 + filhos = o[i].filhos;
  310 + m = filhos.length;
  311 + for(j=0;j<m;j++){
  312 + b = {};
  313 + b.text = filhos[j].titulo;
  314 + b.url = 'javascript:$i(\"Eid_medida_variavel\").value=\"'+filhos[j].id+'\"';
  315 + a.push(b);
  316 + }
  317 + core_arvore(o[i].titulo,"arvore_"+i,{"propriedades":a})
  318 +
  319 + }
  320 + //ins += "<br><div>"+YAHOO.lang.JSON.parse(o.responseText)+"</div>";
  321 + //$i("editor_bd").innerHTML = ins;
301 322 },
302 323 failure: function(){return ins;},
303 324 argument: { foo:"foo", bar:"bar" }
... ... @@ -305,7 +326,7 @@ function montaDivTema(i)
305 326 param = {
306 327 "linhas":[
307 328 {titulo:"T&iacute;tulo:",id:"Etitulo",size:"50",value:i.titulo,tipo:"text",div:""},
308   - {titulo:"ID da medida de uma vari&aacute;vel (veja em ID no relat&oacute;rio abaixo):",id:"Eid_medida_variavel",size:"50",value:i.id_medida_variavel,tipo:"text",div:""}
  329 + {titulo:"ID da medida de uma vari&aacute;vel (clique nos links abaixo para escolher):",id:"Eid_medida_variavel",size:"50",value:i.id_medida_variavel,tipo:"text",div:""}
309 330 ]
310 331 };
311 332 ins += core_geraLinhas(param);
... ... @@ -433,8 +454,8 @@ function adicionarTema(id)
433 454 adicionaNosTemas(no,[dados],true);
434 455 editar('tema',dados.id_mapa_tema);
435 456 },
436   - failure:core_handleFailure,
437   - argument: { foo:"foo", bar:"bar" }
  457 + failure:core_handleFailure,
  458 + argument: { foo:"foo", bar:"bar" }
438 459 };
439 460 core_makeRequest(sUrl,callback);
440 461 }
... ... @@ -450,8 +471,8 @@ function adicionarGrupo(id_mapa)
450 471 adicionaNosGrupos(no,[dados],true);
451 472 editar('grupo',dados.id_mapa_grupo);
452 473 },
453   - failure:core_handleFailure,
454   - argument: { foo:"foo", bar:"bar" }
  474 + failure:core_handleFailure,
  475 + argument: { foo:"foo", bar:"bar" }
455 476 };
456 477 core_makeRequest(sUrl,callback);
457 478 }
... ... @@ -494,47 +515,47 @@ function gravaDados(tipo,id)
494 515  
495 516 var callback =
496 517 {
497   - success:function(o)
498   - {
499   - try
500   - {
501   - if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
502   - {
503   - core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel excluir. Verifique se n&atilde;o existem menus vinculados a este tema</span>");
504   - setTimeout("core_carregando('desativa')",3000);
505   - }
506   - else
507   - {
508   - if(tipo == "mapa")
509   - {
510   - var no = tree.getNodeByProperty("id_mapa",id);
511   - no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo").value;
  518 + success:function(o)
  519 + {
  520 + try
  521 + {
  522 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  523 + {
  524 + core_carregando("<span style=color:red >N&atilde;o foi poss&iacute;vel excluir. Verifique se n&atilde;o existem menus vinculados a este tema</span>");
  525 + setTimeout("core_carregando('desativa')",3000);
  526 + }
  527 + else
  528 + {
  529 + if(tipo == "mapa")
  530 + {
  531 + var no = tree.getNodeByProperty("id_mapa",id);
  532 + no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo").value;
512 533 no.getContentEl().getElementsByTagName("span")[0].style.color = "";
513   - no.html = no.getContentEl().innerHTML;
514   - }
515   - if(tipo == "grupo")
516   - {
517   - var no = tree.getNodeByProperty("id_mapa_grupo",id);
518   - no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo").value;
  534 + no.html = no.getContentEl().innerHTML;
  535 + }
  536 + if(tipo == "grupo")
  537 + {
  538 + var no = tree.getNodeByProperty("id_mapa_grupo",id);
  539 + no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo").value;
519 540 no.getContentEl().getElementsByTagName("span")[0].style.color = "";
520   - no.html = no.getContentEl().innerHTML;
521   - }
522   - if(tipo == "tema")
523   - {
524   - var no = tree.getNodeByProperty("id_mapa_tema",id);
525   - no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo").value;
  541 + no.html = no.getContentEl().innerHTML;
  542 + }
  543 + if(tipo == "tema")
  544 + {
  545 + var no = tree.getNodeByProperty("id_mapa_tema",id);
  546 + no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo").value;
526 547 no.getContentEl().getElementsByTagName("span")[0].style.color = "";
527   - no.html = no.getContentEl().innerHTML;
528   - }
529   - core_carregando("desativa");
530   - }
  548 + no.html = no.getContentEl().innerHTML;
  549 + }
  550 + core_carregando("desativa");
  551 + }
531 552 YAHOO.admin.container.panelEditor.destroy();
532 553 YAHOO.admin.container.panelEditor = null;
533   - }
534   - catch(e){core_handleFailure(e,o.responseText);}
535   - },
536   - failure:core_handleFailure,
537   - argument: { foo:"foo", bar:"bar" }
  554 + }
  555 + catch(e){core_handleFailure(e,o.responseText);}
  556 + },
  557 + failure:core_handleFailure,
  558 + argument: { foo:"foo", bar:"bar" }
538 559 };
539 560 if(prog && par){
540 561 core_carregando("ativa");
... ...
admin/php/metaestat.php
... ... @@ -118,7 +118,7 @@ switch (strtoupper($funcao))
118 118 exit;
119 119 break;
120 120 /*
121   - Valor: LISTAVARIAVEL
  121 + Valor: LISTAVARIAVEL
122 122  
123 123 Lista de variaveis
124 124  
... ... @@ -154,7 +154,7 @@ switch (strtoupper($funcao))
154 154 exit;
155 155 break;
156 156 /*
157   - Valor: LISTACLASSECLASSIFICACAO
  157 + Valor: LISTACLASSECLASSIFICACAO
158 158  
159 159 Lista as classes de uma classificacoes
160 160  
... ... @@ -168,7 +168,7 @@ switch (strtoupper($funcao))
168 168 exit;
169 169 break;
170 170 /*
171   - Valor: LISTAMEDIDAVARIAVEL
  171 + Valor: LISTAMEDIDAVARIAVEL
172 172  
173 173 Lista das medidas de uma variavel
174 174  
... ... @@ -182,7 +182,7 @@ switch (strtoupper($funcao))
182 182 exit;
183 183 break;
184 184 /*
185   - Valor: LISTAPARAMETRO
  185 + Valor: LISTAPARAMETRO
186 186  
187 187 Lista de parametros
188 188  
... ... @@ -201,7 +201,7 @@ switch (strtoupper($funcao))
201 201 exit;
202 202 break;
203 203 /*
204   - Valor: LISTAUNIDADEMEDIDA
  204 + Valor: LISTAUNIDADEMEDIDA
205 205  
206 206 Lista de unidades de medida
207 207  
... ... @@ -225,7 +225,7 @@ switch (strtoupper($funcao))
225 225 exit;
226 226 break;
227 227 /*
228   - Valor: LISTATIPOPERIODO
  228 + Valor: LISTATIPOPERIODO
229 229  
230 230 Lista de unidades de medida
231 231  
... ... @@ -239,7 +239,7 @@ switch (strtoupper($funcao))
239 239 exit;
240 240 break;
241 241 /*
242   - Valor: LISTATIPOREGIAO
  242 + Valor: LISTATIPOREGIAO
243 243  
244 244 Lista de tipos de regiao
245 245  
... ... @@ -340,7 +340,7 @@ switch (strtoupper($funcao))
340 340 exit;
341 341 break;
342 342 /*
343   - Valor: ALTERAMEDIDAVARIAVEL
  343 + Valor: ALTERAMEDIDAVARIAVEL
344 344  
345 345 Altera os dados de uma medida de uma variavel
346 346  
... ... @@ -401,7 +401,7 @@ switch (strtoupper($funcao))
401 401 exit;
402 402 break;
403 403 /*
404   - Valor: ALTERAPARAMETROMEDIDA
  404 + Valor: ALTERAPARAMETROMEDIDA
405 405  
406 406 Altera os dados de uma parametro de uma medida
407 407  
... ... @@ -422,7 +422,7 @@ switch (strtoupper($funcao))
422 422 exit;
423 423 break;
424 424 /*
425   - Valor: ALTERACLASSIFICACAOMEDIDA
  425 + Valor: ALTERACLASSIFICACAOMEDIDA
426 426  
427 427 Altera os dados de uma classificacao de uma medida
428 428  
... ... @@ -540,7 +540,7 @@ switch (strtoupper($funcao))
540 540 exit;
541 541 break;
542 542 /*
543   - Valor: ALTERACLASSECLASSIFICACAO
  543 + Valor: ALTERACLASSECLASSIFICACAO
544 544  
545 545 Altera os dados de uma classe de uma classificacao
546 546  
... ... @@ -592,7 +592,7 @@ switch (strtoupper($funcao))
592 592 exit;
593 593 break;
594 594 /*
595   - Valor: ALTERARUNIDADEMEDIDA
  595 + Valor: ALTERARUNIDADEMEDIDA
596 596  
597 597 Altera a tabela de unidades de medida
598 598  
... ... @@ -612,7 +612,7 @@ switch (strtoupper($funcao))
612 612 exit;
613 613 break;
614 614 /*
615   - Valor: ALTERARCONEXAO
  615 + Valor: ALTERARCONEXAO
616 616  
617 617 Altera a tabela de conexoes
618 618  
... ... @@ -632,7 +632,7 @@ switch (strtoupper($funcao))
632 632 exit;
633 633 break;
634 634 /*
635   - Valor: ALTERARTIPOREGIAO
  635 + Valor: ALTERARTIPOREGIAO
636 636  
637 637 Altera a tabela de regioes
638 638  
... ... @@ -664,7 +664,7 @@ switch (strtoupper($funcao))
664 664 exit;
665 665 break;
666 666 /*
667   - Valor: ALTERARTIPOPERIODO
  667 + Valor: ALTERARTIPOPERIODO
668 668  
669 669 Altera a tabela de tipos de periodo
670 670  
... ... @@ -687,7 +687,7 @@ switch (strtoupper($funcao))
687 687 exit;
688 688 break;
689 689 /*
690   - Valor: ALTERAMAPA
  690 + Valor: ALTERAMAPA
691 691  
692 692 Altera a tabela de mapas para publicacao
693 693  
... ... @@ -707,7 +707,7 @@ switch (strtoupper($funcao))
707 707 exit;
708 708 break;
709 709 /*
710   - Valor: ALTERAMAPAGRUPO
  710 + Valor: ALTERAMAPAGRUPO
711 711  
712 712 Altera a tabela de grupos para publicacao
713 713  
... ... @@ -738,7 +738,7 @@ switch (strtoupper($funcao))
738 738 exit;
739 739 break;
740 740 /*
741   - Valor: EXCLUIRMAPA
  741 + Valor: EXCLUIRMAPA
742 742  
743 743 Exclui um mapa do publicador
744 744  
... ... @@ -800,7 +800,7 @@ switch (strtoupper($funcao))
800 800 exit;
801 801 break;
802 802 /*
803   - Valor: EXCLUIRTIPOPERIODO
  803 + Valor: EXCLUIRTIPOPERIODO
804 804  
805 805 Exclui uma variavel
806 806  
... ... @@ -832,7 +832,7 @@ switch (strtoupper($funcao))
832 832 exit;
833 833 break;
834 834 /*
835   - Valor: EXCLUIRUNIDADEMEDIDA
  835 + Valor: EXCLUIRUNIDADEMEDIDA
836 836  
837 837 Exclui uma unidade de medida"Dados inseridos"
838 838  
... ... @@ -900,7 +900,7 @@ switch (strtoupper($funcao))
900 900 exit;
901 901 break;
902 902 /*
903   - Valor: EXCLUIRTIPOREGIAO
  903 + Valor: EXCLUIRTIPOREGIAO
904 904  
905 905 Exclui uma regiao
906 906  
... ... @@ -928,7 +928,7 @@ switch (strtoupper($funcao))
928 928 exit;
929 929 break;
930 930 /*
931   - Valor: EXCLUIRMEDIDAVARIAVEL
  931 + Valor: EXCLUIRMEDIDAVARIAVEL
932 932  
933 933 Exclui uma medida da variavel
934 934  
... ... @@ -971,7 +971,7 @@ switch (strtoupper($funcao))
971 971 exit;
972 972 break;
973 973 /*
974   - Valor: EXCLUIRCLASSIFICACAOMEDIDA
  974 + Valor: EXCLUIRCLASSIFICACAOMEDIDA
975 975  
976 976 Exclui uma classificacao de uma medida da variavel
977 977  
... ... @@ -996,7 +996,7 @@ switch (strtoupper($funcao))
996 996 exit;
997 997 break;
998 998 /*
999   - Valor: EXCLUIRCLASSECLASSIFICACAO
  999 + Valor: EXCLUIRCLASSECLASSIFICACAO
1000 1000  
1001 1001 Exclui uma classe de uma classificacao
1002 1002  
... ... @@ -1090,7 +1090,7 @@ switch (strtoupper($funcao))
1090 1090 exit;
1091 1091 break;
1092 1092 /*
1093   - Valor: MAPFILEMEDIDAVARIAVEL
  1093 + Valor: MAPFILEMEDIDAVARIAVEL
1094 1094  
1095 1095 Cria o mapfile de uma media de uma variavel
1096 1096  
... ... @@ -1139,7 +1139,7 @@ switch (strtoupper($funcao))
1139 1139 exit;
1140 1140 break;
1141 1141 /*
1142   - Valor: KMLMEDIDAVARIAVEL
  1142 + Valor: KMLMEDIDAVARIAVEL
1143 1143  
1144 1144 Gera um arquivo kml que pode ser aberto no googleearth
1145 1145  
... ... @@ -1290,7 +1290,7 @@ switch (strtoupper($funcao))
1290 1290 exit;
1291 1291 break;
1292 1292 /*
1293   - Valor: COLUNASTABELA
  1293 + Valor: COLUNASTABELA
1294 1294  
1295 1295 Lista as colunas de uma tabela
1296 1296  
... ... @@ -1349,7 +1349,7 @@ switch (strtoupper($funcao))
1349 1349 exit;
1350 1350 break;
1351 1351 /*
1352   - Valor: DESCREVECOLUNASTABELA
  1352 + Valor: DESCREVECOLUNASTABELA
1353 1353  
1354 1354 Lista as colunas de uma tabela
1355 1355  
... ... @@ -1374,6 +1374,15 @@ switch (strtoupper($funcao))
1374 1374 }
1375 1375 exit;
1376 1376 break;
  1377 + case "ARVOREVAR":
  1378 + $m = new Metaestat();
  1379 + if(empty($codigo_variavel)){
  1380 + $codigo_variavel = "";
  1381 + }
  1382 + $dados = $m->relatorioCompleto($codigo_variavel,$dadosGerenciais);
  1383 + retornaJSON($dados);
  1384 + exit;
  1385 + break;
1377 1386 case "RELATORIOCOMPLETO":
1378 1387 $m = new Metaestat();
1379 1388 if(empty($codigo_variavel)){
... ...