Commit 7e293c196650e29557d7c650a2474eec45f56dee
1 parent
e10cc0c8
Exists in
master
and in
7 other branches
Atualização do programa de criação do banco de dados de administração
Showing
4 changed files
with
26 additions
and
22 deletions
Show diff stats
admin/php/criabanco.php
| ... | ... | @@ -46,10 +46,6 @@ |
| 46 | 46 | |
| 47 | 47 | i3geo/admin/php/criabanco.php |
| 48 | 48 | */ |
| 49 | - /** | |
| 50 | - * | |
| 51 | - * TODO verificar se as tabelas estao corretas em funcao do sistema de administracao e incluir o login e senha | |
| 52 | - */ | |
| 53 | 49 | $funcao = ""; |
| 54 | 50 | //echo __DIR__; |
| 55 | 51 | include("admin.php"); |
| ... | ... | @@ -75,10 +71,26 @@ |
| 75 | 71 | "CREATE TABLE ".$esquemaadmin."i3geoadmin_n3 (publicado TEXT, ordem NUMERIC, id_n2 NUMERIC, id_n3 INTEGER PRIMARY KEY, id_tema NUMERIC, n3_perfil TEXT)", |
| 76 | 72 | "CREATE TABLE ".$esquemaadmin."i3geoadmin_comentarios (comentario TEXT, data TEXT, openidnome TEXT, openidimagem TEXT, openidservico TEXT, openidusuario TEXT, openidurl TEXT, id_tema NUMERIC)", |
| 77 | 73 | "CREATE TABLE ".$esquemaadmin."i3geousr_usuarios (ativo NUMERIC, data_cadastro TEXT, email TEXT, id_usuario INTEGER PRIMARY KEY, login TEXT, nome_usuario TEXT, senha TEXT)", |
| 78 | - "CREATE TABLE ".$esquemaadmin."i3geousr_papelusuario (papel_id NUMERIC, usuario_id NUMERIC)", | |
| 74 | + "CREATE TABLE ".$esquemaadmin."i3geousr_papelusuario (id_papel NUMERIC, id_usuario NUMERIC)", | |
| 79 | 75 | "CREATE TABLE ".$esquemaadmin."i3geousr_papeis (descricao TEXT, id_papel INTEGER PRIMARY KEY, nome TEXT)", |
| 80 | 76 | "CREATE TABLE ".$esquemaadmin."i3geousr_operacoes (id_operacao INTEGER PRIMARY KEY, codigo TEXT, descricao TEXT)", |
| 81 | - "CREATE TABLE ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao NUMERIC, id_papel NUMERIC)" | |
| 77 | + "CREATE TABLE ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao NUMERIC, id_papel NUMERIC)", | |
| 78 | + "CREATE TABLE ".$esquemaadmin."i3geousr_grupousuario (id_usuario NUMERIC, id_grupo NUMERIC)", | |
| 79 | + "CREATE TABLE ".$esquemaadmin."i3geousr_grupotema (id_grupo NUMERIC, id_tema NUMERIC)", | |
| 80 | + "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT)", | |
| 81 | + "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao integer primary key,bancodedados text,host text,porta text,usuario text,senha text)", | |
| 82 | + "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)", | |
| 83 | + "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao integer primary key,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | |
| 84 | + "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo integer primary key,nome text,descricao text)", | |
| 85 | + "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida integer primary key,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | |
| 86 | + "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel integer primary key,nome text,descricao text)", | |
| 87 | + "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)", | |
| 88 | + "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao integer primary key,nome text,id_medida_variavel integer,observacao text)", | |
| 89 | + "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)", | |
| 90 | + "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo integer primary key,titulo text unique,link text)", | |
| 91 | + "create table ".$esquemaadmin."i3geoestat_fonteinfo_medida(id_medida_variavel integer not null,id_fonteinfo integer not null)", | |
| 92 | + "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link integer primary key)", | |
| 93 | + "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)" | |
| 82 | 94 | ); |
| 83 | 95 | if($conexaoadmin == ""){ |
| 84 | 96 | if(empty($_POST["senha"]) || empty($_POST["usuario"])){ |
| ... | ... | @@ -111,7 +123,7 @@ |
| 111 | 123 | echo "<br>Arquivo admin/metaestat.db ja existe. Vc deve apagá-lo para poder criá-lo novamente caso precise"; |
| 112 | 124 | } |
| 113 | 125 | else{ |
| 114 | - //TODO nao funciona | |
| 126 | + //FIXME nao funciona | |
| 115 | 127 | //if(function_exists("SQLite3")){ |
| 116 | 128 | //cria o banco de dados de metadados estatisticos |
| 117 | 129 | //$banco = new SQLite3("../../admin/metaestat.db",SQLITE3_OPEN_CREATE); |
| ... | ... | @@ -141,7 +153,9 @@ |
| 141 | 153 | $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')"); |
| 142 | 154 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')"); |
| 143 | 155 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')"); |
| 156 | + | |
| 144 | 157 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',1,'admin','admin','admin')"); |
| 158 | + | |
| 145 | 159 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)"); |
| 146 | 160 | |
| 147 | 161 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')"); |
| ... | ... | @@ -159,6 +173,9 @@ |
| 159 | 173 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')"); |
| 160 | 174 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')"); |
| 161 | 175 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')"); |
| 176 | + $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('16', 'admin/php/editortexto', 'editor de textos para edicao de mapfiles')"); | |
| 177 | + $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')"); | |
| 178 | + | |
| 162 | 179 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)"); |
| 163 | 180 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)"); |
| 164 | 181 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)"); |
| ... | ... | @@ -168,6 +185,8 @@ |
| 168 | 185 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)"); |
| 169 | 186 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)"); |
| 170 | 187 | $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)"); |
| 188 | + $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES ('16', '2')"); | |
| 189 | + | |
| 171 | 190 | $banco = null; |
| 172 | 191 | echo "Banco criado!!! administrador: admin / admin - não esqueça de alterar essa senha na opção de edição do cadastro de usuários"; |
| 173 | 192 | } | ... | ... |
admin/sql/operacoesusuario.sql
admin/sql/papeisoperacao.sql
admin/sql/usuarios_papeis.sql
| ... | ... | @@ -1,6 +0,0 @@ |
| 1 | -SELECT i3geoadmin_usuarios."id_usuario", i3geoadmin_usuarios."nome_usuario", | |
| 2 | - i3geoadmin_usuarios."data_cadastro", i3geoadmin_usuarios."email", i3geoadmin_papeis.id_papel | |
| 3 | - FROM | |
| 4 | - i3geoadmin_usuarios JOIN i3geoadmin_papelusuario ON | |
| 5 | - i3geoadmin_usuarios."id_usuario" = i3geoadmin_papelusuario."id_usuario" | |
| 6 | - JOIN i3geoadmin_papeis ON i3geoadmin_papelusuario."id_papel" = i3geoadmin_papeis."id_papel" |