liquid_feedback_frontend
annotate app/main/timeline/_action/save.lua @ 144:7c3e8a1678fc
fix timeline saved filters
add Members:set_setting_map code
check for empty name
update settings when saved under same name
fixes bug #305
add Members:set_setting_map code
check for empty name
update settings when saved under same name
fixes bug #305
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Wed Oct 06 18:15:23 2010 +0200 (2010-10-06) |
parents | 77d58efe99fd |
children |
rev | line source |
---|---|
bsw@11 | 1 local id = param.get("id", atom.number) |
bsw@11 | 2 |
bsw@11 | 3 local setting_key = "liquidfeedback_frontend_timeline_current_options" |
bsw@11 | 4 local setting = Setting:by_pk(app.session.member.id, setting_key) |
bsw@11 | 5 local options_string = setting.value |
bsw@11 | 6 |
bsw@11 | 7 local timeline_filter |
bsw@11 | 8 |
bsw@11 | 9 local subkey = param.get("name") |
bsw@11 | 10 |
poelzi@144 | 11 if not subkey or subkey == "" then |
poelzi@144 | 12 slot.put_into("error", _"This name is really too short!") |
poelzi@144 | 13 request.redirect{ |
poelzi@144 | 14 module = "timeline", |
poelzi@144 | 15 view = "save_filter", |
poelzi@144 | 16 } |
poelzi@144 | 17 return |
poelzi@144 | 18 end |
poelzi@144 | 19 |
poelzi@144 | 20 app.session.member:set_setting_map("timeline_filters", subkey, options_string) |
bsw@11 | 21 |
bsw@11 | 22 local timeline_params = {} |
bsw@11 | 23 if options_string then |
bsw@11 | 24 for event_ident, filter_idents in setting.value:gmatch("(%S+):(%S+)") do |
bsw@11 | 25 timeline_params["option_" .. event_ident] = true |
bsw@11 | 26 if filter_idents ~= "*" then |
bsw@11 | 27 for filter_ident in filter_idents:gmatch("([^\|]+)") do |
bsw@11 | 28 timeline_params["option_" .. event_ident .. "_" .. filter_ident] = true |
bsw@11 | 29 end |
bsw@11 | 30 end |
bsw@11 | 31 end |
bsw@11 | 32 end |
bsw@11 | 33 |
bsw@11 | 34 local setting_key = "liquidfeedback_frontend_timeline_current_date" |
bsw@11 | 35 local setting = Setting:by_pk(app.session.member.id, setting_key) |
bsw@11 | 36 |
bsw@11 | 37 if setting then |
bsw@11 | 38 timeline_params.date = setting.value |
bsw@11 | 39 end |
bsw@11 | 40 |
bsw@11 | 41 request.redirect{ |
bsw@11 | 42 module = "timeline", |
bsw@11 | 43 view = "index", |
bsw@11 | 44 params = timeline_params |
bsw@11 | 45 } |