rev |
line source |
bsw/jbe@1309
|
1 function _G.ontomap_get_instances(event)
|
bsw/jbe@1309
|
2 if true then return {} end
|
bsw/jbe@1309
|
3 local url = config.ontomap.base_url .. "instances/Issue?geometries=true&descriptions=true"
|
bsw/jbe@1309
|
4 print("OnToMap>>")
|
bsw/jbe@1309
|
5
|
bsw/jbe@1309
|
6 local output, err, status = extos.pfilter(doc, "curl", "-X", "GET", "-H", "Content-Type: application/json", "--cert", config.ontomap.client_cert_file, "-d", "@-", url)
|
bsw/jbe@1309
|
7 print(output)
|
bsw/jbe@1309
|
8
|
bsw/jbe@1309
|
9 local data = json.import(output)
|
bsw/jbe@1309
|
10
|
bsw/jbe@1309
|
11 if not data then
|
bsw/jbe@1309
|
12 return {}
|
bsw/jbe@1309
|
13 end
|
bsw/jbe@1309
|
14
|
bsw/jbe@1309
|
15 if data.type ~= "FeatureCollection" or not data.features then
|
bsw/jbe@1309
|
16 return {}
|
bsw/jbe@1309
|
17 end
|
bsw/jbe@1309
|
18
|
bsw/jbe@1309
|
19 local instances = {}
|
bsw/jbe@1309
|
20 for i, feature in ipairs(data.features) do
|
bsw/jbe@1309
|
21 if feature.geometry then
|
bsw/jbe@1309
|
22 table.insert(instances, {
|
bsw/jbe@1309
|
23 application = feature.applicationName,
|
bsw/jbe@1309
|
24 title = feature.hasName,
|
bsw/jbe@1309
|
25 description = slot.use_temporary(function()
|
bsw/jbe@1309
|
26 ui.link{ external = feature.properties.external_url, text = feature.properties.hasName or "" }
|
bsw/jbe@1309
|
27 ui.container{ content = feature.hasDescription }
|
bsw/jbe@1309
|
28 end),
|
bsw/jbe@1309
|
29 lon = feature.geometry.coordinates[1],
|
bsw/jbe@1309
|
30 lat = feature.geometry.coordinates[2],
|
bsw/jbe@1309
|
31 label = "IMC" .. feature.properties.hasID,
|
bsw/jbe@1309
|
32 type = "Improve My City"
|
bsw/jbe@1309
|
33 })
|
bsw/jbe@1309
|
34 print(feature.applicationName, feature.properties.hasName, feature.properties.hasDescription)
|
bsw/jbe@1309
|
35 end
|
bsw/jbe@1309
|
36 end
|
bsw/jbe@1309
|
37 return instances
|
bsw/jbe@1309
|
38
|
bsw/jbe@1309
|
39 end
|
bsw/jbe@1309
|
40
|
bsw/jbe@1309
|
41
|
bsw/jbe@1309
|
42 local function new_log_event(event, actor, activity_type)
|
bsw/jbe@1309
|
43 local e = json.object{
|
bsw/jbe@1309
|
44 activity_type = activity_type,
|
bsw/jbe@1309
|
45 activity_objects = json.array(),
|
bsw/jbe@1309
|
46 references = json.array(),
|
bsw/jbe@1309
|
47 visibility_details = json.array(),
|
bsw/jbe@1309
|
48 details = json.object()
|
bsw/jbe@1309
|
49 }
|
bsw/jbe@1309
|
50 e.actor = actor
|
bsw/jbe@1309
|
51 e.timestamp = math.floor(event.occurrence_epoch * 1000)
|
bsw/jbe@1309
|
52 return e
|
bsw/jbe@1309
|
53 end
|
bsw/jbe@1309
|
54
|
bsw/jbe@1309
|
55 local function new_activity_object(attr)
|
bsw/jbe@1309
|
56 return json.object{
|
bsw/jbe@1309
|
57 type = "Feature",
|
bsw/jbe@1309
|
58 geometry = attr.geometry or json.null,
|
bsw/jbe@1309
|
59 properties = json.object{
|
bsw/jbe@1309
|
60 hasType = attr.type,
|
bsw/jbe@1309
|
61 external_url = attr.url
|
bsw/jbe@1309
|
62 }
|
bsw/jbe@1309
|
63 }
|
bsw/jbe@1309
|
64 end
|
bsw/jbe@1309
|
65
|
bsw@1519
|
66 local function new_reference_object(url, application, type)
|
bsw/jbe@1309
|
67 return json.object{
|
bsw/jbe@1309
|
68 application = application or config.ontomap.application_ident,
|
bsw@1519
|
69 external_url = url,
|
bsw@1519
|
70 type = type
|
bsw/jbe@1309
|
71 }
|
bsw/jbe@1309
|
72 end
|
bsw/jbe@1309
|
73
|
bsw/jbe@1309
|
74 local function log_to_ontomap(log_events)
|
bsw/jbe@1309
|
75 if json.type(log_events) == "object" then
|
bsw/jbe@1309
|
76 log_events = json.array{ log_events }
|
bsw/jbe@1309
|
77 end
|
bsw/jbe@1309
|
78 for i, log_event in ipairs(log_events) do
|
bsw/jbe@1309
|
79 if #(log_event.activity_objects) == 0 then
|
bsw/jbe@1309
|
80 log_event.activity_objects = nil
|
bsw/jbe@1309
|
81 end
|
bsw/jbe@1309
|
82 if #(log_event.references) == 0 then
|
bsw/jbe@1309
|
83 log_event.references = nil
|
bsw/jbe@1309
|
84 end
|
bsw/jbe@1309
|
85 if #(log_event.visibility_details) == 0 then
|
bsw/jbe@1309
|
86 log_event.visibility_details = nil
|
bsw/jbe@1309
|
87 end
|
bsw/jbe@1309
|
88 if not (next(log_event.details)) then -- TODO
|
bsw/jbe@1309
|
89 log_event.details = nil
|
bsw/jbe@1309
|
90 end
|
bsw/jbe@1309
|
91 end
|
bsw/jbe@1309
|
92
|
bsw/jbe@1309
|
93 local doc = json.export(json.object{
|
bsw/jbe@1309
|
94 event_list = log_events
|
bsw/jbe@1309
|
95 }, " ")
|
bsw/jbe@1309
|
96
|
bsw/jbe@1309
|
97 local url = config.ontomap.base_url .. "logger/events"
|
bsw/jbe@1309
|
98 print("OnToMap<<")
|
bsw/jbe@1309
|
99 print(doc)
|
bsw/jbe@1309
|
100
|
bsw/jbe@1309
|
101 local output, err, status = extos.pfilter(doc, "curl", "-X", "POST", "-H", "Content-Type: application/json", "--cert", config.ontomap.client_cert_file, "-d", "@-", url)
|
bsw/jbe@1309
|
102
|
bsw/jbe@1309
|
103 print("---------")
|
bsw/jbe@1309
|
104 print(output)
|
bsw/jbe@1309
|
105 print("---------")
|
bsw/jbe@1309
|
106
|
bsw/jbe@1309
|
107 if err then
|
bsw/jbe@1309
|
108 -- TODO log error
|
bsw/jbe@1309
|
109 end
|
bsw/jbe@1309
|
110 end
|
bsw/jbe@1309
|
111
|
bsw/jbe@1309
|
112 local function url_for(relation, id)
|
bsw/jbe@1309
|
113 return config.absolute_base_url .. relation .. "/show/" .. id .. ".html"
|
bsw/jbe@1309
|
114 end
|
bsw/jbe@1309
|
115
|
bsw/jbe@1309
|
116
|
bsw/jbe@1309
|
117 local function unit_updated(event, event_type)
|
bsw/jbe@1309
|
118 local log_event = new_log_event(event, 0, event_type == "created" and "object_created" or "object_updated")
|
bsw/jbe@1309
|
119 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
120 type = "unit",
|
bsw/jbe@1309
|
121 url = url_for("unit", event.unit_id)
|
bsw/jbe@1309
|
122 })
|
bsw/jbe@1309
|
123 log_event.details.active = event.unit.active
|
bsw/jbe@1309
|
124 log_event.details.name = event.unit.name
|
bsw/jbe@1309
|
125 log_event.details.description = event.unit.description
|
bsw/jbe@1309
|
126 log_event.details.external_reference = event.unit.external_reference
|
bsw/jbe@1309
|
127 log_event.details.region = event.unit.region
|
bsw/jbe@1309
|
128 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
129 end
|
bsw/jbe@1309
|
130
|
bsw/jbe@1309
|
131 local function area_updated(event, event_type)
|
bsw/jbe@1309
|
132 local log_event = new_log_event(event, 0, event_type == "created" and "object_created" or "object_updated")
|
bsw/jbe@1309
|
133 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
134 type = "area",
|
bsw/jbe@1309
|
135 url = url_for("area", event.area_id)
|
bsw/jbe@1309
|
136 })
|
bsw/jbe@1309
|
137 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
138 url_for("unit", event.area.unit_id)
|
bsw/jbe@1309
|
139 ))
|
bsw/jbe@1309
|
140 log_event.details.active = event.area.active
|
bsw/jbe@1309
|
141 log_event.details.name = event.area.name
|
bsw/jbe@1309
|
142 log_event.details.description = event.area.description
|
bsw/jbe@1309
|
143 log_event.details.external_reference = event.area.external_reference
|
bsw/jbe@1309
|
144 log_event.details.region = event.area.region
|
bsw/jbe@1309
|
145 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
146 end
|
bsw/jbe@1309
|
147
|
bsw/jbe@1309
|
148 local function policy_updated(event, event_type)
|
bsw/jbe@1309
|
149 local log_event = new_log_event(event, 0, event_type == "created" and "object_created" or "object_updated")
|
bsw/jbe@1309
|
150 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
151 type = "policy",
|
bsw/jbe@1309
|
152 url = url_for("policy", event.policy_id)
|
bsw/jbe@1309
|
153 })
|
bsw/jbe@1309
|
154 log_event.details.active = event.policy.active
|
bsw/jbe@1309
|
155 log_event.details.name = event.policy.name
|
bsw/jbe@1309
|
156 log_event.details.description = event.policy.description
|
bsw/jbe@1309
|
157 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
158 end
|
bsw/jbe@1309
|
159
|
bsw/jbe@1309
|
160 local mapper = {
|
bsw/jbe@1309
|
161
|
bsw/jbe@1309
|
162 unit_created = function(event)
|
bsw/jbe@1309
|
163 unit_updated(event, "created")
|
bsw/jbe@1309
|
164 end,
|
bsw/jbe@1309
|
165
|
bsw/jbe@1309
|
166 unit_updated = function(event)
|
bsw/jbe@1309
|
167 unit_updated(event, "updated")
|
bsw/jbe@1309
|
168 end,
|
bsw/jbe@1309
|
169
|
bsw/jbe@1309
|
170 area_created = function(event)
|
bsw/jbe@1309
|
171 area_updated(event, "created")
|
bsw/jbe@1309
|
172 end,
|
bsw/jbe@1309
|
173
|
bsw/jbe@1309
|
174 area_updated = function(event)
|
bsw/jbe@1309
|
175 area_updated(event, "updated")
|
bsw/jbe@1309
|
176 end,
|
bsw/jbe@1309
|
177
|
bsw/jbe@1309
|
178 policy_created = function(event)
|
bsw/jbe@1309
|
179 policy_updated(event, "created")
|
bsw/jbe@1309
|
180 end,
|
bsw/jbe@1309
|
181
|
bsw/jbe@1309
|
182 policy_updated = function(event)
|
bsw/jbe@1309
|
183 policy_updated(event, "updated")
|
bsw/jbe@1309
|
184 end,
|
bsw/jbe@1309
|
185
|
bsw/jbe@1309
|
186 issue_state_changed = function(event)
|
bsw/jbe@1309
|
187 local log_event = new_log_event(event, 0, "issue_status_updated")
|
bsw/jbe@1309
|
188 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
189 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
190 ))
|
bsw/jbe@1309
|
191 log_event.details.new_issue_state = event.state
|
bsw/jbe@1309
|
192 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
193 end,
|
bsw/jbe@1309
|
194
|
bsw/jbe@1309
|
195 initiative_created_in_new_issue = function(event)
|
bsw/jbe@1309
|
196 local log_events = json.array()
|
bsw/jbe@1309
|
197
|
bsw/jbe@1309
|
198 local log_event = new_log_event(event, 0, "object_created")
|
bsw/jbe@1309
|
199 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
200 type = "issue",
|
bsw/jbe@1309
|
201 url = url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
202 })
|
bsw/jbe@1309
|
203 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
204 url_for("policy", event.issue.policy_id)
|
bsw/jbe@1309
|
205 ))
|
bsw/jbe@1309
|
206 log_event.details.new_issue_state = event.state
|
bsw/jbe@1309
|
207 table.insert(log_events, log_event)
|
bsw@1519
|
208
|
bsw/jbe@1309
|
209 local log_event = new_log_event(event, event.member_id, "object_created")
|
bsw@1519
|
210
|
bsw@1519
|
211 local location = event.initiative.location
|
bsw@1527
|
212 if location and location.marker_link then
|
bsw@1519
|
213 local marker_link = location.marker_link
|
bsw@1519
|
214 location.marker_link = nil
|
bsw@1519
|
215 table.insert(log_event.references, new_reference_object(
|
bsw@1519
|
216 marker_link, config.firstlife.application_ident, "BELONGS_TO"
|
bsw@1519
|
217 ))
|
bsw@1519
|
218 end
|
bsw@1519
|
219
|
bsw@1519
|
220 local activity_object = new_activity_object{
|
bsw/jbe@1309
|
221 type = "initiative",
|
bsw/jbe@1309
|
222 url = url_for("initiative", event.initiative_id),
|
bsw@1519
|
223 geometry = location
|
bsw@1519
|
224 }
|
bsw@1519
|
225 activity_object.properties.name = event.initiative.name
|
bsw@1519
|
226 table.insert(log_event.activity_objects, activity_object)
|
bsw/jbe@1309
|
227 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
228 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
229 ))
|
bsw/jbe@1309
|
230 table.insert(log_events, log_event)
|
bsw/jbe@1309
|
231
|
bsw/jbe@1309
|
232 log_to_ontomap(log_events)
|
bsw/jbe@1309
|
233 end,
|
bsw/jbe@1309
|
234
|
bsw/jbe@1309
|
235 initiative_created_in_existing_issue = function(event)
|
bsw/jbe@1309
|
236 local log_event = new_log_event(event, event.member_id, "object_created")
|
bsw@1519
|
237 local location = event.initiative.location
|
bsw@1519
|
238 if location and location.marker_link then
|
bsw@1519
|
239 local marker_link = location.marker_link
|
bsw@1519
|
240 location.marker_link = nil
|
bsw@1519
|
241 table.insert(log_event.references, new_reference_object(
|
bsw@1519
|
242 marker_link, config.firstlife.application_ident, "BELONGS_TO"
|
bsw@1519
|
243 ))
|
bsw@1519
|
244 end
|
bsw@1519
|
245 local activity_object = new_activity_object{
|
bsw/jbe@1309
|
246 type = "initiative",
|
bsw/jbe@1309
|
247 url = url_for("initiative", event.initiative_id),
|
bsw@1519
|
248 geometry = location
|
bsw@1519
|
249 }
|
bsw@1519
|
250 activity_object.properties.name = event.initiative.name
|
bsw@1519
|
251 table.insert(log_event.activity_objects, activity_object)
|
bsw/jbe@1309
|
252 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
253 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
254 ))
|
bsw/jbe@1309
|
255 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
256 end,
|
bsw/jbe@1309
|
257
|
bsw/jbe@1309
|
258 initiative_revoked = function(event)
|
bsw/jbe@1309
|
259 -- TODO -> which activity?
|
bsw/jbe@1309
|
260 end,
|
bsw/jbe@1309
|
261
|
bsw/jbe@1309
|
262 new_draft_created = function(event)
|
bsw/jbe@1309
|
263 local log_event = new_log_event(event, event.member_id, "object_updated")
|
bsw/jbe@1309
|
264 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
265 type = "initiative",
|
bsw/jbe@1309
|
266 url = url_for("initiative", event.issue_id)
|
bsw/jbe@1309
|
267 })
|
bsw/jbe@1309
|
268 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
269 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
270 ))
|
bsw/jbe@1309
|
271 log_event.details.name = event.initiative.name
|
bsw/jbe@1309
|
272 log_event.details.location = event.initiative.current_draft.location
|
bsw/jbe@1309
|
273 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
274 end,
|
bsw/jbe@1309
|
275
|
bsw/jbe@1309
|
276 interest = function(event)
|
bsw/jbe@1309
|
277 local activity_type = event.boolean_value and "interest_added" or "interest_removed"
|
bsw/jbe@1309
|
278 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
279 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
280 url_for("issue", event.issue_id)
|
bsw/jbe@1309
|
281 ))
|
bsw/jbe@1309
|
282 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
283 end,
|
bsw/jbe@1309
|
284
|
bsw/jbe@1309
|
285 initiator = function(event)
|
bsw/jbe@1309
|
286 local activity_type = event.boolean_value and "initiator_added" or "initiator_removed"
|
bsw/jbe@1309
|
287 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
288 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
289 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
290 ))
|
bsw/jbe@1309
|
291 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
292 end,
|
bsw/jbe@1309
|
293
|
bsw/jbe@1309
|
294 support = function(event)
|
bsw/jbe@1309
|
295 local activity_type = event.boolean_value and "support_added" or "support_removed"
|
bsw/jbe@1309
|
296 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
297 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
298 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
299 ))
|
bsw/jbe@1309
|
300 log_event.details.draft_id = event.draft_id
|
bsw/jbe@1309
|
301 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
302 end,
|
bsw/jbe@1309
|
303
|
bsw/jbe@1309
|
304 support_updated = function(event)
|
bsw/jbe@1309
|
305 local log_event = new_log_event(event, event.member_id, "support_updated")
|
bsw/jbe@1309
|
306 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
307 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
308 ))
|
bsw/jbe@1309
|
309 log_event.details.draft_id = event.draft_id
|
bsw/jbe@1309
|
310 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
311 end,
|
bsw/jbe@1309
|
312
|
bsw/jbe@1309
|
313 suggestion_created = function(event)
|
bsw/jbe@1309
|
314 local log_event = new_log_event(event, event.member_id, "object_created")
|
bsw/jbe@1309
|
315 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
316 type = "suggestion",
|
bsw/jbe@1309
|
317 url = url_for("suggestion", event.suggestion_id)
|
bsw/jbe@1309
|
318 })
|
bsw/jbe@1309
|
319 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
320 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
321 ))
|
bsw/jbe@1309
|
322 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
323 end,
|
bsw/jbe@1309
|
324
|
bsw/jbe@1309
|
325 suggestion_removed = function(event)
|
bsw/jbe@1309
|
326 local log_event = new_log_event(event, 0, "object_removed")
|
bsw/jbe@1309
|
327 table.insert(log_event.activity_objects, new_activity_object{
|
bsw/jbe@1309
|
328 type = "suggestion",
|
bsw/jbe@1309
|
329 url = url_for("suggestion", event.suggestion_id)
|
bsw/jbe@1309
|
330 })
|
bsw/jbe@1309
|
331 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
332 url_for("initiative", event.initiative_id)
|
bsw/jbe@1309
|
333 ))
|
bsw/jbe@1309
|
334 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
335 end,
|
bsw/jbe@1309
|
336
|
bsw/jbe@1309
|
337 suggestion_rated = function(event)
|
bsw/jbe@1309
|
338 local log_event = new_log_event(event, event.member_id, "suggestion_rated")
|
bsw/jbe@1309
|
339 table.insert(log_event.references, new_reference_object(
|
bsw/jbe@1309
|
340 url_for("suggestion", event.suggestion_id)
|
bsw/jbe@1309
|
341 ))
|
bsw/jbe@1309
|
342 log_event.details.degree = event.numeric_value
|
bsw/jbe@1309
|
343 log_event.details.fulfilled = event.boolean_value or json.null
|
bsw/jbe@1309
|
344 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
345 end,
|
bsw/jbe@1309
|
346
|
bsw/jbe@1309
|
347 delegation = function(event)
|
bsw/jbe@1309
|
348 -- TODO
|
bsw/jbe@1309
|
349 end,
|
bsw/jbe@1309
|
350
|
bsw/jbe@1309
|
351 member_activated = function(event)
|
bsw/jbe@1309
|
352 local log_event = new_log_event(event, event.member_id, "account_registered")
|
bsw/jbe@1309
|
353 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
354 end,
|
bsw/jbe@1309
|
355
|
bsw/jbe@1309
|
356 member_removed = function(event)
|
bsw/jbe@1309
|
357 -- TODO -> which activity to log?
|
bsw/jbe@1309
|
358 end,
|
bsw/jbe@1309
|
359
|
bsw/jbe@1309
|
360 member_active = function(event)
|
bsw/jbe@1309
|
361 -- TODO -> which activity to log?
|
bsw/jbe@1309
|
362 end,
|
bsw/jbe@1309
|
363
|
bsw/jbe@1309
|
364 member_name_updated = function(event)
|
bsw/jbe@1309
|
365 local log_event = new_log_event(event, event.member_id, "screen_name_changed")
|
bsw/jbe@1309
|
366 log_event.details.screen_name = event.text_value
|
bsw/jbe@1309
|
367 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
368 end,
|
bsw/jbe@1309
|
369
|
bsw/jbe@1309
|
370 member_profile_updated = function(event)
|
bsw/jbe@1309
|
371 local log_event = new_log_event(event, event.member_id, "profile_updated")
|
bsw/jbe@1309
|
372 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
373 end,
|
bsw/jbe@1309
|
374
|
bsw/jbe@1309
|
375 member_image_updated = function(event)
|
bsw/jbe@1309
|
376 local log_event = new_log_event(event, event.member_id, "avatar_changed")
|
bsw/jbe@1309
|
377 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
378 end,
|
bsw/jbe@1309
|
379
|
bsw/jbe@1309
|
380 contact = function(event)
|
bsw/jbe@1309
|
381 local activity_type = event.boolean_value and "contact_published" or "contact_unpublished"
|
bsw/jbe@1309
|
382 local log_event = new_log_event(event, event.member_id, activity_type)
|
bsw/jbe@1309
|
383 log_event.details.other_member_id = event.other_member_id
|
bsw/jbe@1309
|
384 log_to_ontomap(log_event)
|
bsw/jbe@1309
|
385 end
|
bsw/jbe@1309
|
386
|
bsw/jbe@1309
|
387 }
|
bsw/jbe@1309
|
388
|
bsw/jbe@1309
|
389 function _G.ontomap_log_event(event)
|
bsw/jbe@1309
|
390
|
bsw/jbe@1309
|
391 if mapper[event.event] then
|
bsw/jbe@1309
|
392 local e = Event:new_selector()
|
bsw/jbe@1309
|
393 :add_where{ "id = ?", event.id }
|
bsw/jbe@1309
|
394 :add_field("extract(epoch from occurrence)", "occurrence_epoch")
|
bsw/jbe@1309
|
395 :optional_object_mode()
|
bsw/jbe@1309
|
396 :exec()
|
bsw/jbe@1309
|
397 if e then
|
bsw/jbe@1309
|
398 mapper[event.event](e)
|
bsw/jbe@1309
|
399 end
|
bsw/jbe@1309
|
400 end
|
bsw/jbe@1309
|
401
|
bsw/jbe@1309
|
402
|
bsw/jbe@1309
|
403 end
|