Commit df20836dbb3c61a1ad92c3b78fb8980f129ea892
1 parent
5f62d268
Exists in
master
and in
7 other branches
Correções nos scripts de criação de banco
Showing
10 changed files
with
280 additions
and
149 deletions
Show diff stats
admin/js/arvore.js
| ... | ... | @@ -626,7 +626,7 @@ function editar(tipo,id) |
| 626 | 626 | if(tipo == "grupo") |
| 627 | 627 | { |
| 628 | 628 | var dados = YAHOO.lang.JSON.parse(o.responseText)[0]; |
| 629 | - core_montaEditor("gravawDados('grupo','"+id+"')","400px","400px"); | |
| 629 | + core_montaEditor("gravaDados('grupo','"+id+"')","400px","400px"); | |
| 630 | 630 | $i("editor_bd").innerHTML = montaDivGrupo(dados); |
| 631 | 631 | core_comboGrupos("comboGrupo","Eid_grupo",dados.id_grupo,""); |
| 632 | 632 | core_comboPerfis("comboPerfil","Eperfil_grupo","","registraPerfil(this.value,\"En1_perfil\")"); | ... | ... |
admin/js/estat_fonteinfo.js
| ... | ... | @@ -34,7 +34,7 @@ i3GEOadmin.fonteinfo = { |
| 34 | 34 | YAHOO.namespace("fonteinfo"); |
| 35 | 35 | YAHOO.namespace("admin.container"); |
| 36 | 36 | core_ativaPainelAjuda("ajuda","botaoAjuda"); |
| 37 | - core_ativaBotaoAdicionaLinha("../php/metaestat.php?funcao=alterarFonteinfo","adicionaNovaLinha","i3GEOadmin.fonteinfo.obtem"); | |
| 37 | + core_ativaBotaoAdicionaLinha("../php/metaestat.php?funcao=alteraFonteinfo","adicionaNovaLinha","i3GEOadmin.fonteinfo.obtem"); | |
| 38 | 38 | i3GEOadmin.fonteinfo.obtem(); |
| 39 | 39 | }, |
| 40 | 40 | /* | ... | ... |
admin/js/estat_variavel.js
| ... | ... | @@ -600,7 +600,8 @@ i3GEOadmin.variaveis = { |
| 600 | 600 | if(redesenha){tree.draw();} |
| 601 | 601 | }, |
| 602 | 602 | adicionar: function(id_medida_variavel){ |
| 603 | - var no = tree.getNodeByProperty("id_medida_variavel",id_medida_variavel), | |
| 603 | + var no = tree.getNodeByProperty("no_parametros",id_medida_variavel), | |
| 604 | + | |
| 604 | 605 | sUrl = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=alteraParametroMedida&id_medida_variavel="+id_medida_variavel, |
| 605 | 606 | callback = { |
| 606 | 607 | success: function(oResponse){ |
| ... | ... | @@ -711,7 +712,7 @@ i3GEOadmin.variaveis = { |
| 711 | 712 | if(!redesenha) { |
| 712 | 713 | tempNode = new YAHOO.widget.HTMLNode( |
| 713 | 714 | { |
| 714 | - html:"<span style=\"cursor:pointer;\" onclick=\"i3GEOadmin.variaveis.fonte.adicionar('"+no.data.no_fonteinfo+"')\" ><img style=\"position:relative;top:2px\" src=\"../imagens/05.png\" /><i>Adicionar nova fonte</i></span>" | |
| 715 | + html:"<span style=\"cursor:pointer;\" onclick=\"i3GEOadmin.variaveis.editar('fonteinfo','"+no.data.no_fonteinfo+"')\" ><img style=\"position:relative;top:2px\" src=\"../imagens/05.png\" /><i>Adicionar nova fonte</i></span>" | |
| 715 | 716 | }, |
| 716 | 717 | no, |
| 717 | 718 | false, |
| ... | ... | @@ -733,20 +734,22 @@ i3GEOadmin.variaveis = { |
| 733 | 734 | } |
| 734 | 735 | if(redesenha){tree.draw();} |
| 735 | 736 | }, |
| 737 | + /* | |
| 736 | 738 | adicionar: function(id_medida_variavel,id_fonteinfo){ |
| 737 | 739 | var no = tree.getNodeByProperty("no_fonteinfo",id_medida_variavel), |
| 738 | - sUrl = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=alteraFonteinfo&id_medida_variavel="+id_medida_variavel, | |
| 740 | + sUrl = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=adicinaFonteinfoMedida&id_medida_variavel="+id_medida_variavel, | |
| 739 | 741 | callback = { |
| 740 | 742 | success: function(oResponse){ |
| 741 | 743 | var dados = YAHOO.lang.JSON.parse(oResponse.responseText); |
| 742 | 744 | i3GEOadmin.variaveis.fonte.adicionaNos(no,[dados],true); |
| 743 | - i3GEOadmin.variaveis.editar('fonteinfo',dados.id_fonteinfo); | |
| 745 | + i3GEOadmin.variaveis.editar('fonteinfo',id_medida_variavel); | |
| 744 | 746 | }, |
| 745 | 747 | failure:core_handleFailure, |
| 746 | 748 | argument: { foo:"foo", bar:"bar" } |
| 747 | 749 | }; |
| 748 | 750 | core_makeRequest(sUrl,callback); |
| 749 | 751 | }, |
| 752 | + */ | |
| 750 | 753 | montaDiv: function(dados){ |
| 751 | 754 | ins = "<br><b>Escolha a Fonte:</b><br><br>"; |
| 752 | 755 | ins += "<select style='width:400px;' id='Eid_fonteinfo' >"; | ... | ... |
admin/php/classe_metaestat.php
| ... | ... | @@ -197,6 +197,7 @@ class Metaestat{ |
| 197 | 197 | function insertId($tabela,$colunatemp,$colunaid){ |
| 198 | 198 | $idtemp = (rand (9000,10000)) * -1; |
| 199 | 199 | //echo "INSERT INTO ".$this->esquemaadmin.$tabela." ($colunatemp) VALUES ('$idtemp')";exit; |
| 200 | + | |
| 200 | 201 | $this->dbhw->query("INSERT INTO ".$this->esquemaadmin.$tabela." ($colunatemp) VALUES ('$idtemp')"); |
| 201 | 202 | $id = $this->dbh->query("SELECT $colunaid FROM ".$this->esquemaadmin.$tabela." WHERE $colunatemp = '$idtemp'"); |
| 202 | 203 | $id = $id->fetchAll(); |
| ... | ... | @@ -1038,6 +1039,7 @@ class Metaestat{ |
| 1038 | 1039 | $nome = utf8_encode($nome); |
| 1039 | 1040 | $descricao = utf8_encode($descricao); |
| 1040 | 1041 | } |
| 1042 | + //echo "UPDATE ".$this->esquemaadmin."i3geoestat_tipo_periodo SET nome = '$nome', descricao = '$descricao' WHERE codigo_tipo_periodo = $codigo_tipo_periodo";exit; | |
| 1041 | 1043 | $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_tipo_periodo SET nome = '$nome', descricao = '$descricao' WHERE codigo_tipo_periodo = $codigo_tipo_periodo"); |
| 1042 | 1044 | $retorna = $codigo_tipo_periodo; |
| 1043 | 1045 | } |
| ... | ... | @@ -1082,6 +1084,7 @@ class Metaestat{ |
| 1082 | 1084 | $nome_tipo_regiao = utf8_encode($nome_tipo_regiao); |
| 1083 | 1085 | $descricao_tipo_regiao = utf8_encode($descricao_tipo_regiao); |
| 1084 | 1086 | } |
| 1087 | + //echo "UPDATE ".$this->esquemaadmin."i3geoestat_tipo_regiao SET codigo_estat_conexao = '$codigo_estat_conexao', colunacentroide = '$colunacentroide',nome_tipo_regiao = '$nome_tipo_regiao',descricao_tipo_regiao = '$descricao_tipo_regiao',esquemadb = '$esquemadb',tabela = '$tabela',colunageo = '$colunageo',data = '$data',identificador = '$identificador',colunanomeregiao = '$colunanomeregiao', srid = '$srid', colunasvisiveis = '$colunasvisiveis', apelidos = '$apelidos' WHERE codigo_tipo_regiao = $codigo_tipo_regiao";exit; | |
| 1085 | 1088 | $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_tipo_regiao SET codigo_estat_conexao = '$codigo_estat_conexao', colunacentroide = '$colunacentroide',nome_tipo_regiao = '$nome_tipo_regiao',descricao_tipo_regiao = '$descricao_tipo_regiao',esquemadb = '$esquemadb',tabela = '$tabela',colunageo = '$colunageo',data = '$data',identificador = '$identificador',colunanomeregiao = '$colunanomeregiao', srid = '$srid', colunasvisiveis = '$colunasvisiveis', apelidos = '$apelidos' WHERE codigo_tipo_regiao = $codigo_tipo_regiao"); |
| 1086 | 1089 | $retorna = $codigo_tipo_regiao; |
| 1087 | 1090 | } |
| ... | ... | @@ -1122,7 +1125,7 @@ class Metaestat{ |
| 1122 | 1125 | $nome = utf8_encode($nome); |
| 1123 | 1126 | $descricao = utf8_encode($descricao); |
| 1124 | 1127 | } |
| 1125 | - //echo "UPDATE ".$this->esquemaadmin."i3geoestat_parametro_medida SET nomeparametro = '$nomeparametro',descricao = '$descricao',coluna = '$coluna',agregavalores = '$agregavalores' WHERE id_parametro_medida = $id_parametro_medida";exit; | |
| 1128 | + //echo "UPDATE ".$this->esquemaadmin."i3geoestat_parametro_medida SET nome = '$nome',descricao = '$descricao',coluna = '$coluna',id_pai = '$id_pai', tipo = '$tipo' WHERE id_parametro_medida = $id_parametro_medida";exit; | |
| 1126 | 1129 | $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_parametro_medida SET nome = '$nome',descricao = '$descricao',coluna = '$coluna',id_pai = '$id_pai', tipo = '$tipo' WHERE id_parametro_medida = $id_parametro_medida"); |
| 1127 | 1130 | $retorna = $id_parametro_medida; |
| 1128 | 1131 | } |
| ... | ... | @@ -1281,6 +1284,7 @@ class Metaestat{ |
| 1281 | 1284 | $sql .= "ON i3geoestat_fonteinfo.id_fonteinfo = i3geoestat_fonteinfo_medida.id_fonteinfo "; |
| 1282 | 1285 | $sql .= "WHERE i3geoestat_fonteinfo_medida.id_medida_variavel = $id_medida_variavel "; |
| 1283 | 1286 | $sql .= "ORDER BY titulo"; |
| 1287 | + //echo $sql;exit; | |
| 1284 | 1288 | return $this->execSQL($sql,$id_fonteinfo); |
| 1285 | 1289 | } |
| 1286 | 1290 | /* | ... | ... |
admin/php/conexaopostgresql.php
| 1 | 1 | <?php |
| 2 | 2 | try |
| 3 | 3 | { |
| 4 | - $dbh = new PDO('pgsql:dbname=postgres;user=postgres;password=postgres;host=localhost'); | |
| 5 | - $dbhw = new PDO('pgsql:dbname=postgres;user=postgres;password=postgres;host=localhost'); | |
| 4 | + $dbh = new PDO('pgsql:dbname=teste;user=postgres;password=postgres;host=localhost'); | |
| 5 | + $dbhw = new PDO('pgsql:dbname=teste;user=postgres;password=postgres;host=localhost'); | |
| 6 | 6 | } |
| 7 | 7 | catch (PDOException $e) |
| 8 | 8 | { | ... | ... |
admin/php/criabanco.php
| ... | ... | @@ -48,6 +48,7 @@ |
| 48 | 48 | */ |
| 49 | 49 | $funcao = ""; |
| 50 | 50 | //echo __DIR__; |
| 51 | + $esquemaadmin = ""; | |
| 51 | 52 | include("admin.php"); |
| 52 | 53 | error_reporting(E_ALL); |
| 53 | 54 | $tabelas = array( |
| ... | ... | @@ -80,137 +81,237 @@ |
| 80 | 81 | "CREATE TABLE ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao NUMERIC, id_papel NUMERIC)", |
| 81 | 82 | "CREATE TABLE ".$esquemaadmin."i3geousr_grupousuario (id_usuario NUMERIC, id_grupo NUMERIC)", |
| 82 | 83 | "CREATE TABLE ".$esquemaadmin."i3geousr_grupotema (id_grupo NUMERIC, id_tema NUMERIC)", |
| 83 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT)", | |
| 84 | + "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT, descricao TEXT)", | |
| 84 | 85 | //tabelas do sistema metaestat |
| 85 | - "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao integer primary key,bancodedados text,host text,porta text,usuario text,senha text)", | |
| 86 | - "create table ".$esquemaadmin."i3geoestat_tipo_regiao(codigo_tipo_regiao integer primary key,nome_tipo_regiao text,descricao_tipo_regiao text,codigo_estat_conexao integer,esquemadb text,tabela text,colunageo text,data text,identificador integer,colunanomeregiao text,srid text,colunacentroide text, colunasvisiveis text, apelidos text)", | |
| 87 | - "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao integer primary key,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | |
| 88 | - "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo integer primary key,nome text,descricao text)", | |
| 89 | - "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida integer primary key,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | |
| 90 | - "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel integer primary key,nome text,descricao text)", | |
| 91 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel(id_medida_variavel integer primary key,codigo_unidade_medida integer,codigo_tipo_periodo integer,codigo_variavel integer,codigo_tipo_regiao integer,codigo_estat_conexao integer,esquemadb text,tabela text,colunavalor text,colunaidgeo text,filtro text,nomemedida text,colunaidunico text)", | |
| 92 | - "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao integer primary key,nome text,id_medida_variavel integer,observacao text)", | |
| 93 | - "create table ".$esquemaadmin."i3geoestat_classes(id_classe integer primary key,expressao text,titulo text,vermelho text,verde text,azul text,id_classificacao integer,tamanho text,simbolo text,overmelho text,overde text,oazul text,otamanho text)", | |
| 94 | - "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo integer primary key,titulo text unique,link text)", | |
| 86 | + "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao INTEGER PRIMARY KEY,bancodedados text,host text,porta text,usuario text,senha text)", | |
| 87 | + "create table ".$esquemaadmin."i3geoestat_tipo_regiao(codigo_tipo_regiao INTEGER PRIMARY KEY,nome_tipo_regiao text,descricao_tipo_regiao text,codigo_estat_conexao integer,esquemadb text,tabela text,colunageo text,data text,identificador integer,colunanomeregiao text,srid text,colunacentroide text, colunasvisiveis text, apelidos text)", | |
| 88 | + "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao INTEGER PRIMARY KEY,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | |
| 89 | + "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo INTEGER PRIMARY KEY,nome text,descricao text)", | |
| 90 | + "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida INTEGER PRIMARY KEY,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | |
| 91 | + "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel INTEGER PRIMARY KEY,nome text,descricao text)", | |
| 92 | + "create table ".$esquemaadmin."i3geoestat_medida_variavel(id_medida_variavel INTEGER PRIMARY KEY,codigo_unidade_medida integer,codigo_tipo_periodo integer,codigo_variavel integer,codigo_tipo_regiao integer,codigo_estat_conexao integer,esquemadb text,tabela text,colunavalor text,colunaidgeo text,filtro text,nomemedida text,colunaidunico text)", | |
| 93 | + "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao INTEGER PRIMARY KEY,nome text,id_medida_variavel integer,observacao text)", | |
| 94 | + "create table ".$esquemaadmin."i3geoestat_classes(id_classe INTEGER PRIMARY KEY,expressao text,titulo text,vermelho text,verde text,azul text,id_classificacao integer,tamanho text,simbolo text,overmelho text,overde text,oazul text,otamanho text)", | |
| 95 | + "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo INTEGER PRIMARY KEY,titulo text unique,link text)", | |
| 95 | 96 | "create table ".$esquemaadmin."i3geoestat_fonteinfo_medida(id_medida_variavel integer not null,id_fonteinfo integer not null)", |
| 96 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link integer primary key)", | |
| 97 | - "create table ".$esquemaadmin."i3geoestat_parametro_medida(id_parametro_medida integer primary key,coluna text,nome text,descricao text,id_pai integer default 0,id_medida_variavel integer)", | |
| 97 | + "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link INTEGER PRIMARY KEY)", | |
| 98 | + "create table ".$esquemaadmin."i3geoestat_parametro_medida(id_parametro_medida INTEGER PRIMARY KEY,coluna text,nome text,descricao text,id_pai integer default 0,id_medida_variavel integer, tipo integer default 0)", | |
| 98 | 99 | "create table ".$esquemaadmin."i3geoestat_mapa(id_mapa integer not null unique primary key autoincrement,titulo text,template text,logoesquerdo text,logodireito text,publicado integer)", |
| 99 | 100 | "create table ".$esquemaadmin."i3geoestat_mapa_grupo(id_mapa_grupo integer not null unique primary key autoincrement,id_mapa integer,titulo text,foreign key (id_mapa) references i3geoestat_mapa (id_mapa))", |
| 100 | 101 | "create table ".$esquemaadmin."i3geoestat_mapa_tema (id_mapa_tema integer not null unique primary key autoincrement,id_mapa_grupo integer,titulo text,id_medida_variavel integer,foreign key (id_mapa_grupo) references i3geoestat_mapa_grupo (id_mapa_grupo),foreign key (id_medida_variavel) references i3geoestat_medida_variavel (id_medida_variavel))" |
| 101 | 102 | ); |
| 102 | 103 | //valida o usuario e aplica |
| 103 | 104 | $exts = get_loaded_extensions(); |
| 104 | - if($conexaoadmin == ""){ | |
| 105 | - if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | |
| 106 | - criabancoformularioLoginMaster("criabanco.php"); | |
| 105 | + | |
| 106 | + if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | |
| 107 | + criabancoformularioLoginMaster("criabanco.php"); | |
| 108 | + echo "<br><br><input type=checkbox name=mostraSoSQL /> Mostra apenas o SQL"; | |
| 109 | + exit; | |
| 110 | + } | |
| 111 | + else{ | |
| 112 | + $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | |
| 113 | + if($continua == false){ | |
| 114 | + echo "Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster"; | |
| 107 | 115 | exit; |
| 108 | 116 | } |
| 109 | - else{ | |
| 110 | - $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | |
| 111 | - if($continua == false){ | |
| 112 | - echo "Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster"; | |
| 113 | - exit; | |
| 114 | - } | |
| 115 | - } | |
| 116 | - if(file_exists("../admin.db")) { | |
| 117 | - echo "<br>Arquivo admin/admin.db ja existe. Vc deve apagá-lo para poder criá-lo novamente caso precise"; | |
| 118 | - } | |
| 119 | - else{ | |
| 120 | - //@TODO v5.0 criar um arquivo sqlite vazio apenas com as tabelas | |
| 121 | - copy("../admin_vazio.db","../admin.db"); | |
| 122 | - chmod("../admin.db",0777); | |
| 123 | - if(file_exists("../admin.db")){ | |
| 124 | - echo "Banco copiado ../admin.db !!!"; | |
| 125 | - $dbhw = new PDO('sqlite:../admin.db'); | |
| 126 | - $banco = "ok"; | |
| 117 | + } | |
| 118 | + if($conexaoadmin == ""){ | |
| 119 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 120 | + if(file_exists("../admin.db")) { | |
| 121 | + echo "<br>Arquivo admin/admin.db ja existe. Vc deve apagá-lo para poder criá-lo novamente caso precise"; | |
| 127 | 122 | } |
| 128 | 123 | else{ |
| 129 | - echo "erro"; | |
| 130 | - } | |
| 131 | - //@FIXME a criacao do banco nao funciona no PHP (Linux) | |
| 132 | - /* | |
| 133 | - if(function_exists("sqlite_open")){ | |
| 134 | - $banco = sqlite_open("../admin.db",0666); | |
| 135 | - $banco = null; | |
| 136 | - $dbhw = new PDO('sqlite:../admin.db'); | |
| 137 | - } | |
| 138 | - elseif(in_array("sqlite3",$exts)){ | |
| 139 | - $banco = new SQLite3("../admin.db",SQLITE3_OPEN_CREATE); | |
| 140 | - echo $banco;exit; | |
| 141 | - $banco->close(); | |
| 142 | - $dbhw = new PDO('sqlite:../admin.db'); | |
| 124 | + //@TODO v5.0 criar um arquivo sqlite vazio apenas com as tabelas | |
| 125 | + copy("../admin_vazio.db","../admin.db"); | |
| 126 | + chmod("../admin.db",0777); | |
| 127 | + if(file_exists("../admin.db")){ | |
| 128 | + echo "Banco copiado ../admin.db !!!"; | |
| 129 | + $dbhw = new PDO('sqlite:../admin.db'); | |
| 130 | + } | |
| 131 | + else{ | |
| 132 | + echo "erro"; | |
| 133 | + } | |
| 134 | + //@FIXME a criacao do banco nao funciona no PHP (Linux) | |
| 135 | + /* | |
| 136 | + if(function_exists("sqlite_open")){ | |
| 137 | + $banco = sqlite_open("../admin.db",0666); | |
| 138 | + $banco = null; | |
| 139 | + $dbhw = new PDO('sqlite:../admin.db'); | |
| 140 | + } | |
| 141 | + elseif(in_array("sqlite3",$exts)){ | |
| 142 | + $banco = new SQLite3("../admin.db",SQLITE3_OPEN_CREATE); | |
| 143 | + echo $banco;exit; | |
| 144 | + $banco->close(); | |
| 145 | + $dbhw = new PDO('sqlite:../admin.db'); | |
| 146 | + } | |
| 147 | + if(!function_exists("sqlite_open") && !in_array("sqlite3",$exts)){ | |
| 148 | + echo "<br>A função de criação do banco sqlite não existe no PHP. Vc pode usar o arquivo i3geo/admin/adminvazio.db e renomeá-lo para admin.db."; | |
| 149 | + } | |
| 150 | + */ | |
| 143 | 151 | } |
| 144 | - if(!function_exists("sqlite_open") && !in_array("sqlite3",$exts)){ | |
| 145 | - echo "<br>A função de criação do banco sqlite não existe no PHP. Vc pode usar o arquivo i3geo/admin/adminvazio.db e renomeá-lo para admin.db."; | |
| 146 | - } | |
| 147 | - */ | |
| 152 | + } | |
| 153 | + else{ | |
| 154 | + $dbhw = new PDO('sqlite:../admin.db'); | |
| 148 | 155 | } |
| 149 | 156 | } |
| 150 | 157 | else{ |
| 151 | 158 | include($conexaoadmin); |
| 152 | 159 | } |
| 153 | 160 | if(empty($dbhw)){ |
| 154 | - echo "<br>Fim";exit; | |
| 161 | + echo "<br>Conexao com o banco nao estabelecida";exit; | |
| 155 | 162 | } |
| 156 | 163 | $drivename = $dbhw->getAttribute(PDO::ATTR_DRIVER_NAME); |
| 164 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 165 | + foreach($tabelas as $tabela){ | |
| 166 | + if($drivename == "pgsql"){ | |
| 167 | + $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); | |
| 168 | + } | |
| 169 | + $q = $dbhw->query($tabela); | |
| 170 | + } | |
| 171 | + } | |
| 172 | + echo "Tabelas:<br><br>"; | |
| 157 | 173 | foreach($tabelas as $tabela){ |
| 158 | 174 | if($drivename == "pgsql"){ |
| 159 | 175 | $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); |
| 160 | 176 | } |
| 161 | - //echo $tabela."<br>"; | |
| 162 | - $q = $dbhw->query($tabela); | |
| 177 | + echo $tabela.";<br>"; | |
| 178 | + } | |
| 179 | + echo "<br><br>Inserindo os registros default<br><br>"; | |
| 180 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 181 | + $teste = lista("select * from ".$esquemaadmin."i3geousr_papeis","id_papel"); | |
| 182 | + } | |
| 183 | + else{ | |
| 184 | + $teste = array(); | |
| 185 | + } | |
| 186 | + $sql = array(); | |
| 187 | + | |
| 188 | + | |
| 189 | + if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 190 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem executar qualquer tarefa, inclusive cadastrar novos administradores',1,'admin')"; | |
| 191 | + | |
| 192 | + if(!in_array(2,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 193 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem criar/editar qualquer tema (mapfile) mas nao podem editar a arvore do catalogo de temas',2,'editores')"; | |
| 194 | + if(!in_array(3,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 195 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')"; | |
| 196 | + if(!in_array(4,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 197 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')"; | |
| 198 | + if(!in_array(5,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 199 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES ('Podem administrar o sistema METAESTAT','5', 'adminmetaestat')"; | |
| 200 | + | |
| 201 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 202 | + $teste = lista("select * from ".$esquemaadmin."i3geousr_usuarios","id_usuario"); | |
| 203 | + } | |
| 204 | + else{ | |
| 205 | + $teste = array(); | |
| 163 | 206 | } |
| 164 | - //insercao de dados default | |
| 165 | - if(!empty($banco)){ | |
| 166 | - //papeis | |
| 167 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem executar qualquer tarefa, inclusive cadastrar novos administradores',1,'admin')"); | |
| 168 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem criar/editar qualquer tema (mapfile) mas nao podem editar a arvore do catalogo de temas',2,'editores')"); | |
| 169 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')"); | |
| 170 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')"); | |
| 171 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES ('Podem administrar o sistema METAESTAT','5', 'adminmetaestat')"); | |
| 172 | - //usuarios - inclui apenas o admin | |
| 173 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',0,'admingeral','admingeral','admingeral')"); | |
| 174 | - //papel do usuario | |
| 175 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)"); | |
| 176 | - //operacoes controladas | |
| 177 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')"); | |
| 178 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(2,'admin/html/operacoes','abre o editor de operacoes')"); | |
| 179 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(3,'teste/','teste')"); | |
| 180 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(4,'admin/html/arvore','edicao da arvore do catalogo de temas')"); | |
| 181 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(5,'admin/html/menus','edicao da lista de menus')"); | |
| 182 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(6,'admin/html/ogcws','edicao das preferencias do servico WMS')"); | |
| 183 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(7,'admin/html/atlas','edicao de atlas')"); | |
| 184 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(8,'admin/html/identifica','lista de sistemas incluidos na ferramenta de identificacao')"); | |
| 185 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(9,'admin/html/incluimap','adapta mapfiles antigos para versoes novas do Mapserver')"); | |
| 186 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(10,'admin/html/mapas','lista de links para mapas')"); | |
| 187 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(11,'admin/html/perfis','lista controlada de perfis')"); | |
| 188 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(12,'admin/html/sistemas','lista de sistemas complementares que sao mostrados no catalogo')"); | |
| 189 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')"); | |
| 190 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')"); | |
| 191 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')"); | |
| 192 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('16', 'admin/php/editortexto', 'editor de textos para edicao de mapfiles')"); | |
| 193 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')"); | |
| 194 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('18', 'admin/metaestat/geral', 'permite edicoes mais comuns do sistema de metadados estatisticos')"); | |
| 195 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('19', 'admin/metaestat/editorbanco', 'permite gerenciar as tabelas do banco')"); | |
| 196 | - | |
| 197 | - //papeis por operacao | |
| 198 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)"); | |
| 199 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)"); | |
| 200 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)"); | |
| 201 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(5,3)"); | |
| 202 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(7,3)"); | |
| 203 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(10,3)"); | |
| 204 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)"); | |
| 205 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)"); | |
| 206 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)"); | |
| 207 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(16,2)"); | |
| 208 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(18,1)"); | |
| 209 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES ('18', '5')"); | |
| 210 | - | |
| 211 | - $banco = null; | |
| 212 | - echo "Banco criado!!!"; | |
| 207 | + | |
| 208 | + if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 209 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',0,'admingeral','admingeral','admingeral')"; | |
| 210 | + | |
| 211 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 212 | + $teste = lista("select * from ".$esquemaadmin."i3geousr_papelusuario","id_usuario","id_papel"); | |
| 213 | + } | |
| 214 | + else{ | |
| 215 | + $teste = array(); | |
| 213 | 216 | } |
| 217 | + if(!in_array("1-1",$teste) || $_POST["mostraSoSQL"] == "on") | |
| 218 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)"; | |
| 219 | + | |
| 220 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 221 | + $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoes","id_operacao"); | |
| 222 | + } | |
| 223 | + else{ | |
| 224 | + $teste = array(); | |
| 225 | + } | |
| 226 | + | |
| 227 | + if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 228 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')"; | |
| 229 | + if(!in_array(2,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 230 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(2,'admin/html/operacoes','abre o editor de operacoes')"; | |
| 231 | + if(!in_array(3,$teste)) | |
| 232 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(3,'teste/','teste')"; | |
| 233 | + if(!in_array(4,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 234 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(4,'admin/html/arvore','edicao da arvore do catalogo de temas')"; | |
| 235 | + if(!in_array(5,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 236 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(5,'admin/html/menus','edicao da lista de menus')"; | |
| 237 | + if(!in_array(6,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 238 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(6,'admin/html/ogcws','edicao das preferencias do servico WMS')"; | |
| 239 | + if(!in_array(7,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 240 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(7,'admin/html/atlas','edicao de atlas')"; | |
| 241 | + if(!in_array(8,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 242 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(8,'admin/html/identifica','lista de sistemas incluidos na ferramenta de identificacao')"; | |
| 243 | + if(!in_array(9,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 244 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(9,'admin/html/incluimap','adapta mapfiles antigos para versoes novas do Mapserver')"; | |
| 245 | + if(!in_array(10,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 246 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(10,'admin/html/mapas','lista de links para mapas')"; | |
| 247 | + if(!in_array(11,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 248 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(11,'admin/html/perfis','lista controlada de perfis')"; | |
| 249 | + if(!in_array(12,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 250 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(12,'admin/html/sistemas','lista de sistemas complementares que sao mostrados no catalogo')"; | |
| 251 | + if(!in_array(13,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 252 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')"; | |
| 253 | + if(!in_array(14,$teste)) | |
| 254 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')"; | |
| 255 | + if(!in_array(15,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 256 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')"; | |
| 257 | + if(!in_array(16,$teste)) | |
| 258 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(16,'admin/php/editortexto','editor de texto para mapfiles')"; | |
| 259 | + if(!in_array(17,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 260 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')"; | |
| 261 | + if(!in_array(18,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 262 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('18', 'admin/metaestat/geral', 'permite edicoes mais comuns do sistema de metadados estatisticos')"; | |
| 263 | + if(!in_array(19,$teste) || $_POST["mostraSoSQL"] == "on") | |
| 264 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('19', 'admin/metaestat/editorbanco', 'permite gerenciar as tabelas do banco')"; | |
| 265 | + | |
| 266 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 267 | + $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoespapeis","id_operacao","id_papel"); | |
| 268 | + } | |
| 269 | + else{ | |
| 270 | + $teste = array(); | |
| 271 | + } | |
| 272 | + if(!in_array('1-2',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 273 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)"; | |
| 274 | + if(!in_array('1-3',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 275 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)"; | |
| 276 | + if(!in_array('4-3',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 277 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)"; | |
| 278 | + if(!in_array('5-3',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 279 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(5,3)"; | |
| 280 | + if(!in_array('7-3',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 281 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(7,3)"; | |
| 282 | + if(!in_array('10-3',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 283 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(10,3)"; | |
| 284 | + if(!in_array('13-2',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 285 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)"; | |
| 286 | + if(!in_array('13-4',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 287 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)"; | |
| 288 | + if(!in_array('15-3',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 289 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)"; | |
| 290 | + if(!in_array('16-2',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 291 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(16,2)"; | |
| 292 | + if(!in_array('18-1',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 293 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(18,1)"; | |
| 294 | + if(!in_array('18-5',$teste) || $_POST["mostraSoSQL"] == "on") | |
| 295 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES (18,5)"; | |
| 296 | + | |
| 297 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('1', 'Anual', '')"; | |
| 298 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('2', 'Mensal', '')"; | |
| 299 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('3', 'Diário', '')"; | |
| 300 | + $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('4', 'Horário', '')"; | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + echo "<br>Inserts:<br><br>"; | |
| 305 | + foreach($sql as $s){ | |
| 306 | + if($_POST["mostraSoSQL"] != "on"){ | |
| 307 | + $dbhw->query($s); | |
| 308 | + } | |
| 309 | + echo $s.";<br>"; | |
| 310 | + } | |
| 311 | + | |
| 312 | + echo "<br>Feito!"; | |
| 313 | + | |
| 314 | + | |
| 214 | 315 | function criabancoformularioLoginMaster($action){ |
| 215 | 316 | echo "<form method=post action=$action >"; |
| 216 | 317 | echo "<br>Essa conexão pode não ser segura e os dados de usuário/senha podem ser descobertos<br><br>"; |
| ... | ... | @@ -218,6 +319,21 @@ |
| 218 | 319 | echo "Senha:<br> <input type=password name=senha /><br>"; |
| 219 | 320 | echo "<input type=submit />"; |
| 220 | 321 | } |
| 221 | - | |
| 322 | + function lista($sql,$coluna,$coluna1=""){ | |
| 323 | + global $dbh; | |
| 324 | + $lista = array(); | |
| 325 | + $q = $dbh->query($sql,PDO::FETCH_ASSOC); | |
| 326 | + if($q) | |
| 327 | + { | |
| 328 | + $resultado = $q->fetchAll(); | |
| 329 | + foreach($resultado as $r){ | |
| 330 | + if($coluna1 == "") | |
| 331 | + $lista[] = $r[$coluna]; | |
| 332 | + else | |
| 333 | + $lista[] = $r[$coluna]."-".$r[$coluna1]; | |
| 334 | + } | |
| 335 | + } | |
| 336 | + return $lista; | |
| 337 | + } | |
| 222 | 338 | ?> |
| 223 | 339 | </div> |
| 224 | 340 | \ No newline at end of file | ... | ... |
admin/php/metaestat.php
| ... | ... | @@ -51,7 +51,7 @@ $funcoesEdicao = array( |
| 51 | 51 | "CALCULACLASSIFICACAO", |
| 52 | 52 | "ALTERACLASSECLASSIFICACAO", |
| 53 | 53 | "ALTERALINKMEDIDA", |
| 54 | - "ALTERARFONTEINFO", | |
| 54 | + "ALTERAFONTEINFO", | |
| 55 | 55 | "ADICIONAFONTEINFOMEDIDA", |
| 56 | 56 | "ALTERARUNIDADEMEDIDA", |
| 57 | 57 | "ALTERARCONEXAO", |
| ... | ... | @@ -565,7 +565,7 @@ switch (strtoupper($funcao)) |
| 565 | 565 | retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link)); |
| 566 | 566 | exit; |
| 567 | 567 | break; |
| 568 | - case "ALTERARFONTEINFO": | |
| 568 | + case "ALTERAFONTEINFO": | |
| 569 | 569 | $m = new Metaestat(); |
| 570 | 570 | if(empty($id_fonteinfo)){ |
| 571 | 571 | //isso ira criar um novo registro |
| ... | ... | @@ -579,6 +579,7 @@ switch (strtoupper($funcao)) |
| 579 | 579 | break; |
| 580 | 580 | case "ADICIONAFONTEINFOMEDIDA": |
| 581 | 581 | $m = new Metaestat(); |
| 582 | + //echo $id_medida_variavel;exit; | |
| 582 | 583 | $m->adicinaFonteinfoMedida($id_medida_variavel,$id_fonteinfo); |
| 583 | 584 | retornaJSON($m->listaFonteInfo($id_fonteinfo)); |
| 584 | 585 | exit; | ... | ... |
admin/php/sistemas.php
| ... | ... | @@ -265,22 +265,24 @@ function alterarSistemas() |
| 265 | 265 | function alterarFuncoes() |
| 266 | 266 | { |
| 267 | 267 | global $esquemaadmin,$id_sistema,$id_funcao,$perfil_funcao,$nome_funcao,$w_funcao,$h_funcao,$abrir_funcao; |
| 268 | - try | |
| 269 | - { | |
| 268 | + if(empty($w_funcao)){ | |
| 269 | + $w_funcao = 200; | |
| 270 | + } | |
| 271 | + if(empty($h_funcao)){ | |
| 272 | + $h_funcao = 200; | |
| 273 | + } | |
| 274 | + try{ | |
| 270 | 275 | require_once("conexao.php"); |
| 271 | - if($convUTF) | |
| 272 | - { | |
| 276 | + if($convUTF){ | |
| 273 | 277 | $nome_funcao = utf8_encode($nome_funcao); |
| 274 | 278 | } |
| 275 | - if($id_funcao != "") | |
| 276 | - { | |
| 279 | + if($id_funcao != ""){ | |
| 277 | 280 | $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_sistemasf SET nome_funcao = '$nome_funcao',perfil_funcao = '$perfil_funcao', w_funcao = '$w_funcao',h_funcao = '$h_funcao', abrir_funcao = '$abrir_funcao' WHERE id_funcao = $id_funcao"); |
| 278 | 281 | $retorna = $id_funcao; |
| 279 | 282 | } |
| 280 | - else | |
| 281 | - { | |
| 283 | + else{ | |
| 282 | 284 | $idtemp = (rand (9000,10000)) * -1; |
| 283 | - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_sistemasf (id_sistema,nome_funcao,perfil_funcao,w_funcao,h_funcao,abrir_funcao) VALUES ('$id_sistema','$idtemp','','$w','$h','')"); | |
| 285 | + $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_sistemasf (id_sistema,nome_funcao) VALUES ('$id_sistema','$idtemp')"); | |
| 284 | 286 | $id = $dbh->query("SELECT id_funcao FROM ".$esquemaadmin."i3geoadmin_sistemasf WHERE nome_funcao = '$idtemp'"); |
| 285 | 287 | $id = $id->fetchAll(); |
| 286 | 288 | $id = $id[0]['id_funcao']; | ... | ... |
admin/php/upgradebanco46_47.php
| ... | ... | @@ -78,20 +78,20 @@ $tabelas = array( |
| 78 | 78 | "CREATE TABLE ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao NUMERIC, id_papel NUMERIC)", |
| 79 | 79 | "CREATE TABLE ".$esquemaadmin."i3geousr_grupousuario (id_usuario NUMERIC, id_grupo NUMERIC)", |
| 80 | 80 | "CREATE TABLE ".$esquemaadmin."i3geousr_grupotema (id_grupo NUMERIC, id_tema NUMERIC)", |
| 81 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT)", | |
| 82 | - "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao integer primary key,bancodedados text,host text,porta text,usuario text,senha text)", | |
| 83 | - "create table ".$esquemaadmin."i3geoestat_tipo_regiao(codigo_tipo_regiao integer primary key,nome_tipo_regiao text,descricao_tipo_regiao text,codigo_estat_conexao integer,esquemadb text,tabela text,colunageo text,data text,identificador integer,colunanomeregiao text,srid text,colunacentroide text, colunasvisiveis text, apelidos text)", | |
| 84 | - "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao integer primary key,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | |
| 85 | - "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo integer primary key,nome text,descricao text)", | |
| 86 | - "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida integer primary key,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | |
| 87 | - "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel integer primary key,nome text,descricao text)", | |
| 88 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel(id_medida_variavel integer primary key,codigo_unidade_medida integer,codigo_tipo_periodo integer,codigo_variavel integer,codigo_tipo_regiao integer,codigo_estat_conexao integer,esquemadb text,tabela text,colunavalor text,colunaidgeo text,filtro text,nomemedida text,colunaidunico text)", | |
| 89 | - "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao integer primary key,nome text,id_medida_variavel integer,observacao text)", | |
| 90 | - "create table ".$esquemaadmin."i3geoestat_classes(id_classe integer primary key,expressao text,titulo text,vermelho text,verde text,azul text,id_classificacao integer,tamanho text,simbolo text,overmelho text,overde text,oazul text,otamanho text)", | |
| 91 | - "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo integer primary key,titulo text unique,link text)", | |
| 81 | + "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT, descricao TEXT)", | |
| 82 | + "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao INTEGER PRIMARY KEY,bancodedados text,host text,porta text,usuario text,senha text)", | |
| 83 | + "create table ".$esquemaadmin."i3geoestat_tipo_regiao(codigo_tipo_regiao INTEGER PRIMARY KEY,nome_tipo_regiao text,descricao_tipo_regiao text,codigo_estat_conexao integer,esquemadb text,tabela text,colunageo text,data text,identificador integer,colunanomeregiao text,srid text,colunacentroide text, colunasvisiveis text, apelidos text)", | |
| 84 | + "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao INTEGER PRIMARY KEY,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | |
| 85 | + "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo INTEGER PRIMARY KEY,nome text,descricao text)", | |
| 86 | + "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida INTEGER PRIMARY KEY,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | |
| 87 | + "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel INTEGER PRIMARY KEY,nome text,descricao text)", | |
| 88 | + "create table ".$esquemaadmin."i3geoestat_medida_variavel(id_medida_variavel INTEGER PRIMARY KEY,codigo_unidade_medida integer,codigo_tipo_periodo integer,codigo_variavel integer,codigo_tipo_regiao integer,codigo_estat_conexao integer,esquemadb text,tabela text,colunavalor text,colunaidgeo text,filtro text,nomemedida text,colunaidunico text)", | |
| 89 | + "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao INTEGER PRIMARY KEY,nome text,id_medida_variavel integer,observacao text)", | |
| 90 | + "create table ".$esquemaadmin."i3geoestat_classes(id_classe INTEGER PRIMARY KEY,expressao text,titulo text,vermelho text,verde text,azul text,id_classificacao integer,tamanho text,simbolo text,overmelho text,overde text,oazul text,otamanho text)", | |
| 91 | + "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo INTEGER PRIMARY KEY,titulo text unique,link text)", | |
| 92 | 92 | "create table ".$esquemaadmin."i3geoestat_fonteinfo_medida(id_medida_variavel integer not null,id_fonteinfo integer not null)", |
| 93 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link integer primary key)", | |
| 94 | - "create table ".$esquemaadmin."i3geoestat_parametro_medida(id_parametro_medida integer primary key,coluna text,nome text,descricao text,id_pai integer default 0,id_medida_variavel integer)", | |
| 93 | + "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link INTEGER PRIMARY KEY)", | |
| 94 | + "create table ".$esquemaadmin."i3geoestat_parametro_medida(id_parametro_medida INTEGER PRIMARY KEY,coluna text,nome text,descricao text,id_pai integer default 0,id_medida_variavel integer, tipo integer default 0)", | |
| 95 | 95 | "create table ".$esquemaadmin."i3geoestat_mapa(id_mapa integer not null unique primary key autoincrement,titulo text,template text,logoesquerdo text,logodireito text,publicado integer)", |
| 96 | 96 | "create table ".$esquemaadmin."i3geoestat_mapa_grupo(id_mapa_grupo integer not null unique primary key autoincrement,id_mapa integer,titulo text,foreign key (id_mapa) references i3geoestat_mapa (id_mapa))", |
| 97 | 97 | "create table ".$esquemaadmin."i3geoestat_mapa_tema (id_mapa_tema integer not null unique primary key autoincrement,id_mapa_grupo integer,titulo text,id_medida_variavel integer,foreign key (id_mapa_grupo) references i3geoestat_mapa_grupo (id_mapa_grupo),foreign key (id_medida_variavel) references i3geoestat_medida_variavel (id_medida_variavel))" |
| ... | ... | @@ -206,6 +206,11 @@ if(!in_array('18-1',$teste) || $_POST["mostraSoSQL"] == "on") |
| 206 | 206 | if(!in_array('18-5',$teste) || $_POST["mostraSoSQL"] == "on") |
| 207 | 207 | $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES (18,5)"; |
| 208 | 208 | |
| 209 | +$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('1', 'Anual', '')"; | |
| 210 | +$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('2', 'Mensal', '')"; | |
| 211 | +$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('3', 'Diário', '')"; | |
| 212 | +$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('4', 'Horário', '')"; | |
| 213 | + | |
| 209 | 214 | echo "<br>Inserts:<br><br>"; |
| 210 | 215 | foreach($sql as $s){ |
| 211 | 216 | if($_POST["mostraSoSQL"] != "on"){ | ... | ... |
temas/_lautolegenda_exemplo.map
| ... | ... | @@ -5,32 +5,32 @@ MAP |
| 5 | 5 | DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" |
| 6 | 6 | METADATA |
| 7 | 7 | "METAESTAT_ID_MEDIDA_VARIAVEL" "" |
| 8 | - "cache" "SIM" | |
| 9 | 8 | "ltempoitemimagem" "" |
| 10 | - "CLASSE" "SIM" | |
| 9 | + "cache" "SIM" | |
| 11 | 10 | "ltempoitemdescricao" "" |
| 12 | - "palletestep" "" | |
| 11 | + "CLASSE" "SIM" | |
| 13 | 12 | "ltempoiteminicio" "" |
| 14 | - "permitekmz" "nao" | |
| 13 | + "palletestep" "" | |
| 15 | 14 | "ltempoitemtip" "" |
| 16 | - "ITENSDESC" "Nome" | |
| 17 | - "description_template" "" | |
| 18 | - "ltempoitemtitulo" "" | |
| 15 | + "permitekmz" "nao" | |
| 19 | 16 | "iconetema" "" |
| 20 | - "CLASSESNOME" "CD_LEGENDA" | |
| 17 | + "ltempoitemtitulo" "" | |
| 18 | + "description_template" "" | |
| 19 | + "ITENSDESC" "Nome" | |
| 21 | 20 | "ltempoitemlink" "" |
| 21 | + "CLASSESNOME" "CD_LEGENDA" | |
| 22 | 22 | "METAESTAT_CODIGO_TIPO_REGIAO" "" |
| 23 | 23 | "palletefile" "" |
| 24 | - "permitedownload" "sim" | |
| 25 | 24 | "ltempoformatodata" "" |
| 25 | + "permitedownload" "sim" | |
| 26 | 26 | "ltempoitemicone" "" |
| 27 | 27 | "CLASSESITEM" "ID" |
| 28 | 28 | "metaestat" "" |
| 29 | 29 | "CLASSESCOR" "COR" |
| 30 | - "ITENS" "CD_LEGENDA" | |
| 31 | 30 | "arquivodownload" "" |
| 32 | - "permitekml" "sim" | |
| 31 | + "ITENS" "CD_LEGENDA" | |
| 33 | 32 | "permiteogc" "sim" |
| 33 | + "permitekml" "sim" | |
| 34 | 34 | "TEMA" "_Teste de geração automática de classes em dados vetoriais" |
| 35 | 35 | "editorsql" "" |
| 36 | 36 | "ltempoitemfim" "" | ... | ... |