Module UI2HTML

Library for creating web applications from ui descriptions based on the HTML library from PAKCS

The installation of a cgi script written with this library can be done by the command

curry makecgi -m main -o /home/user/public_html/prog.cgi prog

where prog is the name of the Curry program with the cgi script, /home/user/public_html/prog.cgi is the desired location of the compiled cgi script, and main is a Curry expression like runGUI "Titel" uiwidget.

Author: Christof Kluss

Version: July 2013

Summary of exported operations:

ref2cgiRef :: Ref CgiRef -> CgiRef   
cgiRef2Ref :: CgiRef -> Ref CgiRef   
ui2hexps :: Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> [HtmlExp]   
ajaxForm :: String -> [HtmlExp] -> HtmlForm   
ajaxForm2 :: String -> [FormParam] -> [HtmlExp] -> HtmlForm   
runUI :: String -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> IO HtmlForm   
getValue :: Ref CgiRef -> UIEnv -> IO String   
Gets the (String) value of a variable in a GUI.
setValue :: Ref CgiRef -> String -> UIEnv -> IO ()   
Sets the (String) value of a variable in a GUI.
setConfig :: Ref CgiRef -> Reconfigure -> UIEnv -> IO ()   
Changes the current configuration of a widget
updateValue :: (String -> String) -> Ref CgiRef -> UIEnv -> IO ()   
Updates the (String) value of a variable w.r.t.
appendValue :: Ref CgiRef -> String -> UIEnv -> IO ()   
Appends a String value to the contents of a widget.
showPopup :: String -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> UIEnv -> IO ()   
Runs a Widget in a new window.
showMessage :: String -> UIEnv -> IO ()   
Shows a String Message in a new window.
includeHtmlForm :: Ref CgiRef -> HtmlForm -> UIEnv -> IO ()   
changeChilds :: Ref CgiRef -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> UIEnv -> IO ()   
nextHtmlForm :: HtmlForm -> UIEnv -> IO ()   
setHandler :: Ref CgiRef -> Event -> (UIEnv -> IO ()) -> UIEnv -> IO ()   
Sets a new Handler to a Widget referred by the first argument.
exitUI :: UIEnv -> IO ()   
An event handler for terminating the GUI.
addCanvas :: Ref CgiRef -> [CanvasItem] -> UIEnv -> IO ()   
Adds a list of canvas items to a canvas referred by the first argument.
setDisabled :: Ref CgiRef -> Bool -> UIEnv -> IO ()   
Sets the state of a widget to disabled (inactive) or active (inactive widgets do not accept any events)
setVisible :: Ref CgiRef -> Bool -> UIEnv -> IO ()   
changeStyles :: Ref CgiRef -> [StyleClass] -> UIEnv -> IO ()   
Changes the style of a widget
setErrorBg :: Ref CgiRef -> Bool -> UIEnv -> IO ()   
seeText :: Ref CgiRef -> (Int,Int) -> UIEnv -> IO ()   
onClickSpicy :: Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> Action a (Ref CgiRef) -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))   

Exported datatypes:


UIEnv

The (abstract) data type for representing environments

Constructors:


UIWidget

Type synonym: UIWidget = Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))


UIRef

Type synonym: UIRef = Ref CgiRef


Reconfigure

Constructors:

  • List :: [String] -> Reconfigure
  • Disabled :: Bool -> Reconfigure
  • Visible :: Bool -> Reconfigure
  • Style :: [StyleClass] -> Reconfigure
  • Pos :: (Int,Int) -> Reconfigure
  • ErrorBg :: Bool -> Reconfigure

Exported operations:

ref2cgiRef :: Ref CgiRef -> CgiRef   

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

cgiRef2Ref :: CgiRef -> Ref CgiRef   

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

ui2hexps :: Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> [HtmlExp]   

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

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

runUI :: String -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> IO HtmlForm   

getValue :: Ref CgiRef -> UIEnv -> IO String   

Gets the (String) value of a variable in a GUI.

setValue :: Ref CgiRef -> String -> UIEnv -> IO ()   

Sets the (String) value of a variable in a GUI.

setConfig :: Ref CgiRef -> Reconfigure -> UIEnv -> IO ()   

Changes the current configuration of a widget

updateValue :: (String -> String) -> Ref CgiRef -> UIEnv -> IO ()   

Updates the (String) value of a variable w.r.t. to an update function.

appendValue :: Ref CgiRef -> String -> UIEnv -> IO ()   

Appends a String value to the contents of a widget.

showPopup :: String -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> UIEnv -> IO ()   

Runs a Widget in a new window.

showMessage :: String -> UIEnv -> IO ()   

Shows a String Message in a new window.

includeHtmlForm :: Ref CgiRef -> HtmlForm -> UIEnv -> IO ()   

Further infos:
  • partially defined

changeChilds :: Ref CgiRef -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> UIEnv -> IO ()   

nextHtmlForm :: HtmlForm -> UIEnv -> IO ()   

Further infos:
  • partially defined

setHandler :: Ref CgiRef -> Event -> (UIEnv -> IO ()) -> UIEnv -> IO ()   

Sets a new Handler to a Widget referred by the first argument. An existing Handler for the same event type is overridden

exitUI :: UIEnv -> IO ()   

An event handler for terminating the GUI.

addCanvas :: Ref CgiRef -> [CanvasItem] -> UIEnv -> IO ()   

Adds a list of canvas items to a canvas referred by the first argument.

setDisabled :: Ref CgiRef -> Bool -> UIEnv -> IO ()   

Sets the state of a widget to disabled (inactive) or active (inactive widgets do not accept any events)

setVisible :: Ref CgiRef -> Bool -> UIEnv -> IO ()   

changeStyles :: Ref CgiRef -> [StyleClass] -> UIEnv -> IO ()   

Changes the style of a widget

setErrorBg :: Ref CgiRef -> Bool -> UIEnv -> IO ()   

seeText :: Ref CgiRef -> (Int,Int) -> UIEnv -> IO ()   

onClickSpicy :: Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> Action a (Ref CgiRef) -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))   

Further infos:
  • defined as left-associative infix operator with precedence 0