can someone explain to me what is mod_harbour?

can someone explain to me what is mod_harbour?

Postby MGA » Tue Jul 23, 2019 1:52 pm

Please,
can someone explain to me what is mod_harbour?
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1253
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: can someone explain to me what is mod_harbour?

Postby Antonio Linares » Tue Jul 23, 2019 3:49 pm

Ubiratan,

Have you ever wished to use Harbour to build apps for the web ? :-)

That is exactly mod_harbour

mod_harbour is an extension module for Apache that allows you to run PRGs directly on the web, without having to build EXEs, etc.

You simply install mod_harbour on an Apache server (running locally on your computer or on a remote PC) and you start running your PRGs on the web !!!

Next, you need to understand how to develop web apps but, don't worry, we provide lots of examples so you can quick start using it

Please review this live demo built using mod_harbour (pure Harbour!)
https://harbour.fourtech.es/modharbour_samples/genesis/index.prg

Finally, mod_harbour is totally free and open source. Wow !!! :-D
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: can someone explain to me what is mod_harbour?

Postby MGA » Tue Jul 23, 2019 6:27 pm

thanks :D
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1253
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: can someone explain to me what is mod_harbour?

Postby Marc Venken » Sun Jul 28, 2019 12:40 pm

Antonio,

So it is easy to show as example Customer.dbf from sample's on the web in a xbrowse now ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: can someone explain to me what is mod_harbour?

Postby Marc Venken » Sun Jul 28, 2019 1:14 pm

Looking into Genesis.

We need php code to do the job right ?

In fact, you use prg directly, but it would be the same as using files in .php like before ?

At this moment it is not so that Xbrowse will become a single line call in Mod_harbour like Xbrowser("customer")
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: can someone explain to me what is mod_harbour?

Postby Marc Venken » Sun Jul 28, 2019 2:28 pm

Ok, I found the source code of Genesis, and mutch more is clear now.

Php is needed !

Maybe FWH can build the php code from xbrowse in the near future... (a Xbrowse light version)
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: can someone explain to me what is mod_harbour?

Postby Antonio Linares » Sun Jul 28, 2019 4:40 pm

Marc,

PHP is NOT needed at all. We only use Harbour PRG code !!!

thats the beauty of it :-)

1. Have you installed Apache on your Windows or Xampp on your Windows ?
2. Have you properly installed mod_harbour ?

Please read this and follow the steps:
viewtopic.php?p=223785#p223785
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: can someone explain to me what is mod_harbour?

Postby Marc Venken » Sun Jul 28, 2019 7:14 pm

Antonio Linares wrote:Marc,

PHP is NOT needed at all. We only use Harbour PRG code !!!

thats the beauty of it :-)

1. Have you installed Apache on your Windows or Xampp on your Windows ?
2. Have you properly installed mod_harbour ?

Please read this and follow the steps:
viewtopic.php?p=223785#p223785


But the source is using PHP to build the table.

I use the same technique to build a php file from fwh and upload that php file to the server. I'm missing the logic and/or advantages right now. What i'm missing that Mod_harbour is doing better ?


Code: Select all  Expand view  RUN

