comparison demo/more/conference.ur @ 1023:e46227efcbba

Bidding interface
author Adam Chlipala <adamc@hcoop.net>
date Sun, 01 Nov 2009 10:20:20 -0500
parents 4de35df3d545
children 7facf72aaf0a
comparison
equal deleted inserted replaced
1022:4de35df3d545 1023:e46227efcbba
1 signature INPUT = sig 1 signature INPUT = sig
2 con paper :: {(Type * Type)} 2 con paper :: {Type}
3 constraint [Id, Document] ~ paper 3 constraint [Id, Document] ~ paper
4 4
5 type userId 5 type userId
6 val userId_inj : sql_injectable_prim userId 6 val userId_inj : sql_injectable_prim userId
7 table user : {Id : userId, Nam : string, Password : string, Chair : bool, OnPc : bool} 7 table user : {Id : userId, Nam : string, Password : string, Chair : bool, OnPc : bool}
8 PRIMARY KEY Id, 8 PRIMARY KEY Id,
9 CONSTRAINT Nam UNIQUE Nam 9 CONSTRAINT Nam UNIQUE Nam
10 10
11 type paperId 11 type paperId
12 val paperId_inj : sql_injectable_prim paperId 12 val paperId_inj : sql_injectable_prim paperId
13 table paper : ([Id = paperId, Document = blob] ++ map fst paper) 13 val paperId_show : show paperId
14 val paperId_read : read paperId
15 table paper : ([Id = paperId, Document = blob] ++ paper)
14 PRIMARY KEY Id 16 PRIMARY KEY Id
15 17
16 val checkLogin : transaction (option {Id : userId, Nam : string, Chair : bool, OnPc : bool}) 18 val checkLogin : transaction (option {Id : userId, Nam : string, Chair : bool, OnPc : bool})
17 val getLogin : transaction {Id : userId, Nam : string, Chair : bool, OnPc : bool} 19 val getLogin : transaction {Id : userId, Nam : string, Chair : bool, OnPc : bool}
20 val getPcLogin : transaction {Id : userId, Nam : string, Chair : bool}
21 val summarizePaper : ctx ::: {Unit} -> [[Body] ~ ctx] => $paper -> xml ([Body] ++ ctx) [] []
18 end 22 end
19 23
20 signature OUTPUT = sig 24 signature OUTPUT = sig
25 con paper :: {Type}
21 type userId 26 type userId
22 type paperId 27 type paperId
23 28
24 val linksForPc : xbody 29 val linksForPc : xbody
25 30
43 constraint [Paper, User] ~ review 48 constraint [Paper, User] ~ review
44 val review : $(map meta review) 49 val review : $(map meta review)
45 val reviewFolder : folder review 50 val reviewFolder : folder review
46 51
47 val submissionDeadline : time 52 val submissionDeadline : time
48 val summarizePaper : $(map fst paper) -> xbody 53 val summarizePaper : ctx ::: {Unit} -> [[Body] ~ ctx] => $(map fst paper) -> xml ([Body] ++ ctx) [] []
49 54
50 functor Make (M : INPUT where con paper = paper) 55 functor Make (M : INPUT where con paper = map fst paper)
51 : OUTPUT where con userId = M.userId 56 : OUTPUT where con paper = map fst paper
57 where con userId = M.userId
52 where con paperId = M.paperId 58 where con paperId = M.paperId
53 end) = struct 59 end) = struct
54 60
55 table user : {Id : int, Nam : string, Password : string, Chair : bool, OnPc : bool} 61 table user : {Id : int, Nam : string, Password : string, Chair : bool, OnPc : bool}
56 PRIMARY KEY Id, 62 PRIMARY KEY Id,
90 ro <- checkLogin; 96 ro <- checkLogin;
91 case ro of 97 case ro of
92 None => error <xml>You must be logged in to do that.</xml> 98 None => error <xml>You must be logged in to do that.</xml>
93 | Some r => return r 99 | Some r => return r
94 100
101 val getPcLogin =
102 r <- getLogin;
103 if r.OnPc then
104 return (r -- #OnPc)
105 else
106 error <xml>You are not on the PC.</xml>
107
95 structure O = M.Make(struct 108 structure O = M.Make(struct
96 val user = user 109 val user = user
97 val paper = paper 110 val paper = paper
98 val checkLogin = checkLogin 111 val checkLogin = checkLogin
99 val getLogin = getLogin 112 val getLogin = getLogin
113 val getPcLogin = getPcLogin
114 val summarizePaper = @@M.summarizePaper
100 end) 115 end)
101 116
102 val checkOnPc = 117 val checkOnPc =
103 r <- getLogin; 118 r <- getLogin;
104 if r.OnPc then 119 if r.OnPc then
193 <xml/>} 208 <xml/>}
194 209
195 {if me.OnPc then 210 {if me.OnPc then
196 <xml> 211 <xml>
197 <li><a link={all ()}>All papers</a></li> 212 <li><a link={all ()}>All papers</a></li>
213 <li><a link={your ()}>Your papers</a></li>
198 {O.linksForPc} 214 {O.linksForPc}
199 </xml> 215 </xml>
200 else 216 else
201 <xml/>} 217 <xml/>}
202 218