diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e0a7c038b5..0a25344823 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +19990725-09:50 CET Felipe Coury + + tests/working/hscript/guestbk.ini; tests/working/hscript/guestbk.htm; + tests/working/hscript/guestbk.prg; tests/working/hscript/guestbk.txt; + tests/working/hscript/bldguest.bat; + Harbour guestbook added + + +19990725-09:45 CET Eddie Runia + * source/runner/runner.c + GPL text added + 19990726-09:45 Antonio Linares * source/rtl/natmsg/msguk.c * missing #include diff --git a/harbour/source/runner/runner.c b/harbour/source/runner/runner.c index 1bfe1a629c..6fc85f2de1 100644 --- a/harbour/source/runner/runner.c +++ b/harbour/source/runner/runner.c @@ -1,6 +1,27 @@ /* * $Id$ */ +/* + * Runner.c contains the .HRB object system + * + * Copyright(C) 1999 by Eddie Runia + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to: + * + * The Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include "pcode.h" diff --git a/harbour/tests/working/hscript/bldguest.bat b/harbour/tests/working/hscript/bldguest.bat new file mode 100644 index 0000000000..336fab0edd --- /dev/null +++ b/harbour/tests/working/hscript/bldguest.bat @@ -0,0 +1,14 @@ +@echo off + +..\..\bin\harbour guestbk /n +..\..\bin\harbour inifiles +..\..\bin\harbour testcgi + +echo -O2 -eguestbk.exe -I..\..\include ..\..\source\vm\hvm.c guestbk.c > b32.bc +echo inifiles.c testcgi.c >> b32.bc +echo ..\..\libs\b32\harbour.lib ..\..\libs\b32\terminal.lib >> b32.bc +echo ..\..\libs\b32\hbgt.lib ..\..\libs\b32\hbpp.lib >> b32.bc +bcc32 @b32.bc +del b32.bc + +guestbk diff --git a/harbour/tests/working/hscript/guestbk.htm b/harbour/tests/working/hscript/guestbk.htm new file mode 100644 index 0000000000..956e6b2527 --- /dev/null +++ b/harbour/tests/working/hscript/guestbk.htm @@ -0,0 +1,33 @@ + + +The Harbour Guestbook + + + + + + + + + + +
Harbour GuestBook Script
+
+
+
+ + + + + + +
Name:
City/State/Country:
E-Mail:
Homepage:
Comments:
+ 
+ +
+ + +
+<#Entries> + + diff --git a/harbour/tests/working/hscript/guestbk.ini b/harbour/tests/working/hscript/guestbk.ini new file mode 100644 index 0000000000..ccc19daa0b --- /dev/null +++ b/harbour/tests/working/hscript/guestbk.ini @@ -0,0 +1,60 @@ +; +; The Harbour Guestbook Script +; Copyright (C) 1999 Felipe G. Coury +; +; GUESTBK.INI - Script configuration file +; +; +; 1. Section [Header] +; +; This section defines the Guestbook fields and color look. +; DataFields= n is the number of fields on guestbook +; DataFieldn= defines the name of the nth field of guestbook +; EvenLine= color of even lines on guestbook +; OddLine= color of odd lines on guestbook +[Header] +DataFields=7 +DataField1=Name +DataField2=City +DataField3=State +DataField4=Country +DataField5=EMail +DataField6=Homepage +DataField7=Comments +EvenLine=#F0F0F0 +OddLine=#000000 + +; 2. Section [Format] +; Formats each guestbook entry. +; FormatLines= number of lines per entry +; FormatLinen= format of the nth line of the entry. You can +; use metatags for replacing its content with the +; correspondent field value. Ex.: +; Format1=Name: <#Name> +; Format2=<#URL> +; Formats one line with "Name:" and the content +; of the "Name" field in bold and the other +; with a link to the "URL" field. The fields +; within metatags must be defined in the [Header] +; section. In addition to those tags you can use +; <#DateTime> tag, which will be expanded to the +; entry date on the format "Month DD, YYYY". +[Format] +FormatLines=3 +Format1=<#Comments> +Format2=<#Name> <<#EMail>> +Format3=<#City>, <#State> <#Country> - <#DateTime> + +; 3. Section [Entries] +; This section is not a configuration section. The Guestbook itself controls +; it adding entries here. Should not be modified. +[Entries] +Entries=1 +Name1=Felipe G. Coury +City1=Campinas +State1=SP +Country1=Brazil +EMail1=fcoury@flexsys-ci.com +Homepage1=http://www.flexsys-ci.com +Comments1=This is Harbour Guestbook. Powered by Harbour. Leave your message after the beep!!!<g> +DateTime1=July 25, 1999 12:00:00 \ No newline at end of file diff --git a/harbour/tests/working/hscript/guestbk.prg b/harbour/tests/working/hscript/guestbk.prg new file mode 100644 index 0000000000..f0ae85a9d8 --- /dev/null +++ b/harbour/tests/working/hscript/guestbk.prg @@ -0,0 +1,143 @@ +/* + * $Id$ + * + Harbour Project source code + + This file contains source for a script of a Guestbook + + Copyright (C) 1999 Felipe G. Coury + www - http://www.harbour-project.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: + + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). + +*/ + +FUNCTION GuestMain() + + LOCAL oIni := TIniFile():New( "c:\inetpub\wwwroot\guestbk.ini" ) + LOCAL oHTML := THTML():New() + LOCAL aEntr := {} + LOCAL cOddColor, cEvenColor + LOCAL cCode, i, j, l, cField, nEntry, cColor + LOCAL aEntries, aLine, cLine + + oHTML:ProcessCGI() + + IF oHTML:QueryFields( "Oper" ) = "A" // Add Entry + + nEntry := oIni:ReadNumber( "Entries", "Entries", 0 ) + 1 + oIni:WriteNumber( "Entries", "Entries", nEntry ) + + // Reads all "Header" fields from CGI + FOR i := 1 TO oIni:ReadNumber( "Header", "DataFields", 0 ) + + cField := oIni:ReadString( "Header", "DataField"+ltrim(str(i)), "" ) + oIni:WriteString( "Entries", cField + ltrim(str(nEntry)), ; + strtran( strtran( oHTML:QueryFields( cField ), chr(10), "" ), chr(13), "
" ) ) + + NEXT + + // Write fields to .ini file + oIni:WriteString( "Entries", "DateTime" + ltrim(str(nEntry)), ; + cmonth( date() ) + " " + ltrim(str(day(date()))) + ", " + ; + ltrim(str(year(date()))) + " " + time() ) + + oIni:UpdateFile() + + oHTML:cContent := '' + ; + '' + + oHTML:ShowResult() + + ELSE + + // Sets the metahtml file + oHTML:SetHTMLFile( "c:\inetpub\wwwroot\guestbk.htm" ) + + // Retrieves odd and even entries color + cOddColor := oIni:ReadString( "Header", "OddColor", "#FFFFFF" ) + cEvenColor := oIni:ReadString( "Header", "EvenColor", "#F0F0F0" ) + + cCode := "" + i := oIni:ReadNumber( "Entries", "Entries", 0 ) + + aEntries := {} + + // Preprocess entries and stores in aEntries + DO WHILE i > 0 + + + aLine := {} + + FOR j := 1 TO oIni:ReadNumber( "Header", "DataFields", 0 ) + + cField := oIni:ReadString( "Header", "DataField" + ltrim( str(j) ), "" ) + aadd( aLine, { cField, ; + oIni:ReadString( "Entries", cField + ltrim( str(i) ), "" ) } ) + + NEXT + + aadd( aEntries, aLine ) + + i-- + + ENDDO + + cCode := "" + + // Formats each line according to the INI file + FOR i := 1 TO len( aEntries ) + + cCode += "" + chr(13) + chr(10) + cColor := if( Mod( i, 2 ) == 0, cEvenColor, cOddColor ) + + FOR j := 1 TO oIni:ReadNumber( "Format", "FormatLines", 0 ) + + cCode += "" + chr(13)+chr(10) + + NEXT + + cCode += "
" + + cLine := oIni:ReadString( "Format", "Format" + ltrim(str(j)), "" ) + FOR l := 1 TO len( aEntries[i] ) + cLine := strtran( cLine, "<#" + aEntries[i,l,1] + ">", ; + aEntries[i,l,2] ) + NEXT + + cLine := strtran( cLine, "<#DateTime>", ; + oIni:ReadString( "Entries", "DateTime" + ltrim(str(len(aEntries)-i+1)), "" ) ) + + cCode += cLine + "
" + chr(13)+chr(10) + + NEXT + + // Generates the output + oHTML:AddReplaceTag( "Entries", cCode ) + oHTML:Generate() + oHTML:ShowResult() + + ENDIF + + RETURN( NIL ) diff --git a/harbour/tests/working/hscript/guestbk.txt b/harbour/tests/working/hscript/guestbk.txt new file mode 100644 index 0000000000..da5a97367c --- /dev/null +++ b/harbour/tests/working/hscript/guestbk.txt @@ -0,0 +1,24 @@ +Harbour Guestbook +Felipe Coury + + +How to create and test the Harbour Guestbook + +You'll find BLDGUEST.BAT, GUESTBK.PRG, GUESTBK.HTM and +GUESTBK.HTM files. To build the executable, review +GUESTBK.PRG and check the directories for locating +GUESTBK.INI and GUESTBK.HTM correctly. + +With that done, build it using BLDGUEST.BAT. Put the +resulting EXE, the INI and HTM files on a script- +enabled directory and call GUESTBK.EXE via WebBrowser. + +The best thing about this guestbook is its highly +configurable architecture. Please review GUESTBK.INI +for configuration options and further explanation. + +That's it !!! + +PS: If you don't have a WebServer, I will be pleased to +demonstrate it to you. Just contact me via ICQ, my +UIN is #19504786. Thanks!!!