+ tests/stripeol.hb
+ added script to strip spaces at EOL
* contrib/gtalleg/tests/test.prg
* contrib/gtwvg/tests/demoxbp.prg
* contrib/gtwvg/tests/wvgactivex.prg
* contrib/gtwvg/tests/wvgxbp.prg
* contrib/gtwvg/wvgclass.prg
* contrib/hbamf/tests/tstendin.prg
* contrib/hbbz2/tests/test.prg
* contrib/hbcairo/tests/fancytxt.prg
* contrib/hbcairo/tests/table.prg
* contrib/hbct/ctrand.prg
* contrib/hbct/doc/en/addascii.txt
* contrib/hbct/doc/en/atadjust.txt
* contrib/hbct/doc/en/count.txt
* contrib/hbct/doc/en/ct.txt
* contrib/hbct/doc/en/ctc.txt
* contrib/hbct/doc/en/ctmath.txt
* contrib/hbct/doc/en/ctmath2.txt
* contrib/hbct/doc/en/ctpad.txt
* contrib/hbct/doc/en/ctstr.txt
* contrib/hbct/doc/en/datetime.txt
* contrib/hbct/doc/en/dattime2.txt
* contrib/hbct/doc/en/exponent.txt
* contrib/hbct/doc/en/finan.txt
* contrib/hbct/doc/en/ftoc.txt
* contrib/hbct/doc/en/justify.txt
* contrib/hbct/doc/en/keyset.txt
* contrib/hbct/doc/en/misc1.txt
* contrib/hbct/doc/en/num1.txt
* contrib/hbct/doc/en/numat.txt
* contrib/hbct/doc/en/numconv.txt
* contrib/hbct/doc/en/pos1.txt
* contrib/hbct/doc/en/pos2.txt
* contrib/hbct/doc/en/posdiff.txt
* contrib/hbct/doc/en/print.txt
* contrib/hbct/doc/en/range.txt
* contrib/hbct/doc/en/relation.txt
* contrib/hbct/doc/en/remove.txt
* contrib/hbct/doc/en/replace.txt
* contrib/hbct/doc/en/screen1.txt
* contrib/hbct/doc/en/strdiff.txt
* contrib/hbct/doc/en/strswap.txt
* contrib/hbct/doc/en/token1.txt
* contrib/hbct/doc/en/token2.txt
* contrib/hbct/doc/en/trig.txt
* contrib/hbct/doc/en/video.txt
* contrib/hbct/doc/en/wordtoch.txt
* contrib/hbct/getinfo.prg
* contrib/hbfimage/tests/fitest.prg
* contrib/hbgd/gdimage.prg
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbide/idetags.prg
* contrib/hblzf/tests/test2.prg
* contrib/hbmisc/doc/en/ht_conv.txt
* contrib/hbmisc/fcomma.prg
* contrib/hbmisc/fileread.prg
* contrib/hbmisc/hbedit.prg
* contrib/hbnf/anomatch.prg
* contrib/hbnf/calendar.prg
* contrib/hbnf/clrsel.prg
* contrib/hbnf/dispmsg.prg
* contrib/hbnf/doc/en/aading.txt
* contrib/hbnf/doc/en/aavg.txt
* contrib/hbnf/doc/en/acctadj.txt
* contrib/hbnf/doc/en/acctmnth.txt
* contrib/hbnf/doc/en/acctqtr.txt
* contrib/hbnf/doc/en/acctweek.txt
* contrib/hbnf/doc/en/acctyear.txt
* contrib/hbnf/doc/en/adessort.txt
* contrib/hbnf/doc/en/aemaxlen.txt
* contrib/hbnf/doc/en/aeminlen.txt
* contrib/hbnf/doc/en/amedian.txt
* contrib/hbnf/doc/en/anomatch.txt
* contrib/hbnf/doc/en/any2any.txt
* contrib/hbnf/doc/en/aredit.txt
* contrib/hbnf/doc/en/asum.txt
* contrib/hbnf/doc/en/at2.txt
* contrib/hbnf/doc/en/bitclr.txt
* contrib/hbnf/doc/en/bitset.txt
* contrib/hbnf/doc/en/blink.txt
* contrib/hbnf/doc/en/byt2bit.txt
* contrib/hbnf/doc/en/byt2hex.txt
* contrib/hbnf/doc/en/byteand.txt
* contrib/hbnf/doc/en/byteneg.txt
* contrib/hbnf/doc/en/bytenot.txt
* contrib/hbnf/doc/en/bytexor.txt
* contrib/hbnf/doc/en/calendar.txt
* contrib/hbnf/doc/en/chdir.txt
* contrib/hbnf/doc/en/cntryset.txt
* contrib/hbnf/doc/en/color2n.txt
* contrib/hbnf/doc/en/d2e.txt
* contrib/hbnf/doc/en/datecnfg.txt
* contrib/hbnf/doc/en/dayofyr.txt
* contrib/hbnf/doc/en/daytobow.txt
* contrib/hbnf/doc/en/dfile.txt
* contrib/hbnf/doc/en/diskfunc.txt
* contrib/hbnf/doc/en/dispc.txt
* contrib/hbnf/doc/en/dispmsg.txt
* contrib/hbnf/doc/en/dosver.txt
* contrib/hbnf/doc/en/e2d.txt
* contrib/hbnf/doc/en/easter.txt
* contrib/hbnf/doc/en/elapsed.txt
* contrib/hbnf/doc/en/findith.txt
* contrib/hbnf/doc/en/floptst.txt
* contrib/hbnf/doc/en/ftattr.txt
* contrib/hbnf/doc/en/ftidle.txt
* contrib/hbnf/doc/en/ftisprn.txt
* contrib/hbnf/doc/en/ftround.txt
* contrib/hbnf/doc/en/fttext.txt
* contrib/hbnf/doc/en/gcd.txt
* contrib/hbnf/doc/en/getenvrn.txt
* contrib/hbnf/doc/en/hex2dec.txt
* contrib/hbnf/doc/en/iamidle.txt
* contrib/hbnf/doc/en/isbit.txt
* contrib/hbnf/doc/en/isbiton.txt
* contrib/hbnf/doc/en/isshare.txt
* contrib/hbnf/doc/en/kspeed.txt
* contrib/hbnf/doc/en/linked.txt
* contrib/hbnf/doc/en/madd.txt
* contrib/hbnf/doc/en/menutonf.txt
* contrib/hbnf/doc/en/metaph.txt
* contrib/hbnf/doc/en/miltime.txt
* contrib/hbnf/doc/en/month.txt
* contrib/hbnf/doc/en/netpv.txt
* contrib/hbnf/doc/en/nooccur.txt
* contrib/hbnf/doc/en/ntow.txt
* contrib/hbnf/doc/en/nwlstat.txt
* contrib/hbnf/doc/en/nwsem.txt
* contrib/hbnf/doc/en/nwuid.txt
* contrib/hbnf/doc/en/ontick.txt
* contrib/hbnf/doc/en/origin.txt
* contrib/hbnf/doc/en/page.txt
* contrib/hbnf/doc/en/pchr.txt
* contrib/hbnf/doc/en/peek.txt
* contrib/hbnf/doc/en/pending.txt
* contrib/hbnf/doc/en/poke.txt
* contrib/hbnf/doc/en/popadder.txt
* contrib/hbnf/doc/en/proper.txt
* contrib/hbnf/doc/en/prtesc.txt
* contrib/hbnf/doc/en/putkey.txt
* contrib/hbnf/doc/en/qtr.txt
* contrib/hbnf/doc/en/rand1.txt
* contrib/hbnf/doc/en/savearr.txt
* contrib/hbnf/doc/en/scregion.txt
* contrib/hbnf/doc/en/setdate.txt
* contrib/hbnf/doc/en/setkeys.txt
* contrib/hbnf/doc/en/setlastk.txt
* contrib/hbnf/doc/en/settime.txt
* contrib/hbnf/doc/en/sinkey.txt
* contrib/hbnf/doc/en/sleep.txt
* contrib/hbnf/doc/en/sqzn.txt
* contrib/hbnf/doc/en/sysmem.txt
* contrib/hbnf/doc/en/tbwhile.txt
* contrib/hbnf/doc/en/tempfile.txt
* contrib/hbnf/doc/en/vertmenu.txt
* contrib/hbnf/doc/en/vidcur.txt
* contrib/hbnf/doc/en/vidmode.txt
* contrib/hbnf/doc/en/wda.txt
* contrib/hbnf/doc/en/week.txt
* contrib/hbnf/doc/en/workdays.txt
* contrib/hbnf/doc/en/woy.txt
* contrib/hbnf/doc/en/xbox.txt
* contrib/hbnf/doc/en/year.txt
* contrib/hbnf/ftround.prg
* contrib/hbnf/metaph.prg
* contrib/hbnf/nwsem.prg
* contrib/hbnf/nwuid.prg
* contrib/hbnf/pending.prg
* contrib/hbnf/popadder.prg
* contrib/hbnf/scregion.prg
* contrib/hbnf/tbwhile.prg
* contrib/hbnf/workdays.prg
* contrib/hbodbc/browodbc.prg
* contrib/hbqt/tests/browqt.prg
* contrib/hbqt/tests/dbfbrowserclass.prg
* contrib/hbqt/tests/testbrow.prg
* contrib/hbsqlit3/tests/blob.prg
* contrib/hbsqlit3/tests/sl3_test.prg
* contrib/hbxbp/tests/demoxbp.prg
* contrib/hbxbp/tests/dialogqt.prg
* contrib/hbxbp/xbpdataref.prg
* contrib/hbxbp/xbpmenubar.prg
* contrib/hbxbp/xbpprintdialog.prg
* contrib/hbxbp/xbpprinter.prg
* contrib/hbxbp/xbprtf.prg
* contrib/hbxbp/xbpscrollbar.prg
* contrib/xhb/cstruct.prg
* contrib/xhb/hblog.prg
* contrib/xhb/hterrsys.prg
* contrib/xhb/htjlist.prg
* contrib/xhb/sprintf.prg
* contrib/xhb/stream.prg
* contrib/xhb/tcgi.prg
* contrib/xhb/tedit.prg
* contrib/xhb/tfile.prg
* contrib/xhb/thtm.prg
* contrib/xhb/trpc.prg
* contrib/xhb/trpccli.prg
* contrib/xhb/ttable.prg
* contrib/xhb/txml.prg
* contrib/xhb/xcstr.prg
* contrib/xhb/xhberr.prg
* contrib/xhb/xhbmt.prg
* doc/cmpopt.txt
* doc/en/dbstrux.txt
* examples/hbapollo/array.prg
* examples/hbvpdf/hbvpdf.prg
* examples/hbvpdf/hbvpdft.prg
* examples/hbxlsxml/xlsxml_s.prg
* examples/hbxlsxml/xlsxml_y.prg
* examples/httpsrv/cgifunc.prg
* examples/httpsrv/cookie.prg
* examples/httpsrv/modules/cookie.prg
* examples/httpsrv/modules/info.prg
* examples/httpsrv/modules/showcounter.prg
* examples/httpsrv/modules/tableservletdb.prg
* examples/httpsrv/modules/testajax.prg
* examples/httpsrv/session.prg
* examples/httpsrv/uhttpd.prg
* include/hbclass.ch
* include/hbtrace.ch
* src/debug/dbgtinp.prg
* src/debug/debugger.prg
* src/debug/tbrwtext.prg
* src/rdd/usrrdd/rdds/hscdx.prg
* src/rtl/hbi18n2.prg
* src/rtl/valtoexp.prg
* formatting, fixed indentation, cleanups, deleting system specific information,
optimizing out platform dependent code, using hb_ntos()
739 lines
17 KiB
Plaintext
739 lines
17 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* Editing and Forms Class for HTMLLIB
|
|
*
|
|
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
|
|
* www - http://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://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 "common.ch"
|
|
#include "cgi.ch"
|
|
|
|
#define _OPTION_TEXT 1
|
|
#define _OPTION_VALUE 2
|
|
#define _OPTION_LABEL 3
|
|
#define _OPTION_SELECTED 4
|
|
#define _OPTION_DISABLED 5
|
|
|
|
STATIC soForm
|
|
|
|
/****
|
|
*
|
|
* Class THtmlControl()
|
|
*
|
|
*/
|
|
|
|
CLASS THtmlControl
|
|
DATA nH
|
|
DATA Document
|
|
DATA Form
|
|
Data oHtm
|
|
|
|
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
|
|
|
|
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 SetLabel( l ) INLINE ::lLabel := l
|
|
|
|
METHOD Put()
|
|
|
|
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
|
|
|
|
/****
|
|
*
|
|
* THtmlControl():Put()
|
|
*
|
|
*/
|
|
|
|
METHOD Put() CLASS THtmlControl
|
|
|
|
LOCAL i
|
|
LOCAL cStr := ""
|
|
|
|
::nH := HtmlPageHandle()
|
|
::form := HtmlFormName()
|
|
::oHtm := HtmlPageObject()
|
|
|
|
::cOutput += iif( ::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="' + hb_ntos( ::Rows ) + '"' + CRLF()
|
|
ENDIF
|
|
|
|
IF ::Cols != NIL
|
|
::cOutput += Space( 2 ) + ' COLS="' + hb_ntos( ::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="' + hb_ntos( ::maxChars ) + '"' + CRLF()
|
|
ENDIF
|
|
|
|
IF ::Size != NIL
|
|
::cOutput += Space( 2 ) + ' SIZE="' + hb_ntos( ::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 )
|
|
::oHtm:cStr += ::cOutput
|
|
|
|
IF ::Type == "SELECT"
|
|
|
|
FOR i := 1 TO Len( ::aOptions )
|
|
cStr := "<OPTION"
|
|
cStr += iif( ::aOptions[ i, _OPTION_VALUE ] != NIL, ;
|
|
" value=" + ::aOptions[ i, _OPTION_VALUE ], "" )
|
|
cStr += iif( ::aOptions[ i, _OPTION_LABEL ] != NIL, ;
|
|
" label=" + ::aOptions[ i, _OPTION_LABEL ], "" )
|
|
cStr += iif( ::aOptions[ i, _OPTION_SELECTED ] == .T., ;
|
|
" SELECTED ", "" )
|
|
cStr += iif( ::aOptions[ i, _OPTION_DISABLED ] == .T., ;
|
|
" DISABLED ", "" )
|
|
cStr += ">" + ::aOptions[ i, _OPTION_TEXT ] + "</OPTION>" + CRLF()
|
|
//Fwrite( ::nH, cStr )
|
|
::oHtm:cStr += cStr
|
|
NEXT
|
|
|
|
//Fwrite( ::nH, "</SELECT>" )
|
|
::oHtm:cStr += "</SELECT>"
|
|
ENDIF
|
|
|
|
RETURN Self
|
|
|
|
/****
|
|
*
|
|
* THtmlControl():AddOption()
|
|
*
|
|
*/
|
|
|
|
METHOD AddOption( cOption, cValue, cLabel, lSelected, lDisabled ) CLASS THtmlControl
|
|
|
|
Aadd( ::aOptions, { cOption, cValue, cLabel, lSelected, lDisabled } )
|
|
|
|
RETURN Self
|
|
|
|
/****
|
|
*
|
|
* THtmlControl():setControl()
|
|
*
|
|
* Batch set control properties/methods
|
|
*
|
|
*/
|
|
|
|
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 THtmlControl
|
|
|
|
::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 THtmlForm()
|
|
*
|
|
*/
|
|
|
|
CLASS THtmlForm
|
|
|
|
DATA nH
|
|
Data oHtm
|
|
|
|
DATA aControls INIT {}
|
|
DATA Name INIT ""
|
|
DATA Action
|
|
DATA METHOD
|
|
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 iif( HB_ISOBJECT( 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 )
|
|
|
|
ENDCLASS
|
|
|
|
/****
|
|
*
|
|
* THtmlForm():New()
|
|
*
|
|
*/
|
|
|
|
METHOD New( cName, cAction, cMethod, lFrame, cCaption, nWidth ) CLASS THtmlForm
|
|
|
|
HB_SYMBOL_UNUSED( cAction )
|
|
|
|
DEFAULT cName TO "Form1"
|
|
DEFAULT cMethod TO "POST"
|
|
DEFAULT lFrame TO .F.
|
|
DEFAULT cCaption TO ""
|
|
DEFAULT nWidth TO 90
|
|
::oHtm := HtmlPageObject()
|
|
::Name := cName
|
|
::Method := cMethod
|
|
|
|
::nH := HtmlPageHandle()
|
|
|
|
::Frame := lFrame
|
|
::Caption := cCaption
|
|
::width := nWidth
|
|
|
|
::aControls := {}
|
|
|
|
soForm := Self
|
|
|
|
RETURN Self
|
|
|
|
/****
|
|
*
|
|
* THtmlForm():Put()
|
|
*
|
|
*/
|
|
|
|
METHOD Put( lPutControls ) CLASS THtmlForm
|
|
|
|
DEFAULT lPutControls TO .F.
|
|
|
|
IF ! HB_ISNUMERIC( ::width )
|
|
::width := 90
|
|
ENDIF
|
|
|
|
IF ! HB_ISSTRING( ::color )
|
|
::Color := "#9196A0"
|
|
ENDIF
|
|
|
|
IF ! HB_ISSTRING( ::fontColor )
|
|
::fontColor := "black"
|
|
ENDIF
|
|
|
|
IF ! HB_ISSTRING( ::CaptionColor )
|
|
::CaptionColor := "black"
|
|
ENDIF
|
|
|
|
IF ::Frame
|
|
::cOutPut := CRLF() + CRLF() + CRLF() + "<!------- Start of Form ------->" + CRLF() + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
::cOutPut := '<TABLE BGCOLOR="#9196A0" ' + CRLF() + ;
|
|
" COLS=1 " + CRLF() + ;
|
|
" ROWS=1 " + CRLF() + ;
|
|
" CELLPADDING=3 " + CRLF() + ;
|
|
" CELLSPACING=3 " + CRLF() + ;
|
|
" WIDTH=" + hb_ntos( ::width ) + "% " + CRLF() + ;
|
|
' BORDERCOLORLIGHT="#000000" ' + CRLF() + ;
|
|
' BORDERCOLORDARK="#FFFFFF" ' + CRLF() + ;
|
|
" BORDER " + CRLF() + ;
|
|
" >" + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
::cOutPut := '<TR BGCOLOR="' + ::captionColor + '">' + CRLF()
|
|
|
|
IF ::Caption != NIL
|
|
::cOutPut := "<TD"
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
|
|
IF ::captionImage != NIL
|
|
::cOutPut := ' BACKGROUND="' + ::captionImage + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
::cOutPut := '>'
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
|
|
IF ::capFontColor != NIL
|
|
::cOutPut := '<FONT COLOR="' + ::capFontColor + '">' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
::cOutPut := "<B>" + ::Caption + "</B>" + CRLF()
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
::cOutPut := "</TD></TR>"
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
::cOutPut := '<TR BGCOLOR="' + ::color + '">' + CRLF()
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
::cOutPut := '<TD'
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
IF ::bgImage != NIL
|
|
::cOutPut := ' BACKGROUND="' + ::bgImage + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
::cOutPut := '>'
|
|
//Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
IF ::fontColor != NIL
|
|
::cOutPut := '<FONT COLOR="' + ::FontColor + '">' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
ENDIF
|
|
|
|
::cOutput += CRLF() + "<FORM " + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
|
|
IF ::name != NIL
|
|
::cOutPut := Space( 5 ) + ' NAME="' + ::Name + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
IF ::method != NIL
|
|
::cOutPut := Space( 5 ) + ' METHOD="' + ::Method + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
IF ::Action != NIL
|
|
::cOutPut := Space( 5 ) + ' ACTION=' + ::Action + '' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
IF ::Target != NIL
|
|
::cOutPut := Space( 5 ) + ' TARGET=' + ::Target + '' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
IF ::Enctype != NIL
|
|
::cOutPut := Space( 5 ) + ' ENCTYPE="' + ::encType + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
IF ::onSubmit != NIL
|
|
::cOutPut := Space( 5 ) + 'onSubmit="' + ::onSubmit + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
IF ::onReset != NIL
|
|
::cOutPut := Space( 5 ) + ' onReset="' + ::onReset + '"' + CRLF()
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
ENDIF
|
|
|
|
::cOutPut := ">" + CRLF()
|
|
|
|
// Fwrite( ::nH, ::cOutput )
|
|
::oHtm:cStr += ::cOutput
|
|
IF lPutControls
|
|
Aeval( ::aControls, {| e | iif( HB_ISOBJECT( e ), ;
|
|
e:Put(), ::oHtm:cStr += e ) } )
|
|
ENDIF
|
|
|
|
RETURN Self
|
|
|
|
/****
|
|
*
|
|
* THtmlForm():End()
|
|
*
|
|
*/
|
|
|
|
METHOD End() CLASS THtmlForm
|
|
|
|
::ohtm:cStr += "</FORM>" + CRLF()
|
|
|
|
IF ::Frame
|
|
::ohtm:cStr += "</TD>" + CRLF()
|
|
::ohtm:cStr += "</TR>" + CRLF()
|
|
::ohtm:cStr += "</TABLE>" + CRLF()
|
|
ENDIF
|
|
|
|
::ohtm:cStr += CRLF() + CRLF() + "<!--- End of Form --->" + CRLF() + CRLF() + CRLF()
|
|
RETURN Self
|
|
|
|
/****
|
|
*
|
|
* THtmlForm():GetControl()
|
|
*
|
|
* Retrieve a form control object by name
|
|
*
|
|
*/
|
|
|
|
METHOD GetControl( cName ) CLASS THtmlForm
|
|
|
|
LOCAL oRet
|
|
LOCAL nPos := Ascan( ::aControls, {| e | e:name == cName } )
|
|
|
|
IF nPos > 0
|
|
oRet := ::aControls[ nPos ]
|
|
ENDIF
|
|
|
|
RETURN oRet
|
|
|
|
/****
|
|
*
|
|
* HtmlFormObject()
|
|
*
|
|
* Return current form object
|
|
*
|
|
*/
|
|
|
|
FUNCTION HtmlFormObject()
|
|
|
|
RETURN soForm
|