liquid_feedback_frontend
diff app/main/initiative/show.lua @ 11:77d58efe99fd
Version beta7
Important security fixes:
- Added missing HTML encoding to postal address of member
- Link to discussion URL only if it starts with http(s)://
Other bugfixes:
- Fixed wrong display of 2nd level delegating voters for an initiative
- Do not display invited initiators as initiators while voting
- Added missing translation
New features:
- Public message of the day
- Both direct and indirect supporter count is shown in tab heads
- Support shown in initiative lists
Language chooser at the login page has been added (again)
Important security fixes:
- Added missing HTML encoding to postal address of member
- Link to discussion URL only if it starts with http(s)://
Other bugfixes:
- Fixed wrong display of 2nd level delegating voters for an initiative
- Do not display invited initiators as initiators while voting
- Added missing translation
New features:
- Public message of the day
- Both direct and indirect supporter count is shown in tab heads
- Support shown in initiative lists
Language chooser at the login page has been added (again)
author | bsw |
---|---|
date | Fri Jan 22 12:00:00 2010 +0100 (2010-01-22) |
parents | 72c5e0ee7c98 |
children | 00d1004545f1 |
line diff
1.1 --- a/app/main/initiative/show.lua Sun Jan 10 12:00:00 2010 +0100 1.2 +++ b/app/main/initiative/show.lua Fri Jan 22 12:00:00 2010 +0100 1.3 @@ -151,18 +151,22 @@ 1.4 ui.tag{ 1.5 tag = "span", 1.6 content = function() 1.7 - if initiative.discussion_url and #initiative.discussion_url > 0 then 1.8 - ui.link{ 1.9 - attr = { 1.10 - class = "actions", 1.11 - target = "_blank", 1.12 - title = initiative.discussion_url 1.13 - }, 1.14 - content = function() 1.15 - slot.put(encode.html(initiative.discussion_url)) 1.16 - end, 1.17 - external = initiative.discussion_url 1.18 - } 1.19 + if initiative.discussion_url:find("^https?://") then 1.20 + if initiative.discussion_url and #initiative.discussion_url > 0 then 1.21 + ui.link{ 1.22 + attr = { 1.23 + class = "actions", 1.24 + target = "_blank", 1.25 + title = initiative.discussion_url 1.26 + }, 1.27 + content = function() 1.28 + slot.put(encode.html(initiative.discussion_url)) 1.29 + end, 1.30 + external = initiative.discussion_url 1.31 + } 1.32 + end 1.33 + else 1.34 + slot.put(encode.html(initiative.discussion_url)) 1.35 end 1.36 slot.put(" ") 1.37 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 1.38 @@ -248,7 +252,7 @@ 1.39 ui.container{ 1.40 attr = { class = "draft_updated_info" }, 1.41 content = function() 1.42 - slot.put("The draft of this initiative has been updated!") 1.43 + slot.put(_"The draft of this initiative has been updated!") 1.44 slot.put(" ") 1.45 ui.link{ 1.46 content = _"Show diff", 1.47 @@ -358,18 +362,27 @@ 1.48 end 1.49 } 1.50 1.51 -local members_selector = initiative:get_reference_selector("supporting_members_snapshot") 1.52 +local members_selector = initiative:get_reference_selector("supporting_members_snapshot") 1.53 :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id") 1.54 :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") 1.55 :add_field("direct_interest_snapshot.weight") 1.56 :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") 1.57 :add_where("direct_supporter_snapshot.satisfied") 1.58 1.59 -local satisfied_supporter_count = members_selector:count() 1.60 +local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object") 1.61 +local direct_satisfied_supporter_count = tmp.count 1.62 +local indirect_satisfied_supporter_count = (tmp.weight or 0) - tmp.count 1.63 + 1.64 +local count_string 1.65 +if indirect_satisfied_supporter_count > 0 then 1.66 + count_string = "(" .. tostring(direct_satisfied_supporter_count) .. "+" .. tostring(indirect_satisfied_supporter_count) .. ")" 1.67 +else 1.68 + count_string = "(" .. tostring(direct_satisfied_supporter_count) .. ")" 1.69 +end 1.70 1.71 tabs[#tabs+1] = { 1.72 name = "satisfied_supporter", 1.73 - label = _"Supporter" .. " (" .. tostring(satisfied_supporter_count) .. ")", 1.74 + label = _"Supporter" .. " " .. count_string, 1.75 content = function() 1.76 execute.view{ 1.77 module = "member", 1.78 @@ -389,11 +402,20 @@ 1.79 :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") 1.80 :add_where("NOT direct_supporter_snapshot.satisfied") 1.81 1.82 -local potential_supporter_count = members_selector:count() 1.83 +local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object") 1.84 +local direct_potential_supporter_count = tmp.count 1.85 +local indirect_potential_supporter_count = (tmp.weight or 0) - tmp.count 1.86 + 1.87 +local count_string 1.88 +if indirect_potential_supporter_count > 0 then 1.89 + count_string = "(" .. tostring(direct_potential_supporter_count) .. "+" .. tostring(indirect_potential_supporter_count) .. ")" 1.90 +else 1.91 + count_string = "(" .. tostring(direct_potential_supporter_count) .. ")" 1.92 +end 1.93 1.94 tabs[#tabs+1] = { 1.95 name = "supporter", 1.96 - label = _"Potential supporter" .. " (" .. tostring(potential_supporter_count) .. ")", 1.97 + label = _"Potential supporter" .. " " .. count_string, 1.98 content = function() 1.99 execute.view{ 1.100 module = "member",