Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
curry-packages
wui
Commits
f89ee6b2
Commit
f89ee6b2
authored
8 years ago
by
Michael Hanus
Browse files
Options
Downloads
Patches
Plain Diff
Code refactoring
parent
ad809b09
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/WUI.curry
+10
-0
10 additions, 0 deletions
src/WUI.curry
src/WUIjs.curry
+11
-0
11 additions, 0 deletions
src/WUIjs.curry
with
21 additions
and
0 deletions
src/WUI.curry
+
10
−
0
View file @
f89ee6b2
...
...
@@ -11,6 +11,8 @@
--- @category web
------------------------------------------------------------------------------
{-# OPTIONS_CYMAKE -Wno-incomplete-patterns #-}
module WUI(--WuiState,cgiRef2state,state2cgiRef,value2state,state2value,
--states2state,state2states,altstate2state,state2altstate,
Rendering,WuiSpec,
...
...
@@ -91,10 +93,13 @@ type Rendering = [HtmlExp] -> HtmlExp
--- * a condition to specify legal input values
type WuiParams a = (Rendering, String, a->Bool)
renderOf :: WuiParams a -> Rendering
renderOf (render,_,_) = render
errorOf :: WuiParams a -> String
errorOf (_,err,_) = err
conditionOf :: WuiParams a -> (a -> Bool)
conditionOf (_,_,c) = c
------------------------------------------------------------------------------
...
...
@@ -365,6 +370,7 @@ wMultiCheckSelect showelem selset =
in (render (map showItem numsetitems),
states2state (map cgiRef2state refs))
newVars :: [_]
newVars = unknown : newVars
--- A widget to select a value from a given list of values via a radio button.
...
...
@@ -921,6 +927,7 @@ unRenderTuple hexp =
map (\ (HtmlStruct "td" _ [e]) -> e) tds
-- Standard error message for tuples:
tupleError :: String
tupleError = "Illegal combination:"
--- Standard rendering of tuples with a tag for each element.
...
...
@@ -944,6 +951,7 @@ renderError render errmsg hexps =
table [[[boldRedTxt errmsg]], [[render hexps]]]
`addAttr` ("bgcolor","#ffff00") -- background color: yellow
boldRedTxt :: String -> HtmlExp
boldRedTxt s = HtmlStruct "font" [("color","#ff0000")] [bold [htxt s]]
...
...
@@ -954,12 +962,14 @@ mergeTableOfTable (HtmlStruct "table" attrs rows) =
then map mergeRowWithSingleTableData rows
else rows )
isRowWithSingleTableData :: HtmlExp -> Bool
isRowWithSingleTableData row = case row of
(HtmlStruct "tr" []
[HtmlStruct "td" []
[HtmlStruct "table" _ [HtmlStruct "tr" _ _]]]) -> True
_ -> False
mergeRowWithSingleTableData :: HtmlExp -> HtmlExp
mergeRowWithSingleTableData
(HtmlStruct "tr" [] [HtmlStruct "td" [] [HtmlStruct "table" _ [row]]]) = row
...
...
This diff is collapsed.
Click to expand it.
src/WUIjs.curry
+
11
−
0
View file @
f89ee6b2
...
...
@@ -14,6 +14,8 @@
--- @category web
------------------------------------------------------------------------------
{-# OPTIONS_CYMAKE -Wno-incomplete-patterns #-}
module WUIjs(--WuiState,cgiRef2state,state2cgiRef,value2state,state2value,
--states2state,state2states,altstate2state,state2altstate,
Rendering,WuiSpec,
...
...
@@ -140,12 +142,16 @@ type Rendering = [HtmlExp] -> HtmlExp
--- * optionally a JavaScript function name implementing the condition
type WuiParams a = (Rendering, String, a->Bool, Maybe String)
renderOf :: WuiParams a -> Rendering
renderOf (render,_,_,_) = render
errorOf :: WuiParams a -> String
errorOf (_,err,_,_) = err
conditionOf :: WuiParams a -> (a -> Bool)
conditionOf (_,_,c,_) = c
jsConditionOf :: WuiParams a -> Maybe String
jsConditionOf (_,_,_,jsc) = jsc
------------------------------------------------------------------------------
...
...
@@ -543,6 +549,7 @@ wMultiCheckSelect showelem selset =
in (render (map showItem numsetitems), Nothing,
states2state (map (\cref->cgiRef2state cref Nothing) refs) Nothing)
newVars :: [_]
newVars = unknown : newVars
...
...
@@ -1452,6 +1459,7 @@ unRenderTuple hexp =
map (\ (HtmlStruct "td" _ [e]) -> e) tds
-- Standard error message for tuples:
tupleError :: String
tupleError = "Illegal combination:"
--- Standard rendering of tuples with a tag for each element.
...
...
@@ -1474,12 +1482,14 @@ mergeTableOfTable (HtmlStruct "table" attrs rows) =
then map mergeRowWithSingleTableData rows
else rows )
isRowWithSingleTableData :: HtmlExp -> Bool
isRowWithSingleTableData row = case row of
(HtmlStruct "tr" []
[HtmlStruct "td" []
[HtmlStruct "table" _ [HtmlStruct "tr" _ _]]]) -> True
_ -> False
mergeRowWithSingleTableData :: HtmlExp -> HtmlExp
mergeRowWithSingleTableData
(HtmlStruct "tr" [] [HtmlStruct "td" [] [HtmlStruct "table" _ [row]]]) = row
...
...
@@ -1557,6 +1567,7 @@ showAndReadWUI wspec store errorform (htmledits,jsfs,readenv) =
--------------------------------------------------------------------------
-- The style sheet used in WUIs:
wuiStyleSheet :: HtmlExp
wuiStyleSheet = styleSheet $
"\n.wuihide { display: none; }\n" ++
".wuinohide { display: inline; color: red; font-weight: bold ; background-color: yellow; }\n" ++
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment