Files
harbour-core/harbour/website/samples/testhtml.prg.html
Viktor Szakats 94a305ed4f 2013-02-27 18:30 UTC+0100 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/hbmk2.prg
    ! fixed hbmk_FNameEscape() plugin API's legacy fallback
      after latest patch (still untested)
    ! avoid potential RTE in hbmk_PathFromWorkdirToCWD()
      plugin API
    ! rtlink/blinker/exospace linker script processing will
      now add directories of library input files as libpaths
      (as opposed to passing them as part of the libname)
    ! fixed rtlink/blinker/exospace linker script processing
      to convert dirseps to native ones in output
    ! fixed rtlink/blinker/exospace linker script processing
      to strip extension from library name and output name
      (only if it's '.exe')
    ! fixed to verify non-portable output extensions in more
      reliable way

  * contrib/hbmisc/hb_f.c
  * contrib/hbmisc/fcomma.prg
  * contrib/hbmisc/hbmisc.hbx
  * contrib/hbmisc/tests/hb_f.prg
  * contrib/hbmisc/tests/numtxtru.prg
  * contrib/hbmisc/tests/rtfclass.prg
  * contrib/hbnf/fttext.c
  * contrib/hbnf/tests/fttext.prg
    * use constants instead of literals
    ! fixed buffer over- and underrun in HB_FSELECT()
    % HB_FUSE() optimized
    ! fixed long time core/hbmisc function name
      collision by renaming HB_FEof() inside hbmisc
      to hb_FAtEof(). hbmisc code and tests changed
      to use the new one. A parallel hb_FEof() in
      hbmisc remains until HB_LEGACY_LEVEL4.
      [INCOMPATIBLE] Update your hbmisc HB_FEOF()
      call according to above, or even better change
      HB_F*() calls to original FT_F*() API in hbnf.
      It's the original version of this code, what
      was cloned in a dumbed down version into hbmisc
      when hbnf didn't exist in Harbour yet.

  * contrib/hbamf/tests/encode.prg
    + updated to use hbtest instead of similar
      local solution

  * contrib/hbfimage/tests/fitest.prg
    % use core functions instead of local clones
    ! minor output fix

  * tests/mousetst.prg
    * obfuscate e-mail address in this public sample

  * website/samples/mousetst.prg.html
  * website/samples/testhtml.prg.html
  * website/samples/tstmacro.prg.html
    * synced with code changes

  * */tests/*
    * dropped 'tst'/'ts'/'test' from most
      filenames inside 'tests' subdirs. 8 chars will
      allow for more descriptive names than 4-5.
    + do not explicitly include the original source
      filename (use __FILE__ or similar)
    ; List of changes, in /contrib:
      /hbmisc/tests/testbbab.prg   -> bubbleb.prg
      /hbmisc/tests/testcall.prg   -> calldll.prg
      /hbmisc/tests/testhbf.prg    -> hb_f.prg
      /hbmisc/tests/tsstrfmt.prg   -> strfmt.prg
      /hbmisc/tests/twirl.prg      -> twirler.prg
      /hbmisc/tests/udpdstst.prg   -> udpds.prg
      /hbxpp/tests/testdll.prg     -> dllcall.prg
      /xhb/tests/testcp.prg        -> copyfile.prg
      /hbwin/tests/testax.prg      -> activex.prg
      /hbwin/tests/testcom1.prg    -> serial1.prg
      /hbwin/tests/testcom2.prg    -> serial2.prg
      /hbwin/tests/testcopy.prg    -> shfileop.prg
      /hbwin/tests/testdir.prg     -> sysdir.prg
      /hbwin/tests/testevnt.prg    -> eventlog.prg
      /hbwin/tests/testgdi.prg     -> prngdi.prg
      /hbwin/tests/testmapi.prg    -> mapimail.prg
      /hbwin/tests/testole.prg     -> ole.prg
      /hbwin/tests/testprn.prg     -> prn1.prg
      /hbwin/tests/testprn2.prg    -> prn2.prg
      /hbwin/tests/testprn3.prg    -> prn3.prg
      /hbwin/tests/testprn4.prg    -> prn4.prg
      /hbwin/tests/testreg.prg     -> registry.prg
      /hbwin/tests/testrpc.prg     -> uuid.prg
      /hbwin/tests/testsim.prg     -> simwce.prg
      /hbwin/tests/testsvc.prg     -> service.prg
      /hbwin/tests/testwmtx.prg    -> mutexwin.prg
      /hbzebra/tests/testcair.prg  -> cairo.prg
      /hbzebra/tests/testhpdf.prg  -> harupdf.prg
      /hbzebra/tests/testwin.prg   -> wingdi.prg
      /rddads/tests/testmg.prg     -> manage.prg
      /hbodbc/tests/odbcdemo.prg   -> todbc.prg
      /hbodbc/tests/testodbc.prg   -> odbc.prg
      /hbsqlit3/tests/hdbctest.prg -> hdbc.prg
      /hbsqlit3/tests/sl3_test.prg -> demo.prg
      /hbunix/tests/testdmn.prg    -> daemon.prg
      /hbunix/tests/testpid.prg    -> getpid.prg
      /hbgd/tests/bartest.prg      -> barcode.prg
      /hbgd/tests/barms.prg        -> barcode2.prg
      /hbgd/tests/gdtest.prg       -> gdapi.prg
      /hbgd/tests/gdtestcl.prg     -> gdclass.prg
      /hbgd/tests/testdpi.prg      -> fontdpi.prg
      /hbgd/tests/test_out.prg     -> cgi.prg
      /hbtip/tests/test01.prg      -> httpcli.prg
      /hbtip/tests/tipmime.prg     -> mimetype.prg
      /hbtip/tests/tiptest.prg     -> tipwget.prg
      /hbtip/tests/tiptime.prg     -> timestmp.prg
      /hbamf/tests/tstendin.prg    -> test.prg
      /hbfimage/tests/fitest.prg   -> test.prg
      /hbtpathy/tests/testtp.prg   -> test.prg
      /hbgs/tests/testgs.prg       -> test.prg

  * contrib/hbmxml/tests/testmxml.prg
  * contrib/rddads/tests/datad.prg
    * minor
2013-02-27 17:39:07 +00:00

149 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/xregexp/2.0.0/xregexp-min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/xregexp/2.0.0/backcompat.js"></script>
<script type="text/javascript" src="/js/shCore.js"></script>
<script type="text/javascript" src="/js/shBrushHarbour.js"></script>
<link href="/css/shCore.css" rel="stylesheet" type="text/css" />
<link href="/css/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">SyntaxHighlighter.all()</script>
</head>
<body>
<script type="syntaxhighlighter" class="brush: harbour; light: true"><![CDATA[
/**
*
* Harbour Test of a HTML-Generator class.
*
* Tips: - Use ShowResults to make dynamic html (to test dynamic
* results, put the exe file on CGI-BIN dir or equivalent);
* - Use SaveToFile to make static html page
*
*/
#include "hbclass.ch"
PROCEDURE Main()
LOCAL oHTML := THtml():New()
oHTML:SetTitle( "Harbour Power Demonstration" )
oHTML:AddHead( "Harbour" )
oHTML:AddPara( "<b>Harbour</b> is xBase at its best. Have a taste today!", "LEFT" )
oHTML:AddPara( "<b>L i n k s</b>", "CENTER" )
oHTML:AddLink( "http://harbour-project.org", "Meet the Harbour power!" )
oHTML:Generate()
// Uncomment the following if you don't have a Web Server to test
// this sample
// oHTML:SaveToFile( "test.htm" )
// If the above is uncommented, you may comment this line:
oHTML:ShowResult()
RETURN
CREATE CLASS THTML
VAR cTitle // Page Title
VAR cBody // HTML Body Handler
VAR cBGColor // Background Color
VAR cLinkColor // Link Color
VAR cvLinkColor // Visited Link Color
VAR cContent // Page Content Handler
METHOD New() // New Method
METHOD SetTitle( cTitle ) // Set Page Title
METHOD AddLink( cLinkTo, cLinkName ) // Add <H1> Header
METHOD AddHead( cDescr ) // Add Hyperlink
METHOD AddPara( cPara, cAlign ) // Add Paragraph
METHOD Generate() // Generate HTML
METHOD ShowResult() // Saves Content to File
METHOD SaveToFile( cFile ) // Show Result
END CLASS
METHOD New() CLASS THTML
::cTitle := "Untitled"
::cBGColor := "#FFFFFF"
::cLinkColor := "#0000FF"
::cvLinkColor := "#FF0000"
::cContent := ""
::cBody := ""
RETURN Self
METHOD SetTitle( cTitle ) CLASS THTML
::cTitle := cTitle
RETURN Self
METHOD AddLink( cLinkTo, cLinkName ) CLASS THTML
::cBody += "<a href='" + cLinkTo + "'>" + cLinkName + "</a>"
RETURN Self
METHOD AddHead( cDescr ) CLASS THTML
// Why this doesn't work?
// ::cBody += ...
// ???
::cBody += "<h1>" + cDescr + "</h1>"
RETURN NIL
METHOD AddPara( cPara, cAlign ) CLASS THTML
hb_default( @cAlign, "Left" )
::cBody += ;
"<p align='" + cAlign + "'>" + hb_eol() + ;
cPara + hb_eol() + ;
"</p>"
RETURN Self
METHOD Generate() CLASS THTML
::cContent := ;
"<html><head>" + hb_eol() + ;
"<title>" + ::cTitle + "</title>" + hb_eol() + ;
"<body link='" + ::cLinkColor + "' " + ;
"vlink='" + ::cvLinkColor + "'>" + + hb_eol() + ;
::cBody + hb_eol() + ;
"</body></html>"
RETURN Self
METHOD ShowResult() CLASS THTML
OutStd( ;
;// "HTTP/1.0 200 OK" + hb_eol() + ;
"CONTENT-TYPE: TEXT/HTML" + hb_eol() + hb_eol() + ;
::cContent )
RETURN Self
METHOD SaveToFile( cFile ) CLASS THTML
LOCAL hFile := FCreate( cFile )
FWrite( hFile, ::cContent )
FClose( hFile )
RETURN Self
]]></script>
</body>
</html>