liquid_feedback_frontend
diff app/main/initiative/_action/create.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 | 8d91bccab0bf |
line diff
1.1 --- a/app/main/initiative/_action/create.lua Thu Dec 10 12:00:00 2009 +0100 1.2 +++ b/app/main/initiative/_action/create.lua Fri Dec 25 12:00:00 2009 +0100 1.3 @@ -1,13 +1,29 @@ 1.4 +local tmp = db:query({ "SELECT text_entries_left, initiatives_left FROM member_contingent_left WHERE member_id = ?", app.session.member.id }, "opt_object") 1.5 +if tmp then 1.6 + if tmp.initiatives_left and tmp.initiatives_left < 1 then 1.7 + slot.put_into("error", _"Sorry, your contingent for creating initiatives has been used up. Please try again later.") 1.8 + return false 1.9 + end 1.10 + if tmp.text_entries_left and tmp.text_entries_left < 1 then 1.11 + slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...") 1.12 + return false 1.13 + end 1.14 +end 1.15 + 1.16 local issue 1.17 local area 1.18 1.19 -db:query("BEGIN") 1.20 - 1.21 local issue_id = param.get("issue_id", atom.integer) 1.22 if issue_id then 1.23 issue = Issue:new_selector():add_where{"id=?",issue_id}:single_object_mode():exec() 1.24 + if issue.closed then 1.25 + slot.put_into("error", _"This issue is already closed.") 1.26 + return false 1.27 + elseif issue.fully_frozen then 1.28 + slot.put_into("error", _"Voting for this issue has already begun.") 1.29 + return false 1.30 + end 1.31 area = issue.area 1.32 - 1.33 else 1.34 local area_id = param.get("area_id", atom.integer) 1.35 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec() 1.36 @@ -22,6 +38,8 @@ 1.37 issue:save() 1.38 end 1.39 1.40 + 1.41 + 1.42 initiative.issue_id = issue.id 1.43 1.44 param.update(initiative, "name", "discussion_url") 1.45 @@ -55,8 +73,6 @@ 1.46 supporter.draft_id = draft.id 1.47 supporter:save() 1.48 1.49 -db:query("COMMIT") 1.50 - 1.51 slot.put_into("notice", _"Initiative successfully created") 1.52 1.53 request.redirect{