2007-12-01 02:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
- contrib/htmllib
* contrib/Makefile
* contrib/make_b32_all.bat
* contrib/make_vc_all.bat
* Removed htmllib (obsolete, non-maintained).
This commit is contained in:
@@ -8,6 +8,13 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-12-01 02:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
- contrib/htmllib
|
||||
* contrib/Makefile
|
||||
* contrib/make_b32_all.bat
|
||||
* contrib/make_vc_all.bat
|
||||
* Removed htmllib (obsolete, non-maintained).
|
||||
|
||||
2007-12-01 01:15 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
- contrib/btree
|
||||
+ contrib/hbbtree
|
||||
|
||||
@@ -6,7 +6,6 @@ ROOT = ../
|
||||
|
||||
DIRS=\
|
||||
hbbtree \
|
||||
htmllib \
|
||||
libct \
|
||||
libgt \
|
||||
libmisc \
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ROOT = ../../
|
||||
|
||||
C_SOURCES=\
|
||||
|
||||
PRG_SOURCES=\
|
||||
ohtm.prg \
|
||||
ocgi.prg \
|
||||
oedit.prg \
|
||||
oframe.prg \
|
||||
oini.prg \
|
||||
ofile.prg \
|
||||
jwindow.prg \
|
||||
htmutil.prg \
|
||||
counter.prg \
|
||||
errorsys.prg \
|
||||
htmbrows.prg \
|
||||
jlist.prg \
|
||||
|
||||
LIBNAME=html
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Colors include file for HTMLLIB
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _COLORS_CH
|
||||
|
||||
#define ALICEBLUE '#A0CF00'
|
||||
#define ANTIQUEWHITE '#FFE8D0'
|
||||
#define AQUA '#00FFFF'
|
||||
#define AQUAMARINE '#7FFFD0'
|
||||
#define AZURE '#F0FFFF'
|
||||
#define BEIGE '#F0F7DF'
|
||||
#define BISQUE '#FFE7C0'
|
||||
#define BLACK '#000000'
|
||||
#define BLANCHEDALMOND '#FFE8CF'
|
||||
#define BLUE '#0000FF'
|
||||
#define BLUEVIOLET '#8F28E0'
|
||||
#define BROWN '#A0282F'
|
||||
#define BURLYWOOD '#DFB880'
|
||||
#define CADETBLUE '#5F9FA0'
|
||||
#define CHARTREUSE '#7FFF00'
|
||||
#define CHOCOLATE '#D0861F'
|
||||
#define CORAL '#FF7F50'
|
||||
#define CORNFLOWERBLUE '#6097EF'
|
||||
#define CORNSILK '#FFF8DF'
|
||||
#define CRIMSON '#DF173F'
|
||||
#define CYAN '#00FFFF'
|
||||
#define DARKBLUE '#00008F'
|
||||
#define DARKCYAN '#00888F'
|
||||
#define DARKGOLDENROD '#BF87F0'
|
||||
#define DARKGRAY '#AFA8AF'
|
||||
#define DARKGREEN '#006700'
|
||||
#define DARKKHAKI '#BFB76F'
|
||||
#define DARKMAGENTA '#8F008F'
|
||||
#define DARKOLIVEGREEN '#50682F'
|
||||
#define DARKORANGE '#FF8F00'
|
||||
#define DARKORCHID '#9F30CF'
|
||||
#define DARKRED '#8F0000'
|
||||
#define DARKSALMON '#EF977F'
|
||||
#define DARKSEAGREEN '#8FBF8F'
|
||||
#define DARKSLATEBLUE '#4F3F8F'
|
||||
#define DARKSLATEGRAY '#2F4F4F'
|
||||
#define DARKTURQUOISE '#00CFD0'
|
||||
#define DARKVIOLET '#9000D0'
|
||||
#define DEEPPINK '#FF1790'
|
||||
#define DEEPSKYBLUE '#00BFFF'
|
||||
#define DIMGRAY '#6F686F'
|
||||
#define DODGERBLUE '#1F90FF'
|
||||
#define FIREBRICK '#B02020'
|
||||
#define FLORALWHITE '#FFF8F0'
|
||||
#define FORESTGREEN '#208820'
|
||||
#define FUCHSIA '#FF00FF'
|
||||
#define GAINSBORO '#DFDFDF'
|
||||
#define GHOSTWHITE '#FFF8FF'
|
||||
#define GOLD '#FFD700'
|
||||
#define GOLDENROD '#DFA720'
|
||||
#define GRAY '#808080'
|
||||
#define GREEN '#008000'
|
||||
#define GREENYELLOW '#AFFF2F'
|
||||
#define HONEYDEW '#F0FFF0'
|
||||
#define HOTPINK '#FF68B0'
|
||||
#define INDIANRED '#CF5F5F'
|
||||
#define INDIGO '#4F0080'
|
||||
#define IVORY '#FFFFF0'
|
||||
#define KHAKI '#F0E78F'
|
||||
#define LAVENDER '#E0E7FF'
|
||||
#define LAVENDERBLUSH '#FFF0F0'
|
||||
#define LAWNGREEN '#7FFF00'
|
||||
#define LEMONCHIFFON '#FFF8CF'
|
||||
#define LIGHTBLUE '#AFD8E0'
|
||||
#define LIGHTCORAL '#F08080'
|
||||
#define LIGHTCYAN '#E0FFFF'
|
||||
#define LIGHTGOLDENRODYELLOW '#FFF8D0'
|
||||
#define LIGHTGREEN '#90EF90'
|
||||
#define LIGHTGREY '#D0D0D0'
|
||||
#define LIGHTPINK '#FFB7C0'
|
||||
#define LIGHTSALMON '#FFA07F'
|
||||
#define LIGHTSEAGREEN '#20B0AF'
|
||||
#define LIGHTSKYBLUE '#80CFFF'
|
||||
#define LIGHTSLATEGRAY '#70889F'
|
||||
#define LIGHTSTEELBLUE '#B0C7DF'
|
||||
#define LIGHTYELLOW '#FFFFE0'
|
||||
#define LIME '#00FF00'
|
||||
#define LIMEGREEN '#30CF30'
|
||||
#define LINEN '#FFF0E0'
|
||||
#define MAGENTA '#FF00FF'
|
||||
#define MAROON '#800000'
|
||||
#define MEDIUMAQUAMARINE '#60CFAF'
|
||||
#define MEDIUMBLUE '#0000CF'
|
||||
#define MEDIUMORCHID '#BF57D0'
|
||||
#define MEDIUMPURPLE '#9070DF'
|
||||
#define MEDIUMSEAGREEN '#3FB070'
|
||||
#define MEDIUMSLATEBLUE '#7F68EF'
|
||||
#define MEDIUMSPRINGGREEN '#00F89F'
|
||||
#define MEDIUMTURQUOISE '#4FD0CF'
|
||||
#define MEDIUMVIOLETRED '#C01780'
|
||||
#define MIDNIGHTBLUE '#1F1870'
|
||||
#define MINTCREAM '#F0FFFF'
|
||||
#define MISTYROSE '#FFE7E0'
|
||||
#define MOCCASIN '#FFE7B0'
|
||||
#define NAVAJOWHITE '#FFDFAF'
|
||||
#define NAVY '#000080'
|
||||
#define OLDLACE '#FFF7E0'
|
||||
#define OLIVE '#808000'
|
||||
#define OLIVEDRAB '#6F8F20'
|
||||
#define ORANGE '#FFA700'
|
||||
#define ORANGERED '#FF4700'
|
||||
#define ORCHID '#DF70D0'
|
||||
#define PALEGOLDENROD '#EFE8AF'
|
||||
#define PALEGREEN '#9FF89F'
|
||||
#define PALETURQUOISE '#AFEFEF'
|
||||
#define PALEVIOLETRED '#DF7090'
|
||||
#define PAPAYAWHIP '#FFEFD0'
|
||||
#define PEACHPUFF '#FFD8BF'
|
||||
#define PERU '#CF873F'
|
||||
#define PINK '#FFC0CF'
|
||||
#define PLUM '#DFA1DF'
|
||||
#define POWDERBLUE '#B0E0E0'
|
||||
#define PURPLE '#800080'
|
||||
#define RED '#FF0000'
|
||||
#define ROSYBROWN '#BF8F8F'
|
||||
#define ROYALBLUE '#4068E0'
|
||||
#define SADDLEBROWN '#8F4710'
|
||||
#define SALMON '#FF8070'
|
||||
#define SANDYBROWN '#F0A760'
|
||||
#define SEAGREEN '#2F8850'
|
||||
#define SEASHELL '#FFF7EF'
|
||||
#define SIENNA '#A0502F'
|
||||
#define SILVER '#C0C0C0'
|
||||
#define SKYBLUE '#80CFEF'
|
||||
#define SLATEBLUE '#6F58CF'
|
||||
#define SLATEGRAY '#708090'
|
||||
#define SNOW '#FFF8FF'
|
||||
#define SPRINGGREEN '#00FF7F'
|
||||
#define STEELBLUE '#4080B0'
|
||||
#define TAN '#D0B78F'
|
||||
#define TEAL '#008080'
|
||||
#define THISTLE '#DFBFDF'
|
||||
#define TOMATO '#FF6040'
|
||||
#define TURQUOISE '#40E0D0'
|
||||
#define VIOLET '#EF80EF'
|
||||
#define WHEAT '#F0DFB0'
|
||||
#define WHITE '#FFFFFF'
|
||||
#define WHITESMOKE '#F0F7F0'
|
||||
#define YELLOW '#FFFF00'
|
||||
#define YELLOWGREEN '#9FCF30'
|
||||
|
||||
#define _COLORS_CH
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
LIBNAME = html
|
||||
|
||||
LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT)
|
||||
|
||||
LIB_OBJS = \
|
||||
$(OBJ_DIR)\ohtm$(OBJEXT) \
|
||||
$(OBJ_DIR)\htmbrows$(OBJEXT) \
|
||||
$(OBJ_DIR)\oedit$(OBJEXT) \
|
||||
$(OBJ_DIR)\ofile$(OBJEXT) \
|
||||
$(OBJ_DIR)\jlist$(OBJEXT) \
|
||||
$(OBJ_DIR)\oini$(OBJEXT) \
|
||||
$(OBJ_DIR)\jwindow$(OBJEXT) \
|
||||
$(OBJ_DIR)\ocgi$(OBJEXT) \
|
||||
$(OBJ_DIR)\oframe$(OBJEXT) \
|
||||
$(OBJ_DIR)\counter$(OBJEXT) \
|
||||
$(OBJ_DIR)\errorsys$(OBJEXT) \
|
||||
$(OBJ_DIR)\htmutil$(OBJEXT) \
|
||||
|
||||
all: \
|
||||
$(LIB_PATH) \
|
||||
@@ -1,88 +0,0 @@
|
||||
#include "html.ch"
|
||||
#include "forms.ch"
|
||||
#include "default.ch"
|
||||
|
||||
|
||||
|
||||
PROC CounterCGI()
|
||||
LOCAL lIsPost := .F.
|
||||
LOCAL cCounterDat := "counter.dat"
|
||||
LOCAL oFrm
|
||||
|
||||
LOCAL oHtm, oCgi
|
||||
|
||||
SET DATE BRITISH
|
||||
|
||||
IF "POST" $ UPPER(GETENV("REQUEST_METHOD"))
|
||||
lIsPost := .T.
|
||||
oCgi := oCGI():New() // get server parameters/variables
|
||||
ENDIF
|
||||
|
||||
oHtm := HTML():CGINew( "Counter.htm", "My Counter File" )
|
||||
|
||||
oHtm:SetPageColor(CLR_DARK_YELLOW ) //"#FFFFCC")
|
||||
oHtm:SetTextColor(CLR_WHITE)
|
||||
oHtm:SetbgImage("/images/back/bg32.bmp")
|
||||
oHtm:Setcenter( .f. )
|
||||
oHtm:qout( "" )
|
||||
SET FONT "Verdana" SIZE 3 OF oHtm
|
||||
|
||||
DEFINE FORM oFrm ;
|
||||
CAPTION "A Simple Counter" ;
|
||||
NAME "MyForm";
|
||||
ACTION "/cgi-bin/counter.exe?" ;
|
||||
FRAME
|
||||
|
||||
CONTROL EDIT NAME "User" ;
|
||||
MAXCHARS 20 ;
|
||||
SIZE 20 ;
|
||||
CAPTION "User Name:" ;
|
||||
IN oFrm
|
||||
|
||||
LINE BREAK IN oFrm
|
||||
LINE IN oFrm
|
||||
LINE BREAK IN oFrm
|
||||
SPACE 80 IN oFrm
|
||||
|
||||
CONTROL SUBMIT NAME cSubmit VALUE (" Ok ") IN oFrm
|
||||
|
||||
ACTIVATE oFrm
|
||||
|
||||
SET FONT "Verdana" SIZE 3 OF oHtm
|
||||
oHtm:defineTable( 2,, 90,, "#9196A0" )
|
||||
oHtm:newTableRow()
|
||||
oHtm:newTableCell()
|
||||
oHtm:QOut( "Page Visited :<b>" + TRANSFORM( incCounter(), "999,999,999" ) + +htmlSpace(2)+"</b>Times")
|
||||
oHtm:EndTableCell()
|
||||
oHtm:EndTableRow()
|
||||
oHtm:EndTable()
|
||||
|
||||
oHtm:cgiClose()
|
||||
RETURN
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
FUNCTION IncCounter()
|
||||
LOCAL n := 0
|
||||
|
||||
IF FILE("Counter.dat")
|
||||
n := VAL(MEMOREAD("counter.dat"))
|
||||
ELSE
|
||||
n := 0
|
||||
ENDIF
|
||||
MEMOWRIT( "counter.dat", STR( n+1 ) )
|
||||
RETURN n
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
FUNCTION GetCounter()
|
||||
LOCAL n := 0
|
||||
|
||||
IF FILE("Counter.dat")
|
||||
n := VAL(MEMOREAD("counter.dat"))
|
||||
ELSE
|
||||
incCounter()
|
||||
ENDIF
|
||||
RETURN n
|
||||
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* DEFAULT.CH some default definition to HTMLLIB
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DEFAULT_CH_
|
||||
|
||||
//#ifndef _BOX_CH
|
||||
//#include "box.ch"
|
||||
//#endif
|
||||
|
||||
#ifndef _INKEY_CH
|
||||
#include "inkey.ch"
|
||||
#endif
|
||||
|
||||
#ifndef _COMMON_CH
|
||||
#include "common.ch"
|
||||
#endif
|
||||
|
||||
#xTranslate PERCENT( <nVal>, <nPCent> ) => ;
|
||||
( ( <nVal> * <nPCent> ) / 100 )
|
||||
|
||||
// --> Default parameters
|
||||
#xcommand DEFAULT <uVar1> := <uVal1> ;
|
||||
[, <uVarN> := <uValN> ] => ;
|
||||
<uVar1> := IIf( <uVar1> == nil, <uVal1>, <uVar1> ) ;;
|
||||
[ <uVarN> := IIf( <uVarN> == nil, <uValN>, <uVarN> ); ]
|
||||
|
||||
#xcommand DEFAULT <v1> TO <x1> [, <vn> TO <xn> ] ;
|
||||
=> ;
|
||||
IF <v1> == NIL ; <v1> := <x1> ; END ;
|
||||
[; IF <vn> == NIL ; <vn> := <xn> ; END ]
|
||||
|
||||
// --> OOPs
|
||||
#xtranslate BYNAME <V> [, <VN> ] => ::<V> := <V> [; ::<VN> := <VN> ]
|
||||
#xtranslate BYNAME <V> DEFAULT <Val> => ::<V> := BYDEFAULT <V>, <Val>
|
||||
#xtranslate BYDEFAULT <V>, <Val> => IIF( <V> == NIL, <Val>, <V> )
|
||||
|
||||
|
||||
// --> Save/Restore video state...
|
||||
#xtranslate SaveState() => { row(), ;
|
||||
col(), ;
|
||||
SetColor(), ;
|
||||
SetCursor(), ;
|
||||
SaveScreen(,,,,) }
|
||||
|
||||
|
||||
#xtranslate RestState(<a>) => DispBegin() ;;
|
||||
RestScreen(,,,,<a>\[5\]) ;;
|
||||
SetColor(<a>\[3\] ) ;;
|
||||
SetCursor(<a>\[4\]) ;;
|
||||
SetPos(<a>\[1\], <a>\[2\] ) ;;
|
||||
DispEnd()
|
||||
|
||||
|
||||
// --> Save/Restore Table state
|
||||
#xTranslate DbSaveState() => IIF( USED(),;
|
||||
{ Select(), ;
|
||||
Recno(), ;
|
||||
OrdBagName(0),;
|
||||
OrdSetFocus() ;
|
||||
},;
|
||||
NIL )
|
||||
|
||||
#xTranslate DbRestState( <a> ) => IIF( <a> != NIL, ;
|
||||
( Select( <a>\[1\] ), ;
|
||||
OrdListAdd(<a>\[3\] ), ;
|
||||
OrdSetFocus(<a>\[4\] ),;
|
||||
DbGoto(<a>\[2\] )),)
|
||||
|
||||
|
||||
// --> Display a Message at MAXROW() with optional colour...
|
||||
#xTranslate Message(<cMsg>,<c>) => ;
|
||||
DispOutAt( maxrow(), 0, PadC(<cMsg>, MaxCol()+1 ), ;
|
||||
IIF( EMPTY(#<c>), "R/W", #<c> ) )
|
||||
|
||||
|
||||
// --> Display a backdrop desktop with optional color
|
||||
#xTranslate DeskTop([<c>]) => ;
|
||||
DispBox( 0,0,maxrow(),maxcol(), replicate("±",9), [<c>] )
|
||||
|
||||
|
||||
// --> Display a box with shadow (without savescreen() )
|
||||
#xTranslate ShadBox( <nTR>, <nTC>, <nBR>, <nBC>, <cStyle>, <cClrs> ) ;
|
||||
=> ;
|
||||
DispBegin() ;;
|
||||
RESTSCREEN( <nTR>+1,<nTC>+2,<nBR>+1,<nBC>+2,;
|
||||
TRANSFORM( ;
|
||||
SAVESCREEN( <nTR>+1,<nTC>+2,<nBR>+1,<nBC>+2 ),;
|
||||
REPLICATE( 'X', ( <nBR>-<nTR>+1 ) * ( <nBC>-<nTC>+1 ) ) ) );;
|
||||
DispBox( <nTR>, <nTC>, <nBR>, <nBC>, [<cStyle>], [<cClrs>] );;
|
||||
SetPos( <nTR>+1, <nTC>+1 );;
|
||||
DispEnd()
|
||||
|
||||
|
||||
// --> Display a box with shadow: Saves screen for WClose()
|
||||
// --> *MUST* pass to variable, e.g.
|
||||
// -->
|
||||
// --> LOCAL aWin := WOpen( 10, 10, 20, 30, B_DOUBLE + " ", "N/W" )
|
||||
// -->
|
||||
#xTranslate WOpen( <nTR>, <nTC>, <nBR>, <nBC>, [<cStyle>], [<cClrs>] ) ;
|
||||
=> ;
|
||||
{ <nTR>, <nTC>, <nBR>+1, <nBC>+2, ;
|
||||
SAVESCREEN( <nTR>, <nTC>, <nBR>+1, <nBC>+2 ) } ;;
|
||||
DispBegin() ;;
|
||||
RESTSCREEN( <nTR>+1,<nTC>+2,<nBR>+1,<nBC>+2,;
|
||||
TRANSFORM( SAVESCREEN( <nTR>+1,<nTC>+2,<nBR>+1,<nBC>+2 ),;
|
||||
REPLICATE( 'X', ( <nBR>-<nTR>+1 ) * ( <nBC>-<nTC>+1 ) ) ) );;
|
||||
DispBox( <nTR>, <nTC>, <nBR>, <nBC>, ;
|
||||
IIF(EMPTY(#<cStyle>), "ÚÄ¿³ÙÄÀ³ ", <cStyle> ), ;
|
||||
IIF(EMPTY(#<cClrs>),"W/B", <cClrs> ) );;
|
||||
SetPos( <nTR>+1, <nTC>+1 );;
|
||||
DispEnd()
|
||||
|
||||
|
||||
// --> Display a Caption for a WOpen() window
|
||||
#xTranslate WTitle( <aWin>, <cTitle>, <cClr> ) => ;
|
||||
DispBox( <aWin>\[1\], <aWin>\[2\], ;
|
||||
<aWin>\[1\], <aWin>\[4\]-2, ;
|
||||
replicate(" ",9), ;
|
||||
IIF( EMPTY(#<cClr>), "b/w", #<cClr> ) ) ;;
|
||||
DispOutAt( <aWin>\[1\], <aWin>\[2\], ;
|
||||
PADC(<cTitle>, (<aWin>\[4\]-<aWin>\[2\])-1, " " ), ;
|
||||
IIF( EMPTY(#<cClr>), "b/w", #<cClr> ))
|
||||
|
||||
// --> Closes a window created with WOpen() - Restores screen
|
||||
#xTranslate WClose(<aWin>) => RestScreen( <aWin>\[1\], <aWin>\[2\], ;
|
||||
<aWin>\[3\], <aWin>\[4\], ;
|
||||
<aWin>\[5\] )
|
||||
|
||||
|
||||
// --> Save/Restore full screen - *MUST* pass to/from var
|
||||
#xtranslate ScreenSave() => SAVESCREEN( 0, 0, 24, 79 )
|
||||
#xtranslate ScreenRest( <c> ) => RESTSCREEN( 0, 0, 24, 79, <c> )
|
||||
|
||||
// --> Build a Picture template
|
||||
#xtranslate CAPFIRST(<foo>) => ( "!" + REPLICATE( "X", LEN( <foo> ) -1 ))
|
||||
|
||||
// --> Array shrink
|
||||
#xTranslate ASHRINK( <array> ) => ;
|
||||
ADEL ( <array>, LEN( <array> ) ) ;
|
||||
; ASIZE( <array>, LEN( <array> ) - 1 )
|
||||
|
||||
|
||||
// --> Number to Trimmed String
|
||||
#xTranslate NTRIM( <nNum> ) => LTRIM(STR( <nNum> ))
|
||||
#xTranslate NUMTRIM( <nNum> ) => LTRIM(STR( <nNum> ))
|
||||
// --> Convert logical to character
|
||||
#xtranslate LTOC(<l>) => IIF( <l>, "T", "F")
|
||||
|
||||
// --> Convert character to logical
|
||||
#xTranslate CTOL(<c>) => IIF( <c> $ "TtYy", .T., .F.)
|
||||
|
||||
|
||||
// --> Left trim a numeric
|
||||
#xtranslate LSTR(<n>) => LTRIM( Str( <n> ) )
|
||||
|
||||
|
||||
// --> Carriage Return + Line Feed
|
||||
#xtranslate CRLF(<str>) => ( <str> + CHR(13)+CHR(10) )
|
||||
#xtranslate CRLF() => CHR(13) + CHR(10)
|
||||
|
||||
|
||||
// --> create a Get/Set Block
|
||||
#define GSB( xVar) {|x| IIF(x == NIL, xVar, xVar := x )}
|
||||
|
||||
#xtranslate GetSetBlock(<xVar>) => {|x| IIF(x == NIL, <xVar>, <xVar> := x )}
|
||||
|
||||
#translate GETSET( <xVal>, <xParm> ) => ;
|
||||
<xVal> := IIF( <xParm> == NIL, <xVal>, <xVal> := <xParm>)
|
||||
|
||||
|
||||
// --> Convert Character String to Code Block
|
||||
#xTranslate COMPILE(<c>) => &("{||" + <c> + "}")
|
||||
|
||||
|
||||
// --> Errors...
|
||||
#define Beep() Tone(300,3)
|
||||
|
||||
#xTranslate ErrorTone() => ( TONE( 1000,.01), ;
|
||||
TONE( 1400,.01), ;
|
||||
TONE( 1800,.01) ;
|
||||
)
|
||||
|
||||
|
||||
#define DEF_PATH SET(_SET_DEFAULT)
|
||||
|
||||
|
||||
// --> GETs ...
|
||||
//#define OK_GETS() LASTKEY() != K_ESC .AND. UPDATED()
|
||||
|
||||
|
||||
|
||||
/*
|
||||
DATA TYPES
|
||||
*/
|
||||
#xtranslate IS_ARRAY(<foo>) => (VALTYPE(<foo>)=="A")
|
||||
#xtranslate IS_BLOCK(<foo>) => (VALTYPE(<foo>)=="B")
|
||||
#xtranslate IS_CHAR(<foo>) => (VALTYPE(<foo>)=="C")
|
||||
#xtranslate IS_DATA(<foo>) => (<foo> \>=32 .AND. <foo> \<= 253)
|
||||
#xtranslate IS_DATE(<foo>) => (VALTYPE(<foo>)=="D")
|
||||
#xtranslate IS_DEF(<foo>) => !(TYPE(<foo>) $ "UE")
|
||||
#xtranslate IS_DIGIT(<foo>) => ISDIGIT(<foo>)
|
||||
#xtranslate IS_INT(<foo>) => (<foo>)==INT(<foo>) )
|
||||
#xtranslate IS_LOGIC(<foo>) => (VALTYPE(<foo>)=="L")
|
||||
#xtranslate IS_MEMO(<foo>) => (VALTYPE(<foo>)=="M")
|
||||
#xtranslate IS_NUM(<foo>) => (VALTYPE(<foo>)=="N")
|
||||
#xtranslate IS_OBJECT(<foo>)=> (VALTYPE(<foo>)=="O")
|
||||
#xtranslate IS_TIME(<foo>) => (VAL(LEFT <foo>,2)) \< 24 .AND. ;
|
||||
VAL(SUBSTR(<foo>,4,2)) \< 60 .AND. ;
|
||||
VAL(RIGHT(<foo>,2 )) \<60 )
|
||||
|
||||
#translate ISNIL( <v1> ) => ( <v1> == NIL )
|
||||
#translate ISARRAY( <v1> ) => ( valtype( <v1> ) == "A" )
|
||||
#translate ISBLOCK( <v1> ) => ( valtype( <v1> ) == "B" )
|
||||
#translate ISCHARACTER( <v1> ) => ( valtype( <v1> ) == "C" )
|
||||
#translate ISDATE( <v1> ) => ( valtype( <v1> ) == "D" )
|
||||
#translate ISLOGICAL( <v1> ) => ( valtype( <v1> ) == "L" )
|
||||
#translate ISMEMO( <v1> ) => ( valtype( <v1> ) == "M" )
|
||||
#translate ISNUMBER( <v1> ) => ( valtype( <v1> ) == "N" )
|
||||
#translate ISOBJECT( <v1> ) => ( valtype( <v1> ) == "O" )
|
||||
|
||||
|
||||
#command REPEAT => DO WHILE .T.
|
||||
#command UNTIL <*lexpr*> => IF (<lexpr>); EXIT ; END ; ENDDO
|
||||
|
||||
#command IF <lexpr> THEN <*statement*> =>;
|
||||
IF(<lexpr>) ; <statement> ; END
|
||||
|
||||
#command IF <lexpr> THEN <statement1> ELSE <statement2> =>;
|
||||
IF(<lexpr>) ; <statement1> ; ELSE ; <statement2> ; END
|
||||
|
||||
#define _DEFAULT_CH_
|
||||
#endif
|
||||
@@ -1,296 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* Errorsys.prg
|
||||
*
|
||||
* Standard Clipper error handler
|
||||
*
|
||||
* Copyright (c) 1990-1993, Computer Associates International, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Compile: /m /n /w
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* HTML output conversion
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "default.ch"
|
||||
#include "error.ch"
|
||||
|
||||
|
||||
#define DEF_ERR_HEADER "Date : "+DTOC(Date())+"<BR>"+;
|
||||
"Time : "+Time()+"<BR>"
|
||||
|
||||
|
||||
// put messages to STDERR
|
||||
#command ? <list,...> => ?? Chr(13) + Chr(10) ; ?? <list>
|
||||
#command ?? <list,...> => OutErr(<list>)
|
||||
|
||||
|
||||
// used below
|
||||
#xTranslate NTRIM(<n>) => ALLTrim( Str( <n> ) )
|
||||
|
||||
REQUEST HARDCR
|
||||
REQUEST MEMOWRIT
|
||||
|
||||
STATIC sbFixCorrupt
|
||||
STATIC scErrFooter := " "
|
||||
|
||||
|
||||
/***
|
||||
* ErrorSys()
|
||||
*
|
||||
* Note: automatically executes at startup
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
PROC ErrorSys()
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
ErrorBlock( {|e| DefError(e)} )
|
||||
return
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* DefError()
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
STATIC FUNC DefError(e)
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
local i, cMessage:= ""
|
||||
Local cErrString := ""
|
||||
LOCAL nDispCount := DispCount()
|
||||
Local aError := {}
|
||||
LOCAL nH := IF( PageHandle() == NIL, 0, PageHandle() )
|
||||
|
||||
// by default, division by zero yields zero
|
||||
IF ( e:genCode == EG_ZERODIV )
|
||||
return (0)
|
||||
END
|
||||
|
||||
IF ( e:genCode == EG_CORRUPTION )
|
||||
if valtype(sbFixCorrupt) == "B"
|
||||
EVAL( sbFixCorrupt, e )
|
||||
RETURN .F.
|
||||
ELSE
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// for network open error, set NETERR() and subsystem default
|
||||
IF ( e:genCode == EG_OPEN .and. (e:osCode == 32 .OR. e:osCode == 5);
|
||||
.and. e:canDefault )
|
||||
|
||||
NETERR(.T.)
|
||||
RETURN (.F.) // NOTE
|
||||
|
||||
END
|
||||
|
||||
|
||||
// for lock error during APPEND BLANK, set NETERR() and subsystem default
|
||||
IF ( e:genCode == EG_APPENDLOCK .and. e:canDefault )
|
||||
|
||||
NETERR(.T.)
|
||||
RETURN (.F.) // NOTE
|
||||
|
||||
END
|
||||
|
||||
// build error message
|
||||
cMessage += ErrorMessage(e)
|
||||
|
||||
|
||||
// display message and traceback
|
||||
IF ( !Empty(e:osCode) )
|
||||
cMessage += " (DOS Error : " + NTRIM(e:osCode) + ")"
|
||||
END
|
||||
|
||||
// RESET System //
|
||||
|
||||
cErrString := CRLF()+"</TD></TR></TABLE>"+CRLF()
|
||||
cErrString += '<TABLE bgcolor="white" border CellPadding=1 CellSpacing=1 COLS=2 WIDTH=80%>'
|
||||
|
||||
cErrString += '<TR><TD bgcolor="black" align="CENTER">'
|
||||
cErrstring += '<FONT face = "verdana" size ="5" color="white">'+CRLF()
|
||||
cErrString += "<B>ERROR REPORT</B>"
|
||||
cErrString += "</TD></TR>"
|
||||
|
||||
cErrString += '<TR><TD bgcolor="blue">'
|
||||
cErrstring += '<FONT face = "verdana" size ="2" color="white">'+CRLF()
|
||||
cErrString += DEF_ERR_HEADER
|
||||
cErrString += "</TD></TR>"
|
||||
|
||||
cErrString += '<TR><TD bgcolor="red">'
|
||||
cErrstring += '<FONT face ="verdana" size ="2" color="white">'+CRLF()
|
||||
cErrString += '<EM>'+cMessage+'</EM>'
|
||||
|
||||
|
||||
cErrString += '</TD></TR><TR><TD bgcolor="cyan">'+CRLF()
|
||||
cErrstring += '<FONT face ="verdana" size ="2" color="black">'+CRLF()
|
||||
cErrString += "ERRORCODE...... :"+ NTRIM(e:GenCode)+"<BR>"+CRLF()
|
||||
cErrString += "SUBSYSTEM..... :"+ e:SubSystem +"<BR>"+CRLF()
|
||||
cErrString += "DESCRIPTION...:"+ e:Description +"<BR>"+CRLF()
|
||||
cErrString += "OPERATION......:"+ e:Operation +"<BR>"+CRLF()
|
||||
cErrString += "FILENAME........ :"+ e:FileName +"<BR>"+CRLF()
|
||||
cErrString += "TRIES............. :"+ NTRIM(e:Tries)+CRLF()
|
||||
|
||||
cErrString += '</TD></TR>'
|
||||
cErrString += '<TR><TD bgcolor="red">'
|
||||
cErrstring += '<FONT face ="verdana" size ="2" color="white">'+CRLF()
|
||||
cErrstring += '<EM>'
|
||||
|
||||
i := 2
|
||||
|
||||
while ( !Empty(ProcName(i)) )
|
||||
|
||||
cErrString += "Called from "+ Trim(ProcName(i)) + ;
|
||||
"(" + NTRIM(ProcLine(i)) + ") <BR>" + CRLF()
|
||||
|
||||
i++
|
||||
END
|
||||
|
||||
cErrstring += '</EM>'
|
||||
cErrString += '</TD></TR>'
|
||||
cErrString += '<TR><TD bgcolor="black">'
|
||||
cErrstring += '<FONT face ="verdana" size ="2" color="white">'+CRLF()
|
||||
cErrstring += "Extra Notes..."
|
||||
|
||||
cErrString += "</TD>"+CRLF()+"</TR>"+CRLF()+"</TABLE>"+CRLF()
|
||||
FWrite( nH, "<BR>"+cErrString+CRLF() )
|
||||
//ÄÄÄÄÄÄÄÄ Write/Append Error Log
|
||||
MemoWrit( "Error.Log", HARDCR(cErrString)+CRLF()+;
|
||||
HARDCR( MEMOREAD("Error.Log") ) )
|
||||
|
||||
FWrite( nH, "</TD>"+CRLF()+"</TR>"+CRLF()+"</TABLE>"+CRLF() )
|
||||
|
||||
/*
|
||||
FWrite( nH, "<FORM NAME='MyForm'>"+CRLF() )
|
||||
FWrite( nH, "<INPUT TYPE=BUTTON NAME='MyButton'"+CRLF() )
|
||||
FWrite( nH, "onFocus=")
|
||||
FWrite( nH, ["alert('Hello')">]+CRLF() )
|
||||
FWrite( nH, "</FORM>"+CRLF() )
|
||||
FWrite( nH, [<A HREF="alert('ERROR!!!')>"]+CRLF() )
|
||||
*/
|
||||
|
||||
JavaCMD( nH, 'alert("There was an error processing your request:\n'+;
|
||||
'Look at the bottom of this page for\n'+;
|
||||
'error description and parameters...");' )
|
||||
FWrite( nH, "</FONT>"+CRLF()+"</BODY></HTML>"+CRLF() )
|
||||
|
||||
CLOSE ALL
|
||||
|
||||
// give up
|
||||
ErrorLevel(1)
|
||||
QUIT
|
||||
|
||||
RETURN(.F.)
|
||||
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
FUNCTION SetCorruptFunc( bFunc )
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
if valtype( bFunc ) == "B"
|
||||
sbFixCorrupt := bFunc
|
||||
ENDIF
|
||||
|
||||
RETURN sbFixCorrupt
|
||||
|
||||
|
||||
FUNCTION SetErrorFooter()
|
||||
RETURN( scErrFooter )
|
||||
|
||||
|
||||
/***
|
||||
* ErrorMessage()
|
||||
*/
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
STATIC FUNC ErrorMessage(e)
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
local cMessage :=""
|
||||
|
||||
// start error message
|
||||
cMessage += if( e:severity > ES_WARNING, "Error ", "Warning " )
|
||||
|
||||
|
||||
// add subsystem name if available
|
||||
IF ( ValType(e:subsystem) == "C" )
|
||||
cMessage += e:subsystem()
|
||||
ELSE
|
||||
cMessage += "???"
|
||||
END
|
||||
|
||||
|
||||
// add subsystem's error code if available
|
||||
IF ( ValType(e:subCode) == "N" )
|
||||
cMessage += ("/" + NTRIM(e:subCode))
|
||||
ELSE
|
||||
cMessage += "/???"
|
||||
END
|
||||
|
||||
|
||||
// add error description if available
|
||||
IF ( ValType(e:description) == "C" )
|
||||
cMessage += ("<BR> " + e:description)
|
||||
END
|
||||
|
||||
|
||||
// add either filename or operation
|
||||
IF ( !Empty(e:filename) )
|
||||
cMessage += (": " + e:filename)
|
||||
|
||||
ELSEIF ( !Empty(e:operation) )
|
||||
cMessage += (": " + e:operation)
|
||||
|
||||
END
|
||||
cMessage += CRLF()
|
||||
|
||||
|
||||
return (cMessage)
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* FERROR.CH Internal HTMLLIB module
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FERROR_CH_
|
||||
|
||||
#define _LAST_IO_ERROR IF(FError() == 0, "", _IO_ERRORS[Ferror()] )
|
||||
|
||||
#define _IO_ERRORS { ;
|
||||
"", ; //1
|
||||
"File not found", ; //2
|
||||
"Path not found", ; //3
|
||||
"Too many files open", ; //4
|
||||
"Access denied", ; //5
|
||||
"Invalid handle", ; //6
|
||||
"", ; //7
|
||||
"Insufficient memory", ; //8
|
||||
"", ; //9
|
||||
"", ; //10
|
||||
"", ; //11
|
||||
"", ; //12
|
||||
"", ; //13
|
||||
"", ; //14
|
||||
"Invalid drive specified", ; //15
|
||||
"", ; //16
|
||||
"", ; //17
|
||||
"", ; //18
|
||||
"Attempted to write to a write-protected disk", ; //19
|
||||
"", ; //20
|
||||
"Drive not ready", ; //21
|
||||
"", ; //22
|
||||
"Data CRC error", ; //23
|
||||
"", ; //24
|
||||
"", ; //25
|
||||
"", ; //26
|
||||
"", ; //27
|
||||
"", ; //28
|
||||
"Write fault", ; //29
|
||||
"Read fault", ; //30
|
||||
"", ; //31
|
||||
"Sharing violation", ; //32
|
||||
"Lock Violation" ; //33
|
||||
}
|
||||
|
||||
#define _FERROR_CH_
|
||||
#endif
|
||||
@@ -1,290 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* FORMS.CH Include file to create forms
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORMS_CH
|
||||
|
||||
#xCommand DEFINE FORM <oFrm> ;
|
||||
[NAME <name>] ;
|
||||
[METHOD <method>] ;
|
||||
[ACTION <action>] ;
|
||||
[ENCTYPE <enctype>] ;
|
||||
[TARGET <target>] ;
|
||||
[ONSUBMIT <onsubmit>] ;
|
||||
[ONRESET <onreset>] ;
|
||||
[<frame:FRAME>] ;
|
||||
[CAPTION <cap>] ;
|
||||
[CAPCOLOR <capclr>] ;
|
||||
[CAPFONTCOLOR <capfntclr>] ;
|
||||
[CAPIMAGE <capimage>] ;
|
||||
[BGIMAGE <bgimg>] ;
|
||||
[FONTCOLOR <fntclr>] ;
|
||||
[COLOR <clr>] ;
|
||||
[WIDTH <w>] ;
|
||||
=> ;
|
||||
<oFrm> := Form():New( [<name>], [<action>], [<method>], ;
|
||||
<.frame.>, <cap> ) ;;
|
||||
[<oFrm>:setTarget( <(target)> ) ;] ;
|
||||
[<oFrm>:setEncType( <(enctype)> ) ;] ;
|
||||
[<oFrm>:setCapClr( <(capclr)> ) ;] ;
|
||||
[<oFrm>:setCapFntClr( <(capfntclr)> ) ;] ;
|
||||
[<oFrm>:setCapImage( <(capimage)> ) ;] ;
|
||||
[<oFrm>:setBgImage( <(bgimg)> ) ;] ;
|
||||
[<oFrm>:setFontColor( <(fntclr)> ) ;] ;
|
||||
[<oFrm>:setFrmColor( <(clr)> ) ;] ;
|
||||
[<oFrm>:setwidth( <w> ) ;] ;
|
||||
[<oFrm>:setAction( <(action)> ) ;] ;
|
||||
[<oFrm>:setOnSubmit( <(onsubmit)> ) ;] ;
|
||||
[<oFrm>:setOnReset( <(onreset)> ) ]
|
||||
|
||||
|
||||
#xCommand ACTIVATE <oFrm> ;
|
||||
=>;
|
||||
<oFrm>:Put(.T.) ; <oFrm>:End()
|
||||
|
||||
|
||||
// --> Controls
|
||||
|
||||
#xCommand CONTROL ;
|
||||
[OF <obj>];
|
||||
[<typ:EDIT,TEXT,TEXTAREA,PASSWORD,BUTTON,IMAGE,CHECKBOX,CHECK,HIDDEN,RADIO,FILE,RESET,SUBMIT,SELECT,LISTBOX>] ;
|
||||
[ALIGN <aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
[WRAP <wrap:OFF,VIRTUAL,PHYSICAL,NORMAL>] ;
|
||||
[NAME <name>] ;
|
||||
[VALUE <value>] ;
|
||||
[SIZE <size>] ;
|
||||
[MAXCHARS <maxchars>] ;
|
||||
[ROWS <rows>] ;
|
||||
[COLS <cols>] ;
|
||||
[ONCHANGE <onchange>] ;
|
||||
[ONSELECT <onselect>] ;
|
||||
[ONFOCUS <onfocus>] ;
|
||||
[ONBLUR <onblur>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[ONMOUSEUP <onmsup>] ;
|
||||
[ONMOUSEDOWN <onmsdn>] ;
|
||||
[ONKEYDOWN <onkdown>] ;
|
||||
[ONKEYUP <onkup>] ;
|
||||
[ONKEYPRESS <onkprs>] ;
|
||||
[PICTURE <pic>] ;
|
||||
[<chk:CHECKED>] ;
|
||||
[<dis:DISABLED>] ;
|
||||
[<ro:READONLY>] ;
|
||||
[<mult:MULTIPLE>] ;
|
||||
[CAPTION <cap>] ;
|
||||
[STYLE <style>] ;
|
||||
[ID <id>] ;
|
||||
[<l:LABEL>] ;
|
||||
IN <oForm> ;
|
||||
=> ;
|
||||
<oForm>:addControl( ;
|
||||
[ <obj>:= ] HControl():setControl(;
|
||||
<(name)>, <rows>, <cols>, <size>, <maxchars>, ;
|
||||
<(value)>, ;
|
||||
<(onfocus)>,<(onblur)>,<(onchange)>,<(onselect)>,;
|
||||
<(onclick)>,<(onmsover)>,<(onmsout)>,<(onmsdn)>,<(onmsup)>,;
|
||||
<(onkdown)>,<(onkup)>,<(onkprs)>,;
|
||||
<(pic)>,<(cap)>,;
|
||||
<.dis.>,<.ro.>,<.mult.>,<.chk.>,;
|
||||
__ALIGN__ [<aln>], ;
|
||||
__WRAP__ [<wrap>], ;
|
||||
__TYPE__ [<typ>],;
|
||||
<style>, <id> ,<.l.>) )
|
||||
|
||||
|
||||
#xCommand DEFINE <typ:EDIT,TEXT,TEXTAREA,PASSWORD,BUTTON,IMAGE,CHECKBOX,CHECK,HIDDEN,RADIO,FILE,RESET,SUBMIT,SELECT,LISTBOX> <oCtr>;
|
||||
[WRAP <wrap:OFF,VIRTUAL,PHYSICAL,NORMAL>] ;
|
||||
[ALIGN <aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
[NAME <name>] ;
|
||||
[SIZE <size>] ;
|
||||
[MAXCHARS <maxchars>] ;
|
||||
[VALUE <value>] ;
|
||||
[ROWS <rows>] ;
|
||||
[COLS <cols>] ;
|
||||
[SOURCE <source>] ;
|
||||
[ONCHANGE <onchange>] ;
|
||||
[ONSELECT <onselect>] ;
|
||||
[ONFOCUS <onfocus>] ;
|
||||
[ONBLUR <onblur>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[ONKEYDOWN <onkdown>] ;
|
||||
[ONKEYUP <onkup>] ;
|
||||
[ONKEYPRESS <onkprs>] ;
|
||||
[PICTURE <pic>] ;
|
||||
[<mult:MULTIPLE>] ;
|
||||
[<checked:CHECKED>] ;
|
||||
[<dis:DISABLED>] ;
|
||||
[<ro:READONLY>] ;
|
||||
[CAPTION <cap>] ;
|
||||
[STYLE <style>] ;
|
||||
[ID <id>] ;
|
||||
[<l:LABEL>] ;
|
||||
IN <oForm> ;
|
||||
=> ;
|
||||
<oCtr> := HControl() ;;
|
||||
[<oCtr>:SetName( <(name)> ) ;] ;
|
||||
[<oCtr>:SetSize( <size> ) ;] ;
|
||||
[<oCtr>:SetRows( <rows> ) ;] ;
|
||||
[<oCtr>:SetCols( <cols> ) ;] ;
|
||||
[<oCtr>:SetAlign( __ALIGN__ <aln> );] ;
|
||||
[<oCtr>:SetWrap( __WRAP__ <wrap> );] ;
|
||||
[<oCtr>:SetSource(<(source)>);] ;
|
||||
[<oCtr>:SetMaxChars( <maxchars> );] ;
|
||||
[<oCtr>:SetValue( <(value)> );] ;
|
||||
[<oCtr>:SetOnFocus(<(onfocus)>);] ;
|
||||
[<oCtr>:SetOnBlur(<(onblur)>);] ;
|
||||
[<oCtr>:SetOnChange(<(onchange)>);] ;
|
||||
[<oCtr>:SetOnSelect(<(onselect)>);] ;
|
||||
[<oCtr>:SetonClick(<(onclick)>);] ;
|
||||
[<oCtr>:SetonMsOver(<(onmsover)>);] ;
|
||||
[<oCtr>:SetonMsOut(<(onmsout)>);] ;
|
||||
[<oCtr>:SetonKDown(<(onkdown)>);] ;
|
||||
[<oCtr>:SetonKUp(<(onkup)>);] ;
|
||||
[<oCtr>:SetonKPress(<(onkprs)>);] ;
|
||||
[<oCtr>:SetPicture(<(pic)>);] ;
|
||||
[<oCtr>:SetCaption(<(cap)>);] ;
|
||||
[<oCtr>:SetStyle(<(style)>);] ;
|
||||
[<oCtr>:SetId(<(id)>);] ;
|
||||
[<oCtr>:SetChecked( <.checked.>);] ;
|
||||
[<oCtr>:SetMultiple(<.mult.>);] ;
|
||||
[<oCtr>:SetDisabled(<.dis.>);] ;
|
||||
[<oCtr>:SetReadonly(<.ro.>);] ;
|
||||
[<oCtr>:SetLabel(<.l.>);] ;
|
||||
<oCtr>:Type := __TYPE__ <typ> ;;
|
||||
<oForm>:AddControl( <oCtr> )
|
||||
|
||||
#xcommand DEFINE OPTION <text> [OF <oSelect>] ;
|
||||
[VALUE <value>] ;
|
||||
[LABEL <label>] ;
|
||||
[<sel:SELECTED>] ;
|
||||
[<dis:DISABLED>] ;
|
||||
=>;
|
||||
<oSelect>:addOption( <text>, <value>, <label>, <.sel.>, <.dis.> )
|
||||
|
||||
#xcommand ADD OPTION <text> [OF <oSelect>] ;
|
||||
[VALUE <value>] ;
|
||||
[LABEL <label>] ;
|
||||
[<sel:SELECTED>] ;
|
||||
[<dis:DISABLED>] ;
|
||||
=>;
|
||||
<oSelect>:addOption( <text>, <value>, <label>, <.sel.>, <.dis.> )
|
||||
|
||||
|
||||
// --> Literals
|
||||
|
||||
#xCommand LINE BREAK ;
|
||||
[IN <oForm>] ;
|
||||
=> ;
|
||||
<oForm>:AddControl( "<BR>"+CRLF() )
|
||||
|
||||
|
||||
#xCommand LINE [IN <oForm>] ;
|
||||
=> ;
|
||||
<oForm>:AddControl( CRLF()+'<HR WIDTH = 100%>'+CRLF() )
|
||||
|
||||
#xCommand SPACE <n> [IN <oForm>] ;
|
||||
=> ;
|
||||
<oForm>:AddControl( replicate( " ", <n> ) )
|
||||
|
||||
|
||||
#xCommand TEXT <c> [IN <oForm>] ;
|
||||
=> ;
|
||||
<oForm>:AddControl( <c> )
|
||||
|
||||
#xCommand SCRIPT <c> [IN <oForm>] ;
|
||||
=> ;
|
||||
<oForm>:AddControl( <c> )
|
||||
|
||||
|
||||
#xCommand START GROUP <c> IN <oForm> => ;
|
||||
<oForm>:AddControl( CRLF()+"<FIELDSET><LEGEND>"+<c>+"</LEGEND>"+CRLF() )
|
||||
|
||||
#xCommand END GROUP IN <oForm> => ;
|
||||
<oForm>:AddControl( CRLF()+"</FIELDSET>"+CRLF() )
|
||||
|
||||
|
||||
#xtranslate __TYPE__ => "TEXT"
|
||||
#xtranslate __TYPE__ <typ:EDIT> => "TEXT"
|
||||
#xtranslate __TYPE__ <typ:TEXT> => "TEXT"
|
||||
#xtranslate __TYPE__ <typ:TEXTAREA> => "TEXTAREA"
|
||||
#xtranslate __TYPE__ <typ:PASSWORD> => "PASSWORD"
|
||||
#xtranslate __TYPE__ <typ:IMAGE> => "IMAGE"
|
||||
#xtranslate __TYPE__ <typ:BUTTON> => "BUTTON"
|
||||
#xtranslate __TYPE__ <typ:CHECKBOX> => "CHECKBOX"
|
||||
#xtranslate __TYPE__ <typ:CHECK> => "CHECKBOX"
|
||||
#xtranslate __TYPE__ <typ:HIDDEN> => "HIDDEN"
|
||||
#xtranslate __TYPE__ <typ:RADIO> => "RADIO"
|
||||
#xtranslate __TYPE__ <typ:FILE> => "FILE"
|
||||
#xtranslate __TYPE__ <typ:RESET> => "RESET"
|
||||
#xtranslate __TYPE__ <typ:SUBMIT> => "SUBMIT"
|
||||
#xtranslate __TYPE__ <typ:SELECT> => "SELECT"
|
||||
|
||||
#xtranslate __WRAP__ => NIL
|
||||
#xtranslate __WRAP__ <wrap:OFF> => "OFF"
|
||||
#xtranslate __WRAP__ <wrap:VIRTUAL> => "VIRTUAL"
|
||||
#xtranslate __WRAP__ <wrap:PHYSICAL> => "PHYSICAL"
|
||||
#xtranslate __WRAP__ <wrap:NORMAL> => "NORMAL"
|
||||
|
||||
#xtranslate __ALIGN__ => NIL
|
||||
#xtranslate __ALIGN__ <aln:LEFT> => "LEFT"
|
||||
#xtranslate __ALIGN__ <aln:RIGHT> => "RIGHT"
|
||||
#xtranslate __ALIGN__ <aln:CENTER> => "MIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:MIDDLE> => "MIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:TOP> => "TOP"
|
||||
#xtranslate __ALIGN__ <aln:TEXTTOP> => "TEXTTOP"
|
||||
#xtranslate __ALIGN__ <aln:BOTTOM> => "BOTTOM"
|
||||
#xtranslate __ALIGN__ <aln:ABSMIDDLE> => "ABSMIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:ABSCENTER> => "ABSMIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:ABSBOTTOM> => "ABSBOTTOM"
|
||||
#xtranslate __ALIGN__ <aln:BASELINE> => "BASELINE"
|
||||
|
||||
|
||||
#define _FORMS_CH
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* HTMBROWS -Browse module
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* Copyright 2001 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* HtmlBrowseSql()
|
||||
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "default.ch"
|
||||
#include "html.ch"
|
||||
|
||||
|
||||
/****
|
||||
* htmlBrowse()
|
||||
*
|
||||
*
|
||||
* Create an HTML table containing the raw contents of a .DBF table.
|
||||
* Every record is associated with an action pushbutton, presented
|
||||
* in the leftmost table cell.
|
||||
*
|
||||
* <oHtm> Active HTML() object
|
||||
* <cAction> Action to perform if the button is clicked
|
||||
* <lUseLinks> Generate record number links instead of push buttons
|
||||
* <cTarget> Target frame for <cAction>
|
||||
* <cAlias> Database alias. Defaults to ALIAS()
|
||||
*
|
||||
* Numbers are right formatted. Everything else is centered.
|
||||
*
|
||||
*/
|
||||
|
||||
PROC htmlBrowse( oHtm, cAction, lUseLinks, cTarget, cAlias )
|
||||
LOCAL i, n := 0
|
||||
LOCAL aFlds := dbStruct()
|
||||
LOCAL cAlign
|
||||
|
||||
HB_SYMBOL_UNUSED( cTarget )
|
||||
HB_SYMBOL_UNUSED( cAlias )
|
||||
|
||||
DEFAULT cAction := "confirm('RECORD: '+this.name+'\nPlace your action here !!!')"
|
||||
DEFAULT lUseLinks := .F.
|
||||
|
||||
/*
|
||||
// browse caption...
|
||||
oHtm:defineTable( 1, 1, 98 )
|
||||
oHtm:newTableRow("black")
|
||||
oHtm:newTableCell(,,,3,"white")
|
||||
oHtm:Write( htmlSpace( 5 ) +"Browsing Table: <B>"+ALIAS()+"</B>" )
|
||||
oHtm:endTableCell()
|
||||
oHtm:endTableRow("black")
|
||||
oHtm:endTable()
|
||||
*/
|
||||
|
||||
oHtm:defineTable( FCount(), 1, 98 )
|
||||
|
||||
oHtm:TableHead( " ? " )
|
||||
FOR i=1 TO FCount()
|
||||
oHtm:TableHead( aFlds[i,1] )
|
||||
NEXT
|
||||
|
||||
WHILE !( EOF() )
|
||||
|
||||
// each row has a different color...
|
||||
IF n == 0
|
||||
oHtm:newTableRow("lightyellow")
|
||||
n := 1
|
||||
ELSE
|
||||
oHtm:newTableRow("#9196A0")
|
||||
n := 0
|
||||
ENDIF
|
||||
|
||||
// put an action pushbutton...
|
||||
oHtm:newTableCell("center")
|
||||
IF lUseLinks
|
||||
LINK (cAction) ;
|
||||
TEXT ( NTrim(Recno()) ) ;
|
||||
OF oHtm
|
||||
ELSE
|
||||
PUSH BUTTON ;
|
||||
NAME "'B"+NTRIM(RECNO())+"'" ;
|
||||
CAPTION "' ? '" ;
|
||||
ONCLICK (cAction) ;
|
||||
OF oHtm
|
||||
ENDIF
|
||||
oHtm:EndTableCell()
|
||||
|
||||
// --> put the formatted fields data...
|
||||
FOR i=1 TO LEN( aFlds )
|
||||
cAlign := IF( aFlds[i,2] == "N", "RIGHT", "CENTER" )
|
||||
oHtm:newTableCell( cAlign,,,, "black" )
|
||||
oHtm:Write( greek2Html( any2Str( FieldGet( i ) ) ) )
|
||||
oHtm:EndTableCell()
|
||||
NEXT
|
||||
oHtm:endTableRow()
|
||||
SKIP
|
||||
ENDDO
|
||||
|
||||
oHtm:endTable()
|
||||
|
||||
RETURN
|
||||
#ifdef MYSQL
|
||||
PROC htmlBrowseSql( oHtm, cAction, lUseLinks, cTarget, oServer,oQuery )
|
||||
LOCAL i,p, n := 0
|
||||
local oCurRow
|
||||
|
||||
LOCAL cAlign
|
||||
|
||||
DEFAULT cAction := "confirm('RECORD: '+this.name+'\nPlace your action here !!!')"
|
||||
DEFAULT lUseLinks := .F.
|
||||
|
||||
/*
|
||||
// browse caption...
|
||||
oHtm:defineTable( 1, 1, 98 )
|
||||
oHtm:newTableRow("black")
|
||||
oHtm:newTableCell(,,,3,"white")
|
||||
oHtm:Write( htmlSpace( 5 ) +"Browsing Table: <B>"+ALIAS()+"</B>" )
|
||||
oHtm:endTableCell()
|
||||
oHtm:endTableRow("black")
|
||||
oHtm:endTable()
|
||||
*/
|
||||
oquery:=oServer:query('Select * from rafael')
|
||||
|
||||
oHtm:defineTable( oQuery:FCount(), 1, 98 )
|
||||
oCurRow:=oQuery:getRow(1)
|
||||
oHtm:TableHead( " ? " )
|
||||
FOR i=1 TO oQuery:FCount()
|
||||
oHtm:TableHead( oCurRow:FieldName(i) )
|
||||
NEXT
|
||||
|
||||
for p:=1 to oQuery:LastRec()
|
||||
oCurRow:=oQuery:getRow(P)
|
||||
// each row has a different color...
|
||||
IF n == 0
|
||||
oHtm:newTableRow("lightyellow")
|
||||
n := 1
|
||||
ELSE
|
||||
oHtm:newTableRow("#9196A0")
|
||||
n := 0
|
||||
ENDIF
|
||||
|
||||
// put an action pushbutton...
|
||||
oHtm:newTableCell("center")
|
||||
IF lUseLinks
|
||||
LINK (cAction) ;
|
||||
TEXT ( NTrim(oQuery:RECNO()) ) ;
|
||||
OF oHtm
|
||||
ELSE
|
||||
PUSH BUTTON ;
|
||||
NAME "'B"+NTRIM(oQuery:RECNO())+"'" ;
|
||||
CAPTION "' ? '" ;
|
||||
ONCLICK (cAction) ;
|
||||
OF oHtm
|
||||
ENDIF
|
||||
oHtm:EndTableCell()
|
||||
|
||||
// --> put the formatted fields data...
|
||||
|
||||
for i:=1 to oquery:fcount()
|
||||
|
||||
cAlign := IF( oCurRow:FieldType(i) == "N", "RIGHT", "CENTER" )
|
||||
oHtm:newTableCell( cAlign,,,, "black" )
|
||||
oHtm:Write( greek2Html( any2Str( oCurRow:FieldGet( i ) ) ) )
|
||||
oHtm:EndTableCell()
|
||||
end
|
||||
oHtm:endTableRow()
|
||||
if !oquery:eof()
|
||||
oquery:skip()
|
||||
endif
|
||||
|
||||
next
|
||||
oHtm:endTable()
|
||||
|
||||
RETURN
|
||||
#endif
|
||||
|
||||
//*** EOF ***//
|
||||
@@ -1,764 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* HTML.CH Main HTML include File Definition of all html lib commands
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HTML_CH
|
||||
|
||||
#include "simpleio.ch"
|
||||
#include "forms.ch"
|
||||
#include "colors.ch"
|
||||
|
||||
#xTranslate DEFAULT( <p>, <v> ) => <p> := IF( <p> == NIL, <v>, <p> )
|
||||
|
||||
|
||||
#define STD_IN 0
|
||||
#define STD_OUT 1
|
||||
|
||||
|
||||
#define _WHITE_BLUE_STYLE "<!-- "+;
|
||||
" A:visited {text-decoration:none;color:blue;background:none;} "+;
|
||||
" A:link {text-decoration:none;color:blue;background:none;} "+;
|
||||
" A:active {text-decoration:none;color:blue;background:none;} "+;
|
||||
" A:hover {text-decoration:none;color:white;background:blue;} "+;
|
||||
"-->"
|
||||
#define _BLUE_WHITE_STYLE "<!-- "+;
|
||||
"A:visited {text-decoration:none;color:white;background:none;} "+;
|
||||
"A:link {text-decoration:none;color:white;background:none;} "+;
|
||||
"A:active {text-decoration:none;color:white;background:none;} "+;
|
||||
"A:hover {text-decoration:none;color:blue;background:white;} "+;
|
||||
"-->"
|
||||
#define _WHITE_RED_STYLE "<!-- "+;
|
||||
"A:visited {text-decoration:none;color:red;background:none;} "+;
|
||||
"A:link {text-decoration:none;color:red;background:none;} "+;
|
||||
"A:active {text-decoration:none;color:red;background:none;} "+;
|
||||
"A:hover {text-decoration:none;color:white;background:red;} "+;
|
||||
"-->"
|
||||
#define _WHITE_BLACK_STYLE "<!-- "+;
|
||||
"A:visited {text-decoration:none;color:black;background:none;}"+;
|
||||
"A:link {text-decoration:none;color:black;background:none;} "+;
|
||||
"A:active {text-decoration:none;color:black;background:none;}"+;
|
||||
"A:hover {text-decoration:none;color:white;background:black;} "+;
|
||||
" -->"
|
||||
|
||||
#define LINE_BREAK "<BR>"
|
||||
#define BOLD_ON "<B>"
|
||||
#define BOLD_OFF "</B>"
|
||||
|
||||
#define _HTML_SPACE chr(38)+"nbsp;"
|
||||
|
||||
#xTranslate HTMLSpace( <n> ) => replicate( " ", <n> ) //" "
|
||||
|
||||
#xTranslate :putLink( <c>, <u> ) => :putTextURL( <c>, <u> )
|
||||
|
||||
|
||||
|
||||
#define CLR_LIGHT_YELLOW "#fffffc0"
|
||||
#define CLR_DARK_YELLOW "#fffffcc"
|
||||
#define CLR_DARKER_YELLOW "#fffff80"
|
||||
#define CLR_LIGHT_BLUE "#DEEFEF" //"00000ff"
|
||||
#define CLR_MAGENTA "#FFD0FF"
|
||||
#define CLR_CYAN "#D0FFFFF"
|
||||
#define CLR_LIGHT_GRAY "#F0F0F0"
|
||||
|
||||
#define CLR_BLACK "black" //"#0000000"
|
||||
#define CLR_MAROON "maroon"
|
||||
#define CLR_GREEN "green"
|
||||
#define CLR_OLIVE "olive"
|
||||
#define CLR_NAVY "navy"
|
||||
#define CLR_PURPLE "purple"
|
||||
#define CLR_TEAL "teal"
|
||||
#define CLR_GRAY "gray"
|
||||
#define CLR_SILVER "silver"
|
||||
#define CLR_RED "red"
|
||||
#define CLR_LIME "lime"
|
||||
#define CLR_YELLOW "yellow"
|
||||
#define CLR_BLUE "blue"
|
||||
#define CLR_FUCHSIA "fuchsia"
|
||||
#define CLR_AQUA "aqua"
|
||||
#define CLR_WHITE "white" //"#fffffff"
|
||||
|
||||
|
||||
#xCommand DEFINE HTML ;
|
||||
[FILE <file>] ;
|
||||
[TITLE <title>] ;
|
||||
[LINKTITLE <linktitle>] ;
|
||||
[CHARSET <charset>] ;
|
||||
[JAVASOURCE <javasrc,...>] ;
|
||||
[JAVACODE <javacode,...>] ;
|
||||
[BGIMAGE <bgimg>] ;
|
||||
[BGCOLOR <bgcolor>] ;
|
||||
[TEXTCOLOR <txtcolor>] ;
|
||||
[ONLOAD <onload>] ;
|
||||
[ONOPEN <onload>] ;
|
||||
[ONUNLOAD <onunload>] ;
|
||||
[ONCLOSE <onunload>] ;
|
||||
[LINKCOLOR <lcolor>] ;
|
||||
[VLINKCOLOR <vlcolor>] ;
|
||||
[ALINKCOLOR <alcolor>] ;
|
||||
[STYLE <cStyle>] ;
|
||||
[IMAGES <aImages,...>] ;
|
||||
[BASEURL <baseurl>] ;
|
||||
[BASETARGET <basetarget>] ;
|
||||
[STYLESHEET <cStyleScr>] ;
|
||||
[<lcache:NOCACHE>] ;
|
||||
OF <oHtml> ;
|
||||
=> ;
|
||||
<oHtml> := html():new( <file>,<title>,<linktitle>,<charset>,;
|
||||
[{<(javasrc)>}], ;
|
||||
[<bgimg>], [<bgcolor>], [<txtcolor>],;
|
||||
[{<(javacode)>}],;
|
||||
[<(onload)>], [<(onunload)>], ;
|
||||
[<(lcolor)>],[<(vlcolor)>],[<(alcolor)>],;
|
||||
[<(cStyle)>], [<aImages>],;
|
||||
[<baseurl>], [<basetarget>] ,<cStyleScr>,<.lcache.>)
|
||||
|
||||
#xCommand DEFINE CGI ;
|
||||
[TITLE <title>] ;
|
||||
[LINKTITLE <linktitle>] ;
|
||||
[CHARSET <charset>] ;
|
||||
[JAVASOURCE <javasrc,...>] ;
|
||||
[JAVACODE <javacode,...>] ;
|
||||
[BGIMAGE <bgimg>] ;
|
||||
[BGCOLOR <bgcolor>] ;
|
||||
[TEXTCOLOR <txtcolor>] ;
|
||||
[ONLOAD <onload>] ;
|
||||
[ONOPEN <onload>] ;
|
||||
[ONUNLOAD <onunload>] ;
|
||||
[ONCLOSE <onunload>] ;
|
||||
[LINKCOLOR <lcolor>] ;
|
||||
[VLINKCOLOR <vlcolor>] ;
|
||||
[ALINKCOLOR <alcolor>] ;
|
||||
[STYLE <cStyle>] ;
|
||||
[IMAGES <aImages>] ;
|
||||
[SERVERSOURCE <srvr,...>] ;
|
||||
[BASEURL <baseurl>] ;
|
||||
[BASETARGET <basetarget>] ;
|
||||
[REFRESH <nrefr> [REFRESHURL <refrURL>] ] ;
|
||||
[STYLESHEET <cStyleScr>] ;
|
||||
[<lcache:NOCACHE>] ;
|
||||
OF <oHtml> ;
|
||||
=> ;
|
||||
<oHtml> := html():CGInew(<title>, <linktitle>, <charset>,;
|
||||
[{<(javasrc)>}], ;
|
||||
[<bgimg>], [<bgcolor>], [<txtcolor>],;
|
||||
[{<(javacode)>}],;
|
||||
[<(onload)>], [<(onunload)>], ;
|
||||
[<(lcolor)>],[<(vlcolor)>],[<(alcolor)>],;
|
||||
[<(cStyle)>], [<aImages>], [{<(srvr)>}],;
|
||||
[<baseurl>], [<basetarget>], ;
|
||||
<nrefr>, <refrURL> ,<cStyleScr>,<.lcache.>)
|
||||
// [<auth:AUTHENTICATE>] ;
|
||||
// [<.auth.>]
|
||||
|
||||
|
||||
#xCommand DEFINE TABLE ;
|
||||
[COLS <cols>] ;
|
||||
[BORDER <border>] ;
|
||||
[WIDTH <width>] ;
|
||||
[HEIGHT <height>] ;
|
||||
[COLORFORE <clrfore>] ;
|
||||
[BGCOLOR <clrbg>] ;
|
||||
[COLORBG <clrbg>] ;
|
||||
[COLORDARK <clrdrk>] ;
|
||||
[COLORLIGHT <clrlt>] ;
|
||||
[BORDERCOLOR <cClrBorder>] ;
|
||||
[BGIMAGE <bgImage>] ;
|
||||
[<aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
[CELLPADDING <nCellPadding>] ;
|
||||
[CELLSPACING <nCellSpacing>] ;
|
||||
[STYLE <cStyle>] ;
|
||||
[<d:3D>] ;
|
||||
[<c:RCOLS>] ;
|
||||
[<r:RROWS>] ;
|
||||
[<x:RALL>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:defineTable( <cols>, <border>, <width>,<height>, ;
|
||||
<clrfore>, <clrbg>, ;
|
||||
<.d.>, <.c.>, <.r.>,;
|
||||
<clrdrk>, <clrlt>, <cClrBorder>, ;
|
||||
<nCellPadding>,<nCellSpacing>,__ALIGN__ [<aln>],<.x.>,<bgImage>,<cStyle>)
|
||||
|
||||
|
||||
#xCommand DEFINE TABLE HEADER ;
|
||||
[TEXT <cHead>] ;
|
||||
[COLOR <cColor>] ;
|
||||
[<aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
[FONT <cFont>] ;
|
||||
[SIZE <nSize>] ;
|
||||
[FONTCOLOR <cFntColor>] ;
|
||||
[HEIGHT <nHeight>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:TableHead( <cHead>, <cColor>, __ALIGN__ [<aln>], <cFont>, ;
|
||||
<nSize>, <cFntColor>, <nHeight> )
|
||||
|
||||
|
||||
#xCommand DEFINE CELL ;
|
||||
[COLOR <cColor>] ;
|
||||
[ALING <aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
[FONT <cFont>] ;
|
||||
[SIZE <nSize>] ;
|
||||
[FONTCOLOR <cFntColor>] ;
|
||||
[HEIGHT <nHeight>] ;
|
||||
[IMAGE <img>] ;
|
||||
[BGIMAGE <img>] ;
|
||||
[WIDTH <width>] ;
|
||||
[COLORDARK <clrdrk>] ;
|
||||
[COLORLIGHT <clrlt>] ;
|
||||
[ROWSPAN <rspan>] ;
|
||||
[COLSPAN <cspan>] ;
|
||||
[<nowrap:NOWRAP>] ;
|
||||
[<valn:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
[BORDERCOLOR <bclrlt>] ;
|
||||
[CLASS <cClass>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:newTableCell( __ALIGN__ [<aln>], <cColor>, <cFont>, ;
|
||||
<nSize>, <cFntColor>, <nHeight>, ;
|
||||
<img>, <width>, !<.nowrap.>, ;
|
||||
<cspan>, <rspan> ,__ALIGN__ [<valn>],<clrdrk>,<clrlt>,<bclrlt>,<cClass>)
|
||||
|
||||
|
||||
#xCommand TABLE CELL ;
|
||||
[COLOR <cColor>] ;
|
||||
[FONT <cFont>] ;
|
||||
[SIZE <nSize>] ;
|
||||
[FONTCOLOR <cFntColor>] ;
|
||||
[HEIGHT <nHeight>] ;
|
||||
[IMAGE <img>] ;
|
||||
[WIDTH <width>] ;
|
||||
[ROWSPAN <rspan>] ;
|
||||
[COLSPAN <cspan>] ;
|
||||
[<nowrap:NOWRAP>] ;
|
||||
[<aln:LEFT,RIGHT,CENTER,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSCENTER,ABSBOTTOM,BASELINE>];
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:newTableCell( __ALIGN__ [<aln>], <cColor>, <cFont>, ;
|
||||
<nSize>, <cFntColor>, <nHeight>, ;
|
||||
<img>, <width>, !<.nowrap.>,;
|
||||
<cspan>, <rspan> )
|
||||
|
||||
|
||||
#xCommand DEFINE FONT [<cFont>] ;
|
||||
[<ftype:BOLD,ITALIC,ULINE,UNDERLINE>] ;
|
||||
[SIZE <s>] ;
|
||||
[COLOR <c>] ;
|
||||
[OF <oHtm>] ;
|
||||
=> ;
|
||||
<oHtm>:defineFont( [<(cFont)>], __FTYPE__ [<ftype>], ;
|
||||
[<s>], [<c>] )
|
||||
|
||||
|
||||
#xCommand SET FONT [<cFont>] ;
|
||||
[<bold:BOLD>] ;
|
||||
[<itl:ITALIC>] ;
|
||||
[<uln:UNDERLINE>] ;
|
||||
[SIZE <s>] ;
|
||||
[COLOR <c>] ;
|
||||
[<lset:NOTSET>] ;
|
||||
[OF <oHtm>] ;
|
||||
=> ;
|
||||
<oHtm>:SetFont( [<(cFont)>], [<.bold.>], ;
|
||||
[<.itl.>], [<.uln.>], ;
|
||||
[<s>], [<c>],!<.lset.> )
|
||||
|
||||
|
||||
#xCommand START FONT [<cFont>] ;
|
||||
[<bold:BOLD>] ;
|
||||
[<itl:ITALIC>] ;
|
||||
[<uln:UNDERLINE>] ;
|
||||
[SIZE <s>] ;
|
||||
[COLOR <c>] ;
|
||||
[<lset:NOTSET>] ;
|
||||
[OF <oHtm>] ;
|
||||
=> ;
|
||||
<oHtm>:StartFont( [<(cFont)>], [<.bold.>], ;
|
||||
[<.itl.>], [<.uln.>], ;
|
||||
[<s>], [<c>] ,!<.lset.> )
|
||||
|
||||
|
||||
#xCommand END FONT [<cFont>] ;
|
||||
[OF <oHtm>] ;
|
||||
=> ;
|
||||
<oHtm>:EndFont()
|
||||
|
||||
|
||||
#xcommand SAY <str> ;
|
||||
[FONT <fnt> ] ;
|
||||
[TYPE <type>] ;
|
||||
[SIZE <size>] ;
|
||||
[STYLE <style>] ;
|
||||
[COLOR <clr>] ;
|
||||
<of:OF,IN> <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:Say( <str>, <fnt>, <size>, <type>, <clr>, <style>)
|
||||
|
||||
|
||||
#xcommand PUSH BUTTON ;
|
||||
[NAME <name>] ;
|
||||
[CAPTION <caption>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONFOCUS <onfocus>] ;
|
||||
[ONBLUR <onblur>] ;
|
||||
[ONMSOVER <onmsov>] ;
|
||||
[ONMSOUT <onmsou>] ;
|
||||
[CGIAPP <cgiapp>] ;
|
||||
[STYLE <style>] ;
|
||||
[ID <id>] ;
|
||||
[OF <oHtm>] ;
|
||||
=> ;
|
||||
<oHtm>:PushButton( <(name)>, <(caption)>, ;
|
||||
[<(cgiapp)>], [<(onclick)>], ;
|
||||
[<(onfocus)>], [<(onblur)>],;
|
||||
[<(onmsov)>], [<(onmsou)>],;
|
||||
[<(style)>], [<(id)>] )
|
||||
|
||||
#xcommand BUTTON ;
|
||||
[NAME <name>] ;
|
||||
[CAPTION <caption>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONMSOVER <onmsov>] ;
|
||||
[ONMSOUT <onmsou>] ;
|
||||
[CGIAPP <cgiapp>] ;
|
||||
[STYLE <style>] ;
|
||||
[ID <id>] ;
|
||||
[OF <oHtm>] ;
|
||||
=>;
|
||||
<oHtm>:Button( <(name)>, <(caption)>, ;
|
||||
[<(onclick)>],[<(cgiapp)>], ;
|
||||
[<(onmsov)>], [<(onmsou)>],;
|
||||
[<(style)>], [<(id)>] )
|
||||
|
||||
|
||||
#xCommand END BUTTON OF <oHtm> ;
|
||||
=>;
|
||||
<oHtm>:endButton()
|
||||
|
||||
|
||||
#xCommand IMAGE <image> ;
|
||||
URL <url> ;
|
||||
[BORDER <border>] ;
|
||||
[HEIGHT <height>] ;
|
||||
[WIDTH <width>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[NAME <name>] ;
|
||||
[TARGET <target>] ;
|
||||
[ALT <alt>] ;
|
||||
[<break:BREAK>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:putImageURL( <image>, <border>, <height>, <url>,;
|
||||
<onclick>, <onmsover>, <onmsout>, ;
|
||||
<name>, <alt>, <target>, <width>,<.break.>)
|
||||
|
||||
|
||||
#xCommand IMAGE <image> ;
|
||||
[BORDER <border>] ;
|
||||
[HEIGHT <height>] ;
|
||||
[WIDTH <width>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[NAME <name>] ;
|
||||
[TARGET <target>] ;
|
||||
[ALT <alt>] ;
|
||||
[<break:BREAK>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:putImage( <image>, <border>, <height>,;
|
||||
<onclick>, <onmsover>, <onmsout>, ;
|
||||
<name>, <alt>, ;
|
||||
<target>,<width> ,<.break.>)
|
||||
|
||||
#xCommand LINK <url> ;
|
||||
[TEXT <text>] ;
|
||||
[FONT <font>] ;
|
||||
[FONTCOLOR <clr>] ;
|
||||
[SIZE <size>] ;
|
||||
[STYLE <style>] ;
|
||||
[<bld:BOLD>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[TARGET <target>] ;
|
||||
[<break:BREAK>] ;
|
||||
[CLASS <cClass>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:putTextURL( <text>, <url>, ;
|
||||
<onclick>, <onmsover>, <onmsout>, ;
|
||||
<target>,<font>,<clr>,<size>,<style>,<.bld.> ,<.break.>,<cClass>)
|
||||
|
||||
#xCommand LINK <url> ;
|
||||
[IMAGE <image>] ;
|
||||
[WIDTH <width>] ;
|
||||
[HEIGHT <height>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[BORDER <border>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[NAME <name>] ;
|
||||
[ALT <alt>] ;
|
||||
[TARGET <target>] ;
|
||||
[<break:BREAK>] ;
|
||||
[CLASS <cClass>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:putImageURL( <image>,<border>,<height>,<url>,;
|
||||
<onclick>, <onmsover>, <onmsout>,<name>,<alt>, ;
|
||||
<target> ,<width>,<.break.>,<cClass>)
|
||||
|
||||
|
||||
#xCommand NEW FRAMEPAGE ;
|
||||
[TITLE <title>] ;
|
||||
[FILE <file>] ;
|
||||
OF <oFrm> ;
|
||||
=> ;
|
||||
<oFrm>:=frameSet():New( <file>, <title>)
|
||||
|
||||
|
||||
#xCommand FRAMESET ;
|
||||
[TITLE <title>] ;
|
||||
[FILE <file>] ;
|
||||
[ROWS <rows,...>] ;
|
||||
[COLS <cols,...>] ;
|
||||
[ONLOAD <onload>] ;
|
||||
[ONUNLOAD <onunload>] ;
|
||||
OF <oFrm> ;
|
||||
=> ;
|
||||
<oFrm>:StartSet( [{<(rows)>}], [{<(cols)>}], ;
|
||||
[<(onload)>], [<(onunload)>] )
|
||||
|
||||
|
||||
|
||||
#xCommand FRAME ;
|
||||
[NAME <name>] ;
|
||||
[URL <url>] ;
|
||||
[<brd:NOBORDER>] ;
|
||||
[<res:NORESIZE>] ;
|
||||
[<scr:SCROLLBAR>] ;
|
||||
[SCROLLING <scrl:YES,NO,ON,OFF,AUTO>] ;
|
||||
[TARGET <target>] ;
|
||||
[MARGINWIDTH <mw>] ;
|
||||
[MARGINHEIGHT <mh>] ;
|
||||
OF <oFrm> ;
|
||||
=> ;
|
||||
<oFrm>:frame( [<name>], [<url>], ;
|
||||
!<.brd.>, !<.res.>, [<.scr.>], ;
|
||||
[<mw>], [<mh>], [<target>], ;
|
||||
__SCROLL__ [<scrl>] )
|
||||
|
||||
#xCommand ENDSET <oFrm> => <oFrm>:EndSet()
|
||||
#xCommand END FRAMEPAGE <oFrm> => <oFrm>:End()
|
||||
|
||||
|
||||
#xcommand MARQUEE <cText> ;
|
||||
[FONT <cFont>] ;
|
||||
[FONTCOLOR <cFntColor>] ;
|
||||
[FONTSIZE <nFntSize>] ;
|
||||
[<pos:TOP,MIDDLE,BOTTOM>] ;
|
||||
[WIDTH <nWidth>] ;
|
||||
[HEIGHT <nHeight>] ;
|
||||
[BGCOLOR <cbgColor>] ;
|
||||
[<bhv:SCROLL,SLIDE,ALT,ALTERNATE>] ;
|
||||
[<dir:LEFT,RIGHT>] ;
|
||||
[SCROLLAMT <nScrollAmt>] ;
|
||||
[SCROLLDELAY <nScrollDel>] ;
|
||||
[LOOP <loop>] ;
|
||||
[ONMSOVER <onmsover>] ;
|
||||
[ONMSOUT <onmsout>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONSTART <onstart>] ;
|
||||
[ONFINISH <onfinish>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:Marquee( <cText>, <cFont>, <cFntColor>, <nFntSize>, ;
|
||||
__POS__ [<pos>], <nWidth>, <nHeight>, <cbgColor>, ;
|
||||
__BEHAVE__ [<bhv>], __DIR__ [<dir>], ;
|
||||
<nScrollAmt>, <nScrollDel>, <loop>,;
|
||||
[<(onmsover)>], [<(onmsout)>], [<(onclick)>], ;
|
||||
[<(onstart)>], [<(onfinish)>] )
|
||||
|
||||
|
||||
#xcommand START MARQUEE ;
|
||||
[FONT <cFont>] ;
|
||||
[FONTCOLOR <cFntColor>] ;
|
||||
[FONTSIZE <nFntSize>] ;
|
||||
[<pos:TOP,MIDDLE,BOTTOM>] ;
|
||||
[WIDTH <nWidth>] ;
|
||||
[HEIGHT <nHeight>] ;
|
||||
[BGCOLOR <cbgColor>] ;
|
||||
[<bhv:SCROLL,SLIDE,ALT,ALTERNATE>] ;
|
||||
[<dir:LEFT,RIGHT>] ;
|
||||
[SCROLLAMT <nScrollAmt>] ;
|
||||
[SCROLLDELAY <nScrollDel>] ;
|
||||
[LOOP <loop>] ;
|
||||
[ONMSOVER <onmsover>] ;
|
||||
[ONMSOUT <onmsout>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[ONSTART <onstart>] ;
|
||||
[ONFINISH <onfinish>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:StartMarquee( <cFont>, <cFntColor>, <nFntSize>, ;
|
||||
__POS__ [<pos>], <nWidth>, <nHeight>, <cbgColor>, ;
|
||||
__BEHAVE__ [<bhv>], __DIR__ [<dir>], ;
|
||||
<nScrollAmt>, <nScrollDel>, <loop>,;
|
||||
[<(onmsover)>], [<(onmsout)>], [<(onclick)>], ;
|
||||
[<(onstart)>], [<(onfinish)>] )
|
||||
|
||||
|
||||
|
||||
#xCommand END MARQUEE OF <oHtm> => <oHtm>:endMarquee()
|
||||
|
||||
|
||||
|
||||
#xcommand INLINE FRAME ;
|
||||
[NAME <name>] ;
|
||||
[SRC <url>] ;
|
||||
[URL <url>] ;
|
||||
[HEIGHT <height>] ;
|
||||
[WIDTH <width>] ;
|
||||
[MARGINHEIGHT <mheight>] ;
|
||||
[MARGINWIDTH <mwidth>] ;
|
||||
[<scr:SCROLLING>] ;
|
||||
[<brd:NOBORDER>] ;
|
||||
[ALIGN <align>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:iFrame( <name>, <url>, !<.brd.>, ;
|
||||
<mwidth>, <mheight>, ;
|
||||
<.scr.>, <align>, ;
|
||||
<width>, <height> )
|
||||
|
||||
|
||||
|
||||
#xcommand COUNTER ;
|
||||
[NUMBER <num>] ;
|
||||
[DIGITS <dig>] ;
|
||||
[COLOR <clr>] ;
|
||||
[WIDTH <w>] ;
|
||||
[BORDER <b>] ;
|
||||
[FOLDER <folder>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
putCounter( <oHtm>, <num>, <folder>, <dig>, <w>, <clr>, <b> )
|
||||
|
||||
/*******************************************/
|
||||
/* New Commands */
|
||||
/*******************************************/
|
||||
|
||||
#xCommand LINKS <url> ;
|
||||
[TEXT <text>] ;
|
||||
[IMAGE <image>] ;
|
||||
[WIDTH <width>] ;
|
||||
[HEIGHT <height>] ;
|
||||
[ONCLICK <onclick>] ;
|
||||
[BORDER <border>] ;
|
||||
[ONMOUSEOVER <onmsover>] ;
|
||||
[ONMOUSEOUT <onmsout>] ;
|
||||
[NAME <name>] ;
|
||||
[ALT <alt>] ;
|
||||
[TARGET <target>] ;
|
||||
[<break:BREAK>] ;
|
||||
[CLASS <cClass>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:putTextImageURL( <image>,<border>,<height>,<url>,;
|
||||
<onclick>, <onmsover>, <onmsout>,<name>,<alt>, ;
|
||||
<target> ,<width>,<.break.>,<cClass>,<text>)
|
||||
#xCommand SPAN <text> ;
|
||||
[STYLE <cStyle>] ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:Span(<text>,<cStyle>)
|
||||
|
||||
#xCommand Comment <text> ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:Comment(<text>)
|
||||
|
||||
#xCommand LINKNAME <cName> ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:PutLinkName(<cName>)
|
||||
|
||||
|
||||
#xCommand CREATE OBJECT ;
|
||||
[NAME <cName>] ;
|
||||
[TYPE <cType>] ;
|
||||
[CLASSID <cClassid>] ;
|
||||
[CODE <cCode>] ;
|
||||
[CODEBASE <cCodeBase>] ;
|
||||
[HEIGHT<nHeight>] ;
|
||||
[WIDTH <nWidth>] ;
|
||||
[<lDisable:DISABLED>] ;
|
||||
[<aln:LEFT,RIGHT,MIDDLE,TOP,TEXTTOP,BOTTOM,ABSMIDDLE,ABSBOTTOM,BASELINE>];
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:ADDOBJECT(<cType>,<cClassid>,__ALING__ [<aln>],<cCode>,<.lDisable.>,<cCodeBase>,<cName>,<nWidth>,<nHeight>)
|
||||
|
||||
#xCommand OBJECT PARAM ;
|
||||
NAME <cName> ;
|
||||
VALUE <cValue> ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:ADDPARAM(<cName>,<cValue>)
|
||||
|
||||
#xCommand END OBJECT ;
|
||||
OF <oHtm> ;
|
||||
=> ;
|
||||
<oHtm>:ENDOBJECT()
|
||||
|
||||
|
||||
|
||||
#xtranslate __SCROLL__ => "AUTO"
|
||||
#xtranslate __SCROLL__ <scrl:NO> => "NO"
|
||||
#xtranslate __SCROLL__ <scrl:OFF> => "NO"
|
||||
#xtranslate __SCROLL__ <scrl:ON> => "YES"
|
||||
#xtranslate __SCROLL__ <scrl:YES> => "YES"
|
||||
#xtranslate __SCROLL__ <scrl:AUTO> => "AUTO"
|
||||
|
||||
|
||||
#xtranslate __ALIGN__ => NIL
|
||||
#xtranslate __ALIGN__ <aln:LEFT> => "LEFT"
|
||||
#xtranslate __ALIGN__ <aln:RIGHT> => "RIGHT"
|
||||
#xtranslate __ALIGN__ <aln:CENTER> => "center"
|
||||
#xtranslate __ALIGN__ <aln:MIDDLE> => "MIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:TOP> => "TOP"
|
||||
#xtranslate __ALIGN__ <aln:TEXTTOP> => "TEXTTOP"
|
||||
#xtranslate __ALIGN__ <aln:BOTTOM> => "BOTTOM"
|
||||
#xtranslate __ALIGN__ <aln:ABSMIDDLE> => "ABSMIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:ABSCENTER> => "ABSMIDDLE"
|
||||
#xtranslate __ALIGN__ <aln:ABSBOTTOM> => "ABSBOTTOM"
|
||||
#xtranslate __ALIGN__ <aln:BASELINE> => "BASELINE"
|
||||
|
||||
#xtranslate __POS__ => NIL
|
||||
#xtranslate __POS__ <pos:TOP> => "TOP"
|
||||
#xtranslate __POS__ <pos:MIDDLE> => "MIDDLE"
|
||||
#xtranslate __POS__ <pos:BOTTOM> => "BOTTOM"
|
||||
|
||||
#xtranslate __DIR__ => NIL
|
||||
#xtranslate __DIR__ <dir:LEFT> => "LEFT"
|
||||
#xtranslate __DIR__ <dir:RIGHT> => "RIGHT"
|
||||
|
||||
#xtranslate __BEHAVE__ => NIL
|
||||
#xtranslate __BEHAVE__ <bhv:SCROLL> => "SCROLL"
|
||||
#xtranslate __BEHAVE__ <bhv:SLIDE> => "SLIDE"
|
||||
#xtranslate __BEHAVE__ <bhv:ALTERNATE> => "ALTERNATE"
|
||||
#xtranslate __BEHAVE__ <bhv:ALT> => "ALTERNATE"
|
||||
|
||||
#xtranslate __FTYPE__ => NIL
|
||||
#xtranslate __FTYPE__ <ftype:ITALIC> => "<I>"
|
||||
#xtranslate __FTYPE__ <ftype:BOLD> => "<B>"
|
||||
#xtranslate __FTYPE__ <ftype:ULINE> => "<U>"
|
||||
#xtranslate __FTYPE__ <ftype:UNDERLINE> => "<U>"
|
||||
|
||||
|
||||
#define GREEK_CGI {;
|
||||
{"€","%C1"},;
|
||||
{"<22>","%C2"},;
|
||||
{"‚","%C3"},;
|
||||
{"ƒ","%C4"},;
|
||||
{"„","%C5"},;
|
||||
{"…","%C6"},;
|
||||
{"†","%C7"},;
|
||||
{"‡","%C8"},;
|
||||
{"ˆ","%C9"},;
|
||||
{"‰","%CA"},;
|
||||
{"Š","%CB"},;
|
||||
{"‹","%CC"},;
|
||||
{"Œ","%CD"},;
|
||||
{"<22>","%CE"},;
|
||||
{"Ž","%CF"},;
|
||||
{"<22>","%D0"},;
|
||||
{"<22>","%D1"},;
|
||||
{"‘","%D3"},;
|
||||
{"’","%D4"},;
|
||||
{"“","%D5"},;
|
||||
{"”","%D6"},;
|
||||
{"•","%D7"},;
|
||||
{"–","%D8"},;
|
||||
{"—","%D9"},;
|
||||
{"˜","%E1"},;
|
||||
{"™","%E2"},;
|
||||
{"š","%E3"},;
|
||||
{"›","%E4"},;
|
||||
{"œ","%E5"},;
|
||||
{"<22>","%E6"},;
|
||||
{"ž","%E7"},;
|
||||
{"Ÿ","%E8"},;
|
||||
{" ","%E9"},;
|
||||
{"¡","%EA"},;
|
||||
{"¢","%EB"},;
|
||||
{"£","%EC"},;
|
||||
{"¤","%ED"},;
|
||||
{"¥","%EE"},;
|
||||
{"¦","%EF"},;
|
||||
{"§","%F0"},;
|
||||
{"¨","%F1"},;
|
||||
{"©","%F3"},;
|
||||
{"«","%F4"},;
|
||||
{"¬","%F5"},;
|
||||
{"","%F6"},;
|
||||
{"®","%F7"},;
|
||||
{"¯","%F8"},;
|
||||
{"à","%F9"},;
|
||||
{"ª","%F2"},;
|
||||
{"á","%DC"},;
|
||||
{"â","%DD"},;
|
||||
{"ã","%DE"},;
|
||||
{"å","%DF"},;
|
||||
{"æ","%FC"},;
|
||||
{"ç","%FD"},;
|
||||
{"é","%FE"} ;
|
||||
}
|
||||
|
||||
|
||||
#define _HTML_CH
|
||||
#endif
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Misc Suport Functions for HTMLLIB
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "html.ch"
|
||||
#include "default.ch"
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* backButton()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
PROC BackButton( cImage, oHtm )
|
||||
|
||||
DEFAULT cImage := "back.gif"
|
||||
DEFAULT oHtm := oPage()
|
||||
|
||||
IMAGE (cImage) ;
|
||||
URL "" ;
|
||||
ONCLICK "history.back()";
|
||||
OF oHtm
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* BackFormButton()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
PROC BackFormButton( cImage, oForm )
|
||||
LOCAL oBut
|
||||
|
||||
DEFAULT oForm := oForm()
|
||||
|
||||
IF cImage == NIL
|
||||
DEFINE BUTTON oBut ;
|
||||
NAME "BackButton" ;
|
||||
VALUE "go Back" ;
|
||||
ONCLICK "history.back()" ;
|
||||
IN oForm
|
||||
ELSE
|
||||
DEFINE IMAGE oBut ;
|
||||
NAME "BackButton";
|
||||
SOURCE (cImage) ;
|
||||
ONCLICK "history.back()";
|
||||
IN oForm
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* PutCounter()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
FUNCTION PutCounter( oHtm, nNumber, cDir, nDigits, nWidth, bgColor, nBorder )
|
||||
LOCAL i
|
||||
LOCAL cStr := ""
|
||||
LOCAL cLetter := ""
|
||||
|
||||
DEFAULT oHtm := oPage()
|
||||
DEFAULT nNumber := 0
|
||||
DEFAULT cDir := "/images/counters/"
|
||||
DEFAULT nWidth := 50
|
||||
DEFAULT nDigits := LEN(ALLTRIM(STR( nNumber )))
|
||||
DEFAULT nBorder := 1
|
||||
DEFAULT bgColor := "black"
|
||||
|
||||
IF Valtype( nNumber ) == "N"
|
||||
cStr := STRZERO(nNumber, nDigits)
|
||||
ENDIF
|
||||
|
||||
oHtm:Write("<center>")
|
||||
DEFINE TABLE ;
|
||||
BORDER (nBorder) ;
|
||||
WIDTH (nWidth) ;
|
||||
COLORBG (bgColor) ;
|
||||
OF oHtm
|
||||
|
||||
oHtm:newTableRow()
|
||||
oHtm:newTableCell("center")
|
||||
|
||||
FOR i=1 TO LEN( cStr )
|
||||
cLetter := SUBSTR( cStr, i, 1 )
|
||||
IMAGE cDir+cLetter+".gif" ;
|
||||
BORDER 0 ;
|
||||
OF oHtm
|
||||
NEXT
|
||||
|
||||
oHtm:endTableCell()
|
||||
oHtm:endTableRow()
|
||||
oHtm:endTable()
|
||||
|
||||
oHtm:Write("</center>")
|
||||
|
||||
RETURN Nil
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* HtmlPadL()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
FUNCTION HtmlPadL( cStr, n )
|
||||
LOCAL cRet := ""
|
||||
LOCAL nStrLen, nSpaces
|
||||
|
||||
IF n == NIL
|
||||
RETURN cStr
|
||||
ENDIF
|
||||
|
||||
nStrLen := LEN( cStr )
|
||||
nSpaces := n - LEN( cStr )
|
||||
|
||||
IF n <= 0
|
||||
cRet := RIGHT(cStr, n )
|
||||
ELSE
|
||||
cRet := REPLICATE( _HTML_SPACE, nSpaces )+ cStr
|
||||
ENDIF
|
||||
|
||||
RETURN cRet
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* HtmlPadR()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
FUNCTION HtmlPadR( cStr, n )
|
||||
LOCAL cRet := ""
|
||||
LOCAL nStrLen, nSpaces
|
||||
|
||||
IF n == NIL
|
||||
RETURN cStr
|
||||
ENDIF
|
||||
|
||||
nStrLen := LEN( cStr )
|
||||
nSpaces := n - LEN( cStr )
|
||||
|
||||
IF n <= 0
|
||||
cRet := LEFT(cStr, n )
|
||||
ELSE
|
||||
cRet := cStr+REPLICATE( _HTML_SPACE, nSpaces )
|
||||
ENDIF
|
||||
|
||||
RETURN cRet
|
||||
|
||||
|
||||
@@ -1,338 +0,0 @@
|
||||
|
||||
/****
|
||||
*
|
||||
* oList.prg
|
||||
*
|
||||
* Generates Javascript & DHTML list menus
|
||||
* (see the website/jList dir for an example)
|
||||
*
|
||||
* Uses list.js and resize.js (heavily modified) found at
|
||||
* developer.Netscape.com
|
||||
*
|
||||
*
|
||||
* (c) 1999-2000 Manos Aspradakis, Greece
|
||||
* eMail : maspr@otenet.gr
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "html.ch"
|
||||
#include "default.ch"
|
||||
|
||||
|
||||
|
||||
|
||||
PROC TestJList()
|
||||
LOCAL o
|
||||
|
||||
o := ncList():new( , .T., 200, 22 ) //, "#336699",, "white" )
|
||||
o:newNode( "node1") //,,,,"lightblue" )
|
||||
o:AddLink("test","test" )
|
||||
o:AddLink("test","test" )
|
||||
o:AddLink("test","test" )
|
||||
o:endNode( "node1", "NODE #1")
|
||||
o:fontColor := "white"
|
||||
o:newNode( "node2") //,,,,"lightblue" )
|
||||
o:AddLink("test","test" )
|
||||
o:AddLink("test","test" )
|
||||
o:AddLink("test","test" )
|
||||
o:AddLink("Test Link", "www.test.com") //, "lightblue")
|
||||
o:AddLink("Test Link", "www.test.com") //,, "lightblue")
|
||||
o:AddLink("Test Link", "www.test.com") //,, "lightblue")
|
||||
o:AddItem("Test Link", "www.test.com") //, "lightblue")
|
||||
o:AddItem("Test Link", "www.test.com") //, "lightblue")
|
||||
o:endNode( "node2", "NODE #2")
|
||||
o:build()
|
||||
o:put("test.htm")
|
||||
RETURN
|
||||
|
||||
|
||||
/****
|
||||
* oList.prg
|
||||
*
|
||||
* Implementation of the Javascript colapsible list object.
|
||||
*
|
||||
* Not finished yet.
|
||||
*/
|
||||
|
||||
|
||||
CLASS NcList
|
||||
DATA nH init STD_OUT
|
||||
DATA aScript init {}
|
||||
DATA aItems init {}
|
||||
DATA cScript init ""
|
||||
DATA nTimes init 0
|
||||
DATA nItems init 0
|
||||
DATA cMainNode init ""
|
||||
DATA cCurrentNode init ""
|
||||
DATA Style init _WHITE_BLACK_STYLE
|
||||
DATA Font init "Verdana"
|
||||
DATA Size init 2
|
||||
DATA bgColor init "white"
|
||||
DATA FontColor init "black"
|
||||
|
||||
|
||||
METHOD New( name, lOpen, width, height, bgColor, ;
|
||||
font, fntColor, fntSize, cMinusIg, cPlusImg )
|
||||
|
||||
METHOD NewNode( name, lOpen, width, height, bgColor )
|
||||
METHOD SetFont( name, font, fntColor, fntSize )
|
||||
METHOD AddItem(name, url, bgColor)
|
||||
METHOD AddLink(name, url, img, bgColor)
|
||||
METHOD EndNode( name, caption )
|
||||
METHOD Build( xPos, yPos)
|
||||
METHOD Put( cFile )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
/****
|
||||
* Create main node
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD New( name, lOpen, width, height, bgColor, ;
|
||||
font, fntColor, fntSize, cMinusImg, cPlusImg ) CLASS NcList
|
||||
|
||||
LOCAL cStr
|
||||
|
||||
DEFAULT name := "l"
|
||||
DEFAULT lOpen := .F.
|
||||
DEFAULT width := 200
|
||||
DEFAULT height := 22
|
||||
DEFAULT bgColor := "white"
|
||||
DEFAULT font := "Verdana"
|
||||
DEFAULT fntColor := "black"
|
||||
DEFAULT fntSize := 2
|
||||
DEFAULT cMinusImg := "minus.gif"
|
||||
DEFAULT cPlusImg := "plus.gif"
|
||||
|
||||
|
||||
::font := font
|
||||
::size := fntSize
|
||||
::fontColor := fntColor
|
||||
::bgColor := bgColor
|
||||
|
||||
::nItems := 0
|
||||
::aSCript:= {}
|
||||
|
||||
cStr := "<HTML>"+CRLF()+"<HEAD>"+CRLF()+;
|
||||
"<STYLE>" + ::Style + "</STYLE>"+CRLF() +;
|
||||
'<SCRIPT LANGUAGE="JavaScript1.2" SRC="resize.js"></SCRIPT>'+CRLF()+;
|
||||
CRLF()+;
|
||||
'<SCRIPT LANGUAGE="JavaScript1.2" SRC="list.js"></SCRIPT>'+CRLF()+;
|
||||
CRLF()+;
|
||||
'<SCRIPT LANGUAGE="JavaScript">'+CRLF()+;
|
||||
"<!--"+crlf()+;
|
||||
"var "+ name +";"+CRLF()+CRLF()+;
|
||||
"function listInit() {"+CRLF()+;
|
||||
"var width =" + NTRIM(width) + ";"+;
|
||||
"var height=" + NTRIM(height) + ";" + CRLF() + ;
|
||||
'listSetImages( "'+cMinusImg+'", "'+cPlusImg+'" );' + CRLF() + CRLF()
|
||||
|
||||
::cMainNode := name
|
||||
|
||||
cStr += "" //SPACE(10)
|
||||
cStr += name + " = new List("
|
||||
cStr += IF( lOpen, "true,", "false," )
|
||||
cStr += NTRIM(width)+","
|
||||
cStr += NTRIM(height)+","
|
||||
cStr += '"'+bgColor +'"'+");"+CRLF()
|
||||
cStr += "" //SPACE(10)
|
||||
cStr += name+[.setFont("<FONT FACE='] + font + [' SIZE=] + NTRIM(fntSize) + [' COLOR='] + fntColor + ['>","</FONT>");]+CRLF()
|
||||
|
||||
::nItems++
|
||||
AADD( ::aScript, cStr )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
* Add a new sub-node
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD newNode( name, lOpen, width, height, bgColor ) CLASS NcList
|
||||
LOCAL cStr := ""
|
||||
DEFAULT lOpen := .F.
|
||||
DEFAULT width := 200
|
||||
DEFAULT height := 22
|
||||
DEFAULT bgColor := "white"
|
||||
cStr += "" //SPACE(10)
|
||||
cStr += name + "= new List("
|
||||
cStr += IF( lOpen, "true,", "false," )
|
||||
cStr += NTRIM(width)+","
|
||||
cStr += NTRIM(height)+","
|
||||
cStr += '"'+bgColor+'"'+");"+CRLF()
|
||||
|
||||
::cCurrentNode := name
|
||||
::nItems++
|
||||
AADD( ::aScript, cStr )
|
||||
|
||||
::setFont()
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
* Set the font for an item or node
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD SetFont( name, font, fntColor, fntSize ) CLASS NcList
|
||||
LOCAL cStr := ""
|
||||
|
||||
DEFAULT name := ::cCurrentNode
|
||||
DEFAULT font := ::font
|
||||
DEFAULT fntColor := ::fontColor
|
||||
DEFAULT fntSize := ::Size
|
||||
|
||||
|
||||
cStr += name+[.setFont("<FONT ]+;
|
||||
[FACE='] + font + ['] +;
|
||||
[ SIZE=] + NTRIM(fntSize) + [']+;
|
||||
[ COLOR='] + fntColor + [']+;
|
||||
[>","</FONT>");]+CRLF()
|
||||
AADD( ::aScript, cStr )
|
||||
RETURN self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
* Add a menu item
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD AddItem(name, url, bgColor) CLASS NcList
|
||||
LOCAL cStr := ""
|
||||
LOCAL cUrl := ""
|
||||
DEFAULT name := "o"
|
||||
DEFAULT url := ""
|
||||
cUrl := [<A HREF=']+url+['>]+htmlSpace(2)+name+htmlSpace(2)
|
||||
cStr += ::cCurrentNode + '.addItem( "' + cUrl +'"'+ IF( bgColor != NIL, ',"'+ bgColor+'"', "")+');'+CRLF()
|
||||
::nItems++
|
||||
AADD( ::aScript, cStr )
|
||||
RETURN self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
* Add a menu item
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD AddLink(name, url, img, bgColor) CLASS NcList
|
||||
LOCAL cStr := ""
|
||||
LOCAL cUrl := ""
|
||||
DEFAULT name := "o"
|
||||
DEFAULT url := ""
|
||||
DEFAULT img := "webpage.jpg"
|
||||
cUrl := "<A HREF='"+url+"'><IMG SRC='"+ img+"' border=0 align=absmiddle>"+htmlSpace(2)+name+htmlSpace(2)
|
||||
cStr += ::cCurrentNode + '.addItem( "' + curl +'"'+ IF( bgColor != NIL, ',"'+ bgColor+'"', "")+');'+CRLF()
|
||||
::nItems++
|
||||
AADD( ::aScript, cStr )
|
||||
RETURN self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD endNode( name, caption ) CLASS NcList
|
||||
LOCAL cStr := ""
|
||||
|
||||
::cCurrentNode := ::cMainNode
|
||||
cStr += ::cMainNode + ".addList( "+name+", '<B>"+caption+"</B>' );"+CRLF()
|
||||
|
||||
::nItems++
|
||||
AADD( ::aScript, cStr )
|
||||
RETURN self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD Build( xPos, yPos) CLASS NcList
|
||||
LOCAL i := 0
|
||||
LOCAL cStr := ""
|
||||
|
||||
DEFAULT xPos := 5
|
||||
DEFAULT yPos := 5
|
||||
|
||||
cStr += ::cMainNode +".build(" + NTRIM( xPos ) + "," + NTRIM(yPos) + ");" + CRLF()
|
||||
cStr += "}"+CRLF()
|
||||
CsTR += "// -->"+crlf()
|
||||
cStr += "</SCRIPT>"+CRLF()
|
||||
cStr += '<STYLE TYPE="text/css">'+CRLF()
|
||||
cStr += "#spacer { position: absolute; height: 1120; }"+CRLF()
|
||||
cStr += "</STYLE>"+CRLF()
|
||||
cStr += '<STYLE TYPE="text/css">'+CRLF()
|
||||
FOR i = 0 to ::nItems + 6
|
||||
cStr += "#"+::cMainNode+"Item"+NTRIM(i)+" { position:absolute; }"+CRLF()
|
||||
NEXT
|
||||
cStr += "</STYLE>"+CRLF()
|
||||
|
||||
AADD( ::aScript, cStr )
|
||||
cStr := ""
|
||||
|
||||
cStr += "<TITLE>Collapsable Lists: Basic Example</TITLE>"+CRLF()
|
||||
cStr += "</HEAD>"+CRLF()
|
||||
cStr += '<BODY ONLOAD="listInit();" BGCOLOR="#FFFFFF">'+CRLF()
|
||||
cStr += '<DIV ID="spacer"></DIV>'+CRLF()
|
||||
//cStr += '<DIV ID="'+::cMainNode+'Item0" NAME="'+::cMainNode+"Item0"></DIV>'+CRLF()
|
||||
|
||||
FOR i = 0 TO ::nItems
|
||||
cStr += '<DIV ID="'+::cMainNode+'Item'+NTRIM(i)+'" NAME="'+::cMainNode+'Item'+NTRIM(i)+'"></DIV>'+CRLF()
|
||||
NEXT
|
||||
cStr += "</BODY></HTML>"+CRLF()
|
||||
|
||||
AADD( ::aScript, cStr )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD Put( cFile ) CLASS NcList
|
||||
IF cFile == NIL
|
||||
::nH := STD_OUT
|
||||
ELSE
|
||||
::nH := FCreate(cFile)
|
||||
ENDIF
|
||||
|
||||
AEVAL( ::aScript, {|e| fWrite( ::nH, e ) })
|
||||
|
||||
FClose( ::nH )
|
||||
|
||||
RETURN Self
|
||||
@@ -1,434 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Java Window Class
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "html.ch"
|
||||
#include "default.ch"
|
||||
|
||||
|
||||
Class JWindow
|
||||
|
||||
DATA nH
|
||||
DATA Name init ""
|
||||
DATA oHtm
|
||||
DATA VarName init ""
|
||||
DATA URL init ""
|
||||
DATA Features init ""
|
||||
|
||||
DATA ScreenX, ScreenY init 100
|
||||
DATA height, width init 300
|
||||
DATA innerHeight, innerWidth, outerHeight init 0
|
||||
DATA alwaysRaised, alwaysLowered init .F.
|
||||
DATA Menubar, personalBar init .F.
|
||||
DATA location, directories, copyHistory init .F.
|
||||
DATA Toolbar init .F.
|
||||
DATA Status, TitleBar init .T.
|
||||
DATA Scrollbars, Resizable, dependent init .T.
|
||||
|
||||
DATA Title
|
||||
DATA aScriptSRC
|
||||
DATA aServerSRC
|
||||
DATA bgImage, bgColor, fontColor
|
||||
DATA Style
|
||||
|
||||
DATA onLoad
|
||||
DATA onUnLoad
|
||||
|
||||
METHOD New( cVarName, cUrl, cName, x, y, w, h )
|
||||
|
||||
METHOD setOnLoad( c ) INLINE ::onLoad := c
|
||||
METHOD setOnUnLoad( c ) INLINE ::onUnLoad := c
|
||||
|
||||
|
||||
METHOD Alert( c ) INLINE HB_SYMBOL_UNUSED( c ), ::QOut( "alert('c')" )
|
||||
METHOD confirm( c ) INLINE HB_SYMBOL_UNUSED( c ), ::QOut( "confirm('c')" )
|
||||
METHOD SetSize(x,y,h,w)
|
||||
METHOD Write( c )
|
||||
METHOD lineBreak() INLINE ::QOut( "<BR>" )
|
||||
METHOD Paragraph() INLINE ::QOut( "<P></P>" )
|
||||
METHOD center(l) INLINE ::QOut( IF( l , "<CENTER>", "</CENTER>" ) )
|
||||
METHOD bold(l) INLINE ::QOut( IF( l , "<B>", "</B>" ) )
|
||||
METHOD Italic(l) INLINE ::QOut( IF( l , "<I>", "</I>" ) )
|
||||
METHOD ULine(l) INLINE ::QOut( IF( l , "<U>", "</U>" ) )
|
||||
METHOD Put()
|
||||
METHOD Begin()
|
||||
METHOD End()
|
||||
METHOD QOut( c )
|
||||
METHOD WriteLN( c ) INLINE ::qOut( c )
|
||||
METHOD SetFeatures( alwaysRaised, alwaysLowered,;
|
||||
Resizable, Menubar, personalBar,;
|
||||
dependent, location, directories,;
|
||||
Scrollbars, Status, TitleBar, Toolbar )
|
||||
|
||||
METHOD ImageURL( cImage, cUrl, nHeight, nBorder, ;
|
||||
cOnClick, cOnMsover, cOnMsout,;
|
||||
cName, cAlt )
|
||||
|
||||
//METHOD Debug() INLINE __clsDebug( self ) NOSELF
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Start a new window definition
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD New( cVarName, cUrl, cName, x, y, w, h ) Class JWindow
|
||||
|
||||
DEFAULT cVarName := "newWin"
|
||||
DEFAULT cURL := " "
|
||||
DEFAULT cName := cVarName //"newWin"
|
||||
DEFAULT x := 100
|
||||
DEFAULT y := 100
|
||||
DEFAULT h := 300
|
||||
DEFAULT w := 300
|
||||
|
||||
::nH := PageHandle()
|
||||
::oHtm := oPage()
|
||||
::varName := cVarName
|
||||
::URL := cUrl
|
||||
::Name := cName
|
||||
|
||||
::ScreenX := x
|
||||
::ScreenY := y
|
||||
::height := h
|
||||
::width := w
|
||||
|
||||
// objectViewer( self )
|
||||
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Set the properties of the window
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD SetFeatures( alwaysRaised, alwaysLowered,;
|
||||
Resizable, Menubar, personalBar,;
|
||||
dependent, location, directories,;
|
||||
Scrollbars, Status, TitleBar, Toolbar, copyHistory ) Class JWindow
|
||||
|
||||
LOCAL cStr := ""
|
||||
|
||||
DEFAULT alwaysRaised := ::alwaysRaised
|
||||
DEFAULT alwaysLowered := ::alwaysLowered
|
||||
DEFAULT Resizable := ::Resizable
|
||||
DEFAULT Menubar := ::Menubar
|
||||
DEFAULT personalBar := ::personalBar
|
||||
DEFAULT dependent := ::dependent
|
||||
DEFAULT location := ::location
|
||||
DEFAULT directories := ::directories
|
||||
DEFAULT Scrollbars := ::Scrollbars
|
||||
DEFAULT Status := ::Status
|
||||
DEFAULT TitleBar := ::TitleBar
|
||||
DEFAULT Toolbar := ::Toolbar
|
||||
DEFAULT copyHistory := ::copyHistory
|
||||
|
||||
|
||||
IF alwaysRaised ; cStr += "alwaysraised=yes," ; ELSE ; cStr += "alwaysraised=no," ;ENDIF
|
||||
IF alwaysLowered ; cStr += "alwayslowered=yes," ; ELSE ; cStr += "alwayslowered=no," ;ENDIF
|
||||
IF Resizable ; cStr += "resizable=yes," ; ELSE ; cStr += "resizable=no," ;ENDIF
|
||||
IF Menubar ; cStr += "menubar=yes," ; ELSE ; cStr += "menubar=no," ;ENDIF
|
||||
IF personalBar ; cStr += "personalbar=yes," ; ELSE ; cStr += "personalbar=no," ;ENDIF
|
||||
IF dependent ; cStr += "dependent=yes," ; ELSE ; cStr += "dependent=no," ;ENDIF
|
||||
IF location ; cStr += "location=yes," ; ELSE ; cStr += "location=no," ;ENDIF
|
||||
IF directories ; cStr += "directories=yes," ; ELSE ; cStr += "directories=no," ;ENDIF
|
||||
IF Scrollbars ; cStr += "scrollbars=yes," ; ELSE ; cStr += "scrollbars=no," ;ENDIF
|
||||
IF Status ; cStr += "status=yes," ; ELSE ; cStr += "status=no," ;ENDIF
|
||||
IF TitleBar ; cStr += "titlebar=yes," ; ELSE ; cStr += "titlebar=no," ;ENDIF
|
||||
IF Toolbar ; cStr += "toolbar=yes," ; ELSE ; cStr += "toolbar=no," ;ENDIF
|
||||
IF copyHistory ; cStr += "copyHistory=yes," ; ELSE ; cStr += "copyHistory=no," ;ENDIF
|
||||
|
||||
::features += IF( EMPTY( ::Features ), cStr+",", cStr )
|
||||
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* set the size for the window
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD SetSize(x,y,h,w) Class JWindow
|
||||
LOCAL cStr := ""
|
||||
DEFAULT x := ::ScreenX ,;
|
||||
y := ::ScreenY ,;
|
||||
h := ::height ,;
|
||||
w := ::width
|
||||
|
||||
::ScreenX := x
|
||||
::ScreenY := y
|
||||
::height := h
|
||||
::width := w
|
||||
|
||||
cStr := "screenX="+ NTRIM(::screenX) +","
|
||||
|
||||
cStr:= cStr+ "screenY="+ NTRIM(::screenY) +","
|
||||
cStr:= cStr+ "height=" + NTRIM(::height) +","
|
||||
cStr:= cStr+ "width=" + NTRIM(::width)
|
||||
|
||||
::features += IF( EMPTY( ::Features ), cStr+",", cStr )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Open the window from within the current document
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD Put() Class JWindow
|
||||
LOCAL cStr := ""
|
||||
|
||||
IF ::nH == NIL
|
||||
::nH := pageHandle()
|
||||
IF ::nH == NIL
|
||||
RETURN Self
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF Empty( ::features )
|
||||
::setSize()
|
||||
::setFeatures()
|
||||
endif
|
||||
|
||||
IF VALTYPE( ::name ) != "C"
|
||||
::name := "newWin"
|
||||
ENDIF
|
||||
|
||||
cStr += ::varName + " = window.open('"+;
|
||||
::URL +"', '"+;
|
||||
::varName + "', '"+;
|
||||
::features + "')"
|
||||
|
||||
JavaCMD( ::nH, cStr )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Output stand alone Javascript code in the current document
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD Write( c ) Class JWindow
|
||||
JavaCMD( ::nH, ::varName+".document.write('"+c+"')" + CRLF() )
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Output Javascript (or HTML) code in the current document and
|
||||
* in the current script
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD QOut( c ) Class JWindow
|
||||
FWrite( ::nH, ::varName+".document.write('"+c+"')"+CRLF() )
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Begin HTML output to the window from within the current document
|
||||
* and the current script
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD Begin() Class JWindow
|
||||
LOCAL i
|
||||
|
||||
FWrite( ::nH, "<SCRIPT LANGUAGE=JavaScript 1.2>"+CRLF() )
|
||||
FWrite( ::nH, "<!--"+CRLF() )
|
||||
::QOut( "<HTML><HEAD>")
|
||||
|
||||
IF ::Title != NIL
|
||||
::QOut( "<TITLE>"+::Title+"</TITLE>" )
|
||||
ENDIF
|
||||
|
||||
IF ::aScriptSrc != NIL
|
||||
FOR i =1 TO LEN( ::aScriptSrc )
|
||||
::QOut( ;
|
||||
'<SCRIPT LANGUAGE=JavaScript SRC="'+::aScriptSrc[i]+'"></SCRIPT>' )
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
IF ::aServerSrc != NIL
|
||||
FOR i =1 TO LEN( ::aServerSrc )
|
||||
::QOut( ;
|
||||
'<SCRIPT LANGUAGE=JavaScript SRC="'+::aServerSrc[i]+'" RUNAT=SERVER></SCRIPT>' )
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
IF ::Style != NIL
|
||||
::QOut( "<STYLE> "+ ::Style+" </STYLE>" )
|
||||
ENDIF
|
||||
|
||||
::QOut( "</HEAD>"+"<BODY" )
|
||||
|
||||
IF ::onLoad != NIL
|
||||
::Qout(' onLoad="'+::onLoad+'"' )
|
||||
ENDIF
|
||||
|
||||
IF ::onUnLoad != NIL
|
||||
::QOut( ' onUnload="'+::onUnLoad+'"' )
|
||||
ENDIF
|
||||
|
||||
::QOut( '>' )
|
||||
|
||||
IF ::bgColor != NIL
|
||||
::QOut( '<BODY BGCOLOR="'+::bgColor+'">' )
|
||||
ENDIF
|
||||
|
||||
IF ::fontColor != NIL
|
||||
::QOut( '<BODY TEXT="'+::fontColor+'">' )
|
||||
ENDIF
|
||||
|
||||
IF ::bgImage != NIL
|
||||
::QOut( '<BODY BACKGROUND="'+::bgImage+'">' )
|
||||
ENDIF
|
||||
|
||||
FWrite( ::nH, "//-->" )
|
||||
FWrite( ::nH, "</SCRIPT>"+CRLF() )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* End HTML output to the window
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD End() Class JWindow
|
||||
|
||||
JavaCMD( ::nH, ::varName+".document.write('</BODY></HTML>')" + CRLF() )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Place an image link to the window
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD ImageURL( cImage, cUrl, nHeight, nBorder, ;
|
||||
cOnClick, cOnMsover, cOnMsout,;
|
||||
cName, cAlt ) Class JWindow
|
||||
|
||||
|
||||
LOCAL cStr := ""
|
||||
|
||||
DEFAULT cUrl := ""
|
||||
|
||||
IF cName != NIL
|
||||
cStr += ' NAME= "'+cName + '"'+CRLF()
|
||||
ENDIF
|
||||
IF cAlt != NIL
|
||||
cStr += ' ALT= "'+cAlt+ '"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF nBorder != NIL
|
||||
cStr += " BORDER = "+NTRIM(nBorder) + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF nHeight != NIL
|
||||
cStr += " HEIGHT = "+NTRIM(nHeight) + "% " + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF cOnClick != NIL
|
||||
cStr += ' onClick="'+cOnClick+'"' + CRLF()
|
||||
ENDIF
|
||||
IF cOnMsOver != NIL
|
||||
cStr += ' onMouseOver="'+cOnMsOver+'"' + CRLF()
|
||||
ENDIF
|
||||
IF cOnMsOut != NIL
|
||||
cStr += ' onMouseOut="'+cOnMsOut+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF cURL != NIL
|
||||
::QOut( '<A HREF='+cUrl+'><IMG SRC="'+cImage+'"'+;
|
||||
cStr +'></A>' )
|
||||
ELSE
|
||||
::QOut( '<IMG SRC="'+cImage+'"'+;
|
||||
cStr +'></A>' )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
//*** EOF ***//
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* LOWFILES.CH low files commands
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
// Lowfiles.ch
|
||||
|
||||
#include "fileio.ch"
|
||||
|
||||
#translate FGOTOP(<f>) => FSEEK( <f>, 0 )
|
||||
|
||||
#translate FGOBOTTOM(<f>) => FSEEK( <f>, 0, FS_END)
|
||||
|
||||
#translate FPOS(<f>) => FSEEK( <f>, 0, FS_RELATIVE )
|
||||
|
||||
#translate FBOF(<f>) => (FPOS(<f>) == 0)
|
||||
|
||||
#translate FEOF(<f>) => (FPOS(<f>) == FSize(<f>))
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
@echo off
|
||||
rem
|
||||
rem $Id$
|
||||
rem
|
||||
|
||||
call ..\mtpl_b32.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
@@ -1,6 +0,0 @@
|
||||
@echo off
|
||||
rem
|
||||
rem $Id$
|
||||
rem
|
||||
|
||||
call ..\mtpl_vc.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
@@ -1,307 +0,0 @@
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Cgi Class
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "default.ch"
|
||||
#include "html.ch"
|
||||
|
||||
|
||||
|
||||
CLASS oCgi FROM HTML
|
||||
|
||||
DATA nH
|
||||
DATA Server_Software
|
||||
DATA Server_Name
|
||||
DATA Gateway_Interface
|
||||
DATA Server_Protocol
|
||||
DATA Server_Port
|
||||
DATA Request_Method
|
||||
DATA Http_Accept
|
||||
DATA Http_User_agent
|
||||
DATA Http_Referer
|
||||
DATA Path_Info
|
||||
DATA Path_Translated
|
||||
DATA Script_Name
|
||||
DATA Query_String
|
||||
DATA Remote_Host
|
||||
DATA Remote_Addr
|
||||
DATA ipAddress
|
||||
DATA Remote_User
|
||||
DATA Auth_Type
|
||||
DATA Auth_User
|
||||
DATA Auth_Pass
|
||||
DATA Content_Type
|
||||
DATA Content_Length
|
||||
DATA Annotation_Server
|
||||
|
||||
DATA aQueryFields INIT {}
|
||||
|
||||
METHOD New( c )
|
||||
METHOD CGIField( c )
|
||||
|
||||
METHOD toObject()
|
||||
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* oCgi():new()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
METHOD New( cInBuffer ) Class oCgi
|
||||
LOCAL i
|
||||
LOCAL aTemp := {}
|
||||
LOCAL aVar := {}
|
||||
|
||||
// function in oHtm.prg
|
||||
::nH := PageHandle()
|
||||
|
||||
::Server_Software := GetEnv( "SERVER_SOFTWARE" )
|
||||
::Server_Name := GetEnv( "SERVER_NAME" )
|
||||
::Gateway_Interface := GetEnv( "GATEWAY_INTERFACE" )
|
||||
::Server_Protocol := GetEnv( "SERVER_PROTOCOL" )
|
||||
::Server_Port := GetEnv( "SERVER_PORT" )
|
||||
::Request_Method := GetEnv( "REQUEST_METHOD" )
|
||||
::Http_Accept := GetEnv( "HTTP_ACCEPT" )
|
||||
::Http_User_agent := GetEnv( "HTTP_USER_AGENT" )
|
||||
::Http_Referer := GetEnv( "HTTP_REFERER" )
|
||||
::Path_Info := GetEnv( "PATH_INFO" )
|
||||
::Path_Translated := GetEnv( "PATH_TRANSLATED" )
|
||||
::Script_Name := GetEnv( "SCRIPT_NAME" )
|
||||
::Query_String := GetEnv( "QUERY_STRING" )
|
||||
::Remote_Host := GetEnv( "REMOTE_HOST" )
|
||||
::Remote_Addr := GetEnv( "REMOTE_ADDR" )
|
||||
::ipAddress := GetEnv( "REMOTE_ADDR" )
|
||||
::Remote_User := GetEnv( "REMOTE_USER" )
|
||||
::Auth_Type := GetEnv( "AUTH_TYPE" )
|
||||
::Auth_User := GetEnv( "AUTH_USER" )
|
||||
::Auth_Pass := GetEnv( "AUTH_PASS" )
|
||||
::Content_Type := GetEnv( "CONTENT_TYPE" )
|
||||
::Content_Length := GetEnv( "CONTENT_LENGTH" )
|
||||
::Annotation_Server := GetEnv( "ANNOTATION_SERVER" )
|
||||
|
||||
IF cInBuffer != NIL
|
||||
::Query_String := RTRIM( cInBuffer )
|
||||
ELSE
|
||||
IF "POST" $ UPPER(::Request_Method)
|
||||
::Query_String := RTRIM(FReadStr( STD_IN, VAL(::CONTENT_LENGTH) ))
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF !empty( ::Query_String )
|
||||
|
||||
::aQueryFields := {}
|
||||
|
||||
aTemp := listAsArray( ::Query_String, "&" ) // separate fields
|
||||
|
||||
IF LEN( aTemp ) != 0
|
||||
FOR i=1 TO LEN( aTemp )
|
||||
aVar := LISTASARRAY( aTemp[i], "=" )
|
||||
IF LEN( aVar ) == 2
|
||||
AADD(::aQueryFields, {aVar[1], decodeURL(aVar[2]) } )
|
||||
ENDIF
|
||||
NEXT
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
//#ifdef _CLASS_CH
|
||||
RETURN ::ToObject() //Self
|
||||
//#else
|
||||
//RETURN Self
|
||||
//#endif
|
||||
|
||||
|
||||
|
||||
//#ifdef _CLASS_CH
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* oCgi():ToObject()
|
||||
*
|
||||
* Creates instance variables out of CGI FORM return values
|
||||
* or URL encoded content.
|
||||
*
|
||||
* It subclasses the oCGI class to a *new* class
|
||||
*/
|
||||
|
||||
METHOD ToObject() CLAss ocgi
|
||||
local i
|
||||
LOCAL nScope:=1
|
||||
LOCAL aDb, oNew
|
||||
STATIC sn := 0
|
||||
|
||||
// --> create new oObject class from this one...
|
||||
sn++
|
||||
//aDB := ClassNew( "NewCgi"+STRZERO(sn,3), {|| oCGI() }, "cgi" )
|
||||
aDb:= hbClass():New("NewCgi"+STRZERO(sn,3),__CLS_PARAM("oCgi" ) )
|
||||
FOR i = 1 TO LEN( ::aQueryFields )
|
||||
IF ::aQueryFields[i,2] == NIL .OR. EMPTY(::aQueryFields[i,2])
|
||||
::aQueryFields[i,2] := ""
|
||||
ENDIF
|
||||
//ClassData( ::aQueryFields[i,1], ::aQueryFields[i,2] )
|
||||
adb:AddData( ::aQueryFields[i,1],::aQueryFields[i,2],,nScope)
|
||||
// adb:AddData( ,,,nScope)
|
||||
// aDb:AddMultiData(,,if(.F.,1,if(.F.,2,if(.F.,4,nScope) ) ) + if(.F.,16,0 ),__MULTIPARAM("nH" ) )
|
||||
NEXT
|
||||
adb:Create()
|
||||
//aDB := ClassMAKE()
|
||||
//hNewClass := aDB[_CLASS_HANDLE]
|
||||
oNew := adb:Instance()
|
||||
//aDb := ClassEndIns( oNew, aDB )
|
||||
//aDB[_CLASS_OBJECT] := oNew
|
||||
//oNew:Dict := aDB
|
||||
oNew:aQueryFields := ::aQueryFields
|
||||
oNew:Server_Software := ::Server_Software
|
||||
oNew:Server_Name := ::Server_Name
|
||||
oNew:Gateway_Interface := ::Gateway_Interface
|
||||
oNew:Server_Protocol := ::Server_Protocol
|
||||
oNew:Server_Port := ::Server_Port
|
||||
oNew:Request_Method := ::Request_Method
|
||||
oNew:Http_Accept := ::Http_Accept
|
||||
oNew:Http_User_agent := ::Http_User_agent
|
||||
oNew:Http_Referer := ::Http_Referer
|
||||
oNew:Path_Info := ::Path_Info
|
||||
oNew:Path_Translated := ::Path_Translated
|
||||
oNew:Script_Name := ::Script_Name
|
||||
oNew:Query_String := ::Query_String
|
||||
oNew:Remote_Host := ::Remote_Host
|
||||
oNew:Remote_Addr := ::Remote_Addr
|
||||
oNew:ipAddress := ::ipAddress
|
||||
oNew:Remote_User := ::Remote_User
|
||||
oNew:Auth_Type := ::Auth_Type
|
||||
oNew:Content_Type := ::Content_Type
|
||||
oNew:Content_Length := ::Content_Length
|
||||
oNew:Annotation_Server := ::Annotation_Server
|
||||
oNew:nH := IF( PageHandle()==NIL, STD_OUT, PageHandle() )
|
||||
|
||||
RETURN oNew
|
||||
|
||||
//#endif
|
||||
|
||||
// ripped from HARBOUR
|
||||
|
||||
METHOD CGIField( cQueryName ) Class oCgi
|
||||
|
||||
LOCAL cRet := ""
|
||||
LOCAL nRet
|
||||
|
||||
DEFAULT cQueryName := ""
|
||||
|
||||
nRet := aScan( ::aQueryFields, ;
|
||||
{ |x| upper( x[1] ) = upper( cQueryName ) } )
|
||||
|
||||
IF nRet > 0
|
||||
cRet := ::aQueryFields[nRet, 2]
|
||||
ENDIF
|
||||
|
||||
RETURN( cRet )
|
||||
|
||||
|
||||
// ripped from HARBOUR
|
||||
|
||||
FUNCTION ParseString( cString, cDelim, nRet )
|
||||
|
||||
LOCAL cBuf, aElem, nPosFim, nSize, i
|
||||
|
||||
nSize := len( cString ) - len( StrTran( cString, cDelim, '' ) ) + 1
|
||||
aElem := array( nSize )
|
||||
|
||||
cBuf := cString
|
||||
i := 1
|
||||
FOR i := 1 TO nSize
|
||||
nPosFim := at( cDelim, cBuf )
|
||||
|
||||
IF nPosFim > 0
|
||||
aElem[i] := substr( cBuf, 1, nPosFim - 1 )
|
||||
ELSE
|
||||
aElem[i] := cBuf
|
||||
ENDIF
|
||||
|
||||
cBuf := substr( cBuf, nPosFim + 1, len( cBuf ) )
|
||||
|
||||
NEXT i
|
||||
|
||||
RETURN( aElem[ nRet ] )
|
||||
|
||||
|
||||
// ripped from HARBOUR
|
||||
|
||||
FUNCTION Hex2Dec( cHex )
|
||||
|
||||
LOCAL aHex := { { "0", 00 }, ;
|
||||
{ "1", 01 }, ;
|
||||
{ "2", 02 }, ;
|
||||
{ "3", 03 }, ;
|
||||
{ "4", 04 }, ;
|
||||
{ "5", 05 }, ;
|
||||
{ "6", 06 }, ;
|
||||
{ "7", 07 }, ;
|
||||
{ "8", 08 }, ;
|
||||
{ "9", 09 }, ;
|
||||
{ "A", 10 }, ;
|
||||
{ "B", 11 }, ;
|
||||
{ "C", 12 }, ;
|
||||
{ "D", 13 }, ;
|
||||
{ "E", 14 }, ;
|
||||
{ "F", 15 } }
|
||||
LOCAL nRet
|
||||
LOCAL nRes
|
||||
|
||||
nRet := ascan( aHex, { |x| upper( x[1] ) = upper( left( cHex, 1 ) ) } )
|
||||
nRes := aHex[nRet, 2] * 16
|
||||
nRet := ascan( aHex, { |x| upper( x[1] ) = upper( right( cHex, 1 ) ) } )
|
||||
nRes += aHex[nRet, 2]
|
||||
|
||||
RETURN( nRes )
|
||||
|
||||
@@ -1,676 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Editing and Forms Class for HTMLLIB
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "default.ch"
|
||||
#include "forms.ch"
|
||||
#include "html.ch"
|
||||
|
||||
#define _OPTION_TEXT 1
|
||||
#define _OPTION_VALUE 2
|
||||
#define _OPTION_LABEL 3
|
||||
#define _OPTION_SELECTED 4
|
||||
#define _OPTION_DISABLED 5
|
||||
|
||||
|
||||
STATIC soForm
|
||||
|
||||
/****
|
||||
*
|
||||
* Class HControl()
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
CLASS HControl // ALIAS hCtr
|
||||
DATA nH
|
||||
DATA Document
|
||||
DATA Form
|
||||
|
||||
|
||||
DATA Caption
|
||||
DATA lBreak INIT .F.
|
||||
|
||||
|
||||
DATA Type INIT "TEXT"
|
||||
DATA Name
|
||||
DATA Value
|
||||
DATA Size
|
||||
DATA rows, cols
|
||||
|
||||
DATA cOutPut INIT ""
|
||||
|
||||
DATA Picture INIT "@X"
|
||||
|
||||
DATA aOptions INIT {} // SELECT options
|
||||
|
||||
DATA TabIndex INIT 0
|
||||
DATA disabled INIT .F.
|
||||
DATA readOnly INIT .F.
|
||||
DATA Multiple INIT .F.
|
||||
DATA style
|
||||
DATA id
|
||||
|
||||
DATA MaxLength // length in chars
|
||||
DATA MaxChars // length on screen
|
||||
|
||||
DATA Checked INIT .F. // checkboxes...
|
||||
DATA lLabel init .f.
|
||||
|
||||
DATA Source, Align // images...
|
||||
DATA Wrap // textarea
|
||||
|
||||
DATA onBlur
|
||||
DATA onChange
|
||||
DATA onFocus
|
||||
DATA onSelect
|
||||
DATA onClick
|
||||
DATA onMouseOver
|
||||
DATA onMouseOut
|
||||
DATA onMouseDown
|
||||
DATA onMouseup
|
||||
DATA onKeyPress
|
||||
DATA onKeyDown
|
||||
DATA onKeyUp
|
||||
DATA onSelect
|
||||
|
||||
METHOD SetName( c ) INLINE ::Name := c
|
||||
METHOD SetValue( c ) INLINE ::Value := c
|
||||
METHOD SetStyle( c ) INLINE ::Style := c
|
||||
METHOD SetId( c ) INLINE ::id := c
|
||||
METHOD SetRows( c ) INLINE ::Rows := c
|
||||
METHOD SetCols( c ) INLINE ::Cols := c
|
||||
METHOD SetCaption(c) INLINE ::Caption := c
|
||||
METHOD SetPicture(c) INLINE ::picture := c
|
||||
METHOD SetOnBlur(c) INLINE ::onBlur := c
|
||||
METHOD SetOnChange(c) INLINE ::onChange := c
|
||||
METHOD SetOnFocus(c) INLINE ::onFocus := c
|
||||
METHOD SetOnSelect(c) INLINE ::onSelect := c
|
||||
METHOD SetOnClick(c) INLINE ::onClick := c
|
||||
METHOD SetOnMsOver(c) INLINE ::onMouseOver := c
|
||||
METHOD SetOnMsOut(c) INLINE ::onMouseOut := c
|
||||
METHOD SetSize( n ) INLINE ::Size := n
|
||||
METHOD SetMaxChars( n ) INLINE ::MaxChars := n
|
||||
METHOD SetChecked( l ) INLINE ::Checked := l
|
||||
METHOD SetAlign( c ) INLINE ::Align := c
|
||||
METHOD SetWrap( c ) INLINE ::wrap := c
|
||||
METHOD SetSource( c ) INLINE ::Source := c
|
||||
METHOD SetReadOnly( l ) INLINE ::readOnly := l
|
||||
METHOD SetDisabled( l ) INLINE ::disabled := l
|
||||
METHOD SetMultiple( l ) INLINE ::multiple := l
|
||||
METHOD SetOnMsDown(c) INLINE ::onMouseDown := c
|
||||
METHOD SetOnMsUp(c) INLINE ::onMouseup := c
|
||||
METHOD SetOnKPress(c) INLINE ::onKeyPress := c
|
||||
METHOD SetOnKDown(c) INLINE ::onKeyDown := c
|
||||
METHOD SetOnKUp(c) INLINE ::onKeyUp := c
|
||||
METHOD SetOnSelect(c) INLINE ::onSelect := c
|
||||
METHOD SetLabel(l) INLINE ::lLabel := l
|
||||
//METHOD Debug() INLINE __clsDebug( self )
|
||||
|
||||
METHOD Put(lPut)
|
||||
METHOD AddOption( cOption, cValue, cLabel, lSelected, lDisabled )
|
||||
METHOD SetControl( name,rows,cols,size,maxchars,value,onfocus,;
|
||||
onblur,onchange,onselect,onclick,onmsover,onmsout,;
|
||||
onmsdown,onmsup,onkdown,onkup,onkprs, ;
|
||||
pic,cap,dis,ro,lMulti,checked,;
|
||||
align,wrap,type, Style, Id ,lLabel)
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* HControl():Put()
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
method Put(lPut) CLASS HControl
|
||||
LOCAL i, cStr := ""
|
||||
|
||||
HB_SYMBOL_UNUSED( lPut )
|
||||
|
||||
::nH := pageHandle()
|
||||
::form := currentForm()
|
||||
|
||||
::cOutput += IF( ::lBreak, CRLF()+"<BR>", CRLF() )
|
||||
IF ::lLabel
|
||||
::cOutPut+=CRLF()+"<LABEL>"+CRLF()
|
||||
ENDIF
|
||||
IF ::Caption != NIL
|
||||
::cOutput += ::Caption + HTMLSPACE(2) +" <!-- "+::Type+" Control Caption -->"+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Type == "SELECT"
|
||||
::cOutPut += CRLF()+' <SELECT '+CRLF()
|
||||
ELSE
|
||||
::cOutPut += CRLF()+' <INPUT TYPE="'
|
||||
::cOutput += ::Type +'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Name != NIL
|
||||
::cOutput += space(2)+' NAME="'+ ::Name +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Type = "TEXTAREA"
|
||||
IF ::Rows != NIL
|
||||
::cOutput += space(2)+' ROWS="'+ NTRIM(::Rows) +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Cols != NIL
|
||||
::cOutput += space(2)+' COLS="'+ NTRIM(::Cols) +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Wrap != NIL
|
||||
::cOutput += space(2)+' WRAP="'+ ::Wrap +'"' + CRLF()
|
||||
ENDIF
|
||||
ENDIF // textArea
|
||||
|
||||
IF ::value != NIL
|
||||
IF ::Picture == NIL
|
||||
::Picture := "@X"
|
||||
ENDIF
|
||||
::cOutput += space(2)+' VALUE="'+ TRANSFORM(::Value, ::Picture) +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::maxChars != NIL
|
||||
::cOutput += space(2)+'MAXLENGTH="'+ NTRIM(::maxChars) +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Size != NIL
|
||||
::cOutput += space(2)+' SIZE="'+ NTRIM(::Size) +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Id != NIL
|
||||
::cOutput += space(2)+' ID="'+ ::Id +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Style != NIL
|
||||
::cOutput += space(2)+' STYLE="'+ ::Style +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::type = "IMAGE"
|
||||
IF ::Source != NIL
|
||||
::cOutput += space(2)+' SRC="'+ ::Source +'"' + CRLF()
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF ::Align != NIL
|
||||
::cOutput += space(2)+' ALIGN="'+ ::Align +'"' + CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::type = "RADIO" .OR. ::type = "CHECKBOX"
|
||||
IF ::Checked
|
||||
::cOutput += space(2)+' CHECKED' +CRLF()
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF ::Disabled
|
||||
::cOutput += space(2)+' DISABLED' +CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::Readonly
|
||||
::cOutput += space(2)+' READONLY' +CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onChange != NIL
|
||||
::cOutput += space(2)+' onChange="'+::onChange+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onFocus != NIL
|
||||
::cOutput += space(2)+' onFocus="'+::onFocus+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onBlur != NIL
|
||||
::cOutput += space(2)+' onBlur="'+::onBlur+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onSelect != NIL
|
||||
::cOutput += space(2)+' onSelect="'+::onSelect+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onClick != NIL
|
||||
::cOutput += space(2)+' onClick="'+::onClick+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onMouseOver != NIL
|
||||
::cOutput += 'onMouseOver="'+::onMouseOver+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onMouseOut != NIL
|
||||
::cOutput += space(1)+'onMouseOut="'+::onMouseOut+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onMouseDown != NIL
|
||||
::cOutput += 'onMouseDown="'+::onMouseDown+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onMouseUp != NIL
|
||||
::cOutput += space(1)+'onMouseUp="'+::onMouseUp+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onKeyDown != NIL
|
||||
::cOutput += 'onKeyDown="'+::onKeyDown+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onKeyUp != NIL
|
||||
::cOutput += space(1)+'onKeyUp="'+::onKeyUp+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
IF ::onKeyPress != NIL
|
||||
::cOutput += space(1)+'onKeyPress="'+::onKeyPress+'"'+CRLF()
|
||||
ENDIF
|
||||
|
||||
::cOutput += " >"+CRLF()
|
||||
|
||||
if ::lLabel
|
||||
::cOutPut+=CRLF()+"</LABEL>"+CRLF()
|
||||
Endif
|
||||
|
||||
FWrite( ::nH, ::cOutput )
|
||||
|
||||
IF ::Type == "SELECT"
|
||||
FOR i=1 TO LEN( ::aOptions )
|
||||
cStr := "<OPTION"
|
||||
cStr += IF( ::aOptions[i,_OPTION_VALUE] != NIL, ;
|
||||
" value="+::Options[i,_OPTION_VALUE], "")
|
||||
cStr += IF( ::aOptions[i,_OPTION_LABEL] != NIL, ;
|
||||
" label="+::Options[i,_OPTION_LABEL], "")
|
||||
cStr += IF( ::aOptions[i,_OPTION_SELECTED] == .T., ;
|
||||
" SELECTED ", "")
|
||||
cStr += IF( ::aOptions[i,_OPTION_DISABLED] == .T., ;
|
||||
" DISABLED ", "")
|
||||
cStr += ">"+::aOptions[i,_OPTION_TEXT]+"</OPTION>"+CRLF()
|
||||
FWrite( ::nH, cStr )
|
||||
NEXT
|
||||
FWrite( ::nH, "</SELECT>" )
|
||||
ENDIF
|
||||
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* HControl():AddOption()
|
||||
*
|
||||
*/
|
||||
|
||||
method AddOption( cOption, cValue, cLabel, lSelected, lDisabled ) CLASS HControl
|
||||
AADD( ::aOptions, { cOption, cValue, cLabel, lSelected, lDisabled } )
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* HControl():setControl()
|
||||
*
|
||||
* Batch set control properties/methods
|
||||
*
|
||||
* All default to NIL. See controls.ch
|
||||
*/
|
||||
|
||||
method setControl( name,rows,cols,size,maxchars,value,onfocus,;
|
||||
onblur,onchange,onselect,onclick,onmsover,onmsout,;
|
||||
onmsdown,onmsup,onkdown,onkup,onkprs, ;
|
||||
pic,cap,dis,ro,lMulti,checked,;
|
||||
align,wrap,type, Style, Id,lLabel ) CLASS HControl
|
||||
::name := name
|
||||
::rows := rows
|
||||
::cols := cols
|
||||
::size := size
|
||||
::maxChars := maxchars
|
||||
::value := value
|
||||
::onFocus := onfocus
|
||||
::onBlur := onblur
|
||||
::onChange := onchange
|
||||
::onSelect := onselect
|
||||
::onClick := onclick
|
||||
::onMouseOver := onmsover
|
||||
::onMouseOut := onmsout
|
||||
::onMouseDown := onmsdown
|
||||
::onMouseUp := onmsup
|
||||
::onKeyDown := onkdown
|
||||
::onKeyUp := onkup
|
||||
::onKeyPress := onkprs
|
||||
::picture := pic
|
||||
::caption := cap
|
||||
::disabled := dis
|
||||
::readonly := ro
|
||||
::Multiple := lMulti
|
||||
::Checked := checked
|
||||
::Align := align
|
||||
::Wrap := wrap
|
||||
::type := type
|
||||
::Style := Style
|
||||
::Id := Id
|
||||
::lLabel := lLabel
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Class Form()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
CLASS Form
|
||||
|
||||
DATA nH
|
||||
DATA aControls init {}
|
||||
DATA Name init ""
|
||||
DATA Action
|
||||
DATA Method //"mailto:name@site"
|
||||
DATA EncType init "multipart/form-data"
|
||||
DATA onSubmit
|
||||
DATA onReset
|
||||
DATA Target
|
||||
DATA Frame init .F.
|
||||
DATA Caption init ""
|
||||
DATA CaptionColor init "black"
|
||||
DATA CapFontColor init "white"
|
||||
DATA CaptionImage
|
||||
DATA bgImage
|
||||
DATA fontColor init "black"
|
||||
DATA Color init "#9196A0"
|
||||
DATA width init 90
|
||||
|
||||
DATA cOutput init ""
|
||||
|
||||
METHOD setHandle( h ) INLINE ::nH := h
|
||||
|
||||
METHOD setName( c ) INLINE ::Name := c
|
||||
METHOD setAction( c ) INLINE ::Action := c
|
||||
METHOD setMethod( c ) INLINE ::Method := c
|
||||
METHOD setEncType( c ) INLINE ::encType := c
|
||||
METHOD setOnSubmit( c ) INLINE ::onSubmit := c
|
||||
METHOD setOnReset( c ) INLINE ::onReset := c
|
||||
METHOD setTarget( c ) INLINE ::Target := c
|
||||
METHOD setCapClr( c ) INLINE ::CaptionColor := c
|
||||
METHOD setCapFntClr( c ) INLINE ::CapFontColor := c
|
||||
METHOD setCapImage( c ) INLINE ::CaptionImage := c
|
||||
METHOD setBgImage( c ) INLINE ::bgImage := c
|
||||
METHOD setFontColor( c ) INLINE ::FontColor := c
|
||||
METHOD setFrmColor( c ) INLINE ::Color := c
|
||||
METHOD setwidth( c ) INLINE ::width := c
|
||||
|
||||
|
||||
METHOD AddControl( o ) INLINE IF(Valtype(o)=="O",;
|
||||
(o:nH := ::nH, o:Form := Self),), ;
|
||||
AADD( ::aControls, o )
|
||||
|
||||
METHOD PutControls() INLINE AEVAL( ::aControls, {|e| e:Put() } )
|
||||
METHOD New( cName, cAction, cMethod, lFrame, cCaption, nWidth )
|
||||
METHOD Put( lPutControls)
|
||||
METHOD End()
|
||||
METHOD GetControl( cName)
|
||||
|
||||
//METHOD Debug() INLINE __clsDebug( self ) NOSELF
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Form():New()
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
method New( cName, cAction, cMethod, lFrame, cCaption, nWidth ) CLASS Form
|
||||
|
||||
HB_SYMBOL_UNUSED( cAction )
|
||||
|
||||
DEFAULT cName := "Form1"
|
||||
DEFAULT cMethod := "POST"
|
||||
DEFAULT lFrame := .F.
|
||||
DEFAULT cCaption := ""
|
||||
DEFAULT nWidth := 90
|
||||
|
||||
::Name := cName
|
||||
::Method := cMethod
|
||||
|
||||
::nH := PageHandle()
|
||||
|
||||
::Frame := lFrame
|
||||
::Caption := cCaption
|
||||
::width := nWidth
|
||||
|
||||
::aControls := {}
|
||||
|
||||
soForm := Self
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Form():Put()
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
method Put( lPutControls ) CLASS Form
|
||||
|
||||
DEFAULT lPutControls := .F.
|
||||
|
||||
IF VALTYPE(::width) != "N"
|
||||
::width := 90
|
||||
ENDIF
|
||||
|
||||
IF VALTYPE( ::color ) != "C"
|
||||
::Color := "#9196A0"
|
||||
ENDIF
|
||||
|
||||
IF VALTYPE( ::fontColor ) != "C"
|
||||
::fontColor := "black"
|
||||
ENDIF
|
||||
|
||||
IF VALTYPE( ::CaptionColor ) != "C"
|
||||
::CaptionColor := "black"
|
||||
ENDIF
|
||||
|
||||
|
||||
IF ::Frame
|
||||
::cOutPut := CRLF()+CRLF()+CRLF()+"<!------- Start of Form ------->" +CRLF()+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
::cOutPut := '<TABLE BGCOLOR="#9196A0" '+CRLF()+;
|
||||
" COLS=1 "+CRLF()+;
|
||||
" ROWS=1 "+CRLF()+;
|
||||
" CELLPADDING=3 "+CRLF()+;
|
||||
" CELLSPACING=3 "+CRLF()+;
|
||||
" WIDTH=" + NTRIM( ::width ) +"% "+CRLF()+;
|
||||
' BORDERCOLORLIGHT="#000000" '+CRLF()+;
|
||||
' BORDERCOLORDARK="#FFFFFF" ' +CRLF()+;
|
||||
" BORDER "+CRLF()+;
|
||||
" >"+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
::cOutPut := '<TR BGCOLOR="'+::captionColor+'">'+CRLF()
|
||||
IF ::Caption != NIL
|
||||
::cOutPut := "<TD"
|
||||
FWrite( ::nH, ::cOutput )
|
||||
IF ::captionImage != NIL
|
||||
::cOutPut := ' BACKGROUND="'+::captionImage+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
::cOutPut := '>'
|
||||
FWrite( ::nH, ::cOutput )
|
||||
IF ::capFontColor != NIL
|
||||
::cOutPut := '<FONT COLOR="'+::capFontColor+'">'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
::cOutPut := "<B>"+::Caption+"</B>"+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
::cOutPut := "</TD></TR>"
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
::cOutPut := '<TR BGCOLOR="'+::color+'">' +CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
::cOutPut := '<TD'
|
||||
FWrite( ::nH, ::cOutput )
|
||||
IF ::bgImage != NIL
|
||||
::cOutPut := ' BACKGROUND="'+::bgImage+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
::cOutPut := '>'
|
||||
FWrite( ::nH, ::cOutput )
|
||||
|
||||
IF ::fontColor != NIL
|
||||
::cOutPut := '<FONT COLOR="'+::FontColor+'">'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
ENDIF
|
||||
::cOutput+= CRLF()+"<FORM " + CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
|
||||
IF ::name != NIL
|
||||
::cOutPut := space(5)+' NAME="'+::Name+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
IF ::method != NIL
|
||||
::cOutPut := space(5)+' METHOD="'+::Method+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
IF ::Action != NIL
|
||||
::cOutPut := space(5)+' ACTION='+::Action+''+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
IF ::Target != NIL
|
||||
::cOutPut := space(5)+' TARGET='+::Target+''+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
IF ::Enctype != NIL
|
||||
::cOutPut := space(5)+' ENCTYPE="'+::encType+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
IF ::onSubmit != NIL
|
||||
::cOutPut := space(5)+'onSubmit="'+::onSubmit+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
IF ::onReset != NIL
|
||||
::cOutPut := space(5)+' onReset="'+::onReset+'"'+CRLF()
|
||||
FWrite( ::nH, ::cOutput )
|
||||
ENDIF
|
||||
|
||||
::cOutPut := ">"+CRLF()
|
||||
|
||||
FWrite( ::nH, ::cOutput )
|
||||
|
||||
IF lPutControls
|
||||
AEVAL( ::aControls, {|e| IF( VALTYPE(e) == "O", ;
|
||||
e:Put(), FWrite(::nH, e ) ) } )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Form():End()
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
method End() CLASS Form
|
||||
FWrite( ::nH, "</FORM>" + CRLF() )
|
||||
IF ::Frame
|
||||
FWrite( ::nH, "</TD>"+CRLF() )
|
||||
FWrite( ::nH, "</TR>"+CRLF() )
|
||||
FWrite( ::nH, "</TABLE>"+CRLF() )
|
||||
Endif
|
||||
FWrite( ::nH, CRLF()+CRLF()+"<!--- End of Form --->" +CRLF()+CRLF()+CRLF() )
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* Form():getControl()
|
||||
*
|
||||
* Retrieve a form control object by name
|
||||
*
|
||||
*/
|
||||
|
||||
method getControl( cName ) CLASS Form
|
||||
|
||||
LOCAL oRet
|
||||
LOCAL nPos := ASCAN( ::aControls, {|e| e:name = cName } )
|
||||
IF nPos > 0
|
||||
oRet := ::aControls[nPos]
|
||||
ENDIF
|
||||
|
||||
RETURN oRet
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* oForm()
|
||||
*
|
||||
* Return current form
|
||||
*
|
||||
*/
|
||||
|
||||
FUNCTION oForm()
|
||||
RETURN soForm
|
||||
|
||||
|
||||
@@ -1,559 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Base fileIO class.
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "hbclass.ch"
|
||||
|
||||
#include "default.ch"
|
||||
#include "fileio.ch"
|
||||
#include "ferror.ch"
|
||||
//#include "simpleio.ch"
|
||||
|
||||
#translate FPOS(<f>) => FSEEK( <f>, 0, FS_RELATIVE )
|
||||
|
||||
#ifdef TEST
|
||||
PROC TEST()
|
||||
LOCAL oF
|
||||
oF := FileBase():New( "c:\autoexec.bat" ) //oFile.prg" )
|
||||
oF:Open()
|
||||
? of:handle
|
||||
while !oF:EOF()
|
||||
? oF:ReadLine()
|
||||
inkey(0)
|
||||
ENDDO
|
||||
#endif
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
CLASS FileBase // ALIAS FB
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
DATA Buffer INIT "" // Self[1]
|
||||
DATA Name INIT ""
|
||||
DATA Handle //INIT -999
|
||||
DATA FileSize INIT 0
|
||||
DATA BytesRead INIT 0
|
||||
DATA cPage INIT ""
|
||||
DATA nPage INIT 0
|
||||
DATA nPageSize INIT 1024
|
||||
DATA nRecord INIT 0
|
||||
|
||||
METHOD New( cName )
|
||||
METHOD Open( nMode )
|
||||
METHOD Close() INLINE FClose( ::Handle ), ;
|
||||
::Handle := -999
|
||||
|
||||
METHOD Rename(c) INLINE FRename( ::File, c ) == 0
|
||||
METHOD Erase() INLINE Ferase( ::File ) == 0
|
||||
METHOD Exists() INLINE File( ::File )
|
||||
METHOD Error() INLINE Ferror() != 0
|
||||
|
||||
METHOD Tell() INLINE Fseek(::handle,FS_RELATIVE,0)
|
||||
METHOD Pointer() INLINE FPOS( ::handle )
|
||||
METHOD ReadStr(n) INLINE ::Buffer := ;
|
||||
FReadStr( ::Handle, n )
|
||||
METHOD Write( c, n ) INLINE FWrite( ::Handle, c, n )
|
||||
METHOD WriteByte( n )
|
||||
METHOD WriteInt( n )
|
||||
METHOD WriteLong( n )
|
||||
METHOD GetBuffer() INLINE ::Buffer
|
||||
|
||||
METHOD GoTop() INLINE FSEEK( ::Handle, 0 )
|
||||
METHOD GoBottom() INLINE FSEEK( ::Handle, 0, FS_END)
|
||||
METHOD Bof() INLINE ( FPOS(::Handle) == 0)
|
||||
METHOD Eof() INLINE FPOS(::Handle) == ::FileSize
|
||||
METHOD Seek( n, o ) INLINE FSeek( ::Handle, n, o)
|
||||
METHOD Create( n )
|
||||
METHOD Size()
|
||||
|
||||
METHOD _Read( n, c )
|
||||
METHOD ReadAhead( n, c )
|
||||
METHOD ReadLine( n )
|
||||
METHOD PrevLine( nBytes )
|
||||
METHOD ReadByte()
|
||||
METHOD ReadInt()
|
||||
METHOD ReadLong()
|
||||
|
||||
METHOD GoTo( n )
|
||||
METHOD Skip( n )
|
||||
|
||||
METHOD MaxPages(n)
|
||||
METHOD PrevPage(n)
|
||||
METHOD NextPage(n)
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD New( cName ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
::Name := cName
|
||||
::Buffer := "" // Self[1]
|
||||
::Handle := 0
|
||||
::FileSize := 0
|
||||
::BytesRead := 0
|
||||
::cPage := ""
|
||||
::nPage := 0
|
||||
::nPageSize := 1024
|
||||
::nRecord := 0
|
||||
RETURN Self
|
||||
|
||||
|
||||
/*
|
||||
** ::Open( [<nMode>] ) --> lSuccess
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD Open( nMode ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
DEFAULT nMode := FO_EXCLUSIVE //SHARED
|
||||
::Handle := FOpen( ::Name, nMode )
|
||||
IF ::Handle > 0
|
||||
::Size()
|
||||
ENDIF
|
||||
RETURN ::Handle > 0
|
||||
|
||||
|
||||
/*
|
||||
** ::Create( [<nAttrib>] ) --> lSuccess
|
||||
*/
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD Create( nAttr ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nSuccess
|
||||
DEFAULT nAttr := 0
|
||||
nSuccess := FCreate( ::Name, nAttr )
|
||||
::Handle := nSuccess
|
||||
RETURN (nSuccess != -1)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::Size() --> nFileSize
|
||||
**
|
||||
** RETURNs the size in bytes of the current file.
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD Size() CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nCurrent,nLength
|
||||
|
||||
nCurrent := FPOS( ::Handle )
|
||||
nLength := FSEEK( ::Handle, 0, FS_END )
|
||||
|
||||
FSEEK( ::Handle, nCurrent )
|
||||
::FileSize := nLength
|
||||
|
||||
RETURN( nLength )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::Read( [<nSize>], [@<cBuff>] ) --> nBytesRead
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD _Read( nSize, cBuff ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
DEFAULT nSize := 1024
|
||||
DEFAULT cBuff := SPACE(nSize)
|
||||
|
||||
::BytesRead := FRead( ::Handle, @cBuff, nSize )
|
||||
::Buffer := cBuff
|
||||
|
||||
RETURN( cBuff ) //nBytesRead )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::ReadAhead( [<nSize>], [@<cBuff>] ) --> nBytesRead
|
||||
**
|
||||
** Read forward in the file without moving the pointer.
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD ReadAhead( nSize, cBuff ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nCurrent
|
||||
|
||||
DEFAULT nSize := 1024
|
||||
DEFAULT cBuff := SPACE(nSize)
|
||||
|
||||
// --> save position in file
|
||||
nCurrent := FPOS( ::Handle )
|
||||
|
||||
// --> read ahead
|
||||
::BytesRead := FRead( ::Handle, @cBuff, nSize )
|
||||
|
||||
// --> RETURN to saved position
|
||||
FSEEK( ::Handle, nCurrent )
|
||||
|
||||
RETURN( cBuff )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::ReadLine( [<nBytes>] ) --> cLine
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD Readline( nSize ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL cString, nCurrent, nCr
|
||||
|
||||
DEFAULT nSize := 1024
|
||||
|
||||
IF nSize <= 0
|
||||
RETURN( "" )
|
||||
ENDIF
|
||||
|
||||
nCurrent := FSEEK( ::Handle, 0, 1 )
|
||||
cString := FREADSTR( ::Handle, nSize )
|
||||
nCr := AT( CHR(13), cString )
|
||||
|
||||
FSEEK( ::Handle,nCurrent,0 )
|
||||
FSEEK( ::Handle,nCr+1,1 )
|
||||
|
||||
::Buffer := SUBSTR( cString, 1, nCr-1 )
|
||||
::nRecord++
|
||||
|
||||
RETURN ::Buffer
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::ReadByte() --> nByte or -1 if unsuccessfull
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD ReadByte() CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nBytes
|
||||
LOCAL cBuff := SPACE( 1 )
|
||||
|
||||
nBytes := FRead( ::Handle, @cBuff, 1 )
|
||||
|
||||
RETURN( IF( nBytes > 0, ASC(cBuff), -1 ) )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::ReadInt() --> nUnsignedInt or -1 if unsuccessfull
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD ReadInt() CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nBytes
|
||||
LOCAL cBuff := SPACE( 2 )
|
||||
|
||||
nBytes := FRead( ::Handle, @cBuff, 2 )
|
||||
|
||||
RETURN( IF( nBytes > 0, BIN2I(cBuff), -1 ) )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::ReadLong() --> nLong or -1 if unsuccessfull
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD ReadLong() CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nBytes
|
||||
LOCAL cBuff := SPACE( 4 )
|
||||
|
||||
nBytes := FRead( ::Handle, @cBuff, 4 )
|
||||
|
||||
RETURN( IF( nBytes > 0, BIN2L(cBuff), -1 ) )
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::WriteByte( nByte ) --> lSuccess
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD WriteByte( nByte ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL lSuccess := ( FWrite( ::nHandle, chr( nByte ), 1 ) == 1 )
|
||||
RETURN lSuccess
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::WriteInt( nInt ) --> lSuccess
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD WriteInt( nInt ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL lSuccess := ( FWrite( ::nHandle, I2BIN( nInt ), 2 ) == 2 )
|
||||
RETURN lSuccess
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::WriteLong( nLong ) --> lSuccess
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD WriteLong( nLong ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL lSuccess := ( FWrite( ::nHandle, L2BIN( nLong ), 4 ) == 4 )
|
||||
RETURN( lSuccess )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::GOTO( <nLine> ) --> nPrevPos
|
||||
**
|
||||
** Skips to line <nLine> from top. RETURNs previous position in file.
|
||||
**
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD GoTo( nLine ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nCount := 1
|
||||
LOCAL nPos := FPOS( ::Handle )
|
||||
|
||||
::GoTop()
|
||||
|
||||
IF nLine < 0 // don't accept < 0
|
||||
RETURN( nPos )
|
||||
ELSEIF nLine == 0
|
||||
nLine := 1
|
||||
::nRecord := 1
|
||||
::GoTop()
|
||||
RETURN( nPos )
|
||||
ENDIF
|
||||
|
||||
WHILE !::EOF()
|
||||
|
||||
::ReadLine()
|
||||
|
||||
IF nCount == nLine ; EXIT ; ENDIF
|
||||
|
||||
nCount++
|
||||
ENDDO
|
||||
|
||||
RETURN( nPos )
|
||||
|
||||
|
||||
/*
|
||||
** ::Skip( [<nLines>] ) --> nPrevPos
|
||||
**
|
||||
** Skips to line <nLine> from top. RETURNs previous position in file.
|
||||
**
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD Skip( nLines ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL nCount := 0
|
||||
LOCAL nPos := FPOS( ::Handle )
|
||||
|
||||
DEFAULT nLines := 1
|
||||
|
||||
IF nLines <= 0 // don't accept < 0
|
||||
|
||||
RETURN nPos
|
||||
|
||||
ENDIF
|
||||
|
||||
WHILE !::EOF()
|
||||
|
||||
IF nCount == nLines ; EXIT ; ENDIF
|
||||
|
||||
::ReadLine()
|
||||
nCount++
|
||||
ENDDO
|
||||
RETURN( nPos )
|
||||
|
||||
|
||||
/*
|
||||
** ::MaxPages( <nPageSize> ) --> nMaxPages
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD MaxPages( nPageSize ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
DEFAULT nPageSize := ::nPageSize
|
||||
RETURN( ::Size() / nPageSize )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::PrevPage( [<nBytes>] ) --> cPage
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD PrevPage( nBytes ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
DEFAULT nBytes := 1024
|
||||
|
||||
IF nBytes <= 0
|
||||
RETURN( "" )
|
||||
ENDIF
|
||||
|
||||
IF !::BOF()
|
||||
FSEEK( ::Handle, -nBytes, FS_RELATIVE)
|
||||
::cPage := FREADSTR( ::Handle, nBytes )
|
||||
FSEEK( ::Handle, -nBytes, FS_RELATIVE)
|
||||
::nPage--
|
||||
ENDIF
|
||||
|
||||
RETURN( ::cPage )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::NextPage( [<nBytes>] ) --> cPage
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD NextPage( nBytes ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
DEFAULT nBytes := 1024
|
||||
|
||||
IF nBytes <= 0
|
||||
RETURN( "" )
|
||||
ENDIF
|
||||
|
||||
IF !::EOF()
|
||||
::cPage := FREADSTR( ::Handle, nBytes )
|
||||
::nPage++
|
||||
ENDIF
|
||||
|
||||
RETURN( ::cPage )
|
||||
|
||||
|
||||
/*
|
||||
** ::PrevLine( [<nBytes>] ) --> ::Buffer
|
||||
*/
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD PrevLine( npBytes ) CLASS FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
LOCAL fHandle := ::Handle
|
||||
LOCAL nOrigPos := FPOS(fHandle), nMaxRead, nNewPos, ;
|
||||
lMoved, cBuff, nWhereCrLf, nPrev, cTemp
|
||||
|
||||
DEFAULT npBytes := 256
|
||||
|
||||
IF nOrigPos == 0
|
||||
|
||||
lMoved := .F.
|
||||
|
||||
ELSE
|
||||
|
||||
lMoved := .T.
|
||||
|
||||
// Check preceeding 2 chars for CR+LF
|
||||
FSeek(fHandle, -2, FS_RELATIVE)
|
||||
cTemp := Space(2)
|
||||
FRead(fHandle, @cTemp, 2)
|
||||
|
||||
IF cTemp == CRLF()
|
||||
FSeek(fHandle, -2, FS_RELATIVE)
|
||||
ENDIF
|
||||
|
||||
nMaxRead := MIN( npBytes, FPOS(fHandle))
|
||||
|
||||
cBuff := Space(nMaxRead)
|
||||
nNewPos := FSeek(fHandle, -nMaxRead, FS_RELATIVE)
|
||||
FRead(fHandle, @cBuff, nMaxRead)
|
||||
nWhereCrLf := RAT( CRLF(), cBuff )
|
||||
IF nWhereCrLf == 0
|
||||
|
||||
nPrev := nNewPos
|
||||
::Buffer := cBuff
|
||||
|
||||
ELSE
|
||||
|
||||
nPrev := nNewPos + nWhereCrLf + 1
|
||||
::Buffer := SubStr(cBuff, nWhereCrLf + 2)
|
||||
|
||||
ENDIF
|
||||
|
||||
FSeek(fHandle, nPrev, FS_SET)
|
||||
|
||||
ENDIF
|
||||
|
||||
RETURN IF( lMoved, ::Buffer, "" )
|
||||
|
||||
|
||||
/*
|
||||
* * * * * UNCHECKED !!! * * * * *
|
||||
|
||||
METHOD PrevLine( nBytes ) CLASS FileBase
|
||||
LOCAL cRet, cPage := ""
|
||||
LOCAL nAt := 0
|
||||
LOCAL nPos := FPOS( ::Handle )
|
||||
DEFAULT nBytes := 1024
|
||||
|
||||
IF nBytes <= 0
|
||||
RETURN( "" )
|
||||
ENDIF
|
||||
|
||||
IF !( FPOS(::Handle) == 1) // !BOF()
|
||||
FSEEK( ::Handle, -nBytes, FS_RELATIVE) // position back
|
||||
cPage := FREADSTR( ::Handle, nBytes ) // read forward
|
||||
nAt := RAT( Chr(13), cPage ) // find crlf()
|
||||
cRet := RIGHT( cPage, nAt+1)
|
||||
//FSEEK( ::Handle, -(nAt-1), FS_RELATIVE)
|
||||
FSEEK( ::Handle, nPos )
|
||||
FSEEK( ::Handle, -(nAT-1), 1 )
|
||||
ENDIF
|
||||
|
||||
RETURN( cRet )
|
||||
*/
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* HTMLLIB Frame Class
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "default.ch"
|
||||
#include "html.ch"
|
||||
|
||||
|
||||
|
||||
CLASS Frameset
|
||||
DATA nH
|
||||
DATA FName
|
||||
DATA Title init "FrameSet01"
|
||||
|
||||
|
||||
METHOD New( fName, title )
|
||||
METHOD StartSet( aRows, aCols, onLoad, onUnload )
|
||||
METHOD EndSet()
|
||||
METHOD End()
|
||||
METHOD Frame( cName, cURL, lBorder, lResize, lScrolling,;
|
||||
marginwidth, marginheight, cTarget, cScrolling )
|
||||
|
||||
//METHOD Debug() INLINE __clsDebug( self ) NOSELF
|
||||
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD New( cFName, cTitle ) CLASS Frameset
|
||||
|
||||
LOCAL cStr := ""
|
||||
|
||||
DEFAULT cTitle := ""
|
||||
|
||||
::FName := cFName
|
||||
::Title := cTitle
|
||||
|
||||
|
||||
IF ::FName == NIL
|
||||
cStr += "Content-Type: text/html"+CRLF()+CRLF()
|
||||
// cStr := ""
|
||||
::nH := STD_OUT
|
||||
ELSE
|
||||
cStr := ""
|
||||
::nH := FCreate( ::FName )
|
||||
ENDIF
|
||||
|
||||
cStr += "<HTML>"+CRLF()+;
|
||||
" <HEAD>"+CRLF()+;
|
||||
" <TITLE>"+::Title+"</TITLE>"+CRLF()+;
|
||||
" </HEAD>"+CRLF()
|
||||
|
||||
FWrite( ::nH, cStr )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD StartSet( aRows, aCols, onLoad, onUnload ) CLASS Frameset
|
||||
LOCAL i
|
||||
LOCAL cStr := ""
|
||||
|
||||
cStr += CRLF()+" <FRAMESET "
|
||||
|
||||
IF aRows != NIL .and. VALTYPE( aRows ) == "A" .and. !EMPTY( aRows )
|
||||
cStr += ' rows="'
|
||||
FOR i=1 TO LEN( aRows )
|
||||
IF i < LEN( aRows )
|
||||
cStr += aRows[i]+","
|
||||
ELSE
|
||||
cStr += aRows[i]
|
||||
ENDIF
|
||||
NEXT
|
||||
cStr += '"'
|
||||
ENDIF
|
||||
|
||||
IF aCols != NIL .and. VALTYPE( aCols ) == "A" .and. !EMPTY( aCols )
|
||||
cStr += ' cols="'
|
||||
FOR i=1 TO LEN( acOLS )
|
||||
IF i < LEN( acOLS )
|
||||
cStr += acOLS[i]+","
|
||||
ELSE
|
||||
cStr += acOLS[i]
|
||||
ENDIF
|
||||
NEXT
|
||||
cStr += '"'
|
||||
ENDIF
|
||||
|
||||
IF onLoad != NIL
|
||||
cStr += SPACE(7)+' onLoad="'+onLoad+'"'
|
||||
ENDIF
|
||||
IF onUnLoad != NIL
|
||||
cStr += SPACE(5)+' onUnLoad="'+onUnLoad+'"'
|
||||
ENDIF
|
||||
|
||||
cStr += " >"+CRLF()
|
||||
|
||||
FWrite( ::nH, cStr )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
Method Endset() CLASS Frameset
|
||||
FWrite( ::nH, " </FRAMESET>"+CRLF() )
|
||||
RETURN Self
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
Method End() CLASS Frameset
|
||||
FWrite( ::nH, "</HTML>"+CRLF() )
|
||||
IF ::FName != NIL
|
||||
FClose( ::nH )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD Frame( cName, cURL, lBorder, lResize, lScrolling,;
|
||||
marginwidth, marginheight, cTarget, cScrolling ) CLASS Frameset
|
||||
|
||||
LOCAL cStr
|
||||
|
||||
DEFAULT lBorder := .T.
|
||||
DEFAULT lResize := .T.
|
||||
DEFAULT lScrolling := .F.
|
||||
DEFAULT cScrolling := "AUTO"
|
||||
DEFAULT cTarget := "_self" //"_blank"
|
||||
|
||||
cStr := " <FRAME "
|
||||
|
||||
IF cName != NIL
|
||||
cStr += ' name="'+cName +'"'
|
||||
ENDIF
|
||||
|
||||
IF cUrl != NIL
|
||||
cStr += ' src="'+cURL +'"'
|
||||
ENDIF
|
||||
|
||||
IF cTarget != NIL
|
||||
cStr += ' TARGET="'+cTarget +'"'
|
||||
ENDIF
|
||||
|
||||
IF !lBorder
|
||||
cStr += ' frameborder="0"'
|
||||
else
|
||||
cStr += ' frameborder="1"'
|
||||
ENDIF
|
||||
|
||||
IF !lResize
|
||||
cStr += " NORESIZE"
|
||||
//else
|
||||
//cStr += " RESIZE"
|
||||
ENDIF
|
||||
|
||||
IF cScrolling != NIL
|
||||
cStr += ' SCROLLING="'+cScrolling+'"'
|
||||
ELSE
|
||||
IF lScrolling != NIL
|
||||
cStr += ' SCROLLING='+IF( lScrolling, '"yes"', '"no"' )
|
||||
else
|
||||
cStr += ' SCROLLING="auto"'
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF marginwidth != NIL
|
||||
cStr += " MARGINWIDTH='"+NTRIM(marginwidth)+"'"
|
||||
ENDIF
|
||||
|
||||
IF marginheight != NIL
|
||||
cStr += "MARGINHEIGHT="+NTRIM(marginwidth)
|
||||
ENDIF
|
||||
|
||||
cStr += ">"+CRLF()
|
||||
|
||||
FWrite( ::nH, cStr )
|
||||
RETURN Self
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,507 +0,0 @@
|
||||
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Ini Class
|
||||
*
|
||||
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
||||
* 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/).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The following parts are Copyright of the individual authors.
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* Porting this library to Harbour
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
**
|
||||
** oIni.prg
|
||||
** --------
|
||||
**
|
||||
** This implementation of an .ini file reader presents a different
|
||||
** approach to the problem as it creates a two dimensional array to
|
||||
** store and analyse data.
|
||||
**
|
||||
** The first dimension keeps all sections and the second dimension
|
||||
** their entries. This way we avoid misinterpretation of entries (an
|
||||
** entry could be mistaken for section and vice versa) and keep
|
||||
** a clearer view of the whole structure in memory.
|
||||
**
|
||||
** Entries are separated in entry tags, data and comments, e.g.
|
||||
**
|
||||
** TestTag="Data" ; comment
|
||||
**
|
||||
** Header comments are supported only if preceded with "/*", "*" or "/*"
|
||||
** and only at the beginning of the .ini file before any sections.
|
||||
**
|
||||
**
|
||||
** Organisation of the file in memory (two dimensional array):
|
||||
** -----------------------------------------------------------
|
||||
**
|
||||
** [section]
|
||||
** entry=data
|
||||
** entry=data
|
||||
** ...
|
||||
** [section]
|
||||
** ...
|
||||
**
|
||||
**
|
||||
** organisation of the file on disk:
|
||||
** ---------------------------------
|
||||
** /*
|
||||
** ** Header
|
||||
** */
|
||||
**
|
||||
** [section]
|
||||
** entry=data ; comment
|
||||
** entry=data
|
||||
** [section]
|
||||
** ...
|
||||
** ; comment
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "default.ch"
|
||||
|
||||
#ifdef TEST
|
||||
PROC TestMe()
|
||||
LOCAL o := oINI():New( "Test.ini" )
|
||||
//o:Open()
|
||||
o:Read()
|
||||
objectViewer( o )
|
||||
? "handle",o:handle
|
||||
? o:Get( "methods", "method45", 45 )
|
||||
? o:Get( "methods", "method455", .t. )
|
||||
? o:Put( "methods", "method8", .f. )
|
||||
? o:Get( "Test", "Test1", 1234567890 )
|
||||
o:DumpSections()
|
||||
? "handle",o:handle
|
||||
o:Save(";"+CRLF()+;
|
||||
";TEST.INI"+CRLF()+;
|
||||
";Created on "+DTOC(DATE())+" - " + TIME() +CRLF()+;
|
||||
";"+CRLF())
|
||||
o:close()
|
||||
RETURN
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
CLASS oIni FROM FileBase
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
DATA aLines INIT {}
|
||||
DATA aSections INIT {}
|
||||
DATA lineSize INIT 200
|
||||
|
||||
METHOD New( cFile )
|
||||
METHOD Read()
|
||||
METHOD Get( cSection, cEntry, uDefault )
|
||||
METHOD Put( cSection, cEntry, uValue )
|
||||
METHOD Save(c)
|
||||
METHOD DumpSections()
|
||||
ENDCLASS
|
||||
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
METHOD New( cFile ) CLASS oIni
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
Super():New( cFile )
|
||||
::Name := cFile
|
||||
::aLines := {}
|
||||
::aSections := {}
|
||||
::handle := -1
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ::Read()
|
||||
**
|
||||
** Reads the .ini file in memory, separating [sections] from entries
|
||||
**
|
||||
*/
|
||||
|
||||
METHOD Read() CLASS oIni
|
||||
LOCAL nSection := 0
|
||||
|
||||
//? "ohandle",::handle
|
||||
IF ::handle == NIL .OR. ::Handle <= 0
|
||||
|
||||
IF ::Open()
|
||||
|
||||
::aLines := {} ; ::aSections := {}
|
||||
::Size()
|
||||
::GoTop()
|
||||
|
||||
WHILE !::EOF()
|
||||
|
||||
::ReadLine( ::lineSize )
|
||||
|
||||
// ::aLines keep anything before the first section
|
||||
// like comments, headers etc.
|
||||
IF !EMPTY( ::Buffer ) .and. nSection == 0
|
||||
IF ::Buffer = "/*" .or. ;
|
||||
::Buffer = "**" .or. ;
|
||||
::Buffer = "*" .or. ;
|
||||
::Buffer = "*/"
|
||||
|
||||
AADD( ::aLines, ::Buffer )
|
||||
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF LEFT(ALLTRIM( ::Buffer ),1) == "["
|
||||
nSection++
|
||||
AADD( ::aSections, { lower(ALLTRIM(::Buffer)), {} } )
|
||||
ENDIF
|
||||
|
||||
if nSection > 0
|
||||
if !EMPTY( ::Buffer )
|
||||
AADD( ::aSections[nSection,2], ::buffer )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF ::EOF()
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
ENDDO
|
||||
|
||||
AEVAL( ::aSections, ;
|
||||
{|e| ADEL(e[2],1), ASIZE( e[2], LEN( e[2] ) -1 ) } )
|
||||
|
||||
ENDIF // ::open()
|
||||
|
||||
ENDIF // ::handle
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
/*
|
||||
** ::Get( cSection, cEntry, uDefault )
|
||||
**
|
||||
** Retrieves an entry from memory. If it doesn't exist it creates it with
|
||||
** default data. Also it creates the section if it doesn't exist.
|
||||
*/
|
||||
|
||||
METHOD Get( cSection, cEntry, uDefault ) CLASS oIni
|
||||
LOCAL cRet, nSection, nEntry
|
||||
|
||||
DEFAULT uDefault := ""
|
||||
|
||||
cSection := "["+lower( ALLTRIM(cSection) )+"]"
|
||||
nSection := ASCAN( ::aSections, {|e| e[1] = cSection } )
|
||||
|
||||
IF nSection > 0
|
||||
|
||||
nEntry := ASCAN( ::aSections[nSection,2], ;
|
||||
{|e| UPPER(cEntry) == UPPER( ALLTRIM(LEFT( e, AT("=",e)-1 )) ) })
|
||||
|
||||
IF nEntry > 0 // Found entry. Get value. Cast to data type
|
||||
|
||||
cRet := STR2ANY( GetEntryData( ::aSections[nSection,2,nEntry] ), ;
|
||||
uDefault )
|
||||
|
||||
ELSE // Entry not found. Insert new entry
|
||||
|
||||
AADD( ::aSections[nSection,2], cEntry + "=" + ANY2STR( uDefault ) )
|
||||
cRet := uDefault
|
||||
ENDIF
|
||||
|
||||
ELSE // insert new section and entry...
|
||||
AADD( ::aSections, { cSection, ;
|
||||
{ cEntry + "=" + ANY2STR( uDefault ) } } )
|
||||
cRet := uDefault
|
||||
|
||||
ENDIF
|
||||
|
||||
RETURN( cRet )
|
||||
|
||||
|
||||
/*
|
||||
** ::Put()
|
||||
**
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
METHOD Put( cSection, cEntry, uValue ) CLASS oIni
|
||||
LOCAL cRet := ""
|
||||
LOCAL cComment, nSection, nEntry
|
||||
|
||||
DEFAULT uValue := ""
|
||||
|
||||
cSection := "["+Lower( ALLTRIM(cSection) )+"]"
|
||||
nSection := ASCAN( ::aSections, {|e| e[1] = cSection }) //$ e[1] } )
|
||||
IF nSection > 0
|
||||
|
||||
nEntry := ASCAN( ::aSections[nSection,2], ;
|
||||
{|e| UPPER(cEntry) == UPPER( LEFT( e, AT("=",e)-1 ) ) })
|
||||
|
||||
IF nEntry > 0 // Found entry. Get value. Cast to data type
|
||||
|
||||
// return old value
|
||||
cRet := STR2ANY( GetEntryData( ::aSections[nSection,2,nEntry] ), ;
|
||||
uValue )
|
||||
|
||||
cComment := GetEntryComment( ::aSections[nSection,2,nEntry] )
|
||||
|
||||
// put new value
|
||||
::aSections[nSection,2,nEntry] := cEntry + "=" + ;
|
||||
ANY2STR( uValue ) +;
|
||||
SPACE(2)+;
|
||||
cComment
|
||||
|
||||
ELSE // Entry not found. Insert new entry.
|
||||
|
||||
AADD( ::aSections[nSection,2], cEntry + "=" + ANY2STR( uValue ) )
|
||||
cRet := uValue
|
||||
ENDIF
|
||||
|
||||
ELSE // Section not found. Insert section and entry.
|
||||
|
||||
AADD( ::aSections, { cSection, ;
|
||||
{ cEntry + "=" + ANY2STR( uValue ) } } )
|
||||
cRet := uValue
|
||||
|
||||
ENDIF
|
||||
|
||||
RETURN( cRet )
|
||||
|
||||
|
||||
/*
|
||||
** ::Save()
|
||||
**
|
||||
** Stores the .ini file back to disk from memory. All new changes are
|
||||
** saved, including comments...
|
||||
*/
|
||||
|
||||
METHOD Save( cComment ) CLASS oIni
|
||||
LOCAL i, j
|
||||
|
||||
DEFAULT cComment := ""
|
||||
|
||||
::Close()
|
||||
|
||||
// Delete and create file
|
||||
|
||||
IF ::Create( ::Name )
|
||||
|
||||
::Write( cComment + CRLF() )
|
||||
|
||||
AEVAL( ::aLines, {|e| FWrite( ::Handle, e + chr(13)+chr(10) ) } )
|
||||
|
||||
::Write( CRLF() )
|
||||
|
||||
FOR i=1 to LEN(::aSections)
|
||||
|
||||
//alert( ::aSections[i,1] )
|
||||
|
||||
::Write( ::aSections[i,1] + CRLF() )
|
||||
FOR j=1 TO LEN( ::aSections[i,2] )
|
||||
::Write( ::aSections[i,2,j] +CRLF() )
|
||||
NEXT
|
||||
::Write( CRLF() )
|
||||
NEXT
|
||||
|
||||
ENDIF
|
||||
|
||||
::Close()
|
||||
|
||||
RETURN Self
|
||||
|
||||
METHOD DumpSections() cLASS OINI
|
||||
LOCAL i, j
|
||||
for i=1 to len(::aSections)
|
||||
outStd( ::aSections[i,1] + CRLF() )
|
||||
for j=1 to len( ::aSections[i,2] )
|
||||
OUTSTD( SPACE(5) + ::aSections[i,2,j] +CRLF() )
|
||||
next
|
||||
next
|
||||
RETURN Self
|
||||
|
||||
/*
|
||||
** stripSection()
|
||||
**
|
||||
** Removes "[]" characters from a section entry
|
||||
*/
|
||||
STATIC FUNCTION StripSection(cSection)
|
||||
cSection := LOWER( ALLTRIM( cSection ) )
|
||||
DO WHILE "[" $ cSection
|
||||
cSection := STUFF(cSection, AT("[", cSection), 1 )
|
||||
ENDDO
|
||||
DO WHILE "]" $ cSection
|
||||
cSection := STUFF(cSection, AT("]", cSection), 1)
|
||||
ENDDO
|
||||
RETURN "["+cSection+"]"
|
||||
|
||||
|
||||
/*
|
||||
** GetEntryData( cEntry )
|
||||
**
|
||||
** Retrieves the data part of an .ini entry. Supports comments to the
|
||||
** right of the data.
|
||||
*/
|
||||
|
||||
STATIC FUNCTION GetEntryData( cEntry )
|
||||
LOCAL cRet := ""
|
||||
LOCAL nPos := 0
|
||||
LOCAL isComment := ( nPos := AT( ";", cEntry ) ) > 0
|
||||
|
||||
IF isComment
|
||||
cRet := SUBSTR( cEntry, AT( "=", cEntry )+1 , LEN(cEntry)-nPos-1 ) //AT( ";", cEntry )-1 )
|
||||
ELSE
|
||||
cRet := SUBSTR( cEntry, AT( "=", cEntry )+1 )
|
||||
ENDIF
|
||||
|
||||
RETURN alltrim( cRet )
|
||||
|
||||
|
||||
/*
|
||||
** GetEntryComment( cEntry )
|
||||
**
|
||||
** Retrieves the comment of an .ini entry.
|
||||
*/
|
||||
|
||||
STATIC FUNCTION GetEntryComment( cEntry )
|
||||
LOCAL cRet := ""
|
||||
LOCAL nPos := 0
|
||||
LOCAL isComment := ( nPos := AT( ";", cEntry ) ) > 0
|
||||
|
||||
IF isComment
|
||||
cRet := SUBSTR( cEntry, AT( ";", cEntry ), LEN( cEntry ) )
|
||||
ELSE
|
||||
cRet := ""
|
||||
ENDIF
|
||||
|
||||
RETURN alltrim( cRet )
|
||||
|
||||
|
||||
/*
|
||||
** ::DumpSections()
|
||||
**
|
||||
** Display [sections] and entries from memory ( debug method )
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* UTILITIES
|
||||
* ---------
|
||||
*
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
STATIC FUNCTION Any2Str( xVal )
|
||||
LOCAL cRet := ""
|
||||
LOCAL cType := VALTYPE( xVal )
|
||||
DO CASE
|
||||
CASE cType == "D" ; cRet := DTOC( xVal )
|
||||
CASE cType == "N" ; cRet := ALLTRIM(STR( xVal ))
|
||||
CASE cType == "L" ; cRet := IF( xVal == .T., ".T.", ".F." )
|
||||
CASE cType == "B" ; cRet := "{|| ... }"
|
||||
CASE cType == "O" ; cRet := xVal:ClassName()
|
||||
CASE cType == "U" ; cRet := ""
|
||||
OTHERWISE ; cRet := xVal
|
||||
ENDCASE
|
||||
RETURN cRet
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
STATIC FUNCTION Str2Any( cVal, uType )
|
||||
LOCAL bError
|
||||
LOCAL uRet := ""
|
||||
LOCAL cType := VALTYPE( uType )
|
||||
bError:= ERRORBLOCK( {|o| BREAK(o) } )
|
||||
cVal := ALLTRIM( cVal )
|
||||
|
||||
BEGIN SEQUENCE
|
||||
|
||||
DO CASE
|
||||
CASE cType == "D" ; uRet := CTOD( cVal )
|
||||
CASE cType == "N" ; uRet := IF( !EMPTY(cVal), VAL( cVal ), 0 )
|
||||
CASE cType == "L" ; uRet := IF( cVal == ".T.", .T., .F. )
|
||||
CASE cType == "B" ; uRet := {|| .T. }
|
||||
CASE cType == "O" ; uRet := NIL
|
||||
CASE cType == "U" ; uRet := NIL
|
||||
OTHERWISE ; uRet := cVal
|
||||
ENDCASE
|
||||
|
||||
RECOVER
|
||||
uRet := cVal
|
||||
END SEQUENCE
|
||||
|
||||
ERRORBLOCK( bError )
|
||||
|
||||
RETURN uRet
|
||||
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
STATIC FUNCTION Token(cStr, cDelim, nToken)
|
||||
|
||||
LOCAL nPos, cToken, nCounter := 1
|
||||
|
||||
DEFAULT nToken := 1
|
||||
|
||||
WHILE .T.
|
||||
|
||||
IF (nPos := AT(cDelim, cStr)) == 0
|
||||
|
||||
IF nCounter == nToken
|
||||
cToken := cStr
|
||||
endif
|
||||
|
||||
EXIT
|
||||
|
||||
ENDIF
|
||||
|
||||
IF ++nCounter > nToken
|
||||
cToken := LEFT(cStr, nPos - 1)
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
cStr := SUBSTR(cStr, nPos + 1)
|
||||
|
||||
ENDDO
|
||||
|
||||
RETURN cToken
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
/*
|
||||
**
|
||||
** (c) 1999-2000 Manos Aspradakis, Greece
|
||||
** eMail : maspr@otenet.gr
|
||||
**
|
||||
*/
|
||||
|
||||
#include "hbclass.ch"
|
||||
#include "html.ch"
|
||||
#include "default.ch"
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* ::debug()
|
||||
*
|
||||
* method of all objects
|
||||
*
|
||||
*/
|
||||
/*
|
||||
METHOD FUNCTION __clsDebug( opObj )
|
||||
LOCAL saArr := {}
|
||||
LOCAL aData
|
||||
LOCAL aMethods
|
||||
LOCAL cColor := ""
|
||||
LOCAL i, cStr
|
||||
Local lIsoObject := .F.
|
||||
|
||||
IF opObj != NIL
|
||||
IF VALTYPE( opObj ) == "O"
|
||||
Self := opObj
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF ! (VALTYPE( self ) == "O")
|
||||
RETURN NIL
|
||||
ENDIF
|
||||
|
||||
aData := getoData( Self )
|
||||
aMethods := aoMethods( Self )
|
||||
|
||||
saArr := {}
|
||||
|
||||
AADD( saArr, "<BR><BR>")
|
||||
AADD( saArr, "<FONT FACE=Verdana COLOR='black' SIZE='1'>"+CRLF() )
|
||||
AADD( saArr, "<center>")
|
||||
AADD( saArr, '<TABLE COLS="1" BORDER bgcolor="gray" WIDTH="90%"><TR bgcolor="gray" bordercolorlight="#000000" bordercolordark="#FFFFFF"><TD><B><CENTER>Class Viewer</CENTER></B></TD></TR><TR bgcolor="gray"><TD>'+CRLF() )
|
||||
AADD( saArr, "<center>")
|
||||
AADD( saArr, '<TABLE COLS="2" BORDER WIDTH="85%" bordercolorlight="#000000" bordercolordark="#FFFFFF"> '+CRLF() )
|
||||
AADD( saArr, "<TR bgcolor='black'>" )
|
||||
AADD( saArr, "<TD><font size='2' COLOR='white'><b>CLASS "+ Self:ClassName() + "</b></TD>" + ;
|
||||
"<TD><font size='2' COLOR='white'><b>DATA ("+ltrim(str(len(aData)))+") - Methods ("+ ltrim(str(len(aMethods)))+")</b></TD>" )
|
||||
AADD( saArr, "</TR>" )
|
||||
AADD( saArr, "<TR bgcolor='red'>" )
|
||||
|
||||
AADD( saArr, "<TD><b>Data Name</b></TD><TD><b>Value</b></TD>" )
|
||||
//AADD( saArr, "</TD></TR></TR>" )
|
||||
AADD( saArr, "</TR>" )
|
||||
|
||||
|
||||
FOR i=1 to len( aData )
|
||||
cColor := if( i%2=0, "lightyellow", "lightblue" )
|
||||
cColor := if( aData[i,2] == 4, 'red', cColor )
|
||||
cStr := "<TR "+"bgcolor='"+cColor+"'>"
|
||||
cStr += "<TD><FONT SIZE='2' COLOR='blue'><b>"+aData[i,1]+"</b></font></TD>"
|
||||
cStr += "<TD><FONT SIZE='2' COLOR='black'>"
|
||||
|
||||
|
||||
if aData[i,2] == 2
|
||||
if aData[i,3] == 0
|
||||
cStr += "-Method-"
|
||||
else
|
||||
cStr += "-Inline-"
|
||||
endif
|
||||
elseif aData[i,2] == 4
|
||||
cStr += htmlspace(2)
|
||||
else
|
||||
cStr += oTransform( oGetData( Self, aData[i,1]) )
|
||||
endif
|
||||
|
||||
cStr += "</font></TD></TR>"
|
||||
|
||||
AADD( saArr, cStr )
|
||||
NEXT
|
||||
|
||||
AADD( saArr, "</TABLE>" )
|
||||
AADD( saArr, "</center>")
|
||||
AADD( saArr, "</TD></TR></TABLE>" )
|
||||
AADD( saArr, "</FONT>" )
|
||||
AADD( saArr, "</center>")
|
||||
|
||||
AEVAL( saArr, {|e| oPage():QQOut(e) } )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
|
||||
*/
|
||||
/****
|
||||
*
|
||||
* aoData()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
STATIC FUNCTION aoData( oObject )
|
||||
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
local aInfo := ASort( __ClassSel( oObject:ClassH() ) )
|
||||
local aData := {}
|
||||
local aMethods := {}
|
||||
local i := 1
|
||||
local lExact := Set( _SET_EXACT, .t. )
|
||||
|
||||
while SubStr( aInfo[i], 1, 1 ) != "_"
|
||||
if ASCAN( aInfo, "_" + SubStr( aInfo[i], 1, 9 ), i+1 ) != 0
|
||||
AAdd( aData, aInfo[i] )
|
||||
else
|
||||
AAdd( aMethods, aInfo[i] )
|
||||
endif
|
||||
i++
|
||||
end
|
||||
|
||||
Set( _SET_EXACT, lExact )
|
||||
|
||||
RETURN { aData, aMethods }
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* __aoData()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC FUNCTION __aoDATA( oObject )
|
||||
local aInfo := ASort( __ClassSel( oObject:ClassH() ) )
|
||||
local aData := {}
|
||||
local i := 1
|
||||
local lExact := Set( _SET_EXACT, .t. )
|
||||
|
||||
while SubStr( aInfo[i], 1, 1 ) != "_"
|
||||
if ASCAN( aInfo, "_" + SubStr( aInfo[i], 1, 9 ), i+1 ) != 0
|
||||
AADD( aData, aInfo[i] )
|
||||
endif
|
||||
i++
|
||||
end
|
||||
|
||||
Set( _SET_EXACT, lExact )
|
||||
|
||||
RETURN aData
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* getOData()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC FUNCTION GetOData( o )
|
||||
LOCAL i
|
||||
LOCAL aObjData:= aoData( o )
|
||||
LOCAL aData := aObjData[1]
|
||||
LOCAL aMeth := aObjData[2]
|
||||
LOCAL aInline := {}
|
||||
LOCAL aRet := {}
|
||||
|
||||
LOCAL slIsOObject := .F.
|
||||
|
||||
IF ASCAN( aData, "DICT" ) > 0 // Is oObject class !!!
|
||||
IF VALTYPE( o:Dict ) == "A"
|
||||
slIsOObject := .T.
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// oObject Classes
|
||||
IF slIsOObject == .T.
|
||||
for i=1 to LEN( o:Dict[_CLASS_DATA] )
|
||||
|
||||
IF VALTYPE( o:Dict[_CLASS_DATA][i,3] ) == "B" // INLINE-BLOCK
|
||||
AADD( aInline, LOWER( o:Dict[_CLASS_DATA][i,1] ) )
|
||||
ELSE
|
||||
AADD( aRet, { o:Dict[_CLASS_DATA][i,1], 1, 0 } )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
aadd( aRet, { "<font color='white'><b>"+"METHODS</font></b>", 4, 0 })
|
||||
AEVAL( aInline , {|e| aadd( aRet, { LOWER( e ), 2, 1 })})
|
||||
AEVAL( o:Dict[_CLASS_METHODS], {|e| AADD( aRet, { LOWER( e[1] ), 2, 0 })})
|
||||
|
||||
// Normal classes
|
||||
ELSE
|
||||
AEVAL( aData, {|e| AADD( aRet, { e , 1, 0 } ) } )
|
||||
AEVAL( aMeth, {|e| AADD( aRet, { LOWER( e ), 2, 0 } ) } )
|
||||
ENDIf
|
||||
RETURN aRet
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* aoMethods()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC FUNCTION aoMETHODS( oObject )
|
||||
local aInfo := ASort( __ClassSel( oObject:ClassH() ) )
|
||||
local aData := {}
|
||||
local i := 1
|
||||
local lExact := Set( _SET_EXACT, .t. )
|
||||
|
||||
while SubStr( aInfo[i], 1, 1 ) != "_"
|
||||
if ASCAN( aInfo, "_" + SubStr( aInfo[i], 1, 9 ), i+1 ) == 0
|
||||
AADD( aData, aInfo[i] )
|
||||
endif
|
||||
i++
|
||||
end
|
||||
|
||||
Set( _SET_EXACT, lExact )
|
||||
|
||||
RETURN aData
|
||||
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* oGetData()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC FUNCTION oGETDATA( oObject, cIVar )
|
||||
LOCAL oErr := ERRORBLOCK( {|o| break(o) } )
|
||||
LOCAL xRet
|
||||
BEGIN SEQUENCE
|
||||
xRet := EVAL( &( "{ | o | o:" + cIVar + "}" ), oObject )
|
||||
RECOVER USING oErr
|
||||
xRet := "<error>"
|
||||
END SEQUENCE
|
||||
ERRORBLOCK( oErr )
|
||||
RETURN xRet
|
||||
|
||||
/****
|
||||
*
|
||||
* oSetData()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC FUNCTION oSETDATA( oObject, cIVar, xValue )
|
||||
EVAL(&("{ | o, x | o:_" + cIVar + "( x ) }"), oObject, xValue)
|
||||
RETURN ( Nil )
|
||||
|
||||
|
||||
/****
|
||||
*
|
||||
* oTransform()
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC FUNCTION oTRANSFORM(xVal)
|
||||
Local cType:= ValType(xVal)
|
||||
|
||||
Do Case
|
||||
Case cType == "C"
|
||||
RETURN '"' + xVal + '"'
|
||||
Case cType == "N"
|
||||
RETURN LTrim(Str(xVal))
|
||||
Case cType == "D"
|
||||
RETURN "CTOD('" + DToC(xVal) + "')"
|
||||
Case cType == "A"
|
||||
RETURN "{ ... }"
|
||||
Case cType == "B"
|
||||
RETURN "{|| ... }"
|
||||
Case cType == "L"
|
||||
RETURN IIf(xVal, ".T.", ".F.")
|
||||
Case cType == "M"
|
||||
RETURN "<Memo>"
|
||||
Case cType == "O"
|
||||
RETURN "-Object-"
|
||||
EndCase
|
||||
RETURN "-NIL-"
|
||||
RETURN NIL
|
||||
|
||||
|
||||
*** EOF ***
|
||||
|
||||
@@ -13,7 +13,7 @@ rem set DO_NOT_COMPILE=examples hbclip hgf what32
|
||||
set _HB_DIRS=adordd bmdbfcdx hbbtree gtwvg libct libgt libmisc libnf msql
|
||||
for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c make_b32.bat %%n %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
set _HB_DIRS=ole hbziparch htmllib odbc telepath tip win32 xhb
|
||||
set _HB_DIRS=ole hbziparch odbc telepath tip win32 xhb
|
||||
for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c make_b32.bat %%n %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
set _HB_DIRS=samples hbw32ddr
|
||||
|
||||
@@ -13,7 +13,7 @@ rem set DO_NOT_COMPILE=examples hbclip hgf
|
||||
set _HB_DIRS=adordd bmdbfcdx hbbtree gtwvg libct libgt libmisc libnf msql
|
||||
for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c make_vc.bat %%n %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
set _HB_DIRS=ole hbziparch htmllib odbc telepath tip what32 win32 xhb
|
||||
set _HB_DIRS=ole hbziparch odbc telepath tip what32 win32 xhb
|
||||
for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c make_vc.bat %%n %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
set _HB_DIRS=samples hbw32ddr
|
||||
|
||||
Reference in New Issue
Block a user