function BuildBrowse( cTableName )

   local cHtml := "", n, nRow := 0

   USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cTableName ) SHARED NEW

   if ! Empty( GetAction() ) .and. GetAction() == "add"
      APPEND BLANK
      GO TOP
   endif  

   if ! Empty( GetAction() ) .and. GetAction() == "del"
      USE
      USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cTableName ) NEW
      DbGoTo( GetVal1() )
      DELETE
      PACK
      USE
      USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cTableName ) SHARED NEW
      GO TOP
   endif

   if ! Empty( GetAction() ) .and. GetAction() == "search"
      SET FILTER TO Upper( GetParam1() ) $ Upper( DBRECORDINFO( 7 ) )
      GO TOP
      nVal1 = 20
   endif  

   if GetVal2() != 0
      DbSkip( GetVal2() )
   endif  

   cHtml += '<table id="browse" class="table table-striped table-hover;"">' + CRLF
   cHtml += '<thead>' + CRLF
   cHtml += '<tr>' + CRLF
   cHtml += '<th scope="col">#</th>' + CRLF

   for n = 1 to FCount()
      cHtml += '<th scope="col">' + FieldName( n ) + '</th>' + CRLF
   next

   cHtml += '<th scope="col">ACTIONS</th>' + CRLF

   cHtml += '</tr>' + CRLF
   cHtml += '</thead>' + CRLF
   cHtml += '<tbody>' + CRLF

   while ! Eof() .and. nRow < GetVal1()
      cHtml += "<tr>" + CRLF
      cHtml += '<th scope="row">' + AllTrim( Str( RecNo() ) ) + "</th>" + CRLF
     
      for n = 1 to FCount()
         do case
            case FieldType( n ) == "M"
               cHtml += '<td>' + If( "</" $ FieldGet( n ), "...", SubStr( FieldGet( n ), 1, 20 ) ) + CRLF
               if ! "</" $ FieldGet( n )
                  cHtml += '<button onclick="MsgInfo(' + "'" + ;
                           StrTran( FieldGet( n ), Chr( 13 ) + Chr( 10 ), "<br>" ) + "', '" + ;
                           FieldName( n ) + "');" + '"' + ;
                           ' type="button" class="btn btn-primary"' + CRLF
                  cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
                  cHtml += '<i class="fas fa-eye"' + ;
                           ' style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
                  cHtml += '</i>View</button>' + CRLF
               endif  
               if FieldName( n ) == "CODE"
                  cHtml += '<button onclick="location.href=' + "'index.prg?" + Lower( Alias() ) + ":exec:" + ;
                           AllTrim( Str( RecNo() ) ) + "';" + ;
                           '" type="button" class="btn btn-primary"' + CRLF
                           cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
                           cHtml += '<i class="fas fa-flash"' + ;
                                    'style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
                  cHtml += '</i>Exec</button>' +  "</td>" + CRLF
               else
                  cHtml += "</td>" + CRLF                
               endif  
                       
            case FieldType( n ) == "L"
               cHtml += '<td><input type="checkbox" onclick="return false;"' + ;
                        If( FieldGet( n ), "checked", "" ) + "></td>" + CRLF

            otherwise
               cHtml += '<td>' + ValToChar( FieldGet( n ) ) + "</td>" + CRLF  
               if FieldType( n ) == "C" .and. "." $ FieldGet( n )
                  // if File( hb_GetEnv( "PRGPATH" ) + FieldGet( n ) )
                     cHtml += '<td><img src="' + hb_GetEnv( "DOCUMENT_ROOT" ) + ;
                              AllTrim( FieldGet( n ) ) + ;
                              '" style="width:50px;border-radius:50%;"></td>' + CRLF
                  // endif
               endif      
         endcase  
      next

      cHtml += '<td>' + CRLF
      cHtml += '<button onclick="Edit(' + AllTrim( Str( RecNo() ) ) + ');"' + ;
               ' type="button" class="btn btn-primary"' + CRLF
      cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
      cHtml += '<i class="fas fa-edit" style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
      cHtml += '</i>Edit</button>' + CRLF
      cHtml += '<button onclick="Delete(' + AllTrim( Str( RecNo() ) ) + ');"' + ;
               ' type="button" class="btn btn-primary"' + CRLF
      cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
      cHtml += '<i class="fas fa-trash" style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
      cHtml += '</i>Delete</button>' + CRLF
      cHtml += '</td>' + CRLF

      SKIP
      nRow++
   end

   cHtml += '</tbody>' + CRLF
   cHtml += '</table>' + CRLF

   cHtml += "<hr>" + CRLF
   cHtml += '<div class="row" style="padding-left:15px">' + CRLF
   cHtml += '<div class="col-sm-3">' + CRLF
   cHtml += "Showing records " + AllTrim( Str( Max( GetVal2() + 1, 1 ) ) ) + " - " + ;
            AllTrim( Str( RecNo() - 1 ) ) + " / Total: " + AllTrim( Str( RecCount() ) ) + "</div>" + CRLF
   cHtml += '<div class="col-sm-1"></div>' + CRLF        

   if RecCount() > nRow
      cHtml += '<div class="col-sm-3 btn-group" style="height:50px;">' + CRLF
      cHtml += '   <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
               AllTrim( Str( 0 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor1()}};">' + ;
               '<i class="fas fa-angle-double-left" style="color:white;padding-right:15px;font-size:18px;"></i>First</button>' + CRLF
      cHtml += '   <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
               AllTrim( Str( RecNo() - 41 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor2()}};">' + ;
               '<i class="fas fa-angle-left" style="color:white;padding-right:15px;font-size:18px;"></i>Prev</button>' + CRLF
      cHtml += '   <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
               AllTrim( Str( RecNo() - 1 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor2()}};">Next' + ;
               '<i class="fas fa-angle-right" style="color:white;padding-left:15px;font-size:18px;"></i></button>' + CRLF
      cHtml += '   <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
               AllTrim( Str( RecCount() - 20 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor1()}};">Last' + ;
               '<i class="fas fa-angle-double-right" style="color:white;padding-left:15px;font-size:18px;"></i></button>' + CRLF
      cHtml += '</div>' + CRLF
   endif              

   cHtml += "</div>" + CRLF + "</div>" + CRLF + "</div>" + CRLF

   USE

