FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour FiveWeb y Dolphin juntos!
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FiveWeb y Dolphin juntos!
Posted: Wed Apr 24, 2013 09:35 PM
Aqui teneis un primer ejemplo de uso conjunto de FiveWeb y Dolphin. Probado en Windows con xampp y en Linux (DreamHost):

http://www.fivetechsoft.net/cgi-bin/myapp1 (Linux en Dreamhost hosting service)

myapp1.prg
Code (fw): Select all Collapse
#include "FiveWeb.ch"

//----------------------------------------------------------------------------//

function Main( cParams )

聽 聽local aParams := If( cParams != nil, hb_aTokens( cParams, ":" ), nil )
聽 聽local cParam := If( aParams != nil, aParams[ 1 ], "" )

聽 聽SET BACKIMAGE TO "http://fiveweb.googlecode.com/svn/trunk/images/citynight.jpg"
聽 聽
聽 聽SetTheme( "flick" )
聽 聽
聽 聽do case
聽 聽 聽 case cParam == "login"
聽 聽 聽 聽 聽 聽CheckLogin( aParams )

聽 聽 聽 case cParam == "users"
聽 聽 聽 聽 聽 聽Users()

聽 聽 聽 case cParam == "clients"
聽 聽 聽 聽 聽 聽Clients()

聽 聽 聽 otherwise
聽 聽 聽 聽 聽 聽Login()

聽 endcase

return nil

//----------------------------------------------------------------------------//

function Login()

聽 聽local oDlg, oImg
聽 聽local oGetName, cUserName := Space( 30 )
聽 聽local oGetPass, cPassword := ""

聽 聽DEFINE DIALOG oDlg TITLE "Login" SIZE 650, 400

聽 聽@ 聽30, 聽30 IMAGE oImg FILENAME "../images/user.png" SIZE 120, 120 OF oDlg

聽 聽@ 聽69, 190 SAY "User" SIZE 110, 40 OF oDlg

聽 聽@ 124, 190 SAY "Password" SIZE 110, 40 OF oDlg

聽 聽@ 聽66, 315 GET oGetName VAR cUserName SIZE 300, 40 OF oDlg

聽 聽@ 124, 315 GET oGetPass VAR cPassword SIZE 300, 40 OF oDlg PASSWORD

聽 聽@ 265, 189 BUTTON "Ok" SIZE 110, 40 OF oDlg ;
聽 聽 聽 ACTION ( "document.location = '" + AppName() + "?login:' + " ) + ;
聽 聽 聽 聽 聽 聽 聽'oGetName.value + ":" + oGetPass.value'

聽 聽@ 265, 335 BUTTON "Cancel" SIZE 110, 40 OF oDlg ;
聽 聽 聽 ACTION ( oDlg:End() ) // Executed in the server in advance

聽 聽ACTIVATE DIALOG oDlg NOWAIT

return nil

//----------------------------------------------------------------------------//

function CheckLogin( aParams )

聽 聽// ? aParams[ 2 ] 聽username
聽 聽// ? aParams[ 3 ] 聽password 
聽 聽
聽 聽BuildMenu()

return nil

//----------------------------------------------------------------------------//

function BuildMenu()

聽 聽local oMenu
聽 聽
聽 聽MENU oMenu
聽 聽 聽 MENUITEM "About"
聽 聽 聽 MENU
聽 聽 聽 聽 聽MENUITEM "This app..." ;
聽 聽 聽 聽 聽 聽 ACTION MsgAbout( "My FiveWeb app", "(c) FiveTech Software" )
聽 聽 聽 ENDMENU
聽 聽 聽 
聽 聽 聽 MENUITEM "Files"
聽 聽 聽 MENU
聽 聽 聽 聽 聽MENUITEM "Users" ;
聽 聽 聽 聽 聽 聽 ACTION ( 'document.location = "' + AppName() + '?users"' ) 
聽 聽 聽 聽 聽 聽 
聽 聽 聽 聽 聽MENUITEM "Clients" ;
聽 聽 聽 聽 聽 聽 ACTION ( 'document.location = "' + AppName() + '?clients"' ) 
聽 聽 聽 ENDMENU
聽 聽 聽 
聽 聽 聽 MENUITEM "Operations"
聽 聽 聽 MENUITEM "Help"
聽 聽ENDMENU
聽 聽
return oMenu

//----------------------------------------------------------------------------//

function Users()

聽 聽local oDlg, oServer, oBrw
聽 聽
聽 聽BuildMenu()
聽 聽
聽 聽oServer = TDolphinSrv():New( "mysql.fivetechsoft.net", "fiveweb", "fiveweb" )

