mod_harbour code snippets

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

mod_harbour code snippets

Postby Antonio Linares » Mon Aug 05, 2019 3:24 pm

Code: Select all  Expand view  RUN
function Main()

   local n
   
   ? __DYNSCOUNT(), "symbols"
   
   for n = __DYNSCOUNT() to 1 step -1
      ? __DYNSCOUNT() - n + 1, __DYNSGETNAME( n )
   next  
   
   ? "<" + "script>$('#result').css('overflow', 'auto');<" + "/script>"

return nil
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Wed Aug 07, 2019 12:02 pm

Code: Select all  Expand view  RUN
#xcommand DO <prg> => _Do( <prg> )

function Main()

   DO "info.prg"

return nil

function _Do( cFileName )

   cFileName = hb_GetEnv( "PRGPATH" ) + "/../" + cFileName

return AP_RPuts( If( File( cFileName ), Execute( MemoRead( cFileName ) ),;
                 "File not found " + cFileName ) )
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Wed Aug 07, 2019 12:04 pm

Code: Select all  Expand view  RUN
#xcommand DO <prg> => _Do( <prg> )
#xcommand CLEAR => ClearResult()

function Main()

   CLEAR
   // DO "info.prg"

return nil

function _Do( cFileName )

   cFileName = hb_GetEnv( "PRGPATH" ) + "/../" + cFileName

return AP_RPuts( If( File( cFileName ), Execute( MemoRead( cFileName ) ),;
                 "File not found " + cFileName ) )
                 
function ClearResult()

return "<" + "script>$('#result').html( '' );<" + "/script>"
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Wed Aug 07, 2019 1:36 pm

Code: Select all  Expand view  RUN
function Main()

   Popup( "Hello world", "Using Popups" )

return nil

function Popup( cMsg, cTitle )

   DEFAULT cTitle TO "Popups"

return AP_RPuts( "<" + "script>MsgMemo( '" + cMsg + "','" + cTitle + "');<" + "/script>" )
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Wed Aug 07, 2019 2:26 pm

Code: Select all  Expand view  RUN
function Main()

   MsgInfo( "Hello world", "move me with the mouse" )

return nil

function MsgInfo( cMsg, cTitle )

   DEFAULT cTitle TO "Popups"

return AP_RPuts( "<" + "script>MsgInfo( '" + cMsg + "','" + cTitle + "');<" + "/script>" )
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Wed Aug 07, 2019 3:42 pm

Code: Select all  Expand view  RUN
function Main()

   Alert( "ok" )

return nil

function Alert( cMsg )

return AP_RPuts( "<" + "script>alert( '" + cMsg + "' );<" + "/script>" )
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Wed Aug 07, 2019 5:26 pm

Code: Select all  Expand view  RUN
function Main()

   Popup( _Do( "info.prg" ), "info.prg" )

return nil

function Popup( cMsg, cTitle )

return AP_RPuts( "<" + "script>RunCode( '" + cMsg + "');MsgMemo('','" + ;
                 cTitle + "', true );<" + "/script>" )

function _Do( cFileName )

   cFileName = hb_GetEnv( "PRGPATH" ) + "/../" + cFileName

return If( File( cFileName ), HB_BASE64ENCODE( MemoRead( cFileName ) ),;
           "File not found " + cFileName )
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Mon Aug 12, 2019 5:43 am

Review all code snippets:
Code: Select all  Expand view  RUN
function Main()

   local cCode

   USE ( hb_GetEnv( "PRGPATH" ) + "/snippets" ) SHARED NEW
   
   ? "<" + "script>$( '#result' ).css( 'overflow', 'auto' );<" + "/script>"

   while ! Eof()
      ? "<" + "font color='red'>id: " + Field->Id + "<" + "/font>"
      ?
      cCode = Field->Code
      cCode = StrTran( cCode, CRLF, "<" + "br>" )
      cCode = StrTran( cCode, " ", "&" + "nbsp;" )
      cCode = StrTran( cCode, "<" + "d", "<" + " " + "d" )
      ? cCode
      ? "<" + "hr>"
      SKIP
   end
   
   USE

return nil
regards, saludos

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

Re: mod_harbour code snippets

Postby Antonio Linares » Sat Aug 17, 2019 12:23 pm

Code: Select all  Expand view  RUN
function Main()

   MsgGet( "number:  ", "Goto line" )

return nil

function MsgGet( cLabel, cTitle )

return AP_RPuts( "<" + "script>MsgGet('" + cLabel + "','" + cTitle + "')<" + "/script>" )
regards, saludos

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


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 8 guests

cron