liquid_feedback_frontend

changeset 527:4cee33ad5e16

Completed support for config.public_access = "full"
author bsw
date Fri May 18 19:44:41 2012 +0200 (2012-05-18)
parents 18cd8595459b
children 305329da1c75
files app/main/_filter/21_auth.lua app/main/initiative/_show.lua app/main/initiative/show.lua app/main/initiative/show_tab.lua app/main/issue/_show.lua app/main/issue/show.lua app/main/issue/show_tab.lua config/development.lua model/member.lua
line diff
     1.1 --- a/app/main/_filter/21_auth.lua	Fri May 18 19:21:45 2012 +0200
     1.2 +++ b/app/main/_filter/21_auth.lua	Fri May 18 19:44:41 2012 +0200
     1.3 @@ -33,6 +33,15 @@
     1.4  
     1.5  end
     1.6  
     1.7 +if config.public_access == "full" then
     1.8 +  if request.get_module() == "member_image" and request.get_view() == "show"
     1.9 +   or request.get_module() == "vote" and request.get_view() == "show_incoming"
    1.10 +   or request.get_module() == "interest" and request.get_view() == "show_incoming"
    1.11 +   or request.get_module() == "supporter" and request.get_view() == "show_incoming" then
    1.12 +    auth_needed = false
    1.13 +  end
    1.14 +end
    1.15 +
    1.16  if request.get_module() == "sitemap" then
    1.17    auth_needed = false
    1.18  end
     2.1 --- a/app/main/initiative/_show.lua	Fri May 18 19:21:45 2012 +0200
     2.2 +++ b/app/main/initiative/_show.lua	Fri May 18 19:44:41 2012 +0200
     2.3 @@ -1,5 +1,4 @@
     2.4  local initiative = param.get("initiative", "table")
     2.5 -local initiator = param.get("initiator", "table")
     2.6  
     2.7  local initiators_members_selector = initiative:get_reference_selector("initiating_members")
     2.8    :add_field("initiator.accepted", "accepted")
     2.9 @@ -39,7 +38,7 @@
    2.10          content = function()
    2.11            for i, initiator in ipairs(initiators) do
    2.12              slot.put(" ")
    2.13 -            if app.session.member_id then
    2.14 +            if app.session.member_id or config.public_access == "full" then
    2.15                ui.link{
    2.16                  content = function ()
    2.17                    execute.view{
    2.18 @@ -196,13 +195,6 @@
    2.19      }
    2.20    end
    2.21  
    2.22 -  if initiative.issue.state == "cancelled" then
    2.23 -    local policy = initiative.issue.policy
    2.24 -    ui.container{
    2.25 -      attr = { class = "not_admitted_info" },
    2.26 -      content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
    2.27 -    }
    2.28 -  end
    2.29  --end)
    2.30  
    2.31  if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then
     3.1 --- a/app/main/initiative/show.lua	Fri May 18 19:21:45 2012 +0200
     3.2 +++ b/app/main/initiative/show.lua	Fri May 18 19:44:41 2012 +0200
     3.3 @@ -1,35 +1,15 @@
     3.4 -local initiative = param.get("initiative", "table")
     3.5 -
     3.6 -if not initiative then
     3.7 -  initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
     3.8 -end
     3.9 +local initiative = Initiative:by_id(param.get_id())
    3.10  
    3.11  app.html_title.title = initiative.name
    3.12  app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id })
    3.13  
    3.14 -
    3.15  slot.select("head", function()
    3.16 -
    3.17    execute.view{
    3.18 -    module = "issue",
    3.19 -    view = "_head",
    3.20 -    params = { issue = initiative.issue,
    3.21 -              initiative = initiative }
    3.22 +    module = "issue", view = "_head",
    3.23 +    params = { issue = initiative.issue, initiative = initiative }
    3.24    }
    3.25 -
    3.26  end)
    3.27    
    3.28 -if not initiative then
    3.29 -  initiative = Initiative:by_id(param.get_id())
    3.30 -  expanded = true
    3.31 -end
    3.32 -
    3.33 --- TODO performance
    3.34 -local initiator
    3.35 -if app.session.member_id then
    3.36 -  initiator = Initiator:by_pk(initiative.id, app.session.member.id)
    3.37 -end
    3.38 -
    3.39  execute.view{
    3.40    module = "initiative",
    3.41    view = "_show",
     4.1 --- a/app/main/initiative/show_tab.lua	Fri May 18 19:21:45 2012 +0200
     4.2 +++ b/app/main/initiative/show_tab.lua	Fri May 18 19:44:41 2012 +0200
     4.3 @@ -31,7 +31,7 @@
     4.4    }
     4.5  }
     4.6  
     4.7 -if app.session.member_id then
     4.8 +if config.public_access == "full" or app.session.member_id then
     4.9    if initiative.issue.ranks_available then
    4.10      tabs[#tabs+1] = {
    4.11        name = "voting",
    4.12 @@ -61,7 +61,7 @@
    4.13    }
    4.14  }
    4.15  
    4.16 -if app.session.member_id then
    4.17 +if config.public_access == "full" or app.session.member_id then
    4.18    local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
    4.19              :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
    4.20              :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
     5.1 --- a/app/main/issue/_show.lua	Fri May 18 19:21:45 2012 +0200
     5.2 +++ b/app/main/issue/_show.lua	Fri May 18 19:44:41 2012 +0200
     5.3 @@ -148,6 +148,14 @@
     5.4        }
     5.5      end
     5.6  
     5.7 +    if issue.state == "cancelled" then
     5.8 +      local policy = issue.policy
     5.9 +      ui.container{
    5.10 +        attr = { class = "not_admitted_info" },
    5.11 +        content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
    5.12 +      }
    5.13 +    end
    5.14 +
    5.15    end
    5.16  
    5.17    ui.container{ attr = { class = "initiative_list" }, content = function()
     6.1 --- a/app/main/issue/show.lua	Fri May 18 19:21:45 2012 +0200
     6.2 +++ b/app/main/issue/show.lua	Fri May 18 19:44:41 2012 +0200
     6.3 @@ -10,14 +10,6 @@
     6.4  
     6.5  util.help("issue.show")
     6.6  
     6.7 -if issue.state == "cancelled" then
     6.8 -  local policy = issue.policy
     6.9 -  ui.container{
    6.10 -    attr = { class = "not_admitted_info" },
    6.11 -    content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
    6.12 -  }
    6.13 -end
    6.14 -
    6.15  slot.select("head", function()
    6.16    execute.view{ module = "issue", view = "_show", params = { issue = issue } }
    6.17  end )
     7.1 --- a/app/main/issue/show_tab.lua	Fri May 18 19:21:45 2012 +0200
     7.2 +++ b/app/main/issue/show_tab.lua	Fri May 18 19:44:41 2012 +0200
     7.3 @@ -18,7 +18,7 @@
     7.4    static_params = { issue_id = issue.id },
     7.5  }
     7.6  
     7.7 -if app.session.member_id then
     7.8 +if app.session.member_id or config.public_access == "full" then
     7.9    tabs[#tabs+1] =
    7.10      {
    7.11        name = "interested_members",
    7.12 @@ -50,7 +50,7 @@
    7.13      params = { issue = issue }
    7.14    }
    7.15    
    7.16 -if config.etherpad then
    7.17 +if config.etherpad and app.session.member_id then
    7.18    tabs[#tabs+1] =
    7.19      {
    7.20        name = "pad",
     8.1 --- a/config/development.lua	Fri May 18 19:21:45 2012 +0200
     8.2 +++ b/config/development.lua	Fri May 18 19:44:41 2012 +0200
     8.3 @@ -33,7 +33,7 @@
     8.4  
     8.5  --config.motd_intern = "==Internal motd=="
     8.6  
     8.7 -config.public_access = "anonymous"
     8.8 +config.public_access = "full"
     8.9  
    8.10  -- you can put some js code to the bottom on the page
    8.11  -- here it opens the trace window
     9.1 --- a/model/member.lua	Fri May 18 19:21:45 2012 +0200
     9.2 +++ b/model/member.lua	Fri May 18 19:44:41 2012 +0200
     9.3 @@ -467,7 +467,7 @@
     9.4  
     9.5  function Member.object:ui_field_text(args)
     9.6    args = args or {}
     9.7 -  if app.session.member_id or config.public_access == "pseudonym" then
     9.8 +  if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then
     9.9      -- ugly workaround for getting html into a replaced string and to the user
    9.10      ui.container{label = args.label, label_attr={class="ui_field_label"}, content = function()
    9.11          slot.put(string.format('<span><a href="%s">%s</a></span>',

Impressum / About Us