Mercurial > urweb
comparison tests/crud.ur @ 361:260b680a6a04
lform -> form
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 14 Oct 2008 16:41:48 -0400 |
parents | c1e96b387115 |
children | 24a31b35e08f |
comparison
equal
deleted
inserted
replaced
360:c1e96b387115 | 361:260b680a6a04 |
---|---|
52 | 52 |
53 fun update (id : int) = | 53 fun update (id : int) = |
54 fso <- oneOrNoRows (SELECT tab.{{mapT2T fstTT M.cols}} FROM tab WHERE tab.Id = {id}); | 54 fso <- oneOrNoRows (SELECT tab.{{mapT2T fstTT M.cols}} FROM tab WHERE tab.Id = {id}); |
55 case fso : (Basis.option {Tab : $(mapT2T fstTT M.cols)}) of | 55 case fso : (Basis.option {Tab : $(mapT2T fstTT M.cols)}) of |
56 None => return <xml><body>Not found!</body></xml> | 56 None => return <xml><body>Not found!</body></xml> |
57 | Some fs => return <xml><body><lform> | 57 | Some fs => return <xml><body><form> |
58 {foldT2R2 [fstTT] [colMeta] [fn cols :: {(Type * Type)} => xml form [] (mapT2T sndTT cols)] | 58 {foldT2R2 [fstTT] [colMeta] [fn cols :: {(Type * Type)} => xml form [] (mapT2T sndTT cols)] |
59 (fn (nm :: Name) (t :: (Type * Type)) (rest :: {(Type * Type)}) | 59 (fn (nm :: Name) (t :: (Type * Type)) (rest :: {(Type * Type)}) |
60 [[nm] ~ rest] (v : t.1) (col : colMeta t) | 60 [[nm] ~ rest] (v : t.1) (col : colMeta t) |
61 (acc : xml form [] (mapT2T sndTT rest)) => | 61 (acc : xml form [] (mapT2T sndTT rest)) => |
62 <xml> | 62 <xml> |
65 </xml>) | 65 </xml>) |
66 <xml/> | 66 <xml/> |
67 [M.cols] fs.Tab M.cols} | 67 [M.cols] fs.Tab M.cols} |
68 | 68 |
69 <submit action={save id}/> | 69 <submit action={save id}/> |
70 </lform></body></xml> | 70 </form></body></xml> |
71 | 71 |
72 fun delete (id : int) = | 72 fun delete (id : int) = |
73 () <- dml (DELETE FROM tab WHERE Id = {id}); | 73 () <- dml (DELETE FROM tab WHERE Id = {id}); |
74 return <xml><body> | 74 return <xml><body> |
75 The deed is done. | 75 The deed is done. |
115 {rows} | 115 {rows} |
116 </table> | 116 </table> |
117 | 117 |
118 <br/> | 118 <br/> |
119 | 119 |
120 <lform> | 120 <form> |
121 {foldT2R [colMeta] [fn cols :: {(Type * Type)} => xml form [] (mapT2T sndTT cols)] | 121 {foldT2R [colMeta] [fn cols :: {(Type * Type)} => xml form [] (mapT2T sndTT cols)] |
122 (fn (nm :: Name) (t :: (Type * Type)) (rest :: {(Type * Type)}) | 122 (fn (nm :: Name) (t :: (Type * Type)) (rest :: {(Type * Type)}) |
123 [[nm] ~ rest] (col : colMeta t) (acc : xml form [] (mapT2T sndTT rest)) => <xml> | 123 [[nm] ~ rest] (col : colMeta t) (acc : xml form [] (mapT2T sndTT rest)) => <xml> |
124 <li> {cdata col.Nam}: {col.Widget [nm]}</li> | 124 <li> {cdata col.Nam}: {col.Widget [nm]}</li> |
125 {useMore acc} | 125 {useMore acc} |
126 </xml>) | 126 </xml>) |
127 <xml/> | 127 <xml/> |
128 [M.cols] M.cols} | 128 [M.cols] M.cols} |
129 | 129 |
130 <submit action={create}/> | 130 <submit action={create}/> |
131 </lform> | 131 </form> |
132 </body></xml> | 132 </body></xml> |
133 | 133 |
134 end | 134 end |