聽 聽if oServer:hMySQL == nil
聽 聽 聽 MsgInfo( "can't connect to the database" )
聽 聽 聽 return nil
聽 聽endif
聽 聽 聽 聽 聽
聽 聽oServer:SelectDB( "fiveweb" )
聽 聽
聽 聽DEFINE DIALOG oDlg TITLE "Users" SIZE 1000, 600
聽 聽
聽 聽@ 10, 10 BROWSE oBrw SIZE 900, 100 OF oDlg ;
聽 聽 聽 ARRAY oServer:Query( "SELECT * FROM users LIMIT 0, 30" )
聽 聽
聽 聽ACTIVATE DIALOG oDlg NOWAIT
聽 聽
聽 聽oServer:End()
聽 聽
return nil 聽 

//----------------------------------------------------------------------------//

function Clients()

聽 聽local oDlg, oServer, oBrw
聽 聽
聽 聽BuildMenu()
聽 聽
聽 聽oServer = TDolphinSrv():New( "mysql.fivetechsoft.net", "fiveweb", "fiveweb" )

聽 聽if oServer:hMySQL == nil
聽 聽 聽 MsgInfo( "can't connect to the database" )
聽 聽 聽 return nil
聽 聽endif
聽 聽 聽 聽 聽
聽 聽oServer:SelectDB( "fiveweb" )
聽 聽
聽 聽DEFINE DIALOG oDlg TITLE "Clients" SIZE 1200, 650
聽 聽
聽 聽@ 5, 2 BROWSE oBrw SIZE 1150, 100 OF oDlg ;
聽 聽 聽 ARRAY oServer:Query( "SELECT * FROM clients LIMIT 0, 30" )
聽 聽
聽 聽ACTIVATE DIALOG oDlg NOWAIT
聽 聽
聽 聽oServer:End()
聽 聽
return nil 聽 

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 120
Joined: Wed Mar 11, 2009 07:32 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 03:43 PM

que bonito

saludos

Benjamin Casarrubias Moreno
Cd. Obreg贸n, Sonora, M茅xico
chino72vale@hotmail.com
Fivewin 24.04, Harbour 3.3, xharbour 1.2.1, Fivelinux, Visual Estudio 2022
Oracle Api Rest, SDK Contpaq, Facturaci贸n Electr贸nica, XML DIOT 2025
Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 03:52 PM

Excelente, Antonio,
! Felicidades !
Para los que estamos ya familiarizados con Dolphin, nos gusta esto,

Como seria un ABC en FIVEWEB Y DOLPHIN?

Saludos.

Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 06:13 PM

Antonio,

Impresionante !

Felicidades.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 06:14 PM
Cesar,

En mi mensaje anterior est谩 publicado el c贸digo fuente y se puede ver que es muy simple la creaci贸n del browse:

1. Se conecta al servidor mysql:
oServer = TDolphinSrv():New( "mysql.fivetechsoft.net", "fiveweb", "fiveweb" )

2, Se selecciona la base de datos a usar:
oServer:SelectDB( "fiveweb" ) // casualmente la he llamado igual que el usuario "fiveweb"

3. Se realiza un query y el resultado se le d谩 al browse. La tabla usada es "users":
Code (fw): Select all Collapse
 聽 @ 10, 10 BROWSE oBrw SIZE 900, 100 OF oDlg ;
聽 聽 聽 ARRAY oServer:Query( "SELECT * FROM users LIMIT 0, 30" )

4. Se desconecta de la base de datos:
oServer:End()

Hay que entender que FiveWeb funciona cliente/servidor, luego cada vez que el usuario pide algo, se prepara y se le envia. ya implementaremos "sesiones" para que el servidor sepa con que usuario esta conversando :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 08:33 PM

Antonio, si se ve muy sencillo, gracias,

podriamos hacer una combinacion, FIVEWEB,DOLPHIN,PHP ?

es decir en la pantalla donde muestra el catalogo de usuarios o clientes

colocar un BOTON que ejecute un codigo PHP y con este dar de alta, consultar o modificar un u registro

y posteriormente refreascar el Browse. Es una idea,,

veo muy interesante esta combinacion ya que se puede usar FIVEWEB para darle una apariencia bonita

a nuestra APP. ya que en esta parte es donde normalmente los desarrolladores nos quejamos mucho,

y usar DOLPHIN, PHP para el manejo de nuestros datos.

saludos..

Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "
Posts: 1078
Joined: Thu Sep 27, 2007 03:47 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 08:39 PM

Antonio,

Excelente

Felicitdades

Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 08:42 PM

Cesar,

