PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 22 → Wx Informatica - Aula 14 - WEBDEV Site com uma PAGE principal e diversas IPAGES
Wx Informatica - Aula 14 - WEBDEV Site com uma PAGE principal e diversas IPAGES
Débuté par BOLLER, 13 mar. 2018 11:01 - Aucune réponse
Membre enregistré
2 852 messages
Popularité : +89 (91 votes)
Posté le 13 mars 2018 - 11:01
Bom dia a todos

Estou hoje postando uma grande contribuição para a comunidade é um exemplo em Webdev que vai facilitar em muito a criação de sites e diminuir a quantidade de páginas a serem feitas facilitando assim a manutenção. O design da página ainda vou melhorar mas o esqueleto está simples e facil de entender.

Abaixo segue o video de como foi feito o projeto:



Aqui os fontes do Projeto:

http://repository.windev.com/publish.awp…

E aqui o código do projeto:

PÁGINA LOGIN
Procedure Login(user, senha)

ok is boolean = False

IF HReadSeek(t001_usuarios,t001_user,user,hIdentical) = True THEN

IF HFound(t001_usuarios) = True AND t001_usuarios.t001_password = senha

gnUserID = t001_usuarios.t001_usuario_ID

ok = True

END

END

RESULT ok





PÁGINA INDEX
Procedure AbrirIpage(Descricao, PaginaInterna)

IF PaginaInterna <> "" AND Descricao <> ""

DashDeleteAll(PAGE_Index.DASH_01)

gnIndWgt = DashAddWidget(PAGE_Index.DASH_01, PaginaInterna, Descricao)

PAGE_Index.DASH_01[gnIndWgt]..Visible = True

END



Procedure CriarMenu()

Pai is string

TreeDeleteAll(TREE_Menu)

QRY_MenusUsuario.ParamT001_usuario_ID = gnUserID

IF HExecuteQuery(QRY_MenusUsuario,MyConnHfsql,hQueryDefault+hQueryWithoutCorrection) = True THEN

FOR EACH QRY_MenusUsuario

IF HFound(QRY_MenusUsuario) = True THEN

IF QRY_MenusUsuario.t002_tipo_Menu = "Menu" THEN

Pai = QRY_MenusUsuario.t002_descricao

TreeAdd(TREE_Menu,QRY_MenusUsuario.t002_descricao)

ELSE IF QRY_MenusUsuario.t002_tipo_Menu = "SubMenu" THEN

TreeAdd(TREE_Menu, Pai +TAB+ QRY_MenusUsuario.t002_descricao)

END

END

END

ELSE
Error(ErrorInfo())
END



Procedure ExecutaBuscaMenu()

QRY_OpcaoMenu.Paramt002_descricao = gsDescricao

IF HExecuteQuery(QRY_OpcaoMenu,MyConnHfsql,hQueryDefault+hQueryWithoutCorrection) = True

FOR EACH QRY_OpcaoMenu

IF HFound(QRY_OpcaoMenu) = True AND QRY_OpcaoMenu.t002_internalwindow <> ""

//ToastDisplay("Tela a ser aberta: "+ QRY_OpcaoMenu.t002_internalwindow,toastLong,vaMiddle,haCenter)

gsIPageNome = QRY_OpcaoMenu.t002_internalwindow

ExecuteProcess(BTN_BotaoAbrirIpage,trtClick)

END

END

END



Procedure SelecionaMenu()

//Pega item do menu

gsDescricao = TreeSelect(TREE_Menu)

gsDescricao = ExtractString(gsDescricao,lastRank,TAB) // contabil tab livro razao

QRY_OpcaoMenu.Paramt002_descricao = gsDescricao // injector sql impossivel

IF HExecuteQuery(QRY_OpcaoMenu,MyConnHfsql,hQueryDefault+hQueryWithoutCorrection) = True

FOR EACH QRY_OpcaoMenu

IF HFound(QRY_OpcaoMenu) = True AND QRY_OpcaoMenu.t002_internalwindow <> ""

//ToastDisplay("Tela a ser aberta: "+ QRY_OpcaoMenu.t002_internalwindow,toastLong,vaMiddle,haCenter)

gsIPageNome = QRY_OpcaoMenu.t002_internalwindow

ExecuteProcess(BTN_BotaoAbrirIpage,trtClick)

END

END

END



GLOBAL DO PROJETO
HModifyStructure("*",hmsBackgroundTask)
HCreationIfNotFound("*","Senha")
GLOBAL
gnIndWgt is int = 0
gnUserID is 8 bytes int = 0
arrayBusca is array of 0 by 2 strings
gsDescricao, gsIPageNome is string



