Module "HTML.curry"

Library for HTML and CGI programming. This paper contains a description of the basic ideas behind this library.
The installation of a cgi script written with this library can be done by the command
makecurrycgi -m initialForm -o /home/joe/public_html/prog.cgi prog
where prog is the name of the Curry program with the cgi script, /home/joe/public_html/prog.cgi is the desired location of the compiled cgi script, and initialForm is the Curry expression (of type IO HtmlForm) computing the HTML form (where makecurrycgi is a shell script stored in pakcshome/bin).

Author: Michael Hanus (with extensions by Bernd Brassel and Marco Comini)

Version: November 2007


 Exported names:

Datatypes:
CgiEnv | CgiRef | CookieParam | FormParam | HtmlExp | HtmlForm | HtmlHandler | HtmlPage | PageParam

Constructors:
BodyAttr | CookieDomain | CookieExpire | CookiePath | CookieSecure | FormCookie | FormCSS | FormEnc | FormJScript | FormOnSubmit | FormTarget | HeadInclude | HtmlAnswer | HtmlCRef | HtmlEvent | HtmlForm | HtmlPage | HtmlStruct | HtmlText | MultipleHandlers | PageCSS | PageEnc | PageJScript

Functions:
addAttr | addAttrs | addCookies | addFormParam | addHeadings | addPageParam | address | addSound | anchor | answerText | blink | block | blockstyle | bold | breakline | button | center | checkbox | checkedbox | code | cookieForm | coordinates | defaultBackground | defaultEncoding | dlist | emphasize | expires | form | formCSS | formEnc | Form | germanLatexDoc | getCookies | getUrlParameter | HtmlElem | h1 | h2 | h3 | h4 | h5 | headedTable | hempty | hiddenfield | href | hrule | htmlQuote | htxt | htxts | idOfCgiRef | image | imageButton | inline | intForm | intFormMain | italic | litem | multipleSelection | nbsp | olist | page | pageCSS | pageEnc | par | password | pre | radio_main | radio_main_off | radio_other | redirect | resetbutton | runFormServerWithKey | runFormServerWithKeyAndFormParams | selection | selectionInitial | showHtmlDoc | showHtmlDocCSS | showHtmlExp | showHtmlExps | showHtmlPage | showLatexDoc | showLatexDocs | showLatexDocsWithPackages | showLatexDocWithPackages | showLatexExp | showLatexExps | standardForm | standardPage | string2urlencoded | style | styleSheet | table | teletype | textarea | textfield | textstyle | ulist | urlencoded2string | verbatim


 Summary of exported functions:

defaultEncoding  :: String  deterministic 
          The default encoding used in generated web pages.
defaultBackground  :: (String,String)  deterministic 
          The default background for generated web pages.
idOfCgiRef  :: CgiRef -> String  deterministic flexible
          Internal identifier of a CgiRef (intended only for internal use in other libraries!).
HtmlElem  :: String -> [(String,String)] -> HtmlExp  deterministic 
          A single HTML element with a tag, attributes, but no contents (deprecated, included only for backward compatibility).
formEnc  :: String -> FormParam  deterministic 
          An encoding scheme for a HTML form.
formCSS  :: String -> FormParam  deterministic 
          A URL for a CSS file for a HTML form.
form  :: String -> [HtmlExp] -> HtmlForm  deterministic 
          A basic HTML form for active web pages with the default encoding and a default background.
Form  :: String -> [HtmlExp] -> HtmlForm  deterministic 
          A basic HTML form for active web pages (deprecated, included only for backward compatibility).
standardForm  :: String -> [HtmlExp] -> HtmlForm  deterministic 
          A standard HTML form for active web pages where the title is included in the body as the first header.
cookieForm  :: String -> [(String,String)] -> [HtmlExp] -> HtmlForm  deterministic 
          An HTML form with simple cookies.
addCookies  :: [(String,String)] -> HtmlForm -> HtmlForm  deterministic flexible
          Add simple cookie to HTML form.
answerText  :: String -> HtmlForm  deterministic 
          A textual result instead of an HTML form as a result for active web pages.
addFormParam  :: HtmlForm -> FormParam -> HtmlForm  deterministic flexible
          Adds a parameter to an HTML form.
redirect  :: Int -> String -> HtmlForm -> HtmlForm  deterministic 
          Adds redirection to given HTML form.
expires  :: Int -> HtmlForm -> HtmlForm  deterministic 
          Adds expire time to given HTML form.
addSound  :: String -> Bool -> HtmlForm -> HtmlForm  deterministic flexible+rigid
          Adds sound to given HTML form.
pageEnc  :: String -> PageParam  deterministic 
          An encoding scheme for a HTML page.
pageCSS  :: String -> PageParam  deterministic 
          A URL for a CSS file for a HTML page.
page  :: String -> [HtmlExp] -> HtmlPage  deterministic 
          A basic HTML web page with the default encoding.
standardPage  :: String -> [HtmlExp] -> HtmlPage  deterministic 
          A standard HTML web page where the title is included in the body as the first header.
