-
Notifications
You must be signed in to change notification settings - Fork 16
/
discussion.urs
66 lines (54 loc) · 2.78 KB
/
discussion.urs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(* Discussions with topics described by a flexible type of keys *)
(* Levels of authorization to interact with the list of posts *)
datatype access =
Forbidden
(* May not have anything to do with this key *)
| Read
(* May only read posts *)
| Post of { User : string, MayEdit : bool, MayDelete : bool, MayMarkClosed : bool}
(* May read and make own posts, possibly with the ability to edit, delete, or close own posts/threads *)
| Admin of { User : string }
(* Full privileges *)
functor Make(M : sig
con key :: {Type}
con thread :: Name
constraint [thread] ~ [When, Who, Text, Closed, Private, Subject]
constraint key ~ [thread, When, Who, Text, Closed, Private, Subject]
val fl : folder key
val kinj : $(map sql_injectable key)
type text_internal
type text_config
val text : Widget.t string text_internal text_config
table message : (key ++ [thread = time, When = time, Who = string, Text = string])
val access : $key -> transaction access
val showOpenVsClosed : bool
(* Should we expose to users the idea of marking threads open/closed? *)
val allowPrivate : bool
(* May users create threads visible only to themselves and admins? *)
val onNewMessage : transaction (list string)
(* Run to get list of all users who have posted in the thread. *)
-> $(key ++ [thread = time, Subject = string, Who = string, Text = string])
-> transaction unit
(* Callback for every new message posted in any thread *)
end) : sig
include Ui.S where type input = $M.key
con thread = M.thread
(* Generate todo items for users tasked with responding to messages. *)
functor Todo(N : sig
con tag :: Name
con user :: Name
con aother :: {Type}
constraint M.key ~ aother
constraint [user] ~ (M.key ++ aother)
constraint [Assignee, Due, Done, Kind] ~ (M.key ++ [thread = time])
val inj : $(map sql_injectable_prim M.key)
table assignments : (M.key ++ [user = option string] ++ aother)
(* Recording who is responsible for which items *)
val title : string
val render : $(M.key ++ [thread = time]) -> string (* username *) -> xbody
end) : sig
type private
con tag = N.tag
val todo : Todo.t ([thread = time] ++ M.key) [tag = private]
end
end