📄 description.txt
字号:
{**********************************************************************}
{ }
{ "The contents of this file are subject to the Mozilla Public }
{ License Version 1.1 (the "License"); you may not use this }
{ file except in compliance with the License. You may obtain }
{ a copy of the License at }
{ }
{ http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express }
{ or implied. See the License for the specific language }
{ governing rights and limitations under the License. }
{ }
{ The Original Code is DelphiWebScriptII source code, released }
{ January 1, 2001 }
{ }
{ http://www.dwscript.com }
{ }
{ The Initial Developers of the Original Code are Matthias }
{ Ackermann and hannes hernler. }
{ Portions created by Matthias Ackermann are Copyright (C) 2001 }
{ Matthias Ackermann, Switzerland. All Rights Reserved. }
{ Portions created by hannes hernler are Copyright (C) 2001 }
{ hannes hernler, Austria. All Rights Reserved. }
{ }
{ Contributor(s): ______________________________________. }
{ }
{**********************************************************************}
The DWS2-Web-Library brings you 3 components for building Webapps with DWS2
and 1 for desktop script handling (eg. in reports...)
dws2WebLib - introduces some classes to handle the isapi calls of
Borlands webbroker (request, response, cookie), the
scriptdoc class to store information about the scriptfile,
and TFormVarGroup to handle multiple input fields of
database tables in html forms.
there are also some "functions" usefull for webapps.
dws2PageProducer - based on CustomContentProducer, with standard interface
to be called by webactions and return content from scriptfiles.
dws2SessionLib- component to add http-usertracking (not an easy thing)
and store sessiondata
dws2PageLoader - similar to dws2PageProducer but without interface to
webbroker.
dws2WebLib Classes // ************************************************
please see the help files of Delphi about the meaning of these classes
and methods.
Request
.Param(Name: String): String
.Params(Name: String): String (TStrings.text !!)
function params results a string from TStrings.text
to be used in a Stringlist. but doesn磘 use the datatype
TStrings to be compatible with different DWS Libraries (CLasses, VCLwrapper..)
script example: MyStringList.text := Request.Params('ffcheck');
.ParamCount: Integer
.ParamName(Index: Integer): String;
.ParamValue(Index: Integer): string;
.Authorization: string;
.Content: String;
.ContentLength: Integer;
.ContentType: String;
.CookieCount: Integer;
.Date: DateTime;
.From: String;
.Host: String;
.PathInfo: String;
.Referer: String;
.RemoteAddr: String;
.RemoteHost: String;
.ScriptName: String;
.Title: String;
.Url: String;
.UserAgent: String;
.Accept: String;
.Method: String;
.LogContent: String;
.Cookie(Name: String): String;
.CookieName(Index: Integer): String;
.CookieValue(Index: Integer): String;
Response
.Allow: String;
.Content: String;
.ContentEncoding: String;
.ContentLength: Integer;
.ContentType: String;
.ContentVersion: String;
.CookieCount: Integer;
.NewCookie: TCookie;
.SendRedirect(Uri: String);
.Cookie(Index: Integer): TCookie;
.CookieByName(Name: String): TCookie;
.Date: DateTime;
.DerivedFrom: String;
.Expires: DateTime;
.LastModified: DateTime;
.Location: String;
.LogMessage: String;
.Realm: String;
.ReasonString: String;
.Server: String;
.StatusCode: Integer;
.Title: String;
.Version: String;
ScriptDoc
.Date: DateTime;
.Size: Integer;
.FileName: String;
.Path: String;
TCookie
.Domain: String;
.Expires: DateTime;
.HeaderValue: String;
.Name: String;
.Path: String;
.Value: String;
.Secure: Boolean;
TFormVarGroup
.create;
.AddNullFields: boolean;
also add fields where value strings are empty (null) -
e.g. for delete dataset records
.Prefix: String;
when there are mutliple fields (e.g. from a database table) with
values that have to be inserted/updated you can name the fields
like
<input type="text" name="ffprfx<%=qQuery.field('id')%>"
value="<%=qQuery.field('amount')%>">
then Prefix is "ffprfx" and in content params is a list of
Prefix+extension=value
like
ffprfx23=4500
ffprfx677=12345
ffprfx788=3000
where the part between prefix and "=" is extension
.ext: string;
see above
.value: string;
see above
.count: integer;
number of fields with the actual prefix
.RecNr: integer;
actual line index of the paramlist (see first, next, eof)
.First;
set actual line index of the paramlist to 0 (see RecNr, next, eof)
.Next;
inc actual line index of the paramlist (see first, RecNr, eof)
.Eof: boolean;
test actual line index of the paramlist (see first, next, RecNr)
Functions // ***********************************************************
.FormVar(ParamName: String): String;
returns field value of html-form-field by the name of ParamName
in a post request or (ParamName=)value in a get request.
.RtfToHtml(RtfStr: String): String;
replaces all CR/LF with <br>
.TrimURL(sURL: String): String;
deletes 'http://' from the string if any
.AcceptWML: boolean;
reurns if the requesting client accepts WML code
.URLencode(sURL: String): String;
.URLdecode(sURL: String): String;
spaces and special character in string are replaced by %ord(chr) and vs.
.forward(NewFile: String);
stops execution of actual script and continues with script at
path NewFile;
// ***********************************************************
customSessionUnit: Tdws2Unit
const
// session state constants for UserSession.FClientState
dwstateLOFF = -1; // end session and log off
dwsStateTOUT = -2; // session timed out
dwsStateNLI = 0; // user is not logged in
dwsStateGLI = 1; // logged in as guest
dwsStatePRF = 9; // still to proof session
dwsStateULI = 10; // user is logged in, session exists
dwsStateNAT = 12; // logged in on higher level
dwsStateVIP = 20; // logged in on VIP level
dwsStateSU = 100; // logged in on SU level
Classes
Session
.Param(Name: String): variant;
.Store(Name: String; value: variant);
.ActiveUsers: Integer;
number of ActiveUsers
.IpAddr: String;
.ClientState: Integer;
.SBrand: String;
Sessionbrand: please read about session branding on www.dwscript.com
.TLogin: DateTime;
.TLastAction: DateTime;
Functions
TIDfunc: String;
returns the sessionbrand; function name is set like the value of
property SessionBrandLable; e.g. <%= TID %> returns the sessionbrand
if SessionBrandLable has the value 'TID'
ActiveSession: boolean;
tests if this request is within a context of a tracked session
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -