WashNGo-2.12: WASH is a family of embedded domain specific languages (EDSL) for programming Web applications in Haskell.ContentsIndex
WASH.CGI.CGIInternals
Synopsis
makeRef :: (CGIMonad cgi, Monad m) => String -> WithHTML x m () -> cgi (WithHTML y m ())
makePopupRef :: CGIMonad cgi => String -> String -> HTMLCons x y cgi ()
makeA :: CGIMonad cgi => String -> String -> HTMLField cgi x y ()
data VALID = VALID
data INVALID = INVALID
data InputField a x = InputField {
ifName :: String
ifToken :: CGIFieldName
ifFty :: String
ifString :: (Maybe String)
ifValue :: (Maybe a)
ifRaw :: CGIParameters
ifBound :: Bool
}
concatFields :: (Reason c, Read c) => InputField c INVALID -> InputField Text INVALID -> InputField c INVALID
concatFieldsWith :: (Reason c, Read c) => (String -> [String] -> String) -> InputField c INVALID -> [InputField Text INVALID] -> InputField c INVALID
feither :: (a -> b) -> (c -> d) -> Either a c -> Either b d
propagate :: Either [err] a -> Either [err] b -> Either [err] (a, b)
data ValidationError = ValidationError {
veName :: String
veToken :: CGIFieldName
veString :: (Maybe String)
}
data InputType
= TEXT
| PASSWORD
| CHECKBOX
| RADIO
| SUBMIT
| RESET
| FILE
| HIDDEN
| IMAGE
| BUTTON
textual :: InputType -> Bool
type HTMLField cgi x y a = WithHTML x cgi () -> WithHTML y cgi a
resetField :: CGIMonad cgi => HTMLField cgi x y (InputField () INVALID)
submitField :: CGIMonad cgi => cgi () -> HTMLField cgi x y ()
defaultSubmitField :: CGIMonad cgi => cgi () -> HTMLField cgi x y ()
activeInputField :: (CGIMonad cgi, Reason a, Read a) => (a -> cgi ()) -> HTMLField cgi x y ()
activateI :: CGIMonad cgi => (a -> cgi ()) -> HTMLField cgi x y (InputField a INVALID) -> HTMLField cgi x y ()
inputField :: (CGIMonad cgi, Reason a, Read a) => HTMLField cgi x y (InputField a INVALID)
maybeRead :: Read a => String -> Maybe a
textInputField :: CGIMonad cgi => HTMLField cgi x y (InputField String INVALID)
checkedTextInputField :: CGIMonad cgi => (Maybe String -> Maybe String) -> HTMLField cgi x y (InputField String INVALID)
passwordInputField :: (CGIMonad cgi, Reason a, Read a) => HTMLField cgi x y (InputField a INVALID)
checkboxInputField :: CGIMonad cgi => HTMLField cgi x y (InputField Bool INVALID)
fileInputField :: CGIMonad cgi => HTMLField cgi x y (InputField FileReference INVALID)
checkedFileInputField :: CGIMonad cgi => (Maybe FileReference -> Maybe FileReference) -> HTMLField cgi x y (InputField FileReference INVALID)
genericField :: (Reason a, CGIMonad cgi) => InputType -> (Maybe String -> Maybe a) -> HTMLField cgi x y (InputField a INVALID)
internalSubmitLink :: CGIMonad cgi => Bool -> Either [ValidationError] (cgi ()) -> HTMLCons x y cgi ()
imageField :: CGIMonad cgi => Image -> HTMLField cgi x y (InputField (Int, Int) INVALID)
data RadioGroup a x = RadioGroup {
radioName :: String
radioToken :: CGIFieldName
radioString :: (Maybe String)
radioValue :: (Maybe a)
radioBound :: Bool
}
radioGroup :: (CGIMonad cgi, Read a) => WithHTML x cgi (RadioGroup a INVALID)
radioButton :: (Show a, Monad cgi) => RadioGroup a INVALID -> a -> HTMLField cgi x y ()
radioError :: CGIMonad cgi => RadioGroup a INVALID -> WithHTML x cgi ()
makeButton :: CGIMonad cgi => HTMLField cgi x y (InputField Bool INVALID)
makeForm :: CGIMonad cgi => WithHTML x cgi a -> WithHTML y cgi ()
makeTextarea :: CGIMonad cgi => String -> HTMLField cgi x y (InputField String INVALID)
selectMultiple :: (CGIMonad cgi, Eq a) => (a -> String) -> [a] -> [a] -> (Int, Int) -> HTMLField cgi x y (InputField [a] INVALID)
selectSingle :: (CGIMonad cgi, Eq a) => (a -> String) -> Maybe a -> [a] -> HTMLField cgi x y (InputField a INVALID)
selectBounded :: (CGIMonad cgi, Enum a, Bounded a, Read a, Show a, Eq a) => Maybe a -> HTMLField cgi x y (InputField a INVALID)
fieldSIZE :: Monad m => Int -> WithHTML x m ()
fieldMAXLENGTH :: Monad m => Int -> WithHTML x m ()
fieldVALUE :: (Monad m, Show a) => a -> WithHTML x m ()
data Image = Image {
imageSRC :: URL
imageALT :: String
}
internalImage :: CGIMonad cgi => FreeForm -> String -> WithHTML x cgi Image
dataImage :: CGIMonad cgi => FreeForm -> String -> WithHTML x cgi Image
jsImage :: CGIMonad cgi => FreeForm -> String -> WithHTML x cgi Image
externalImage :: CGIMonad cgi => URL -> String -> WithHTML x cgi Image
makeImg :: Monad cgi => Image -> HTMLField cgi x y ()
popuplink :: Monad m => String -> URL -> HTMLCons x y m ()
restart :: CGIMonad cgi => cgi ()
standardQuery :: CGIMonad cgi => String -> WithHTML x cgi a -> cgi ()
Documentation
makeRef
:: (CGIMonad cgi, Monad m)
=> Stringinternal name of entity
-> WithHTML x m ()body of the reference
-> cgi (WithHTML y m ())
Create a hyperlink to internal entity.
makePopupRef
:: CGIMonad cgi
=> Stringname of popup window
-> Stringinternal name of entity
-> HTMLCons x y cgi ()
Create a popup hyperlink to internal entity.
makeA :: CGIMonad cgi => String -> String -> HTMLField cgi x y ()
Create hyperlink to internal entity /path?name.
data VALID
Constructors
VALID
data INVALID
Constructors
INVALID
data InputField a x
Constructors
InputField
ifName :: String
ifToken :: CGIFieldName
ifFty :: String
ifString :: (Maybe String)
ifValue :: (Maybe a)
ifRaw :: CGIParameters
ifBound :: Bool
show/hide Instances
concatFields :: (Reason c, Read c) => InputField c INVALID -> InputField Text INVALID -> InputField c INVALID
create a virtual input field from the concatenation of two input fields
concatFieldsWith :: (Reason c, Read c) => (String -> [String] -> String) -> InputField c INVALID -> [InputField Text INVALID] -> InputField c INVALID
Create a virtual input field from the result of applying a function to two input fields. Parsing is applied to the result of the function call.
feither :: (a -> b) -> (c -> d) -> Either a c -> Either b d
propagate :: Either [err] a -> Either [err] b -> Either [err] (a, b)
data ValidationError
Constructors
ValidationError
veName :: String
veToken :: CGIFieldName
veString :: (Maybe String)
data InputType
Constructors
TEXT
PASSWORD
CHECKBOX
RADIO
SUBMIT
RESET
FILE
HIDDEN
IMAGE
BUTTON
show/hide Instances
textual :: InputType -> Bool
type HTMLField cgi x y a = WithHTML x cgi () -> WithHTML y cgi a
Every input widget maps the content generator for the widget (which may produce HTML elements or attributes) to the content generator of the widget.
resetField :: CGIMonad cgi => HTMLField cgi x y (InputField () INVALID)
Creates a reset button that clears all fields of a form.
submitField :: CGIMonad cgi => cgi () -> HTMLField cgi x y ()
Creates a submit button. Unsafe. Internal use only.
defaultSubmitField :: CGIMonad cgi => cgi () -> HTMLField cgi x y ()
activeInputField
:: (CGIMonad cgi, Reason a, Read a)
=> (a -> cgi ())Function that maps input data to a CGI action.
-> HTMLField cgi x y ()
Creates an input field that submits the field to the browser when data is entered into this field.
activateI :: CGIMonad cgi => (a -> cgi ()) -> HTMLField cgi x y (InputField a INVALID) -> HTMLField cgi x y ()
Attach a CGI action to the value returned by the input field. Activation means that data is submitted as soon as it is entered.
inputField :: (CGIMonad cgi, Reason a, Read a) => HTMLField cgi x y (InputField a INVALID)
Create a textual input field. Return type can be *anything* in class Reason and Read.
maybeRead :: Read a => String -> Maybe a
textInputField :: CGIMonad cgi => HTMLField cgi x y (InputField String INVALID)
Create a textual input field that returns the string entered. (Avoids having to put quotes around a string.)
checkedTextInputField :: CGIMonad cgi => (Maybe String -> Maybe String) -> HTMLField cgi x y (InputField String INVALID)
Creates a textual input field that takes a custom validation function.
passwordInputField :: (CGIMonad cgi, Reason a, Read a) => HTMLField cgi x y (InputField a INVALID)
Like inputField but the characters are not echoed on the screen.
checkboxInputField :: CGIMonad cgi => HTMLField cgi x y (InputField Bool INVALID)
Creates a checkbox. Returns True if box was checked.
fileInputField :: CGIMonad cgi => HTMLField cgi x y (InputField FileReference INVALID)
Creates a file input field. Returns a temporary FileReference. The fileReferenceName of the result is *not* guaranteed to be persistent. The application is responsible for filing it away at a safe place.
checkedFileInputField :: CGIMonad cgi => (Maybe FileReference -> Maybe FileReference) -> HTMLField cgi x y (InputField FileReference INVALID)
Creates a file input field. Like fileInputField but has an additional parameter for additional validation of the input.
genericField :: (Reason a, CGIMonad cgi) => InputType -> (Maybe String -> Maybe a) -> HTMLField cgi x y (InputField a INVALID)
internalSubmitLink :: CGIMonad cgi => Bool -> Either [ValidationError] (cgi ()) -> HTMLCons x y cgi ()
generates a hyperlink that submits the current form.
imageField :: CGIMonad cgi => Image -> HTMLField cgi x y (InputField (Int, Int) INVALID)
Create an input field from an image. Returns (x,y) position clicked in the image.
data RadioGroup a x
Constructors
RadioGroup
radioName :: String
radioToken :: CGIFieldName
radioString :: (Maybe String)
radioValue :: (Maybe a)
radioBound :: Bool
show/hide Instances
radioGroup :: (CGIMonad cgi, Read a) => WithHTML x cgi (RadioGroup a INVALID)
Create a handle for a new radio group. This handle is invisible on the screen!
radioButton :: (Show a, Monad cgi) => RadioGroup a INVALID -> a -> HTMLField cgi x y ()
Create a new radio button and attach it to an existing RadioGroup.
radioError :: CGIMonad cgi => RadioGroup a INVALID -> WithHTML x cgi ()
Create and place the error indicator for an existing RadioGroup. Becomes visible only if no button of a radio group is pressed.
makeButton :: CGIMonad cgi => HTMLField cgi x y (InputField Bool INVALID)
Create a single button.
makeForm :: CGIMonad cgi => WithHTML x cgi a -> WithHTML y cgi ()
Wraps an HTML form around its arguments. All standard attributes are computed and need not be supplied explicitly.
makeTextarea :: CGIMonad cgi => String -> HTMLField cgi x y (InputField String INVALID)
Create a text area with a preset string.
selectMultiple
:: (CGIMonad cgi, Eq a)
=> (a -> String)function to display values of type a
-> [a]list of preselected entries
-> [a]list of all possible entries
-> (Int, Int)(min, max) number of fields that must be selected
-> HTMLField cgi x y (InputField [a] INVALID)
Create a selection box where multiple entries can be selected.
selectSingle
:: (CGIMonad cgi, Eq a)
=> (a -> String)function to display values of type a
-> Maybe aoptional preselected value
-> [a]list of all possible values
-> HTMLField cgi x y (InputField a INVALID)
Create a selection box where exactly one entry can be selected.
selectBounded :: (CGIMonad cgi, Enum a, Bounded a, Read a, Show a, Eq a) => Maybe a -> HTMLField cgi x y (InputField a INVALID)
Selection box for elements of a Bounded type. Argument is the optional preselected value.
fieldSIZE :: Monad m => Int -> WithHTML x m ()
Create a SIZE attribute from an Int.
fieldMAXLENGTH :: Monad m => Int -> WithHTML x m ()
Create a MAXLENGTH attribute from an Int.
fieldVALUE :: (Monad m, Show a) => a -> WithHTML x m ()
Create a VALUE attribute from any Showable.
data Image
Constructors
Image
imageSRC :: URL
imageALT :: String
internalImage
:: CGIMonad cgi
=> FreeFormthe raw image
-> Stringalternative text
-> WithHTML x cgi Image
Reference to internal image.
dataImage
:: CGIMonad cgi
=> FreeFormthe raw image
-> Stringalternative text
-> WithHTML x cgi Image
Reference to internal image via data URL (small images, only).
jsImage
:: CGIMonad cgi
=> FreeFormthe raw image
-> Stringalternative text
-> WithHTML x cgi Image
Reference to internal image via javascript URL (does not seem to work).
externalImage
:: CGIMonad cgi
=> URLURL of image
-> Stringalternative text
-> WithHTML x cgi Image
Reference to image by URL.
makeImg :: Monad cgi => Image -> HTMLField cgi x y ()
Create an inline image.
popuplink :: Monad m => String -> URL -> HTMLCons x y m ()
Hyperlink that creates a named popup window from an URL string.
restart :: CGIMonad cgi => cgi ()
restart application.
standardQuery :: CGIMonad cgi => String -> WithHTML x cgi a -> cgi ()
Convenient workhorse. Takes the title of a page and a monadic HTML value for the contents of the page. Wraps the contents in a form so that input fields and buttons may be used inside.
Produced by Haddock version 0.8