see changelog

This commit is contained in:
Eddie Runia
1999-07-26 08:06:11 +00:00
parent 288e3e7234
commit e14654d0d4
7 changed files with 306 additions and 0 deletions

View File

@@ -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 <eddie@runia.com>
* source/runner/runner.c
GPL text added
19990726-09:45 Antonio Linares <alinares@fivetech.com>
* source/rtl/natmsg/msguk.c
* missing #include <hbdefs.h>

View File

@@ -1,6 +1,27 @@
/*
* $Id$
*/
/*
* Runner.c contains the .HRB object system
*
* Copyright(C) 1999 by Eddie Runia <eddie@runia.com>
*
* 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"

View File

@@ -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

View File

@@ -0,0 +1,33 @@
<HTML>
<HEAD>
<TITLE>The Harbour Guestbook</TITLE>
<META NAME="Generator" CONTENT="EditPlus 1.2">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<!-- Harbour Guestbook Webpage -->
<!-- Copyright (C) 1999 by Felipe G. Coury -->
<BODY BGCOLOR="#FFFFFF">
<FONT FACE="Tahoma">
<CENTER><B>Harbour GuestBook Script</B></CENTER>
<HR>
<CENTER>
<FORM NAME="GuestBook" ACTION="/cgi-bin/guestbk.exe" METHOD="GET">
<TABLE>
<TR><TD><FONT SIZE=2><B>Name:</B></TD><TD><INPUT NAME="Name" TYPE="text" SIZE="60"></TD></TR>
<TR><TD><FONT SIZE=2><B>City/State/Country:</TD><TD><INPUT NAME="City" TYPE="text" SIZE="20"><INPUT NAME="State" TYPE="text" SIZE="20"><INPUT NAME="Country" TYPE="text" SIZE="20"></TD></TR>
<TR><TD><FONT SIZE=2><B>E-Mail:</TD><TD><INPUT NAME="EMail" TYPE="text" SIZE="30"></TD></TR>
<TR><TD><FONT SIZE=2><B>Homepage:</TD><TD><INPUT NAME="Homepage" TYPE="text" SIZE="40"></TD></TR>
<TR><TD valign="TOP"><FONT SIZE=2><B>Comments:</TD><TD><TEXTAREA NAME="Comments" ROWS="5" COLS="60"></TEXTAREA></TD></TR>
</TABLE>
<INPUT TYPE="Submit" VALUE=" Submit Entry ">&nbsp;<INPUT TYPE="Reset" VALUE=" Reset Data "><BR>
<INPUT TYPE="Hidden" NAME="Oper" VALUE="A">
</CENTER>
<IMG SRC="http://www.flexsys-ci.com/harbour-project/images/hscbtn.gif">
</FORM>
<HR>
<#Entries>
</BODY>
</HTML>

View File

@@ -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> n is the number of fields on guestbook
; DataFieldn=<fieldname> defines the name of the nth field of guestbook
; EvenLine=<color> color of even lines on guestbook
; OddLine=<color> 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=<n> number of lines per entry
; FormatLinen=<format> format of the nth line of the entry. You can
; use metatags for replacing its content with the
; correspondent field value. Ex.:
; Format1=Name: <B><#Name></B>
; Format2=<A HREF="<#URL>"><#URL></A>
; 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=<B><#Comments></B>
Format2=<A HREF="<#Homepage>"><#Name></A> &lt;<A HREF="mailto:<#EMail>"><#EMail></A>>
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!!!&ltg>
DateTime1=July 25, 1999 12:00:00

View File

@@ -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), "<BR>" ) )
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 := '<HTML><HEAD><META HTTP-EQUIV="Refresh" ' + ;
'CONTENT="0;URL=/cgi-bin/guestbk.exe"></HEAD>' + ;
'<BODY></BODY></HTML>'
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 += "<TABLE WIDTH=100% CELLSPACING=0>" + chr(13) + chr(10)
cColor := if( Mod( i, 2 ) == 0, cEvenColor, cOddColor )
FOR j := 1 TO oIni:ReadNumber( "Format", "FormatLines", 0 )
cCode += "<TR><TD BGCOLOR='" + cColor +"'>"
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 + "</TD></TR>" + chr(13)+chr(10)
NEXT
cCode += "</TABLE>" + chr(13)+chr(10)
NEXT
// Generates the output
oHTML:AddReplaceTag( "Entries", cCode )
oHTML:Generate()
oHTML:ShowResult()
ENDIF
RETURN( NIL )

View File

@@ -0,0 +1,24 @@
Harbour Guestbook
Felipe Coury <fcoury@flexsys-ci.com>
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!!!