Home WDScript - Documentation
  |   Advanced >>  
Sections :

  EN.WDScriptFunctions  
  r1.11 - 08 Sep 2004 - 12:32 GMT - CyrilBeaussier  
  Parent: WebHome  

Abort()
Abort the HTML page generation
AddLog()
Add a message in the TXT file (useful for debugging)
Call?("file.wlf")
CheckToken?()
Verify if the client's token is valid. Returns a boolean.
CookieWrite (<CookieName>, <Value>, <DayTimeOut=30>, <MinuteTimeOut=0>)
Write or modify a cookie.
DeleteToken?()
Delete the client's token, usually at the end of the session.
GetFormField(value, rank=1)
Returns the value of a field from an HTML form. Rank is optionnal to specified field rank (case of SELECT or CHECKBOX).
GetHtmlUrl?()
Returns the URL to access to the HTML folder
Example:
Display an image of the HTML folder :
<img src='[%GetHtmlUrl()%]logo.jpg>

GetMessage?(language, id, global=false)
Translation function. Reads the message in the .wsm / .wpm file (see also PickMessage?()) The file containing the messages is named HtmlPageName?.wsm. GetMessage?() opens automatically the file corresponding to the HTML page currently processed.
If global=true, the global.wpm is opened (it contains the messages that are global to the application). Also, you could modify this filename in .wsp file at line MESSAGE_FILE=global.wpm

Structure of the .wsm file:

[LANG1]
id1=message
id1=message

[LANG2]
id1=message
id2=message

Sample .wsm file:

[FR]
title=LISTE DES PERSONNES
Name=Nom
Age=Age
gra=Graphe

[EN]
title=PEOPLE LIST
Name=Name
Age=Age
gra=Graph 

Code sample : Display a message attached to the page :

[%GetMessage("FR", "name")%] : [%CL.NAME%]

Display a message attached to the application :

<center>[%GetMessage("FR", "titre", true)%]</center> 

GetTempUrl?()
Returns the URL to access to the TEMP folder.
Example:
Display an image generated in the TEMP folder
<img src='[%GetTempUrl()%]tmp04938.jpg'> 

GetToken?()
Create a token identifying the client session. Each access is detected (see RefreshToken?()), alowwing to detect a session timeout or the use of a closed session (see CheckToken?()).
The token id is a string randomly generated.
Example : Create a token and store data

<WDSCRIPT>
token is string = GetToken()
SetTokenInfo(token, "name", GetFormField("name"))
SetTokenInfo(token, "country", GetFormField("country"))
</WDSCRIPT>

GetTokenInfo?()
Retrieves an information previously attached to a session stored in a token.
Example : Retrieve data

<WDSCRIPT>
token is string = GetUrlField("token")
name is string = GetTokenInfo(token, "name")
country is tring = GetTokenInfo(token, "country")
</WDSCRIPT>

GetURLField?()

Returns the value of a field of the URL.
Example:

token is string = GetUrlField("token")
//URL in format : http://www.toto.com/toto/toto.exe?token=123456 

Include?("FileName.wss")
Include another script file.
IncludeHTML?(FileName?)
Include a HTML page.
Example: inclusion of a page footer common to all the application.

<WDSCRIPT>
IncludeHTML("foot.html")
</WDSCRIPT>

IncludeWLF?("FileName.wlf")
Load WDScript function.
Javascript (Javascript code)
Insert Javascript code
Nation()
Return browser language
MD5?(sting, mode, size)
Get crypted string in MD5 format.
MD5File?(file, mode)
Get crypted file in MD5 format.
PageDisplay(url)
Change Page location (v2.1)
PickMessage?(lang, messages)
Translation function. Returns the message in the choosen language (see also GetMessage?()) Contraty to GetMessage?(), this function retrieves the translation in the code.
The synrax of the 2nd parameter is : "Lang1=message"+eot+"lang2=message"+eot+"lang3=message"+eot+...

Code example: Display a message according to the language :

lang is string = GetTokenInfo(GetUrlField("token"), "lang")
<OUT>
[%PickMessage(lang, "FR=Nom"+eot+"EN=Name")%] : [%CL.NAME%]
</OUT>

RefreshToken?(token)
Memorize the client access, and restart the timeout counter.
SetTokenInfo?()
Stores an information attached to a session previously stored in a token. Example : Store the value of 2 fields in the data of the session

<WDSCRIPT>
token is string = GetUrlField("token")
SetTokenInfo(token, "name", GetFormField("name"))
SetTokenInfo(token, "country", GetFormField("country"))
</WDSCRIPT>

WDScriptInfo()
Display some informations about WDScript (like PhpInfo?).

Revision r1.11 - 08 Sep 2004 - 12:32 GMT - CyrilBeaussier
Date : 28 Mar - 17:46 GMT