liquid_feedback_frontend
annotate app/main/timeline/_action/update.lua @ 124:f740026b1518
add initiator support in delegation
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Mon Sep 20 20:32:04 2010 +0200 (2010-09-20) |
parents | 00d1004545f1 |
children | 7c3e8a1678fc |
rev | line source |
---|---|
bsw@11 | 1 execute.view{ |
bsw@11 | 2 module = "timeline", |
bsw@11 | 3 view = "_constants" |
bsw@11 | 4 } |
bsw@11 | 5 |
bsw@11 | 6 local options_string = param.get("options_string") |
bsw@11 | 7 |
bsw@11 | 8 if not options_string then |
bsw@11 | 9 local active_options = "" |
bsw@11 | 10 for event_ident, event_name in pairs(event_names) do |
bsw@11 | 11 if param.get("option_" .. event_ident, atom.boolean) then |
bsw@11 | 12 active_options = active_options .. event_ident .. ":" |
bsw@11 | 13 local filter_idents = {} |
bsw@11 | 14 for filter_ident, filter_name in pairs(filter_names) do |
bsw@11 | 15 if param.get("option_" .. event_ident .. "_" .. filter_ident, atom.boolean) then |
bsw@11 | 16 filter_idents[#filter_idents+1] = filter_ident |
bsw@11 | 17 end |
bsw@11 | 18 end |
bsw@11 | 19 if #filter_idents > 0 then |
bsw@11 | 20 active_options = active_options .. table.concat(filter_idents, "|") .. " " |
bsw@11 | 21 else |
bsw@11 | 22 active_options = active_options .. "* " |
bsw@11 | 23 end |
bsw@11 | 24 end |
bsw@11 | 25 end |
bsw@11 | 26 if #active_options > 0 then |
bsw@11 | 27 options_string = active_options |
bsw@11 | 28 end |
bsw@11 | 29 end |
bsw@11 | 30 |
bsw@11 | 31 if not options_string then |
bsw@11 | 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:* " |
bsw@11 | 33 end |
bsw@11 | 34 |
bsw@11 | 35 local setting_key = "liquidfeedback_frontend_timeline_current_options" |
bsw@11 | 36 local setting = Setting:by_pk(app.session.member.id, setting_key) |
bsw@11 | 37 |
bsw@11 | 38 if not setting or setting.value ~= options_string then |
bsw@11 | 39 if not setting then |
bsw@11 | 40 setting = Setting:new() |
bsw@11 | 41 setting.member_id = app.session.member_id |
bsw@11 | 42 setting.key = setting_key |
bsw@11 | 43 end |
bsw@11 | 44 if options_string then |
bsw@11 | 45 setting.value = options_string |
bsw@11 | 46 setting:save() |
bsw@11 | 47 end |
bsw@11 | 48 end |
bsw@11 | 49 |
bsw@11 | 50 local date = param.get("date") |
bsw/jbe@19 | 51 trace.debug(param.get("search_from")) |
bsw/jbe@19 | 52 |
bsw/jbe@19 | 53 if param.get("search_from") == "last_24h" then |
bsw/jbe@19 | 54 date = "last_24h" |
bsw/jbe@19 | 55 end |
bsw@11 | 56 |
bsw@11 | 57 if date and #date > 0 then |
bsw@11 | 58 local setting_key = "liquidfeedback_frontend_timeline_current_date" |
bsw@11 | 59 local setting = Setting:by_pk(app.session.member.id, setting_key) |
bsw@11 | 60 if not setting or setting.value ~= date then |
bsw@11 | 61 if not setting then |
bsw@11 | 62 setting = Setting:new() |
bsw@11 | 63 setting.member_id = app.session.member.id |
bsw@11 | 64 setting.key = setting_key |
bsw@11 | 65 end |
bsw@11 | 66 setting.value = date |
bsw@11 | 67 setting:save() |
bsw@11 | 68 end |
bsw@11 | 69 end |
bsw@11 | 70 |
bsw@11 | 71 local setting_key = "liquidfeedback_frontend_timeline_current_options" |
bsw@11 | 72 local setting = Setting:by_pk(app.session.member.id, setting_key) |
bsw@11 | 73 |
bsw@11 | 74 local timeline_params = {} |
bsw@11 | 75 if setting and setting.value then |
bsw@11 | 76 for event_ident, filter_idents in setting.value:gmatch("(%S+):(%S+)") do |
bsw@11 | 77 timeline_params["option_" .. event_ident] = true |
bsw@11 | 78 if filter_idents ~= "*" then |
bsw@11 | 79 for filter_ident in filter_idents:gmatch("([^\|]+)") do |
bsw@11 | 80 timeline_params["option_" .. event_ident .. "_" .. filter_ident] = true |
bsw@11 | 81 end |
bsw@11 | 82 end |
bsw@11 | 83 end |
bsw@11 | 84 end |
bsw@11 | 85 |
bsw@11 | 86 local setting_key = "liquidfeedback_frontend_timeline_current_date" |
bsw@11 | 87 local setting = Setting:by_pk(app.session.member.id, setting_key) |
bsw@11 | 88 |
bsw@11 | 89 if setting then |
bsw@11 | 90 timeline_params.date = setting.value |
bsw@11 | 91 end |
bsw@11 | 92 |
bsw@11 | 93 timeline_params.show_options = param.get("show_options", atom.boolean) |
bsw@11 | 94 |
bsw@11 | 95 if param.get("save", atom.boolean) then |
bsw@11 | 96 request.redirect{ |
bsw@11 | 97 module = "timeline", |
bsw@11 | 98 view = "save_filter" |
bsw@11 | 99 } |
bsw@11 | 100 else |
bsw@11 | 101 request.redirect{ |
bsw@11 | 102 module = "timeline", |
bsw@11 | 103 view = "index", |
bsw@11 | 104 params = timeline_params |
bsw@11 | 105 } |
bsw@11 | 106 end |