liquid_feedback_frontend
view app/main/initiative/_action/create.lua @ 6:8d91bccab0bf
Version beta2
Possibility to browse voters of a closed issue
Registration with invite code
Email confirmation and password recovery
Download function (for database dumps) added
Critical bug solved, which made it impossible to select your opinion on other peoples suggestions
Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted
Fixed wrong sorting order for "supporters" or "potential supporters"
Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)
Strip space characters from certain fields and ensure they contain at least 3 characters
Showing grade in opinion/list as clear text instead of integer value
More information on initiative is displayed while voting
Colored notification box shown on pages of issues or initiatives which are currently in voting state
Changed default filter for issues to "Open"
Back link on suggestion page
Some optical changes
Removed wrong space character in LICENSE file
Possibility to browse voters of a closed issue
Registration with invite code
Email confirmation and password recovery
Download function (for database dumps) added
Critical bug solved, which made it impossible to select your opinion on other peoples suggestions
Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted
Fixed wrong sorting order for "supporters" or "potential supporters"
Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)
Strip space characters from certain fields and ensure they contain at least 3 characters
Showing grade in opinion/list as clear text instead of integer value
More information on initiative is displayed while voting
Colored notification box shown on pages of issues or initiatives which are currently in voting state
Changed default filter for issues to "Open"
Back link on suggestion page
Some optical changes
Removed wrong space character in LICENSE file
author | bsw/jbe |
---|---|
date | Sat Jan 02 12:00:00 2010 +0100 (2010-01-02) |
parents | afd9f769c7ae |
children | 3941792e8be6 |
line source
1 local tmp = db:query({ "SELECT text_entries_left, initiatives_left FROM member_contingent_left WHERE member_id = ?", app.session.member.id }, "opt_object")
2 if tmp then
3 if tmp.initiatives_left and tmp.initiatives_left < 1 then
4 slot.put_into("error", _"Sorry, your contingent for creating initiatives has been used up. Please try again later.")
5 return false
6 end
7 if tmp.text_entries_left and tmp.text_entries_left < 1 then
8 slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...")
9 return false
10 end
11 end
13 local issue
14 local area
16 local issue_id = param.get("issue_id", atom.integer)
17 if issue_id then
18 issue = Issue:new_selector():add_where{"id=?",issue_id}:single_object_mode():exec()
19 if issue.closed then
20 slot.put_into("error", _"This issue is already closed.")
21 return false
22 elseif issue.fully_frozen then
23 slot.put_into("error", _"Voting for this issue has already begun.")
24 return false
25 end
26 area = issue.area
27 else
28 local area_id = param.get("area_id", atom.integer)
29 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec()
30 end
32 local name = param.get("name")
34 local name = util.trim(name)
36 if #name < 3 then
37 slot.put_into("error", _"This name is really too short!")
38 return false
39 end
41 local initiative = Initiative:new()
43 if not issue then
44 issue = Issue:new()
45 issue.area_id = area.id
46 issue.policy_id = param.get("policy_id", atom.integer)
47 issue:save()
48 end
50 initiative.issue_id = issue.id
51 initiative.name = name
52 param.update(initiative, "discussion_url")
53 initiative:save()
55 local draft = Draft:new()
56 draft.initiative_id = initiative.id
57 local formatting_engine = param.get("formatting_engine")
58 local formatting_engine_valid = false
59 for fe, dummy in pairs(config.formatting_engine_executeables) do
60 if formatting_engine == fe then
61 formatting_engine_valid = true
62 end
63 end
64 if not formatting_engine_valid then
65 error("invalid formatting engine!")
66 end
67 draft.formatting_engine = formatting_engine
68 draft.content = param.get("draft")
69 draft.author_id = app.session.member.id
70 draft:save()
72 local initiator = Initiator:new()
73 initiator.initiative_id = initiative.id
74 initiator.member_id = app.session.member.id
75 initiator:save()
77 local supporter = Supporter:new()
78 supporter.initiative_id = initiative.id
79 supporter.member_id = app.session.member.id
80 supporter.draft_id = draft.id
81 supporter:save()
83 slot.put_into("notice", _"Initiative successfully created")
85 request.redirect{
86 module = "initiative",
87 view = "show",
88 id = initiative.id
89 }