Query QRY_MenusUsuario
SELECT
t003_usuarioXmenus.t003_usuarioXmenus_ID AS t003_usuarioXmenus_ID,
t003_usuarioXmenus.t001_usuario_ID AS t001_usuario_ID,
t003_usuarioXmenus.t002_menus_ID AS t002_menus_ID,
t002_menus.t002_descricao AS t002_descricao,
t002_menus.t002_tipo_Menu AS t002_tipo_Menu,
t002_menus.t002_internalwindow AS t002_internalwindow,
t002_menus.t002_status AS t002_status,
t002_menus.t002_ordem AS t002_ordem,
t002_menus.t002_pai_menu AS t002_pai_menu
FROM
t002_menus,
t003_usuarioXmenus
WHERE
t002_menus.t002_menus_ID = t003_usuarioXmenus.t002_menus_ID
AND
(
t003_usuarioXmenus.t001_usuario_ID = {ParamT001_usuario_ID}
AND t002_menus.t002_status = 1
)
ORDER by
t002_ordem Asc


QUERY QRY_OpcaoMenu
SELECT
t002_menus.t002_menus_ID AS t002_menus_ID,
t002_menus.t002_descricao AS t002_descricao,
t002_menus.t002_tipo_Menu AS t002_tipo_Menu,
t002_menus.t002_internalwindow AS t002_internalwindow,
t002_menus.t002_status AS t002_status,
t002_menus.t002_ordem AS t002_ordem,
t002_menus.t002_pai_menu AS t002_pai_menu
FROM
t002_menus
WHERE
t002_menus.t002_descricao = {Paramt002_descricao}
AND t002_menus.t002_status = 1




ANALYSIS
-- Script généré par WEBDEV le 13/03/2018 07:01:02
-- Tables de l'analyse PagDashboard.wda
-- pour SQL générique (ANSI 92)

-- Création de la table t001_usuarios
CREATE TABLE "t001_usuarios" (
"t001_usuario_ID" NUMERIC(19,0) PRIMARY KEY ,
"t001_nome" VARCHAR(50) NOT Null UNIQUE ,
"t001_user" VARCHAR(20) NOT Null UNIQUE ,
"t001_password" VARCHAR(50) );

-- Création de la table t002_menus
CREATE TABLE "t002_menus" (
"t002_menus_ID" NUMERIC(19,0) PRIMARY KEY ,
"t002_descricao" VARCHAR(100) NOT Null UNIQUE ,
"t002_internalwindow" VARCHAR(100) ,
"t002_status" BIT ,
"t002_tipo_Menu" VARCHAR(20) ,
"t002_ordem" INTEGER ,
"t002_pai_menu" NUMERIC(19,0) );

-- Création de la table t003_usuarioXmenus
CREATE TABLE "t003_usuarioXmenus" (
"t003_usuarioXmenus_ID" NUMERIC(19,0) PRIMARY KEY ,
"T001_usuario_ID" NUMERIC(19,0) NOT Null ,
"T002_menus_ID" NUMERIC(19,0) NOT Null );
CREATE INDEX "WDIDX_t003_usuarioXmenus_T001_usuario_ID" ON "t003_usuarioXmenus" ("T001_usuario_ID");
CREATE INDEX "WDIDX_t003_usuarioXmenus_T002_menus_ID" ON "t003_usuarioXmenus" ("T002_menus_ID");
CREATE INDEX "WDIDX_t003_usuarioXmenus_t003_unico" ON "t003_usuarioXmenus" ("T001_usuario_ID","T002_menus_ID");

-- Création de la table t004_produtos
CREATE TABLE "t004_produtos" (
"t004_produtos_ID" NUMERIC(19,0) PRIMARY KEY ,
"t004_codbar" VARCHAR(30) ,
"t004_produto" VARCHAR(50) ,
"t004_estoquemin" NUMERIC(38,6) ,
"t004_valorunitaro" NUMERIC(38,6) ,
"t004_unidade" VARCHAR(3) ,
"t004_estoqueatual" NUMERIC(38,6) );
-- Contraintes d'intégrité
ALTER TABLE "t003_usuarioXmenus" Add FOREIGN KEY ("T001_usuario_ID") REFERENCES "t001_usuarios" ("t001_usuario_ID");
ALTER TABLE "t003_usuarioXmenus" Add FOREIGN KEY ("T002_menus_ID") REFERENCES "t002_menus" ("t002_menus_ID");



CODIGO FONTE DOWNLOAD

http://repository.windev.com/publish.awp…

:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Message modifié, 13 mars 2018 - 11:03