liquid_feedback_frontend
annotate app/main/draft/_action/add.lua @ 5:afd9f769c7ae
Version beta1
Final voting with Schulze-Method is now possible
Many bug fixes and code cleanup
Registration with invite codes
More sort and filter options
Seperated display of "supporters" and "potential supporters"
Optical changes
Flood limit / initiative contigent is now checked by frontend
Neccessary changes to access core beta11
Final voting with Schulze-Method is now possible
Many bug fixes and code cleanup
Registration with invite codes
More sort and filter options
Seperated display of "supporters" and "potential supporters"
Optical changes
Flood limit / initiative contigent is now checked by frontend
Neccessary changes to access core beta11
author | bsw/jbe |
---|---|
date | Fri Dec 25 12:00:00 2009 +0100 (2009-12-25) |
parents | 80c215dbf076 |
children | 72c5e0ee7c98 |
rev | line source |
---|---|
bsw/jbe@5 | 1 local tmp = db:query({ "SELECT text_entries_left FROM member_contingent_left WHERE member_id = ?", app.session.member.id }, "opt_object") |
bsw/jbe@5 | 2 if tmp and tmp.text_entries_left and tmp.text_entries_left < 1 then |
bsw/jbe@5 | 3 slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...") |
bsw/jbe@5 | 4 return false |
bsw/jbe@5 | 5 end |
bsw/jbe@5 | 6 |
bsw/jbe@0 | 7 local initiative = Initiative:by_id(param.get("initiative_id", atom.integer)) |
bsw/jbe@0 | 8 |
bsw/jbe@5 | 9 -- TODO important m1 selectors returning result _SET_! |
bsw/jbe@5 | 10 local issue = initiative:get_reference_selector("issue"):for_share():single_object_mode():exec() |
bsw/jbe@5 | 11 |
bsw/jbe@5 | 12 if issue.closed then |
bsw/jbe@5 | 13 slot.put_into("error", _"This issue is already closed.") |
bsw/jbe@5 | 14 return false |
bsw/jbe@5 | 15 elseif issue.half_frozen then |
bsw/jbe@5 | 16 slot.put_into("error", _"This issue is already frozen.") |
bsw/jbe@5 | 17 return false |
bsw/jbe@5 | 18 end |
bsw/jbe@5 | 19 |
bsw/jbe@0 | 20 if Initiator:by_pk(initiative.id, app.session.member.id) then |
bsw/jbe@0 | 21 local draft = Draft:new() |
bsw/jbe@0 | 22 draft.author_id = app.session.member.id |
bsw/jbe@0 | 23 draft.initiative_id = initiative.id |
bsw/jbe@4 | 24 local formatting_engine = param.get("formatting_engine") |
bsw/jbe@4 | 25 local formatting_engine_valid = false |
bsw/jbe@4 | 26 for fe, dummy in pairs(config.formatting_engine_executeables) do |
bsw/jbe@4 | 27 if formatting_engine == fe then |
bsw/jbe@4 | 28 formatting_engine_valid = true |
bsw/jbe@4 | 29 end |
bsw/jbe@4 | 30 end |
bsw/jbe@4 | 31 if not formatting_engine_valid then |
bsw/jbe@4 | 32 error("invalid formatting engine!") |
bsw/jbe@4 | 33 end |
bsw/jbe@4 | 34 draft.formatting_engine = formatting_engine |
bsw/jbe@0 | 35 draft.content = param.get("content") |
bsw/jbe@0 | 36 draft:save() |
bsw/jbe@0 | 37 |
bsw/jbe@0 | 38 slot.put_into("notice", _"New draft has been added to initiative") |
bsw/jbe@0 | 39 |
bsw/jbe@0 | 40 else |
bsw/jbe@0 | 41 error('access denied') |
bsw/jbe@0 | 42 end |