comparison demo/more/conference.ur @ 1025:7facf72aaf0a

Initial form for paper assignment
author Adam Chlipala <adamc@hcoop.net>
date Sun, 01 Nov 2009 14:26:20 -0500
parents e46227efcbba
children be1aec7333a5
comparison
equal deleted inserted replaced
1024:93415bcf54c0 1025:7facf72aaf0a
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 val paperId_show : show paperId 13 val paperId_show : show paperId
14 val paperId_read : read paperId 14 val paperId_read : read paperId
15 val paperId_eq : eq paperId
15 table paper : ([Id = paperId, Document = blob] ++ paper) 16 table paper : ([Id = paperId, Document = blob] ++ paper)
16 PRIMARY KEY Id 17 PRIMARY KEY Id
17 18
18 val checkLogin : transaction (option {Id : userId, Nam : string, Chair : bool, OnPc : bool}) 19 val checkLogin : transaction (option {Id : userId, Nam : string, Chair : bool, OnPc : bool})
19 val getLogin : transaction {Id : userId, Nam : string, Chair : bool, OnPc : bool} 20 val getLogin : transaction {Id : userId, Nam : string, Chair : bool, OnPc : bool}
20 val getPcLogin : transaction {Id : userId, Nam : string, Chair : bool} 21 val getPcLogin : transaction {Id : userId, Nam : string, Chair : bool}
22 val checkChair : transaction unit
21 val summarizePaper : ctx ::: {Unit} -> [[Body] ~ ctx] => $paper -> xml ([Body] ++ ctx) [] [] 23 val summarizePaper : ctx ::: {Unit} -> [[Body] ~ ctx] => $paper -> xml ([Body] ++ ctx) [] []
22 end 24 end
23 25
24 signature OUTPUT = sig 26 signature OUTPUT = sig
25 con paper :: {Type} 27 con paper :: {Type}
26 type userId 28 type userId
27 type paperId 29 type paperId
28 30
29 val linksForPc : xbody 31 val linksForPc : xbody
32 val linksForChair : xbody
30 33
31 con yourPaperTables :: {{Type}} 34 con yourPaperTables :: {{Type}}
32 constraint [Paper] ~ yourPaperTables 35 constraint [Paper] ~ yourPaperTables
33 val joinYourPaper : tabs ::: {{Type}} -> paper ::: {Type} 36 val joinYourPaper : tabs ::: {{Type}} -> paper ::: {Type}
34 -> [[Paper] ~ tabs] => [[Paper] ~ yourPaperTables] => [tabs ~ yourPaperTables] => [[Id] ~ paper] => 37 -> [[Paper] ~ tabs] => [[Paper] ~ yourPaperTables] => [tabs ~ yourPaperTables] => [[Id] ~ paper] =>
103 if r.OnPc then 106 if r.OnPc then
104 return (r -- #OnPc) 107 return (r -- #OnPc)
105 else 108 else
106 error <xml>You are not on the PC.</xml> 109 error <xml>You are not on the PC.</xml>
107 110
111 val checkChair =
112 r <- getLogin;
113 if r.Chair then
114 return ()
115 else
116 error <xml>You are not a chair.</xml>
117
108 structure O = M.Make(struct 118 structure O = M.Make(struct
109 val user = user 119 val user = user
110 val paper = paper 120 val paper = paper
111 val checkLogin = checkLogin 121 val checkLogin = checkLogin
112 val getLogin = getLogin 122 val getLogin = getLogin
113 val getPcLogin = getPcLogin 123 val getPcLogin = getPcLogin
124 val checkChair = checkChair
114 val summarizePaper = @@M.summarizePaper 125 val summarizePaper = @@M.summarizePaper
115 end) 126 end)
116 127
117 val checkOnPc = 128 val checkOnPc =
118 r <- getLogin; 129 r <- getLogin;
201 </xml> 212 </xml>
202 | Some me => <xml> 213 | Some me => <xml>
203 <div>Welcome, {[me.Nam]}!</div> 214 <div>Welcome, {[me.Nam]}!</div>
204 215
205 {if me.Chair then 216 {if me.Chair then
206 <xml><li><a link={Users.main ()}>Manage users</a></li></xml> 217 <xml>
218 <li><a link={Users.main ()}>Manage users</a></li>
219 {O.linksForChair}
220 </xml>
207 else 221 else
208 <xml/>} 222 <xml/>}
209 223
210 {if me.OnPc then 224 {if me.OnPc then
211 <xml> 225 <xml>