Al usar Dolphin la idea es que no nos haga falta usar PHP y que todo el c贸digo de nuestra aplicaci贸n se implemente en nuestros PRGs.

A煤n asi, FiveWeb permite usar PHP sin problemas. Aunque entendemos que muchos programadores lo que quieren es no tener que aprender otros lenguajes :-)

En el mundo web se pueden facilmente combinar datos que pueden proceder de or铆genes distintos, y FiveWeb permite esa capacidad.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 09:03 PM

Antonio

Excelente !!!

De acuerdo contigo, lo ideal es que no sea necesario usar mas que FiveWeb, claro con Harbour y en este caso con TDolphin para la conexi贸n MySQL, con eso deber铆a bastar, nuevamente felicitaciones ...

Desde mi punto de vista, ya se pueden realizar las consultas, faltar铆a poder imprimirlas, directamente o a PDF y seria genial, espero que a eso se apunte a futuro ...

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: FiveWeb y Dolphin juntos!
Posted: Thu Apr 25, 2013 10:25 PM

Deacuerdo Maestro,
ya vamos entendiendo un poco mas sobre las app.webs,
gracias.

Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: FiveWeb y Dolphin juntos!
Posted: Tue Apr 30, 2013 02:37 AM

Muy interesante realmente!!! Felicidades y gracias por el aporte!!
Antonio: Que versi贸n de FW necesitamos para poder tener FiveWeb, o es un producto aparte?
Gracias!

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FiveWeb y Dolphin juntos!
Posted: Tue Apr 30, 2013 05:52 AM

Cmsoft,

FiveWeb es un producto aparte de FiveWin, aunque en su sintaxis se parecen mucho :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: FiveWeb y Dolphin juntos!
Posted: Tue Apr 30, 2013 01:01 PM
Probando en LocalHost, no logro conectarme a la base de datos y obtengo el siguiente error:
Code (fw): Select all Collapse
FiveWeb error

Application 
=========== 
Path and name: C:\xampp\cgi-bin\myapp1.exe (32 bits) 
Time from start: 0 hours 0 mins 20 secs 
Error occurred at: 04/30/13, 06:53:53 
Error description: Error MYSQL/2013 
Lost connection to MySQL server at 'waiting for initial communication 
packet', system error: 0 

Stack Calls 
=========== 
Called from DOLPHIN_DEFERROR(2807) 
Called from TDOLPHINSRV:CHECKERROR(793) 
Called from TDOLPHINSRV:NEW(340) 
Called from USERS(109) 
Called from MAIN(19) 

Variables in use 
================ 
Procedure Type Value 
========================== 
DOLPHIN_DEFERROR 
Param 1: O Class: ERROR 
TDOLPHINSRV:CHECKERROR 
Param 1: O Class: TDOLPHINSRV 
Param 2: N 2013 
Param 3: L .F. 
Param 4: C "" 
Local 1: C "" 
Local 2: O Class: ERROR 
TDOLPHINSRV:NEW 
Local 1: N 2013 
Local 2: U nil 
Local 3: L .F. 
USERS 
Param 1: C "mysql.fivetechsoft.net" 
Param 2: C "fiveweb" 
Param 3: C "fiveweb" 
Local 1: N 3306 
Local 2: U nil 
Local 3: C "" 
Local 4: U nil 
Local 5: U nil 
Local 6: B {|| ... } 
MAIN 
Local 1: U nil 
Local 2: U nil 
Local 3: U nil 

Linked RDDs 
=========== 
DBF 
DBFFPT 
DBFBLOB 
DBFNTX 

DataBases in use 
================ 

Classes in use: 
=============== 
1 ERROR 
2 HBCLASS 
3 HBOBJECT 
4 TMENU 
5 TMENUITEM 
6 TDOLPHINSRV 

Memory Analysis 
=============== 
32 Static variables 

Dynamic memory consume: 
Actual Value: 0 bytes 
Highest Value: 0 bytes


Si coloco la direcci贸n directamente en el browser, si logro entrar a phpMyAdmin...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FiveWeb y Dolphin juntos!
Posted: Tue Apr 30, 2013 02:07 PM

Bayron,

La base de datos est谩 configurada para que solo se pueda acceder desde la aplicaci贸n que se ejecuta en dreamhost (el hosting en el que estamos publicando las demos de FiveWeb).

Consigues acceder a phpMyAdmin con la base de datos fiveweb ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: FiveWeb y Dolphin juntos!
Posted: Tue Apr 30, 2013 06:47 PM
Desde el navegador consegu铆a hacerlo escribiendo:
mysql.fivetechsoft.net
y luego autenticandome, pero eso ya cambi贸....

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...