diff 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
line wrap: on
line diff
--- a/demo/more/conference.ur	Sun Nov 01 10:31:18 2009 -0500
+++ b/demo/more/conference.ur	Sun Nov 01 14:26:20 2009 -0500
@@ -12,12 +12,14 @@
     val paperId_inj : sql_injectable_prim paperId
     val paperId_show : show paperId
     val paperId_read : read paperId
+    val paperId_eq : eq paperId
     table paper : ([Id = paperId, Document = blob] ++ paper)
                       PRIMARY KEY Id
 
     val checkLogin : transaction (option {Id : userId, Nam : string, Chair : bool, OnPc : bool})
     val getLogin : transaction {Id : userId, Nam : string, Chair : bool, OnPc : bool}
     val getPcLogin : transaction {Id : userId, Nam : string, Chair : bool}
+    val checkChair : transaction unit
     val summarizePaper : ctx ::: {Unit} -> [[Body] ~ ctx] => $paper -> xml ([Body] ++ ctx) [] []
 end
 
@@ -27,6 +29,7 @@
     type paperId
 
     val linksForPc : xbody
+    val linksForChair : xbody
 
     con yourPaperTables :: {{Type}}
     constraint [Paper] ~ yourPaperTables
@@ -105,12 +108,20 @@
         else
             error <xml>You are not on the PC.</xml>
 
+    val checkChair =
+        r <- getLogin;
+        if r.Chair then
+            return ()
+        else
+            error <xml>You are not a chair.</xml>
+
     structure O = M.Make(struct
                              val user = user
                              val paper = paper
                              val checkLogin = checkLogin
                              val getLogin = getLogin
                              val getPcLogin = getPcLogin
+                             val checkChair = checkChair
                              val summarizePaper = @@M.summarizePaper
                          end)
 
@@ -203,7 +214,10 @@
                <div>Welcome, {[me.Nam]}!</div>
 
                {if me.Chair then
-                    <xml><li><a link={Users.main ()}>Manage users</a></li></xml>
+                    <xml>
+                      <li><a link={Users.main ()}>Manage users</a></li>
+                      {O.linksForChair}
+                    </xml>
                 else
                     <xml/>}