TWeb for mod Harbour is ready

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

TWeb for mod Harbour is ready

Postby Carles » Thu Apr 09, 2020 3:41 pm

Hi,

I have published the TWeb for mod Harbour, so that it can be freely used in your programs in a web environment.

The easiest way to create a web screen using our usual xBase syntax

A simple example of how to create a web form that makes a request to our server and that returns a response

https://54.37.60.33/htweb/tutor10.prg

The code that designs the browser screen

Code: Select all  Expand view  RUN
//  {% LoadHrb( 'lib/tweb/tweb.hrb' ) %}

#include {% TWebInclude() %}

function main()

    LOCAL o

    DEFINE WEB oWeb TITLE 'Tutor10' INIT

    DEFINE FORM o ID 'demo' 
       
        HTML o INLINE '<h3>Test MsgServer()</h3><hr>'

    INIT FORM o        
       
        GET ID 'myid'       VALUE '123' GRID 12 LABEL 'Id.' BUTTON 'GetId' ACTION 'GetId()' OF o           
   
        HTML o
       
            <script>
           
                function GetId() {             
                    var cId = $('#myid').val()
               
                    MsgServer( 'tutor10-server.prg', cId, PostCall )
                }
               
                function PostCall( data ) {            
                    MsgInfo( data )            
                }          
               
            </script>   
           
        ENDTEXT
       
    END FORM o 
   
retu nil 


And the part of the backend that is in the server and listens to our requests

Code: Select all  Expand view  RUN
function main()

    local hParam := AP_PostPairs()

    ?? 'Server time: ' + time() + '. Welcome ' +  hParam[ 'value' ]
   
retu nil
 


And this is the basis to be able to quickly and easily create our web pages using the new mod_harbour.

You can easily test, modify, run the examples until you can manage browsers.

https://54.37.60.33/htweb/tutor4b.prg

In this link you will have all the information and the different examples that are already operational

https://54.37.60.33/htweb/index_en.html


I invite everyone to try mod Harbour to be able to make the definitive leap to the web using our usual xBase. It has never been so easy to access the web with our beloved Harbour.

Any questions you can post on the mod-harbour forum -> -> https://forum.mod-harbour.org/viewforum.php?f=7

Enjoy it


Regards

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Taavi » Fri Apr 10, 2020 2:29 pm

Hello,
what could cause this error with tutor4.prg?

With the best,
Taavi.



Error: Syntax error "syntax error at '<'"
operation: line:8
called from: HB_COMPILEFROMBUF, line: 0
called from: ..\apache.prg, EXECUTE, line: 141
called from: ..\apache.prg, EXECINLINE, line: 323
called from: ..\apache.prg, INLINEPRG, line: 303
called from: C:/xampp/htdocs/tweb/lib/tweb/tweb.hrb, TWEBBROWSE:ACTIVATE, line: 212
called from: C:/xampp/htdocs/tweb/lib/tweb/tweb.hrb, TWEBFORM:ACTIVATE, line: 104
called from: pcode.hrb, MAIN, line: 63
called from: HB_HRBDO, line: 0
called from: ..\apache.prg, EXECUTE, line: 143

Source:
0001: function __Inline( ) local cHtml := "" local lMultiSelect := .F. local lSingleSelect := .F. local hCols := {<br>&nbsp;&nbsp;"last":<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;"head":&nbsp;"Last",<br>&nbsp;&nbsp;&nbsp;&nbsp;"width":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"sortable":&nbsp;false,<br>&nbsp;&nbsp;&nbsp;&nbsp;"align":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"formatter":&nbsp;""<br>&nbsp;&nbsp;},<br>&nbsp;&nbsp;"first":<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;"head":&nbsp;"First",<br>&nbsp;&nbsp;&nbsp;&nbsp;"width":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"sortable":&nbsp;false,<br>&nbsp;&nbsp;&nbsp;&nbsp;"align":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"formatter":&nbsp;""<br>&nbsp;&nbsp;},<br>&nbsp;&nbsp;"street":<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;"head":&nbsp;"Street",<br>&nbsp;&nbsp;&nbsp;&nbsp;"width":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"sortable":&nbsp;false,<br>&nbsp;&nbsp;&nbsp;&nbsp;"align":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"formatter":&nbsp;""<br>&nbsp;&nbsp;},<br>&nbsp;&nbsp;"age":<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;"head":&nbsp;"Age",<br>&nbsp;&nbsp;&nbsp;&nbsp;"width":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"sortable":&nbsp;false,<br>&nbsp;&nbsp;&nbsp;&nbsp;"align":&nbsp;"",<br>&nbsp;&nbsp;&nbsp;&nbsp;"formatter":&nbsp;""<br>&nbsp;&nbsp;}<br>}<br> local nWidth := 0 local n, cField, hDef IF lMultiSelect .OR. lSingleSelect cHtml += '<th data-field="st" data-checkbox="true"></th>' ENDIF FOR n := 1 TO Len(hCols) aField := HB_HPairAt( hCols, n ) cField := aField[1] hDef := aField[2] cHtml += '<th data-field="' + cField + '" ' cHtml += 'data-width="' + valtochar(hDef[ "width" ]) + '" ' cHtml += 'data-sortable="' + IF( hDef[ "sortable" ], "true", "false" ) + '" ' cHtml += 'data-align="' + hDef[ "align" ] + '" ' cHtml += 'data-formatter="' + hDef[ "formatter" ] + '" ' cHtml += ">" + hDef[ "head" ] + "</th>" NEXT retu cHtml
Taavi
 
