Mercurial > urweb
annotate demo/more/decision.ur @ 1030:6bcc1020d5cd
Start of Decision
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Mon, 02 Nov 2009 15:48:06 -0500 |
parents | |
children | 5dccff15fa62 |
rev | line source |
---|---|
adamc@1030 | 1 val decision = {Nam = "Decision", |
adamc@1030 | 2 Initialize = None, |
adamc@1030 | 3 Show = fn bo => cdata (case bo of |
adamc@1030 | 4 None => "?" |
adamc@1030 | 5 | Some True => "Accept" |
adamc@1030 | 6 | Some False => "Reject"), |
adamc@1030 | 7 Inject = _} |
adamc@1030 | 8 |
adamc@1030 | 9 functor Make(M : sig |
adamc@1030 | 10 con paperOther :: {Type} |
adamc@1030 | 11 constraint [Id, Decision] ~ paperOther |
adamc@1030 | 12 include Conference.INPUT |
adamc@1030 | 13 where con paper = [Decision = option bool] ++ paperOther |
adamc@1030 | 14 end) = struct |
adamc@1030 | 15 open M |
adamc@1030 | 16 |
adamc@1030 | 17 val linksForChair = |
adamc@1030 | 18 let |
adamc@1030 | 19 fun makeDecisions () = |
adamc@1030 | 20 ps <- queryX (SELECT paper.Id, paper.Decision, paper.{{M.paperOther}} |
adamc@1030 | 21 FROM paper |
adamc@1030 | 22 ORDER BY paper.Id) |
adamc@1030 | 23 (fn r => <xml><tr> |
adamc@1030 | 24 <td>{useMore (summarizePaper (r.Paper -- #Id))}</td> |
adamc@1030 | 25 <td><entry> |
adamc@1030 | 26 <hidden{#Paper} value={show r.Paper.Id}/> |
adamc@1030 | 27 <select{#Decision}> |
adamc@1030 | 28 <option selected={r.Paper.Decision = None}>?</option> |
adamc@1030 | 29 <option selected={r.Paper.Decision = Some True}>Accept</option> |
adamc@1030 | 30 <option selected={r.Paper.Decision = Some False}>Reject</option> |
adamc@1030 | 31 </select></entry></td> |
adamc@1030 | 32 </tr></xml>); |
adamc@1030 | 33 return <xml><body> |
adamc@1030 | 34 <h1>Make acceptance decisions</h1> |
adamc@1030 | 35 |
adamc@1030 | 36 <form><subforms{#Papers}> |
adamc@1030 | 37 <table> |
adamc@1030 | 38 <tr> <th>Paper</th> <th>Decision</th> </tr> |
adamc@1030 | 39 {ps} |
adamc@1030 | 40 </table> |
adamc@1030 | 41 </subforms></form> |
adamc@1030 | 42 </body></xml> |
adamc@1030 | 43 in |
adamc@1030 | 44 <xml> |
adamc@1030 | 45 <li><a link={makeDecisions ()}>Make acceptance decisions</a></li> |
adamc@1030 | 46 </xml> |
adamc@1030 | 47 end |
adamc@1030 | 48 |
adamc@1030 | 49 val linksForPc = <xml/> |
adamc@1030 | 50 |
adamc@1030 | 51 con yourPaperTables = [] |
adamc@1030 | 52 constraint [Paper] ~ yourPaperTables |
adamc@1030 | 53 fun joinYourPaper [tabs] [paper] [[Paper] ~ tabs] [[Paper] ~ _] [tabs ~ yourPaperTables] [[Id] ~ paper] |
adamc@1030 | 54 uid (fi : sql_from_items ([Paper = [Id = paperId] ++ paper] ++ tabs)) = fi |
adamc@1030 | 55 end |