liquid_feedback_frontend
view app/main/timeline/_action/update.lua @ 15:a3ac899559de
Esperanto support activated in frontend
| author | bsw |
|---|---|
| date | Sun Jan 31 22:34:45 2010 +0100 (2010-01-31) |
| parents | 77d58efe99fd |
| children | 00d1004545f1 |
line source
1 execute.view{
2 module = "timeline",
3 view = "_constants"
4 }
6 local options_string = param.get("options_string")
8 if not options_string then
9 local active_options = ""
10 for event_ident, event_name in pairs(event_names) do
11 if param.get("option_" .. event_ident, atom.boolean) then
12 active_options = active_options .. event_ident .. ":"
13 local filter_idents = {}
14 for filter_ident, filter_name in pairs(filter_names) do
15 if param.get("option_" .. event_ident .. "_" .. filter_ident, atom.boolean) then
16 filter_idents[#filter_idents+1] = filter_ident
17 end
18 end
19 if #filter_idents > 0 then
20 active_options = active_options .. table.concat(filter_idents, "|") .. " "
21 else
22 active_options = active_options .. "* "
23 end
24 end
25 end
26 if #active_options > 0 then
27 options_string = active_options
28 end
29 end
31 if not options_string then
32 options_string = "issue_created:* issue_finished_after_voting:* issue_accepted:* issue_voting_started:* suggestion_created:* issue_canceled:* initiative_created:* issue_finished_without_voting:* draft_created:* initiative_revoked:* issue_half_frozen:* "
33 end
35 local setting_key = "liquidfeedback_frontend_timeline_current_options"
36 local setting = Setting:by_pk(app.session.member.id, setting_key)
38 if not setting or setting.value ~= options_string then
39 if not setting then
40 setting = Setting:new()
41 setting.member_id = app.session.member_id
42 setting.key = setting_key
43 end
44 if options_string then
45 setting.value = options_string
46 setting:save()
47 end
48 end
50 local date = param.get("date")
52 if date and #date > 0 then
53 local setting_key = "liquidfeedback_frontend_timeline_current_date"
54 local setting = Setting:by_pk(app.session.member.id, setting_key)
55 if not setting or setting.value ~= date then
56 if not setting then
57 setting = Setting:new()
58 setting.member_id = app.session.member.id
59 setting.key = setting_key
60 end
61 setting.value = date
62 setting:save()
63 end
64 end
66 local setting_key = "liquidfeedback_frontend_timeline_current_options"
67 local setting = Setting:by_pk(app.session.member.id, setting_key)
69 local timeline_params = {}
70 if setting and setting.value then
71 for event_ident, filter_idents in setting.value:gmatch("(%S+):(%S+)") do
72 timeline_params["option_" .. event_ident] = true
73 if filter_idents ~= "*" then
74 for filter_ident in filter_idents:gmatch("([^\|]+)") do
75 timeline_params["option_" .. event_ident .. "_" .. filter_ident] = true
76 end
77 end
78 end
79 end
81 local setting_key = "liquidfeedback_frontend_timeline_current_date"
82 local setting = Setting:by_pk(app.session.member.id, setting_key)
84 if setting then
85 timeline_params.date = setting.value
86 end
88 timeline_params.show_options = param.get("show_options", atom.boolean)
90 if param.get("save", atom.boolean) then
91 request.redirect{
92 module = "timeline",
93 view = "save_filter"
94 }
95 else
96 request.redirect{
97 module = "timeline",
98 view = "index",
99 params = timeline_params
100 }
101 end
