CurryInfo: spicey-4.2.0 / Spicey.ViewGeneration.wuiSpec

definition: Info
 
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: Info
 argument 2
deterministic: Info
 deterministic operation
failfree: Info
 <FAILING>
indeterministic: Info
 referentially transparent operation
infix: Info
 no fixity defined
iotype: Info
 {(_,{Entity},_,_) |-> _}
name: Info
 wuiSpec
precedence: Info
 no precedence defined
result-values: Info
 _
signature: Info
 String -> Database.ERD.Entity -> [Database.ERD.Relationship]
-> [Database.ERD.Entity] -> AbstractCurry.Types.CFuncDecl
solution-complete: Info
 operation might suspend on free variables
terminating: Info
 possibly non-terminating
totally-defined: Info
 possibly non-reducible on same data term