addPageParam  :: HtmlPage -> PageParam -> HtmlPage  deterministic flexible
          Adds a parameter to an HTML page.
htxt  :: String -> HtmlExp  deterministic 
          Basic text as HTML expression.
htxts  :: [String] -> [HtmlExp]  deterministic 
          A list of strings represented as a list of HTML expressions.
hempty  :: HtmlExp  deterministic 
          An empty HTML expression.
nbsp  :: HtmlExp  deterministic 
          Non breaking Space
h1  :: [HtmlExp] -> HtmlExp  deterministic 
          Header 1
h2  :: [HtmlExp] -> HtmlExp  deterministic 
          Header 2
h3  :: [HtmlExp] -> HtmlExp  deterministic 
          Header 3
h4  :: [HtmlExp] -> HtmlExp  deterministic 
          Header 4
h5  :: [HtmlExp] -> HtmlExp  deterministic 
          Header 5
par  :: [HtmlExp] -> HtmlExp  deterministic 
          Paragraph
emphasize  :: [HtmlExp] -> HtmlExp  deterministic 
          Emphasize
bold  :: [HtmlExp] -> HtmlExp  deterministic 
          Boldface
italic  :: [HtmlExp] -> HtmlExp  deterministic 
          Italic
code  :: [HtmlExp] -> HtmlExp  deterministic 
          Program code
center  :: [HtmlExp] -> HtmlExp  deterministic 
          Centered text
blink  :: [HtmlExp] -> HtmlExp  deterministic 
          Blinking text
teletype  :: [HtmlExp] -> HtmlExp  deterministic 
          Teletype font
pre  :: [HtmlExp] -> HtmlExp  deterministic 
          Unformatted input, i.e., keep spaces and line breaks and don't quote special characters.
