Software /
code /
prosody-modules
Comparison
mod_incidents_handling/incidents_handling/mod_incidents_handling.lua @ 920:f183de41b7c6
mod_incidents_handling: "cancel" action doesn't need to be specified, suppresses a (harmless) log error.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Tue, 05 Mar 2013 01:10:08 +0100 |
parent | 918:dec71c31fb78 |
child | 984:c4995b56c358 |
comparison
equal
deleted
inserted
replaced
919:7d72fb45b1e4 | 920:f183de41b7c6 |
---|---|
214 if state then | 214 if state then |
215 if state.step == 1 then | 215 if state.step == 1 then |
216 if data.action == "cancel" then | 216 if data.action == "cancel" then |
217 return { status = "canceled" } | 217 return { status = "canceled" } |
218 elseif data.action == "prev" then | 218 elseif data.action == "prev" then |
219 return { status = "executing", actions = { "next", "cancel", default = "next" }, form = list_incidents_layout }, {} | 219 return { status = "executing", actions = { "next", default = "next" }, form = list_incidents_layout }, {} |
220 end | 220 end |
221 | 221 |
222 local single_incident_layout = state.form_layout | 222 local single_incident_layout = state.form_layout |
223 local fields = single_incident_layout:data(data.form) | 223 local fields = single_incident_layout:data(data.form) |
224 | 224 |
235 if data.action == "cancel" then return { status = "canceled" } end | 235 if data.action == "cancel" then return { status = "canceled" } end |
236 local fields = list_incidents_layout:data(data.form) | 236 local fields = list_incidents_layout:data(data.form) |
237 | 237 |
238 if fields.ids then | 238 if fields.ids then |
239 local single_incident_layout = ih_lib.render_single(incidents[fields.ids]) | 239 local single_incident_layout = ih_lib.render_single(incidents[fields.ids]) |
240 return { status = "executing", actions = { "prev", "cancel", "complete", default = "complete" }, form = single_incident_layout }, { step = 1, form_layout = single_incident_layout, id = fields.ids } | 240 return { status = "executing", actions = { "prev", "complete", default = "complete" }, form = single_incident_layout }, { step = 1, form_layout = single_incident_layout, id = fields.ids } |
241 else | 241 else |
242 return { status = "completed", error = { message = "You need to select the report ID to continue." } } | 242 return { status = "completed", error = { message = "You need to select the report ID to continue." } } |
243 end | 243 end |
244 end | 244 end |
245 else | 245 else |
246 return { status = "executing", actions = { "next", "cancel", default = "next" }, form = list_incidents_layout }, {} | 246 return { status = "executing", actions = { "next", default = "next" }, form = list_incidents_layout }, {} |
247 end | 247 end |
248 end | 248 end |
249 | 249 |
250 local function send_inquiry_command_handler(self, data, state) | 250 local function send_inquiry_command_handler(self, data, state) |
251 local send_inquiry_layout = dataforms_new{ | 251 local send_inquiry_layout = dataforms_new{ |