liquid_feedback_frontend
view app/main/draft/_action/add.lua @ 159:5d797c6706d5
implement quorum display
show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Sat Oct 09 03:42:48 2010 +0200 (2010-10-09) |
parents | 6a12fb7e4963 |
children | cda574707b1c |
line source
1 local tmp = db:query({ "SELECT text_entries_left FROM member_contingent_left WHERE member_id = ?", app.session.member.id }, "opt_object")
2 if tmp and tmp.text_entries_left and tmp.text_entries_left < 1 then
3 slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...")
4 return false
5 end
7 local initiative = Initiative:by_id(param.get("initiative_id", atom.integer))
9 -- TODO important m1 selectors returning result _SET_!
10 local issue = initiative:get_reference_selector("issue"):for_share():single_object_mode():exec()
12 if issue.closed then
13 slot.put_into("error", _"This issue is already closed.")
14 return false
15 elseif issue.half_frozen then
16 slot.put_into("error", _"This issue is already frozen.")
17 return false
18 end
20 local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
21 if not initiator or not initiator.accepted then
22 error("access denied")
23 end
25 local formatting_engine = param.get("formatting_engine")
27 local formatting_engine_valid = false
28 for fe, dummy in pairs(config.formatting_engine_executeables) do
29 if formatting_engine == fe then
30 formatting_engine_valid = true
31 end
32 end
33 if not formatting_engine_valid then
34 error("invalid formatting engine!")
35 end
37 if param.get("preview") then
38 return false
39 end
41 local draft = Draft:new()
42 draft.author_id = app.session.member.id
43 draft.initiative_id = initiative.id
44 draft.formatting_engine = formatting_engine
45 draft.content = param.get("content")
46 draft:save()
48 draft:render_content()
50 slot.put_into("notice", _"New draft has been added to initiative")