verbatim  :: String -> HtmlExp  deterministic 
          Verbatim (unformatted), special characters (<,>,&,") are quoted.
address  :: [HtmlExp] -> HtmlExp  deterministic 
          Address
href  :: String -> [HtmlExp] -> HtmlExp  deterministic 
          Hypertext reference
anchor  :: String -> [HtmlExp] -> HtmlExp  deterministic 
          An anchor for hypertext reference inside a document
ulist  :: [[HtmlExp]] -> HtmlExp  deterministic 
          Unordered list
olist  :: [[HtmlExp]] -> HtmlExp  deterministic 
          Ordered list
litem  :: [HtmlExp] -> HtmlExp  deterministic 
          A single list item (usually not explicitly used)
dlist  :: [([HtmlExp],[HtmlExp])] -> HtmlExp  deterministic 
          Description list
table  :: [[[HtmlExp]]] -> HtmlExp  deterministic 
          Table with a matrix of items where each item is a list of HTML expressions.
headedTable  :: [[[HtmlExp]]] -> HtmlExp  deterministic 
          Similar to table but introduces header tags for the first row.
addHeadings  :: HtmlExp -> [[HtmlExp]] -> HtmlExp  deterministic rigid
          Add a row of items (where each item is a list of HTML expressions) as headings to a table.
hrule  :: HtmlExp  deterministic 
          Horizontal rule
breakline  :: HtmlExp  deterministic 
          Break a line
image  :: String -> String -> HtmlExp  deterministic 
          Image
styleSheet  :: String -> HtmlExp  deterministic 
          Defines a style sheet to be used in this HTML document.
style  :: String -> [HtmlExp] -> HtmlExp  deterministic 
          Provides a style for HTML elements.
textstyle  :: String -> String -> HtmlExp  deterministic 
          Provides a style for a basic text.
blockstyle  :: String -> [HtmlExp] -> HtmlExp  deterministic 
          Provides a style for a block of HTML elements.
inline  :: [HtmlExp] -> HtmlExp  deterministic 
          Joins a list of HTML elements into a single HTML element.
block  :: [HtmlExp] -> HtmlExp  deterministic 
          Joins a list of HTML elements into a block.
button  :: String -> ((CgiRef -> String) -> IO HtmlForm) -> HtmlExp  deterministic 
          Submit button with a label string and an event handler
resetbutton  :: String -> HtmlExp  deterministic 
          Reset button with a label string
imageButton  :: String -> ((CgiRef -> String) -> IO HtmlForm) -> HtmlExp  deterministic 
          Submit button in form of an imag.
textfield  :: CgiRef -> String -> HtmlExp  deterministic 
          Input text field with a reference and an initial contents
password  :: CgiRef -> HtmlExp  deterministic 
          Input text field (where the entered text is obscured) with a reference
textarea  :: CgiRef -> (Int,Int) -> String -> HtmlExp  deterministic flexible
          Input text area with a reference, height/width, and initial contents
checkbox  :: CgiRef -> String -> HtmlExp  deterministic 
          A checkbox with a reference and a value.
checkedbox  :: CgiRef -> String -> HtmlExp  deterministic 
          A checkbox that is initially checked with a reference and a value.
radio_main  :: CgiRef -> String -> HtmlExp  deterministic 
          A main button of a radio (initially "on") with a reference and a value.
radio_main_off  :: CgiRef -> String -> HtmlExp  deterministic 
          A main button of a radio (initially "off") with a reference and a value.
radio_other  :: CgiRef -> String -> HtmlExp  deterministic 
          A further button of a radio (initially "off") with a reference (identical to the main button of this radio) and a value.
selection  :: CgiRef -> [(String,String)] -> HtmlExp  deterministic 
          A selection button with a reference and a list of name/value pairs.
selectionInitial  :: CgiRef -> [(String,String)] -> Int -> HtmlExp  deterministic 
          A selection button with a reference, a list of name/value pairs, and a preselected item in this list.
multipleSelection  :: CgiRef -> [(String,String,Bool)] -> HtmlExp  deterministic 
          A selection button with a reference and a list of name/value/flag pairs.
hiddenfield  :: String -> String -> HtmlExp  deterministic 
          A hidden field to pass a value referenced by a fixed name.
htmlQuote  :: String -> String  deterministic flexible+rigid
          Quotes special characters (<,>,&,", umlauts) in a string as HTML special characters.
addAttr  :: HtmlExp -> (String,String) -> HtmlExp  deterministic 
          Adds an attribute (name/value pair) to an HTML element.
addAttrs  :: HtmlExp -> [(String,String)] -> HtmlExp  deterministic flexible
          Adds a list of attributes (name/value pair) to an HTML element.
showHtmlExps  :: [HtmlExp] -> String  deterministic 
          Transforms a list of HTML expressions into string representation.
showHtmlExp  :: HtmlExp -> String  deterministic 
          Transforms a single HTML expression into string representation.
showHtmlDoc  :: String -> [HtmlExp] -> String  deterministic 
          Transforms HTML expressions into string representation of complete HTML document with title (deprecated, included only for backward compatibility).
showHtmlDocCSS  :: String -> String -> [HtmlExp] -> String  deterministic 
          Transforms HTML expressions into string representation of complete HTML document with title and a URL for a style sheet file (deprecated, included only for backward compatibility).
showHtmlPage  :: HtmlPage -> String  deterministic flexible
          Transforms HTML page into string representation.
getUrlParameter  :: IO String  deterministic 
          Gets the parameter attached to the URL of the script.
urlencoded2string  :: String -> String  deterministic flexible+rigid
          Translates urlencoded string into equivalent ASCII string.
string2urlencoded  :: String -> String  deterministic flexible+rigid
          Translates arbitrary strings into equivalent urlencoded string.
getCookies  :: IO [(String,String)]  deterministic 
          Gets the cookies sent from the browser for the current CGI script.
coordinates  :: (CgiRef -> String) -> Maybe (Int,Int)  deterministic rigid
          For image buttons: retrieve the coordinates where the user clicked within the image.
runFormServerWithKey  :: String -> String -> IO HtmlForm -> IO ()  deterministic 
          The server implementing an HTML form (possibly containing input fields).
runFormServerWithKeyAndFormParams  :: String -> String -> [FormParam] -> IO HtmlForm -> IO ()  deterministic 
          The server implementing an HTML form (possibly containing input fields).
showLatexExps  :: [HtmlExp] -> String  deterministic 
          Transforms HTML expressions into LaTeX string representation.
showLatexExp  :: HtmlExp -> String  deterministic flexible+rigid
          Transforms an HTML expression into LaTeX string representation.
showLatexDoc  :: [HtmlExp] -> String  deterministic 
          Transforms HTML expressions into a string representation of a complete LaTeX document.
showLatexDocWithPackages  :: [HtmlExp] -> [String] -> String  deterministic 
          Transforms HTML expressions into a string representation of a complete LaTeX document.
showLatexDocs  :: [[HtmlExp]] -> String  deterministic 
          Transforms a list of HTML expressions into a string representation of a complete LaTeX document where each list entry appears on a separate page.
showLatexDocsWithPackages  :: [[HtmlExp]] -> [String] -> String  deterministic 
          Transforms a list of HTML expressions into a string representation of a complete LaTeX document where each list entry appears on a separate page.
germanLatexDoc  :: [HtmlExp] -> String  deterministic 
          show german latex document
intForm  :: IO HtmlForm -> IO ()  deterministic 
          Execute an HTML form in "interactive" mode.
intFormMain  :: String -> String -> String -> String -> Bool -> String -> IO HtmlForm -> IO ()  deterministic 
          Execute an HTML form in "interactive" mode with various parameters.

 Imported modules:

Char
Distribution
HtmlCgi
IO
List
NamedSocket
Prelude
Profile
ReadNumeric
ReadShowTerm
System
Time
Unsafe
Directory

 Exported datatypes:

CgiEnv

The type for representing cgi environments (i.e., mappings from cgi references to the corresponding values of the input elements).

Type synonym: CgiEnv = CgiRef -> String


HtmlHandler

The type of event handlers in HTML forms.

Type synonym: HtmlHandler = (CgiRef -> String) -> IO HtmlForm


CgiRef

The (abstract) data type for representing references to input elements in HTML forms.

Constructors:


HtmlExp

The data type for representing HTML expressions.

Constructors:

HtmlText :: String -> HtmlExp

HtmlText s - a text string without any further structure

HtmlStruct :: String -> [(String,String)] -> [HtmlExp] -> HtmlExp

HtmlStruct t as hs - a structure with a tag, attributes, and HTML expressions inside the structure

HtmlCRef :: HtmlExp -> CgiRef -> HtmlExp

HtmlCRef h ref - an input element (described by the first argument) with a cgi reference

HtmlEvent :: HtmlExp -> ((CgiRef -> String) -> IO HtmlForm) -> HtmlExp

HtmlEvent h hdlr - an input element (first arg) with an associated event handler (tpyically, a submit button)


HtmlForm

The data type for representing HTML forms (active web pages) and return values of HTML forms.

Constructors:

HtmlForm :: String -> [FormParam] -> [HtmlExp] -> HtmlForm

HtmlForm t ps hs - an HTML form with title t, optional parameters (e.g., cookies) ps, and contents hs

HtmlAnswer :: String -> String -> HtmlForm

HtmlAnswer t c - an answer in an arbitrary format where t is the content type (e.g., "text/plain") and c is the contents


FormParam

The possible parameters of an HTML form. The parameters of a cookie (FormCookie) are its name and value and optional parameters (expiration date, domain, path (e.g., the path "/" makes the cookie valid for all documents on the server), security) which are collected in a list.

Constructors:

FormCookie :: String -> String -> [CookieParam] -> FormParam

FormCookie name value params - a cookie to be sent to the client's browser

FormCSS :: String -> FormParam

FormCSS s - a URL for a CSS file for this form

FormJScript :: String -> FormParam

FormJScript s - a URL for a Javascript file for this form

FormOnSubmit :: String -> FormParam

FormOnSubmit s - a JavaScript statement to be executed when the form is submitted (i.e., <form ... onsubmit="s">)

FormTarget :: String -> FormParam

FormTarget s - a name of a target frame where the output of the script should be represented (should only be used for scripts running in a frame)

FormEnc :: String -> FormParam

FormEnc - the encoding scheme of this form

HeadInclude :: HtmlExp -> FormParam

HeadInclude he - HTML expression to be included in form header

MultipleHandlers :: FormParam

MultipleHandlers - indicates that the event handlers of the form can be multiply used (i.e., are not deleted if the form is submitted so that they are still available when going back in the browser; but then there is a higher risk that the web server process might overflow with unused events); the default is a single use of event handlers, i.e., one cannot use the back button in the browser and submit the same form again (which is usually a reasonable behavior to avoid double submissions of data).

BodyAttr :: (String,String) -> FormParam

BodyAttr ps - optional attribute for the body element (more than one occurrence is allowed)


CookieParam

The possible parameters of a cookie.

Constructors:

CookieExpire :: ClockTime -> CookieParam
CookieDomain :: String -> CookieParam
CookiePath :: String -> CookieParam
CookieSecure :: CookieParam


HtmlPage

The data type for representing HTML pages. The constructor arguments are the title, the parameters, and the contents (body) of the web page.

Constructors:

HtmlPage :: String -> [PageParam] -> [HtmlExp] -> HtmlPage


PageParam

The possible parameters of an HTML page.

Constructors:

PageEnc :: String -> PageParam

PageEnc - the encoding scheme of this page

PageCSS :: String -> PageParam

PageCSS s - a URL for a CSS file for this page

PageJScript :: String -> PageParam

PageJScript s - a URL for a Javascript file for this page



 Exported functions:

defaultEncoding :: String  deterministic 

The default encoding used in generated web pages.

Further infos:
  • solution complete, i.e., able to compute all solutions

defaultBackground :: (String,String)  deterministic 

The default background for generated web pages.

Further infos:
  • solution complete, i.e., able to compute all solutions

idOfCgiRef :: CgiRef -> String  deterministic flexible

Internal identifier of a CgiRef (intended only for internal use in other libraries!).

Further infos:
  • solution complete, i.e., able to compute all solutions

HtmlElem :: String -> [(String,String)] -> HtmlExp  deterministic 

A single HTML element with a tag, attributes, but no contents (deprecated, included only for backward compatibility).

Further infos:
  • solution complete, i.e., able to compute all solutions

formEnc :: String -> FormParam  deterministic 

An encoding scheme for a HTML form.

Further infos:
  • solution complete, i.e., able to compute all solutions

formCSS :: String -> FormParam  deterministic 

A URL for a CSS file for a HTML form.

Further infos:
  • solution complete, i.e., able to compute all solutions

form :: String -> [HtmlExp] -> HtmlForm  deterministic 

A basic HTML form for active web pages with the default encoding and a default background.

Example call:  (form title hexps)

Parameters:
title - the title of the form
hexps - the form's body (list of HTML expressions)
Returns:
an HTML form
Further infos:
  • solution complete, i.e., able to compute all solutions

Form :: String -> [HtmlExp] -> HtmlForm  deterministic 

A basic HTML form for active web pages (deprecated, included only for backward compatibility).

Example call:  (Form title hexps)

Parameters:
title - the title of the form
hexps - the form's body (list of HTML expressions)
Returns:
an HTML form
Further infos:
  • solution complete, i.e., able to compute all solutions

standardForm :: String -> [HtmlExp] -> HtmlForm  deterministic 

A standard HTML form for active web pages where the title is included in the body as the first header.

Example call:  (standardForm title hexps)

Parameters:
title - the title of the form
hexps - the form's body (list of HTML expressions)
Returns:
an HTML form with the title as the first header

cookieForm :: String -> [(String,String)] -> [HtmlExp] -> HtmlForm  deterministic 

An HTML form with simple cookies. The cookies are sent to the client's browser together with this form.

Example call:  (cookieForm title cookies hexps)

Parameters:
title - the title of the form
cookies - the cookies as a list of name/value pairs
hexps - the form's body (list of HTML expressions)
Returns:
an HTML form

addCookies :: [(String,String)] -> HtmlForm -> HtmlForm  deterministic flexible

Add simple cookie to HTML form. The cookies are sent to the client's browser together with this form.

Example call:  (addCookies cs form)

Parameters:
cs - the cookies as a list of name/value pairs
form - the form to add cookies to
Returns:
a new HTML form

answerText :: String -> HtmlForm  deterministic 

A textual result instead of an HTML form as a result for active web pages.

Example call:  (answerText txt)

Parameters:
txt - the contents of the result page
Returns:
an HTML answer form
Further infos:
  • solution complete, i.e., able to compute all solutions

addFormParam :: HtmlForm -> FormParam -> HtmlForm  deterministic flexible

Adds a parameter to an HTML form.

Example call:  (addFormParam form param)

Parameters:
form - a form
param - a form's parameter
Returns:
an HTML form
Further infos:
  • defined as left-associative infix operator with precedence 0

redirect :: Int -> String -> HtmlForm -> HtmlForm  deterministic 

Adds redirection to given HTML form.

Example call:  (redirect secs url form)

Parameters:
secs - Number of seconds to wait before executing autromatic redirection
url - The URL whereto redirect to
form - The form to add the header information to

expires :: Int -> HtmlForm -> HtmlForm  deterministic 

Adds expire time to given HTML form.

Example call:  (expires secs form)

Parameters:
secs - Number of seconds before document expires
form - The form to add the header information to

addSound :: String -> Bool -> HtmlForm -> HtmlForm  deterministic flexible+rigid

Adds sound to given HTML form. The functions adds two different declarations for sound, one invented by Microsoft for the internet explorer, one introduced for netscape. As neither is an official part of HTML, addsound might not work on all systems and browsers. The greatest chance is by using sound files in MID-format.

Example call:  (addSound soundfile loop form)

Parameters:
soundfile - Name of file containing the sound to be played
loop - Should sound go on infinitely? Use with care.
form - The form to add sound to

pageEnc :: String -> PageParam  deterministic 

An encoding scheme for a HTML page.

Further infos:
  • solution complete, i.e., able to compute all solutions

pageCSS :: String -> PageParam  deterministic 

A URL for a CSS file for a HTML page.

Further infos:
  • solution complete, i.e., able to compute all solutions

page :: String -> [HtmlExp] -> HtmlPage  deterministic 

A basic HTML web page with the default encoding.

Example call:  (page title hexps)

Parameters:
title - the title of the page
hexps - the page's body (list of HTML expressions)
Returns:
an HTML page
Further infos:
  • solution complete, i.e., able to compute all solutions

standardPage :: String -> [HtmlExp] -> HtmlPage  deterministic 

A standard HTML web page where the title is included in the body as the first header.

Example call:  (standardPage title hexps)

Parameters:
title - the title of the page
hexps - the page's body (list of HTML expressions)
Returns:
an HTML page with the title as the first header

addPageParam :: HtmlPage -> PageParam -> HtmlPage  deterministic flexible

Adds a parameter to an HTML page.

Example call:  (addPageParam form param)

Parameters:
form - a page
param - a page's parameter
Returns:
an HTML page
Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

htxt :: String -> HtmlExp  deterministic 

Basic text as HTML expression. The text may contain special HTML chars (like <,>,&,") which will be quoted so that they appear as in the parameter string.


htxts :: [String] -> [HtmlExp]  deterministic 

A list of strings represented as a list of HTML expressions. The strings may contain special HTML chars that will be quoted.


hempty :: HtmlExp  deterministic 

An empty HTML expression.

Further infos:
  • solution complete, i.e., able to compute all solutions

nbsp :: HtmlExp  deterministic 

Non breaking Space

Further infos:
  • solution complete, i.e., able to compute all solutions

h1 :: [HtmlExp] -> HtmlExp  deterministic 

Header 1

Further infos:
  • solution complete, i.e., able to compute all solutions

h2 :: [HtmlExp] -> HtmlExp  deterministic 

Header 2

Further infos:
  • solution complete, i.e., able to compute all solutions

h3 :: [HtmlExp] -> HtmlExp  deterministic 

Header 3

Further infos:
  • solution complete, i.e., able to compute all solutions

h4 :: [HtmlExp] -> HtmlExp  deterministic 

Header 4

Further infos:
  • solution complete, i.e., able to compute all solutions

h5 :: [HtmlExp] -> HtmlExp  deterministic 

Header 5

Further infos:
  • solution complete, i.e., able to compute all solutions

par :: [HtmlExp] -> HtmlExp  deterministic 

Paragraph

Further infos:
  • solution complete, i.e., able to compute all solutions

emphasize :: [HtmlExp] -> HtmlExp  deterministic 

Emphasize

Further infos:
  • solution complete, i.e., able to compute all solutions

bold :: [HtmlExp] -> HtmlExp  deterministic 

Boldface

Further infos:
  • solution complete, i.e., able to compute all solutions

italic :: [HtmlExp] -> HtmlExp  deterministic 

Italic

Further infos:
  • solution complete, i.e., able to compute all solutions

code :: [HtmlExp] -> HtmlExp  deterministic 

Program code

Further infos:
  • solution complete, i.e., able to compute all solutions

center :: [HtmlExp] -> HtmlExp  deterministic 

Centered text

Further infos:
  • solution complete, i.e., able to compute all solutions

blink :: [HtmlExp] -> HtmlExp  deterministic 

Blinking text

Further infos:
  • solution complete, i.e., able to compute all solutions

teletype :: [HtmlExp] -> HtmlExp  deterministic 

Teletype font

Further infos:
  • solution complete, i.e., able to compute all solutions

pre :: [HtmlExp] -> HtmlExp  deterministic 

Unformatted input, i.e., keep spaces and line breaks and don't quote special characters.

Further infos:
  • solution complete, i.e., able to compute all solutions

verbatim :: String -> HtmlExp  deterministic 

Verbatim (unformatted), special characters (<,>,&,") are quoted.


address :: [HtmlExp] -> HtmlExp  deterministic 

Address

Further infos:
  • solution complete, i.e., able to compute all solutions

href :: String -> [HtmlExp] -> HtmlExp  deterministic 

Hypertext reference

Further infos:
  • solution complete, i.e., able to compute all solutions

anchor :: String -> [HtmlExp] -> HtmlExp  deterministic 

An anchor for hypertext reference inside a document

Further infos:
  • solution complete, i.e., able to compute all solutions

ulist :: [[HtmlExp]] -> HtmlExp  deterministic 

Unordered list

Example call:  (ulist items)

Parameters:
items - the list items where each item is a list of HTML expressions

olist :: [[HtmlExp]] -> HtmlExp  deterministic 

Ordered list

Example call:  (olist items)

Parameters:
items - the list items where each item is a list of HTML expressions

litem :: [HtmlExp] -> HtmlExp  deterministic 

A single list item (usually not explicitly used)

Further infos:
  • solution complete, i.e., able to compute all solutions

dlist :: [([HtmlExp],[HtmlExp])] -> HtmlExp  deterministic 

Description list

Example call:  (dlist items)

Parameters:
items - a list of (title/description) pairs (of HTML expressions)

table :: [[[HtmlExp]]] -> HtmlExp  deterministic 

Table with a matrix of items where each item is a list of HTML expressions.


headedTable :: [[[HtmlExp]]] -> HtmlExp  deterministic 

Similar to table but introduces header tags for the first row.


addHeadings :: HtmlExp -> [[HtmlExp]] -> HtmlExp  deterministic rigid

Add a row of items (where each item is a list of HTML expressions) as headings to a table. If the first argument is not a table, the headings are ignored.

Further infos:
  • incompletely defined

hrule :: HtmlExp  deterministic 

Horizontal rule

Further infos:
  • solution complete, i.e., able to compute all solutions

breakline :: HtmlExp  deterministic 

Break a line

Further infos:
  • solution complete, i.e., able to compute all solutions

image :: String -> String -> HtmlExp  deterministic 

Image

Example call:  (image src alt)

Parameters:
src - the URL of the image
alt - the alternative text shown instead of the image

styleSheet :: String -> HtmlExp  deterministic 

Defines a style sheet to be used in this HTML document.

Example call:  (styleSheet css)

Parameters:
css - a string in CSS format
Further infos:
  • solution complete, i.e., able to compute all solutions

style :: String -> [HtmlExp] -> HtmlExp  deterministic 

Provides a style for HTML elements. The style argument is the name of a style class defined in a style definition (see styleSheet) or in an external style sheet (see form and page parameters FormCSS and PageCSS).

Example call:  (style st hexps)

Parameters:
st - name of a style class
hexps - list of HTML expressions
Further infos:
  • solution complete, i.e., able to compute all solutions

textstyle :: String -> String -> HtmlExp  deterministic 

Provides a style for a basic text. The style argument is the name of a style class defined in an external style sheet.

Example call:  (textstyle st txt)

Parameters:
st - name of a style class
txt - a string (special characters will be quoted)

blockstyle :: String -> [HtmlExp] -> HtmlExp  deterministic 

Provides a style for a block of HTML elements. The style argument is the name of a style class defined in an external style sheet. This element is used (in contrast to "style") for larger blocks of HTML elements since a line break is placed before and after these elements.

Example call:  (blockstyle st hexps)

Parameters:
st - name of a style class
hexps - list of HTML expressions
Further infos:
  • solution complete, i.e., able to compute all solutions

inline :: [HtmlExp] -> HtmlExp  deterministic 

Joins a list of HTML elements into a single HTML element. Although this construction has no rendering, it is sometimes useful for programming when several HTML elements must be put together.

Example call:  (inline hexps)

Parameters:
hexps - list of HTML expressions
Further infos:
  • solution complete, i.e., able to compute all solutions

block :: [HtmlExp] -> HtmlExp  deterministic 

Joins a list of HTML elements into a block. A line break is placed before and after these elements.

Example call:  (block hexps)

Parameters:
hexps - list of HTML expressions
Further infos:
  • solution complete, i.e., able to compute all solutions

button :: String -> ((CgiRef -> String) -> IO HtmlForm) -> HtmlExp  deterministic 

Submit button with a label string and an event handler


resetbutton :: String -> HtmlExp  deterministic 

Reset button with a label string


imageButton :: String -> ((CgiRef -> String) -> IO HtmlForm) -> HtmlExp  deterministic 

Submit button in form of an imag.

Example call:  (imageButton src handler)

Parameters:
src - url of the image
handler - event handler
Further infos:
  • solution complete, i.e., able to compute all solutions

textfield :: CgiRef -> String -> HtmlExp  deterministic 

Input text field with a reference and an initial contents


password :: CgiRef -> HtmlExp  deterministic 

Input text field (where the entered text is obscured) with a reference


textarea :: CgiRef -> (Int,Int) -> String -> HtmlExp  deterministic flexible

Input text area with a reference, height/width, and initial contents


checkbox :: CgiRef -> String -> HtmlExp  deterministic 

A checkbox with a reference and a value. The value is returned if checkbox is on, otherwise "" is returned.


checkedbox :: CgiRef -> String -> HtmlExp  deterministic 

A checkbox that is initially checked with a reference and a value. The value is returned if checkbox is on, otherwise "" is returned.


radio_main :: CgiRef -> String -> HtmlExp  deterministic 

A main button of a radio (initially "on") with a reference and a value. The value is returned of this button is on. A complete radio button suite always consists of a main button (radio_main) and some further buttons (radio_others) with the same reference. Initially, the main button is selected (or nothing is selected if one uses radio_main_off instead of radio_main). The user can select another button but always at most one button of the radio can be selected. The value corresponding to the selected button is returned in the environment for this radio reference.


radio_main_off :: CgiRef -> String -> HtmlExp  deterministic 

A main button of a radio (initially "off") with a reference and a value. The value is returned of this button is on.


radio_other :: CgiRef -> String -> HtmlExp  deterministic 

A further button of a radio (initially "off") with a reference (identical to the main button of this radio) and a value. The value is returned of this button is on.


selection :: CgiRef -> [(String,String)] -> HtmlExp  deterministic 

A selection button with a reference and a list of name/value pairs. The names are shown in the selection and the value is returned for the selected name.


selectionInitial :: CgiRef -> [(String,String)] -> Int -> HtmlExp  deterministic 

A selection button with a reference, a list of name/value pairs, and a preselected item in this list. The names are shown in the selection and the value is returned for the selected name.

Example call:  (selectionInitial ref nvs sel)

Parameters:
ref - a CGI reference
nvs - list of name/value pairs
sel - the index of the initially selected item in the list nvs
Returns:
an HTML expression representing the selection button

multipleSelection :: CgiRef -> [(String,String,Bool)] -> HtmlExp  deterministic 

A selection button with a reference and a list of name/value/flag pairs. The names are shown in the selection and the value is returned if the corresponding name is selected. If flag is True, the corresonding name is initially selected. If more than one name has been selected, all values are returned in one string where the values are separated by '\n' characters.


hiddenfield :: String -> String -> HtmlExp  deterministic 

A hidden field to pass a value referenced by a fixed name. This function should be used with care since it may cause conflicts with the CGI-based implementation of this library.

Further infos:
  • solution complete, i.e., able to compute all solutions

htmlQuote :: String -> String  deterministic flexible+rigid

Quotes special characters (<,>,&,", umlauts) in a string as HTML special characters.


addAttr :: HtmlExp -> (String,String) -> HtmlExp  deterministic 

Adds an attribute (name/value pair) to an HTML element.

Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

addAttrs :: HtmlExp -> [(String,String)] -> HtmlExp  deterministic flexible

Adds a list of attributes (name/value pair) to an HTML element.

Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

showHtmlExps :: [HtmlExp] -> String  deterministic 

Transforms a list of HTML expressions into string representation.


showHtmlExp :: HtmlExp -> String  deterministic 

Transforms a single HTML expression into string representation.


showHtmlDoc :: String -> [HtmlExp] -> String  deterministic 

Transforms HTML expressions into string representation of complete HTML document with title (deprecated, included only for backward compatibility).

Example call:  (showHtmlDoc title hexps)

Parameters:
title - the title of the HTML document
hexps - the body (list of HTML expressions) of the document
Returns:
string representation of the HTML document

showHtmlDocCSS :: String -> String -> [HtmlExp] -> String  deterministic 

Transforms HTML expressions into string representation of complete HTML document with title and a URL for a style sheet file (deprecated, included only for backward compatibility).

Example call:  (showHtmlDocCSS title css hexps)

Parameters:
title - the title of the HTML document
css - the URL for a CSS file for this document
hexps - the body (list of HTML expressions) of the document
Returns:
string representation of the HTML document

showHtmlPage :: HtmlPage -> String  deterministic flexible

Transforms HTML page into string representation.

Example call:  (showHtmlPage page)

Parameters:
page - the HTML page
Returns:
string representation of the HTML document

getUrlParameter :: IO String  deterministic 

Gets the parameter attached to the URL of the script. For instance, if the script is called with URL "http://.../script.cgi?parameter", then "parameter" is returned by this I/O action. Note that an URL parameter should be "URL encoded" to avoid the appearance of characters with a special meaning. Use the functions "urlencoded2string" and "string2urlencoded" to decode and encode such parameters, respectively.


urlencoded2string :: String -> String  deterministic flexible+rigid

Translates urlencoded string into equivalent ASCII string.

Further infos:
  • incompletely defined

string2urlencoded :: String -> String  deterministic flexible+rigid

Translates arbitrary strings into equivalent urlencoded string.

Further infos:
  • incompletely defined

getCookies :: IO [(String,String)]  deterministic 

Gets the cookies sent from the browser for the current CGI script. The cookies are represented in the form of name/value pairs since no other components are important here.


coordinates :: (CgiRef -> String) -> Maybe (Int,Int)  deterministic rigid

For image buttons: retrieve the coordinates where the user clicked within the image.


runFormServerWithKey :: String -> String -> IO HtmlForm -> IO ()  deterministic 

The server implementing an HTML form (possibly containing input fields). It receives a message containing the environment of the client's web browser, translates the HTML form w.r.t. this environment into a string representation of the complete HTML document and sends the string representation back to the client's browser by binding the corresponding message argument.

Example call:  (runFormServerWithKey url cgikey hformact)

Parameters:
url - the URL of this executable.
cgikey - a unique key to identify this CGI script (used for safe storing of event handlers in this server)
hformact - an IO action returning an HTML form

runFormServerWithKeyAndFormParams :: String -> String -> [FormParam] -> IO HtmlForm -> IO ()  deterministic 

The server implementing an HTML form (possibly containing input fields). It receives a message containing the environment of the client's web browser, translates the HTML form w.r.t. this environment into a string representation of the complete HTML document and sends the string representation back to the client's browser by binding the corresponding message argument.

Example call:  (runFormServerWithKeyAndFormParams url cgikey formparams hformact)

Parameters:
url - the URL of this executable.
cgikey - a unique key to identify this CGI script (used for safe storing of event handlers on the web server)
formparams - form parameters added to the initial and all subsequent forms
hformact - an IO action returning an HTML form

showLatexExps :: [HtmlExp] -> String  deterministic 

Transforms HTML expressions into LaTeX string representation.


showLatexExp :: HtmlExp -> String  deterministic flexible+rigid

Transforms an HTML expression into LaTeX string representation.

Further infos:
  • incompletely defined

showLatexDoc :: [HtmlExp] -> String  deterministic 

Transforms HTML expressions into a string representation of a complete LaTeX document.


showLatexDocWithPackages :: [HtmlExp] -> [String] -> String  deterministic 

Transforms HTML expressions into a string representation of a complete LaTeX document. The variable "packages" holds the packages to add to the latex document e.g. "ngerman"


showLatexDocs :: [[HtmlExp]] -> String  deterministic 

Transforms a list of HTML expressions into a string representation of a complete LaTeX document where each list entry appears on a separate page.


showLatexDocsWithPackages :: [[HtmlExp]] -> [String] -> String  deterministic 

Transforms a list of HTML expressions into a string representation of a complete LaTeX document where each list entry appears on a separate page. The variable "packages" holds the packages to add to the latex document (e.g., "ngerman").


germanLatexDoc :: [HtmlExp] -> String  deterministic 

show german latex document


intForm :: IO HtmlForm -> IO ()  deterministic 

Execute an HTML form in "interactive" mode.


intFormMain :: String -> String -> String -> String -> Bool -> String -> IO HtmlForm -> IO ()  deterministic 

Execute an HTML form in "interactive" mode with various parameters.

Example call:  (intFormMain baseurl basecgi reldir cginame forever urlparam hformact)

Parameters:
baseurl - the base URL where this script is accessible for clients
basecgi - the base directory in the local file system where this script should stored for execution
reldir - the relative path added to baseurl and basecgi
cginame - the name of the executable cgi script
forever - True if the interactive execution should not be terminated when the final web page (without a handler) is shown
urlparam - the URL parameter for the initial call to the cgi script
hformact - IO action returning the HTML form


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:26:15 2008