Posts: 90
Joined: Mon Nov 21, 2005 10:29 am

Re: TWeb for mod Harbour is ready

Postby Carles » Sat Apr 11, 2020 8:46 am

Taavi,

It's strange. I just downloaded the repository and it works fine. What operating system do you have the mod installed on?

Do the other examples work well?

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Taavi » Sat Apr 11, 2020 9:10 am

Win10 + XAMPP + mod_harbour installed yesterday.


Other examples work ok , problem only with 4 and 4b
Taavi
 
Posts: 90
Joined: Mon Nov 21, 2005 10:29 am

Re: TWeb for mod Harbour is ready

Postby Carles » Sat Apr 11, 2020 9:42 am

Taavi,

Solved ! git pull and try again

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Taavi » Sat Apr 11, 2020 10:23 am

Thanks, Carles
samples working ok now here.

Do You have any docs in english for tWeb xbase commands?

Taavi.
Taavi
 
Posts: 90
Joined: Mon Nov 21, 2005 10:29 am

Re: TWeb for mod Harbour is ready

Postby Carles » Sat Apr 11, 2020 10:48 am

Taavi,

Not yet, I'm sorry and it's not in Spanish yet either. The reason is simple, we have a few documents of techniques carried out but that have not just been consolidated.

When we see that people are comfortable with some style of coding on the web, then we will create doc. At the moment you can review the examples, modify them, see all the source code, ... You can also see the file tweb.ch where there are the directives of all the elbow so far.

Hopefully this model can be well adapted to your needs and then we will try to create the doc. I think for the moment to be able to see the philosophy there is enough to be able to try it.

I hope you understand :-)

Thank you.
C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Taavi » Sun Apr 12, 2020 10:30 am

Helli Carles,
seems that with yesterday patch something went wrong with special characters.

If I insert special characrets in In tutor02.prg

GET ID 'myid' VALUE '123' GRID 4 LABEL 'Special characters ÄäÕõüÜ' PLACEHOLDER 'User Id.' BUTTON 'GetId' ACTION 'GetIdphone()' OF o

With yesterday patch In get in browser label /copy from browser screen/:

Special characters ������


With previous version I get correct characters in browser:

Special characters ÄäÕõüÜ

Taavi.
Taavi
 
Posts: 90
Joined: Mon Nov 21, 2005 10:29 am

Re: TWeb for mod Harbour is ready

Postby Carles » Sun Apr 12, 2020 11:00 am

Taavi,

Try save code with utf8 format and normal.

I will see the last changes
C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Carles » Sun Apr 12, 2020 4:41 pm

Taavi

I have created a forum post https://forum.mod-harbour.org/viewtopic.php?f=7&t=457 for your problem, explaining the charset topic (currently only in Spanish)

Basically, if you save your code with utf-8 format, you simply define the web as it is

DEFINE WEB oWeb TITLE 'Test CharSet - UTF8' INIT

But if you save your web (prg file) in ANSI format you should define it this way

DEFINE WEB oWeb TITLE 'Test CharSet - ANSI'
             oWeb: cCharset: = 'Latin-1'
INIT WEB oWeb

Try it and we comment


Remember ... Git pull
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Taavi » Wed Apr 15, 2020 6:13 pm

Thanks, characters seems to be ok now.

With latest git tutor3, 7 and 8 are giving errors.


Tutor 20 was really helpful, thanks.

Taavi
Taavi
 
Posts: 90
Joined: Mon Nov 21, 2005 10:29 am

Re: TWeb for mod Harbour is ready

Postby Carles » Wed Apr 15, 2020 6:15 pm

Taavi

Whats erors ?

What os and brwower ?

Thanks.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Carles » Thu Apr 16, 2020 6:45 am

Taavi,


Taavi wrote:With latest git tutor3, 7 and 8 are giving errors.


Solved !

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: TWeb for mod Harbour is ready

Postby Maurizio » Wed May 06, 2020 8:36 am

Hello Charly

I have Apache24 + mod_harbour windows x64 no installation

now I would like to try TWEB

can you help me how to install and configure TWEB?

Maurizio
User avatar
Maurizio
 
Posts: 826
Joined: Mon Oct 10, 2005 1:29 pm

Re: TWeb for mod Harbour is ready

Postby Carles » Wed May 06, 2020 10:10 am

Hi Maurizio,

I assume you have mod harbour installed and it is working correctly.

Installing TWeb is very easy.

You just have to download tweb (or make a git clone) from https://github.com/carles9000/tweb . By default you can install it in htdocs\tweb. Once this is done you go to the browser and type localhost/tweb/tutor.prg

If the version of TWeb appears on the screen, the system is ready. Otherwise something in your configuration would have to be revised

In case the system works, check all the tutorxxx files to see the different possibilities
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1141
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Next

Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 1 guest