bsw@11: execute.view{ bsw@11: module = "timeline", bsw@11: view = "_constants" bsw@11: } bsw@11: bsw@11: local options_string = param.get("options_string") bsw@11: bsw@11: if not options_string then bsw@11: local active_options = "" bsw@11: for event_ident, event_name in pairs(event_names) do bsw@11: if param.get("option_" .. event_ident, atom.boolean) then bsw@11: active_options = active_options .. event_ident .. ":" bsw@11: local filter_idents = {} bsw@11: for filter_ident, filter_name in pairs(filter_names) do bsw@11: if param.get("option_" .. event_ident .. "_" .. filter_ident, atom.boolean) then bsw@11: filter_idents[#filter_idents+1] = filter_ident bsw@11: end bsw@11: end bsw@11: if #filter_idents > 0 then bsw@11: active_options = active_options .. table.concat(filter_idents, "|") .. " " bsw@11: else bsw@11: active_options = active_options .. "* " bsw@11: end bsw@11: end bsw@11: end bsw@11: if #active_options > 0 then bsw@11: options_string = active_options bsw@11: end bsw@11: end bsw@11: bsw@162: if not options_string then bsw@162: 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:* " bsw@162: end bsw@162: poelzi@145: if param.get_list("option_ignore_area", atom.string) then poelzi@145: options_string = options_string.." ignore_area:"..table.concat(param.get_list("option_ignore_area", atom.string), "|") poelzi@145: end poelzi@145: bsw@11: local setting_key = "liquidfeedback_frontend_timeline_current_options" bsw@11: local setting = Setting:by_pk(app.session.member.id, setting_key) bsw@11: bsw@11: if not setting or setting.value ~= options_string then bsw@11: if not setting then bsw@11: setting = Setting:new() bsw@11: setting.member_id = app.session.member_id bsw@11: setting.key = setting_key bsw@11: end bsw@11: if options_string then bsw@11: setting.value = options_string bsw@11: setting:save() bsw@11: end bsw@11: end bsw@11: bsw@11: local date = param.get("date") bsw/jbe@19: bsw/jbe@19: if param.get("search_from") == "last_24h" then bsw/jbe@19: date = "last_24h" bsw/jbe@19: end bsw@11: bsw@11: if date and #date > 0 then bsw@11: local setting_key = "liquidfeedback_frontend_timeline_current_date" bsw@11: local setting = Setting:by_pk(app.session.member.id, setting_key) bsw@11: if not setting or setting.value ~= date then bsw@11: if not setting then bsw@11: setting = Setting:new() bsw@11: setting.member_id = app.session.member.id bsw@11: setting.key = setting_key bsw@11: end bsw@11: setting.value = date bsw@11: setting:save() bsw@11: end bsw@11: end bsw@11: bsw@11: local setting_key = "liquidfeedback_frontend_timeline_current_options" bsw@11: local setting = Setting:by_pk(app.session.member.id, setting_key) bsw@11: bsw@11: local timeline_params = {} bsw@11: if setting and setting.value then bsw@11: for event_ident, filter_idents in setting.value:gmatch("(%S+):(%S+)") do bsw@11: timeline_params["option_" .. event_ident] = true bsw@11: if filter_idents ~= "*" then bsw@11: for filter_ident in filter_idents:gmatch("([^\|]+)") do bsw@11: timeline_params["option_" .. event_ident .. "_" .. filter_ident] = true bsw@11: end bsw@11: end bsw@11: end bsw@11: end bsw@11: bsw@11: local setting_key = "liquidfeedback_frontend_timeline_current_date" bsw@11: local setting = Setting:by_pk(app.session.member.id, setting_key) bsw@11: bsw@11: if setting then bsw@11: timeline_params.date = setting.value bsw@11: end bsw@11: bsw@11: timeline_params.show_options = param.get("show_options", atom.boolean) bsw@11: bsw@11: if param.get("save", atom.boolean) then bsw@11: request.redirect{ bsw@11: module = "timeline", poelzi@144: view = "save_filter", poelzi@144: params = { poelzi@144: current_name = param.get("current_name") poelzi@144: } bsw@11: } bsw@11: else bsw@11: request.redirect{ bsw@11: module = "timeline", bsw@11: view = "index", bsw@11: params = timeline_params bsw@11: } bsw@11: end