liquid_feedback_frontend
view app/main/timeline/_action/update.lua @ 81:134fce4bede3
Cache for rendered wiki texts; Accountless API keys; Reverse id order for initiative API
- Support for caching html version of drafts
- Using pre-rendered html versions of help messages
- Added Support for api keys not connected to an account
- Added order option "id_desc" to initiative API
- Support for caching html version of drafts
- Using pre-rendered html versions of help messages
- Added Support for api keys not connected to an account
- Added order option "id_desc" to initiative API
| author | bsw | 
|---|---|
| date | Sat Jul 24 17:22:05 2010 +0200 (2010-07-24) | 
| parents | 00d1004545f1 | 
| children | 7c3e8a1678fc | 
 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")
    51 trace.debug(param.get("search_from"))
    53 if param.get("search_from") == "last_24h" then
    54   date = "last_24h"
    55 end
    57 if date and #date > 0 then
    58   local setting_key = "liquidfeedback_frontend_timeline_current_date"
    59   local setting = Setting:by_pk(app.session.member.id, setting_key)
    60   if not setting or setting.value ~= date then
    61     if not setting then
    62       setting = Setting:new()
    63       setting.member_id = app.session.member.id
    64       setting.key = setting_key
    65     end
    66     setting.value = date
    67     setting:save()
    68   end
    69 end
    71 local setting_key = "liquidfeedback_frontend_timeline_current_options"
    72 local setting = Setting:by_pk(app.session.member.id, setting_key)
    74 local timeline_params = {}
    75 if setting and setting.value then
    76   for event_ident, filter_idents in setting.value:gmatch("(%S+):(%S+)") do
    77     timeline_params["option_" .. event_ident] = true
    78     if filter_idents ~= "*" then
    79       for filter_ident in filter_idents:gmatch("([^\|]+)") do
    80         timeline_params["option_" .. event_ident .. "_" .. filter_ident] = true
    81       end
    82     end
    83   end
    84 end
    86 local setting_key = "liquidfeedback_frontend_timeline_current_date"
    87 local setting = Setting:by_pk(app.session.member.id, setting_key)
    89 if setting then
    90   timeline_params.date = setting.value
    91 end
    93 timeline_params.show_options = param.get("show_options", atom.boolean)
    95 if param.get("save", atom.boolean) then
    96   request.redirect{
    97     module = "timeline",
    98     view = "save_filter"
    99   }
   100 else
   101   request.redirect{
   102     module = "timeline",
   103     view = "index",
   104     params = timeline_params
   105   }
   106 end
