liquid_feedback_frontend

view app/main/initiative/_action/create.lua @ 19:00d1004545f1

Dynamic interface using XMLHttpRequests, and many other changes

Bugfixes:
- Only allow voting on admitted initiatives
- Repaired issue search
- Don't display delegations for closed issues on member page
- Don't show revoke link in initiative, when issue is already half_frozen
- Localization for voting JavaScript
- Display author of suggestions

Disclosure of voting data after voting is finished:
- Possibility to inspect every ballot including preferences
- Show number of voters preferring one initiative to another initiative

Interface behaviour changes:
- Reversed default order of drafts
- Default order of suggestions changed
- Show new drafts of initiatives only once per day in timeline

Accessibility:
- Barrier-free voting implemented
- POST links are now accessible without JavaScript
- Changed gray for unsatisfied supporters in bar graph to a lighter gray

Other interface improvements:
- Optical enhancements
- Dynamic interface using XMLHttpRequests
- Show usage terms in about section
- Show own membership in area listing
- Show uninformed supporters greyed out and marked with yellow question mark
- Warning box in non-admitted initiatives
- When voted, don't display voting notice and change label of voting link
- Show object counts in more tabulator heads
- Enlarged member statement input field

Miscellaneous:
- Code cleanup
- Added README file containing installation instructions
- Use new WebMCP function ui.filters{...} instead of own ui.filter and ui.order functions
author bsw/jbe
date Sat Feb 20 22:10:31 2010 +0100 (2010-02-20)
parents 72c5e0ee7c98
children 88ac7798b562
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 policy_id = param.get("policy_id", atom.integer)
34 if policy_id == -1 then
35 slot.put_into("error", _"Please choose a policy")
36 return false
37 end
39 local name = param.get("name")
41 local name = util.trim(name)
43 if #name < 3 then
44 slot.put_into("error", _"This name is really too short!")
45 return false
46 end
48 local initiative = Initiative:new()
50 if not issue then
51 if not area:get_reference_selector("allowed_policies")
52 :add_where{ "policy.id = ?", policy_id }
53 :optional_object_mode()
54 :exec()
55 then
56 error("policy not allowed")
57 end
58 issue = Issue:new()
59 issue.area_id = area.id
60 issue.policy_id = policy_id
61 issue:save()
62 end
64 initiative.issue_id = issue.id
65 initiative.name = name
66 param.update(initiative, "discussion_url")
67 initiative:save()
69 local draft = Draft:new()
70 draft.initiative_id = initiative.id
71 local formatting_engine = param.get("formatting_engine")
72 local formatting_engine_valid = false
73 for fe, dummy in pairs(config.formatting_engine_executeables) do
74 if formatting_engine == fe then
75 formatting_engine_valid = true
76 end
77 end
78 if not formatting_engine_valid then
79 error("invalid formatting engine!")
80 end
81 draft.formatting_engine = formatting_engine
82 draft.content = param.get("draft")
83 draft.author_id = app.session.member.id
84 draft:save()
86 local initiator = Initiator:new()
87 initiator.initiative_id = initiative.id
88 initiator.member_id = app.session.member.id
89 initiator.accepted = true
90 initiator:save()
92 local supporter = Supporter:new()
93 supporter.initiative_id = initiative.id
94 supporter.member_id = app.session.member.id
95 supporter.draft_id = draft.id
96 supporter:save()
98 slot.put_into("notice", _"Initiative successfully created")
100 request.redirect{
101 module = "initiative",
102 view = "show",
103 id = initiative.id

Impressum / About Us