liquid_feedback_frontend
changeset 333:609e37247615
Removed old report views
author | bsw |
---|---|
date | Tue Feb 28 18:34:09 2012 +0100 (2012-02-28) |
parents | b471e2429838 |
children | 0ec49ed35954 |
files | app/main/report/area.lua app/main/report/index.lua app/main/report/initiative.lua |
line diff
1.1 --- a/app/main/report/area.lua Tue Feb 28 18:31:58 2012 +0100 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,226 +0,0 @@ 1.4 -function show_issue(issue, initiatives_selector) 1.5 - ui.list{ 1.6 - records = initiatives_selector:exec(), 1.7 - columns = { 1.8 - { 1.9 - label = _"Date", 1.10 - label_attr = { style = "width: 7.5em;" }, 1.11 - content = function(initiative) 1.12 - slot.put(format.date(issue.closed)) 1.13 - end 1.14 - }, 1.15 - { 1.16 - label_attr = { style = "width: 8em;" }, 1.17 - label = _"Id", 1.18 - content = function(initiative) 1.19 - ui.link{ 1.20 - external = "", 1.21 - text = "#" .. tostring(issue.id) .. "." .. tostring(initiative.id), 1.22 - attr = { 1.23 - onclick = 1.24 - "openEl('initiative_" .. tostring(initiative.id) .. "');" .. 1.25 - "return(false);" 1.26 - } 1.27 - } 1.28 - end 1.29 - }, 1.30 - { 1.31 - label = _"Rank", 1.32 - label_attr = { style = "width: 3em;" }, 1.33 - field_attr = { style = "text-align: right;" }, 1.34 - content = function(initiative) 1.35 - ui.field.rank{ value = initiative.rank } 1.36 - end 1.37 - }, 1.38 - { 1.39 - label = _"Name", 1.40 - content = function(initiative) 1.41 - if initiative.rank and initiative.rank == 1 then 1.42 - slot.put("<b>") 1.43 - end 1.44 - ui.field.text{ value = initiative.name } 1.45 - if initiative.rank and initiative.rank == 1 then 1.46 - slot.put("</b>") 1.47 - end 1.48 - end 1.49 - } 1.50 - } 1.51 - } 1.52 -end 1.53 - 1.54 -function link_issue(issue) 1.55 - ui.link{ 1.56 - external = "", 1.57 - attr = { 1.58 - style = "text-decoration: none;", 1.59 - name = "issue_" .. tostring(issue.id), 1.60 - onclick = 1.61 - "openEl('issue_" .. tostring(issue.id) .. "');" .. 1.62 - "return(false);" 1.63 - }, 1.64 - content = function() 1.65 - ui.heading{ 1.66 - attr = { style = "background-color: #ddd; color: #000;" }, 1.67 - content = _("##{id}", { id = issue.id }) 1.68 - } 1.69 - end 1.70 - } 1.71 -end 1.72 - 1.73 - 1.74 -local area = param.get("area", "table") 1.75 - 1.76 -local issue_selector = Issue:new_selector() 1.77 -issue_selector:add_where{ "area_id = ?", area.id } 1.78 -issue_selector:add_where("closed NOTNULL") 1.79 -issue_selector:add_order_by("id") 1.80 - 1.81 - 1.82 -local issues = issue_selector:exec() 1.83 - 1.84 -ui.container{ 1.85 - attr = { 1.86 - id = "area_" .. tostring(area.id) 1.87 - }, 1.88 - content = function() 1.89 - 1.90 - link_area(area) 1.91 - 1.92 - for i, issue in ipairs(issues) do 1.93 - 1.94 - link_issue(issue) 1.95 - 1.96 - local initiatives_selector = issue:get_reference_selector("initiatives") 1.97 - 1.98 - local initiatives_count = initiatives_selector:count() 1.99 - 1.100 - initiatives_selector:add_order_by("rank") 1.101 - initiatives_selector:limit(3) 1.102 - 1.103 - show_issue(issue, initiatives_selector) 1.104 - 1.105 - if initiatives_count > 3 then 1.106 - ui.link{ 1.107 - attr = { 1.108 - style = "margin-left: 8em; font-style: italic;", 1.109 - onclick = "openEl('issue_" .. tostring(issue.id) .. "'); return(false);" 1.110 - }, 1.111 - content = _("and #{count} more initiatives", { count = initiatives_count - 3 }), 1.112 - external = "" 1.113 - } 1.114 - end 1.115 - 1.116 - slot.put("<br />") 1.117 - 1.118 - end 1.119 - 1.120 - end 1.121 -} 1.122 - 1.123 -ui.script{ script = "parents['area_" .. tostring(area.id) .. "'] = 'areas';" } 1.124 - 1.125 -local next_issue = issues[1] 1.126 -if next_issue then 1.127 - ui.script{ script = "next_issues['area_" .. tostring(area.id) .. "'] = 'issue_" .. tostring(next_issue.id) .. "';" } 1.128 -end 1.129 - 1.130 -if next_issue then 1.131 - local next_initiative = next_issue.initiatives[1] 1.132 - if next_initiative then 1.133 - ui.script{ script = "next_initiatives['area_" .. tostring(area.id) .. "'] = 'initiative_" .. tostring(next_initiative.id) .. "';" } 1.134 - end 1.135 -end 1.136 - 1.137 - 1.138 -for i, issue in ipairs(issues) do 1.139 - local initiatives_selector = issue:get_reference_selector("initiatives") 1.140 - :add_order_by("rank") 1.141 - 1.142 - local initiatives = initiatives_selector:exec() 1.143 - 1.144 - ui.container{ 1.145 - attr = { 1.146 - id = "issue_" .. tostring(issue.id) 1.147 - }, 1.148 - content = function() 1.149 - link_area(area) 1.150 - link_issue(issue) 1.151 - show_issue(issue, initiatives_selector) 1.152 - end 1.153 - } 1.154 - 1.155 - local previous_issue = issues[i-1] 1.156 - if previous_issue then 1.157 - ui.script{ script = "prev_issues['issue_" .. tostring(issue.id) .. "'] = 'issue_" .. tostring(previous_issue.id) .. "';" } 1.158 - end 1.159 - 1.160 - local next_initiative = initiatives[1] 1.161 - if next_initiative then 1.162 - ui.script{ script = "next_initiatives['issue_" .. tostring(issue.id) .. "'] = 'initiative_" .. tostring(next_initiative.id) .. "';" } 1.163 - end 1.164 - 1.165 - ui.script{ script = "parents['issue_" .. tostring(issue.id) .. "'] = 'area_" .. tostring(area.id) .. "';" } 1.166 - 1.167 - local next_issue = issues[i+1] 1.168 - if next_issue then 1.169 - ui.script{ script = "next_issues['issue_" .. tostring(issue.id) .. "'] = 'issue_" .. tostring(next_issue.id) .. "';" } 1.170 - end 1.171 - 1.172 - ui.script{ 1.173 - script = "document.getElementById('issue_" .. tostring(issue.id) .. "').style.display = 'none';" 1.174 - } 1.175 - 1.176 - 1.177 - for j, initiative in ipairs(initiatives) do 1.178 - 1.179 - ui.container{ 1.180 - attr = { 1.181 - id = "initiative_" .. tostring(initiative.id) 1.182 - }, 1.183 - content = function() 1.184 - execute.view{ 1.185 - module = "report", 1.186 - view = "initiative", 1.187 - params = { initiative = initiative } 1.188 - } 1.189 - slot.put("<br />") 1.190 - slot.put("<br />") 1.191 - slot.put("<br />") 1.192 - slot.put("<br />") 1.193 - slot.put("<br />") 1.194 - end 1.195 - } 1.196 - 1.197 - local previous_issue = issues[i-1] 1.198 - if previous_issue then 1.199 - ui.script{ script = "prev_issues['initiative_" .. tostring(initiative.id) .. "'] = 'issue_" .. tostring(previous_issue.id) .. "';" } 1.200 - end 1.201 - 1.202 - local previous_initiative = initiatives[j-1] 1.203 - if previous_initiative then 1.204 - ui.script{ script = "prev_initiatives['initiative_" .. tostring(initiative.id) .. "'] = 'initiative_" .. tostring(previous_initiative.id) .. "';" } 1.205 - end 1.206 - 1.207 - ui.script{ script = "parents['initiative_" .. tostring(initiative.id) .. "'] = 'issue_" .. tostring(issue.id) .. "';" } 1.208 - 1.209 - local next_initiative = initiatives[j+1] 1.210 - if next_initiative then 1.211 - ui.script{ script = "next_initiatives['initiative_" .. tostring(initiative.id) .. "'] = 'initiative_" .. tostring(next_initiative.id) .. "';" } 1.212 - end 1.213 - 1.214 - local next_issue = issues[i+1] 1.215 - if next_issue then 1.216 - ui.script{ script = "next_issues['initiative_" .. tostring(initiative.id) .. "'] = 'issue_" .. tostring(next_issue.id) .. "';" } 1.217 - end 1.218 - 1.219 - ui.script{ 1.220 - script = "document.getElementById('initiative_" .. tostring(initiative.id) .. "').style.display = 'none';" 1.221 - } 1.222 - 1.223 - end 1.224 -end 1.225 - 1.226 -ui.script{ 1.227 - script = "document.getElementById('area_" .. tostring(area.id) .. "').style.display = 'none';" 1.228 -} 1.229 -
2.1 --- a/app/main/report/index.lua Tue Feb 28 18:31:58 2012 +0100 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,170 +0,0 @@ 2.4 -function link_area(area) 2.5 - ui.link{ 2.6 - external = "", 2.7 - attr = { 2.8 - onclick = 2.9 - "openEl('area_" .. tostring(area.id) .. "');" .. 2.10 - "return(false);" 2.11 - }, 2.12 - content = function() 2.13 - ui.heading{ 2.14 - content = area.name 2.15 - } 2.16 - end 2.17 - } 2.18 -end 2.19 - 2.20 -slot.set_layout("report") 2.21 - 2.22 -slot.put("<br />") 2.23 - 2.24 -ui.container{ 2.25 - attr = { 2.26 - class = "nav", 2.27 - style = "text-align: center;" 2.28 - }, 2.29 - content = function() 2.30 - 2.31 - 2.32 - ui.container{ 2.33 - attr = { 2.34 - class = "left", 2.35 - }, 2.36 - content = function() 2.37 - ui.link{ 2.38 - external = "", 2.39 - attr = { 2.40 - onclick = "undo(); return(false);" 2.41 - }, 2.42 - content = function() 2.43 - ui.image{ static = "icons/16/cancel.png" } 2.44 - slot.put(" ") 2.45 - slot.put(_"Back") 2.46 - end 2.47 - } 2.48 - end 2.49 - } 2.50 - 2.51 - ui.form{ 2.52 - attr = { 2.53 - style = "float: right;", 2.54 - onsubmit = "openElDirect(); return(false);" 2.55 - }, 2.56 - content = function() 2.57 - slot.put("#") 2.58 - ui.tag{ 2.59 - tag = "input", 2.60 - attr = { 2.61 - id = "input_issue", 2.62 - type = "text", 2.63 - style = "width: 4em;" 2.64 - } 2.65 - } 2.66 - slot.put(".") 2.67 - ui.tag{ 2.68 - tag = "input", 2.69 - attr = { 2.70 - id = "input_initiative", 2.71 - type = "text", 2.72 - style = "width: 4em;" 2.73 - } 2.74 - } 2.75 - slot.put(" ") 2.76 - ui.tag{ 2.77 - tag = "input", 2.78 - attr = { 2.79 - type = "submit", 2.80 - value = "OK", 2.81 - } 2.82 - } 2.83 - end 2.84 - } 2.85 - 2.86 - 2.87 - ui.link{ 2.88 - external = "", 2.89 - attr = { 2.90 - onclick = "openPrevIssue(); return(false);" 2.91 - }, 2.92 - content = function() 2.93 - ui.image{ static = "icons/16/resultset_previous_double.png" } 2.94 - slot.put(" ") 2.95 - slot.put(_"Previous issue") 2.96 - end 2.97 - } 2.98 - 2.99 - ui.link{ 2.100 - external = "", 2.101 - attr = { 2.102 - onclick = "openPrevInitiative(); return(false);" 2.103 - }, 2.104 - content = function() 2.105 - ui.image{ static = "icons/16/resultset_previous.png" } 2.106 - slot.put(" ") 2.107 - slot.put(_"Previous initiative") 2.108 - end 2.109 - } 2.110 - 2.111 - ui.link{ 2.112 - external = "", 2.113 - attr = { 2.114 - onclick = "openParent(); return(false);" 2.115 - }, 2.116 - content = function() 2.117 - ui.image{ static = "icons/16/go_up.png" } 2.118 - slot.put(" ") 2.119 - slot.put(_"Go up") 2.120 - end 2.121 - } 2.122 - 2.123 - ui.link{ 2.124 - external = "", 2.125 - attr = { 2.126 - onclick = "openNextInitiative(); return(false);" 2.127 - }, 2.128 - content = function() 2.129 - ui.image{ static = "icons/16/resultset_next.png" } 2.130 - slot.put(" ") 2.131 - slot.put(_"Next initiative") 2.132 - end 2.133 - } 2.134 - 2.135 - ui.link{ 2.136 - external = "", 2.137 - attr = { 2.138 - onclick = "openNextIssue(); return(false);" 2.139 - }, 2.140 - content = function() 2.141 - ui.image{ static = "icons/16/resultset_next_double.png" } 2.142 - slot.put(" ") 2.143 - slot.put(_"Next issue") 2.144 - end 2.145 - } 2.146 - end 2.147 -} 2.148 - 2.149 -slot.put("<br />") 2.150 - 2.151 -local areas = Area:new_selector():add_order_by("name"):exec() 2.152 - 2.153 - 2.154 -ui.container{ 2.155 - attr = { id = "areas" }, 2.156 - content = function() 2.157 - for i, area in ipairs(areas) do 2.158 - link_area(area) 2.159 - end 2.160 - slot.put("<br /><br />") 2.161 - slot.put(_"This report can be saved (use 'save complete website') and used offline.") end 2.162 -} 2.163 - 2.164 -ui.script{ script = "openEl('areas')" } 2.165 - 2.166 -for i, area in ipairs(areas) do 2.167 - execute.view{ 2.168 - module = "report", 2.169 - view = "area", 2.170 - params = { area = area } 2.171 - } 2.172 -end 2.173 -
3.1 --- a/app/main/report/initiative.lua Tue Feb 28 18:31:58 2012 +0100 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,86 +0,0 @@ 3.4 -local initiative = param.get("initiative", "table") 3.5 - 3.6 -link_area(initiative.issue.area) 3.7 - 3.8 -link_issue(initiative.issue) 3.9 - 3.10 -ui.link{ 3.11 - external = "", 3.12 - attr = { 3.13 - style = "display: block; text-decoration: none;", 3.14 - name = "initiative_" .. tostring(initiative.id), 3.15 - }, 3.16 - content = function() 3.17 - ui.heading{ 3.18 - content = _("##{issue_id}.#{id} #{name}", { issue_id = initiative.issue.id, id = initiative.id, name = initiative.shortened_name }) 3.19 - } 3.20 - end 3.21 -} 3.22 - 3.23 -slot.put("<br />") 3.24 - 3.25 -if initiative.issue.ranks_available and initiative.admitted then 3.26 - local class = initiative.rank == 1 and "admitted_info" or "not_admitted_info" 3.27 - ui.container{ 3.28 - attr = { class = class }, 3.29 - content = function() 3.30 - local max_value = initiative.issue.voter_count 3.31 - slot.put(" ") 3.32 - local positive_votes = initiative.positive_votes 3.33 - local negative_votes = initiative.negative_votes 3.34 - slot.put(_"Yes" .. ": <b>" .. tostring(positive_votes) .. "</b>") 3.35 - slot.put(" · ") 3.36 - slot.put(_"Abstention" .. ": <b>" .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "</b>") 3.37 - slot.put(" · ") 3.38 - slot.put(_"No" .. ": <b>" .. tostring(initiative.negative_votes) .. "</b>") 3.39 - slot.put(" · ") 3.40 - slot.put("<b>") 3.41 - if initiative.rank == 1 then 3.42 - slot.put(_"Approved") 3.43 - elseif initiative.rank then 3.44 - slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank })) 3.45 - else 3.46 - slot.put(_"Not approved") 3.47 - end 3.48 - slot.put("</b>") 3.49 - end 3.50 - } 3.51 -end 3.52 - 3.53 -if initiative.issue.state == "cancelled" then 3.54 - local policy = initiative.issue.policy 3.55 - ui.container{ 3.56 - attr = { class = "not_admitted_info" }, 3.57 - content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) }) 3.58 - } 3.59 -elseif initiative.admitted == false then 3.60 - local policy = initiative.issue.policy 3.61 - ui.container{ 3.62 - attr = { class = "not_admitted_info" }, 3.63 - content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) }) 3.64 - } 3.65 -end 3.66 - 3.67 -if initiative.revoked then 3.68 - ui.container{ 3.69 - attr = { class = "revoked_info" }, 3.70 - content = function() 3.71 - slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) })) 3.72 - end 3.73 - } 3.74 -end 3.75 - 3.76 - 3.77 -ui.container{ 3.78 - attr = { class = "draft_content wiki" }, 3.79 - content = function() 3.80 - slot.put(format.wiki_text(initiative.current_draft.content, initiative.current_draft.formatting_engine)) 3.81 - end 3.82 -} 3.83 - 3.84 -execute.view{ 3.85 - module = "initiative", 3.86 - view = "_battles", 3.87 - params = { initiative = initiative } 3.88 -} 3.89 -