return cHtml
 


// 1. Have you installed Apache on your Windows or Xampp on your Windows ?

No, I generaly use dreamweaver to edit the php files offline and put them back online to the server. Also for testing..

// 2. Have you properly installed mod_harbour ?

Not yet. The installation seems not that easy, but I will look into it after seeing some more samples.

I simple would like a database to show data online. I can do it in php, but looking for a sample from Harbour. (the index.prg sample is using also PHP) but maybe I'm missing parts of way Mod is working.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: can someone explain to me what is mod_harbour?

Postby cnavarro » Sun Jul 28, 2019 7:21 pm

Marc Venken wrote:...I can do it in php, but looking for a sample from Harbour. (the index.prg sample is using also PHP) but maybe I'm missing parts of way Mod is working.


Sorry, what is the index.prg file that php uses?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: can someone explain to me what is mod_harbour?

Postby Antonio Linares » Sun Jul 28, 2019 7:31 pm

Marc,

The generated code is HTML. Thats the web language plus css and javascript.

With mod_harbour you don't have to build an EXE. The PRGs directly run from the web server.

That turns Harbour into a web development language, in the same level as php, python, asp, etc

When you get the mod_harbour concept and test it for yourself, then you will realize the enormous difference this means.

We are organizing a mod_harbour seminar in Otto's Hotel. You should come :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: can someone explain to me what is mod_harbour?

Postby Marc Venken » Sun Jul 28, 2019 7:45 pm

cnavarro wrote:
Marc Venken wrote:...I can do it in php, but looking for a sample from Harbour. (the index.prg sample is using also PHP) but maybe I'm missing parts of way Mod is working.


Sorry, what is the index.prg file that php uses?


It is not using php, but it is generating html code (needed for web).

It is somewhat like using php files that also creates html files in order to work on the web.

As I think now, Mod_Harbour is also a way of programming web apps. Users that know Harbour well will benifid surely of the new development.
I had the wrong idea that it was possible now to use fwh programs the normal way and they would become web ready...

But I think that it will be possible in the future that a code like

xbrowser("customer")

will generate the table in html and execute well on the web

I will surely folow the genesis project.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: can someone explain to me what is mod_harbour?

Postby Otto » Mon Jul 29, 2019 11:38 am

Hello Marc,

for a quick test:
Please add these lines to GENESIS in menu.view
Image
That's all. WOW.

Best reards,
Otto


Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: can someone explain to me what is mod_harbour?

Postby Massimo Linossi » Mon Jul 29, 2019 4:07 pm

Otto,
What you have done is really great. I'm making some progress using mod_harbour and with the big help of Antonio
I can now connect with Advantage Database Server. The browses and the selects are like rockets.
And the html code is built and optimized with Bootstrap. So all the forms are compatible with different screen sizes.
I found the Bootstrap Studio https://bootstrapstudio.io that can help to build fantastic forms.
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: can someone explain to me what is mod_harbour?

Postby Otto » Mon Jul 29, 2019 4:29 pm

Massimo,
I bought bootstrapstudio myself.
mod harbour opens up perspectives I did not even dare to think about.

Unfortunately I have a few other jobs to complete and can therefore only use little time for mod harbor at the moment .
I did some ASP programming 15 years ago. This helps me now. But with Harbour at the backend we are ready to go.
But I think I can start the first project in 14 days.
Maybe you come to visit me.
Sincerely
Otto
https://www.bergland.info
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: can someone explain to me what is mod_harbour?

Postby Massimo Linossi » Mon Jul 29, 2019 4:34 pm

Otto,
I wish to come to visit you. Maybe at the end of summer.
We are not so far and I've been a lot of times to ski near your place, many many years ago.
Have a nice evening
Massimo
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests