# HG changeset patch # User bsw # Date 1337363081 -7200 # Node ID 4cee33ad5e16d93fd3ab71771e16541352e28fb7 # Parent 18cd8595459b24dba1214e2c2b68f502e5b1f7d0 Completed support for config.public_access = "full" diff -r 18cd8595459b -r 4cee33ad5e16 app/main/_filter/21_auth.lua --- a/app/main/_filter/21_auth.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/_filter/21_auth.lua Fri May 18 19:44:41 2012 +0200 @@ -33,6 +33,15 @@ end +if config.public_access == "full" then + if request.get_module() == "member_image" and request.get_view() == "show" + or request.get_module() == "vote" and request.get_view() == "show_incoming" + or request.get_module() == "interest" and request.get_view() == "show_incoming" + or request.get_module() == "supporter" and request.get_view() == "show_incoming" then + auth_needed = false + end +end + if request.get_module() == "sitemap" then auth_needed = false end diff -r 18cd8595459b -r 4cee33ad5e16 app/main/initiative/_show.lua --- a/app/main/initiative/_show.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/initiative/_show.lua Fri May 18 19:44:41 2012 +0200 @@ -1,5 +1,4 @@ local initiative = param.get("initiative", "table") -local initiator = param.get("initiator", "table") local initiators_members_selector = initiative:get_reference_selector("initiating_members") :add_field("initiator.accepted", "accepted") @@ -39,7 +38,7 @@ content = function() for i, initiator in ipairs(initiators) do slot.put(" ") - if app.session.member_id then + if app.session.member_id or config.public_access == "full" then ui.link{ content = function () execute.view{ @@ -196,13 +195,6 @@ } end - if initiative.issue.state == "cancelled" then - local policy = initiative.issue.policy - ui.container{ - attr = { class = "not_admitted_info" }, - content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) }) - } - end --end) if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then diff -r 18cd8595459b -r 4cee33ad5e16 app/main/initiative/show.lua --- a/app/main/initiative/show.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/initiative/show.lua Fri May 18 19:44:41 2012 +0200 @@ -1,35 +1,15 @@ -local initiative = param.get("initiative", "table") - -if not initiative then - initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec() -end +local initiative = Initiative:by_id(param.get_id()) app.html_title.title = initiative.name app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id }) - slot.select("head", function() - execute.view{ - module = "issue", - view = "_head", - params = { issue = initiative.issue, - initiative = initiative } + module = "issue", view = "_head", + params = { issue = initiative.issue, initiative = initiative } } - end) -if not initiative then - initiative = Initiative:by_id(param.get_id()) - expanded = true -end - --- TODO performance -local initiator -if app.session.member_id then - initiator = Initiator:by_pk(initiative.id, app.session.member.id) -end - execute.view{ module = "initiative", view = "_show", diff -r 18cd8595459b -r 4cee33ad5e16 app/main/initiative/show_tab.lua --- a/app/main/initiative/show_tab.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/initiative/show_tab.lua Fri May 18 19:44:41 2012 +0200 @@ -31,7 +31,7 @@ } } -if app.session.member_id then +if config.public_access == "full" or app.session.member_id then if initiative.issue.ranks_available then tabs[#tabs+1] = { name = "voting", @@ -61,7 +61,7 @@ } } -if app.session.member_id then +if config.public_access == "full" or app.session.member_id then local members_selector = initiative:get_reference_selector("supporting_members_snapshot") :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id") :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") diff -r 18cd8595459b -r 4cee33ad5e16 app/main/issue/_show.lua --- a/app/main/issue/_show.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/issue/_show.lua Fri May 18 19:44:41 2012 +0200 @@ -148,6 +148,14 @@ } end + if issue.state == "cancelled" then + local policy = issue.policy + ui.container{ + attr = { class = "not_admitted_info" }, + content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) }) + } + end + end ui.container{ attr = { class = "initiative_list" }, content = function() diff -r 18cd8595459b -r 4cee33ad5e16 app/main/issue/show.lua --- a/app/main/issue/show.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/issue/show.lua Fri May 18 19:44:41 2012 +0200 @@ -10,14 +10,6 @@ util.help("issue.show") -if issue.state == "cancelled" then - local policy = issue.policy - ui.container{ - attr = { class = "not_admitted_info" }, - content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) }) - } -end - slot.select("head", function() execute.view{ module = "issue", view = "_show", params = { issue = issue } } end ) diff -r 18cd8595459b -r 4cee33ad5e16 app/main/issue/show_tab.lua --- a/app/main/issue/show_tab.lua Fri May 18 19:21:45 2012 +0200 +++ b/app/main/issue/show_tab.lua Fri May 18 19:44:41 2012 +0200 @@ -18,7 +18,7 @@ static_params = { issue_id = issue.id }, } -if app.session.member_id then +if app.session.member_id or config.public_access == "full" then tabs[#tabs+1] = { name = "interested_members", @@ -50,7 +50,7 @@ params = { issue = issue } } -if config.etherpad then +if config.etherpad and app.session.member_id then tabs[#tabs+1] = { name = "pad", diff -r 18cd8595459b -r 4cee33ad5e16 config/development.lua --- a/config/development.lua Fri May 18 19:21:45 2012 +0200 +++ b/config/development.lua Fri May 18 19:44:41 2012 +0200 @@ -33,7 +33,7 @@ --config.motd_intern = "==Internal motd==" -config.public_access = "anonymous" +config.public_access = "full" -- you can put some js code to the bottom on the page -- here it opens the trace window diff -r 18cd8595459b -r 4cee33ad5e16 model/member.lua --- a/model/member.lua Fri May 18 19:21:45 2012 +0200 +++ b/model/member.lua Fri May 18 19:44:41 2012 +0200 @@ -467,7 +467,7 @@ function Member.object:ui_field_text(args) args = args or {} - if app.session.member_id or config.public_access == "pseudonym" then + if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then -- ugly workaround for getting html into a replaced string and to the user ui.container{label = args.label, label_attr={class="ui_field_label"}, content = function() slot.put(string.format('%s',