|
definition: |
wuiSpec :: ViewGenerator
wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
let
manyToManyEntities = manyToMany allEntities (Entity entityName attrlist)
manyToOneEntities = manyToOne (Entity entityName attrlist) relationships
argumentCount = length attrlist + length manyToOneEntities
+ length manyToManyEntities
in
stCmtFunc
("The WUI specification for the entity type "++entityName++".\n"++
if null manyToOneEntities && null manyToManyEntities
then ""
else "It also includes fields for associated entities.")
(viewModuleName entityName, "w"++entityName) 2 Public
(foldr CFuncType
(applyTC (wuiModule "WuiSpec")
[entityInterface attrlist manyToOneEntities manyToManyEntities])
(map (\e -> listType (ctvar e)) -- possible values
(manyToOneEntities ++ map fst manyToManyEntities))
)
[simpleRule
(map (\ (en,er) -> CPVar (1, lowerFirst $ er ++ en ++ "List"))
(map (\n -> (n,"")) manyToOneEntities ++ manyToManyEntities))
(applyF (wuiModule "withRendering") [
(if (argumentCount == 1) then
head (attrWidgets attrlist)
else
applyF (combinator argumentCount)
( attrWidgets attrlist ++
map (\e -> applyF (wuiModule "wSelect")
[constF (entitiesToHtmlModule erdname,
lowerFirst e ++ "ToShortView"),
CVar (1, lowerFirst $ e ++ "List")])
manyToOneEntities ++
map (\ (ename,erel) ->
applyF (wuiModule "wMultiCheckSelect")
[CLambda [CPVar (1, lowerFirst ename)]
(list2ac [
applyF (html "htxt") [
applyF (entitiesToHtmlModule erdname,
lowerFirst ename ++ "ToShortView")
[CVar (1, lowerFirst ename)]
]]),
CVar (1, lowerFirst $ erel ++ ename ++ "List")
]) manyToManyEntities
)
),
applyF (spiceyModule, "renderLabels")
[constF (entitiesToHtmlModule erdname,
lowerFirst entityName ++ "LabelList")]
]
)]
|
|
demand: |
argument 2 |
|
deterministic: |
deterministic operation |
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,{Entity},_,_) |-> _}
|
|
name: |
wuiSpec |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
String -> Database.ERD.Entity -> [Database.ERD.Relationship] -> [Database.ERD.Entity] -> AbstractCurry.Types.CFuncDecl |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |