# HG changeset patch # User bsw # Date 1341574442 -7200 # Node ID e12f0348b19176d8859c6b20bc91f48f648f0eb9 # Parent 9a2e5f4be58cf7754f2b95f025a3f4d570152c0b Removed files not needed anymore diff -r 9a2e5f4be58c -r e12f0348b191 app/main/initiative/show_tab.lua --- a/app/main/initiative/show_tab.lua Wed Jul 04 23:34:21 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -local initiative = param.get("initiative", "table") -local initiator = param.get("initiator", "table") - -if not initiative then - initiative = Initiative:by_id(param.get("initiative_id", atom.number)) -end - -if not initiator and app.session.member_id then - initiator = Initiator:by_pk(initiative.id, app.session.member.id) -end - -local current_draft_name = _"Current draft" -if initiative.issue.half_frozen then - current_draft_name = _"Voting proposal" -end - -if initiative.issue.state == "finished" then - current_draft_name = _"Voted proposal" -end - -local tabs = { - { - name = "current_draft", - label = current_draft_name, - icon = { static = "icons/16/script.png" }, - module = "draft", - view = "_show", - params = { - draft = initiative.current_draft - } - } -} - -if config.public_access == "full" or app.session.member_id then - if initiative.issue.ranks_available then - tabs[#tabs+1] = { - name = "voting", - label = _"Voting details", - icon = { static = "icons/16/email_open.png" }, - module = "initiative", - view = "_show_voting", - params = { - initiative = initiative - } - } - end -end - -local suggestion_count = initiative:get_reference_selector("suggestions"):count() - -tabs[#tabs+1] = { - name = "suggestions", - label = _"Suggestions" .. " (" .. tostring(suggestion_count) .. ")", - icon = { static = "icons/16/comments.png" }, - module = "suggestion", - view = "_list", - params = { - initiative = initiative, - suggestions_selector = initiative:get_reference_selector("suggestions"), - tab_id = param.get("tab_id") - } -} - -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") - :add_field("direct_interest_snapshot.weight") - :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") - :add_where("direct_supporter_snapshot.satisfied") - :add_field("direct_supporter_snapshot.informed", "is_informed") - - local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object") - local direct_satisfied_supporter_count = tmp.count - local indirect_satisfied_supporter_count = (tmp.weight or 0) - tmp.count - - local count_string - if indirect_satisfied_supporter_count > 0 then - count_string = "(" .. tostring(direct_satisfied_supporter_count) .. "+" .. tostring(indirect_satisfied_supporter_count) .. ")" - else - count_string = "(" .. tostring(direct_satisfied_supporter_count) .. ")" - end - - tabs[#tabs+1] = { - name = "satisfied_supporter", - label = _"Supporters" .. " " .. count_string, - icon = { static = "icons/16/thumb_up_green.png" }, - module = "member", - view = "_list", - params = { - initiative = initiative, - members_selector = members_selector - } - } - - 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") - :add_field("direct_interest_snapshot.weight") - :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") - :add_where("NOT direct_supporter_snapshot.satisfied") - :add_field("direct_supporter_snapshot.informed", "is_informed") - - local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object") - local direct_potential_supporter_count = tmp.count - local indirect_potential_supporter_count = (tmp.weight or 0) - tmp.count - - local count_string - if indirect_potential_supporter_count > 0 then - count_string = "(" .. tostring(direct_potential_supporter_count) .. "+" .. tostring(indirect_potential_supporter_count) .. ")" - else - count_string = "(" .. tostring(direct_potential_supporter_count) .. ")" - end - - tabs[#tabs+1] = { - name = "supporter", - label = _"Potential supporters" .. " " .. count_string, - icon = { static = "icons/16/thumb_up.png" }, - module = "member", - view = "_list", - params = { - initiative = initiative, - members_selector = members_selector - } - } - -end - -local drafts_count = initiative:get_reference_selector("drafts"):count() - -tabs[#tabs+1] = { - name = "drafts", - label = _"Draft history" .. " (" .. tostring(drafts_count) .. ")", - icon = { static = "icons/16/script.png" }, - module = "draft", - view = "_list", - params = { drafts = initiative.drafts } -} - -tabs[#tabs+1] = { - name = "details", - label = _"Details", - icon = { static = "icons/16/magnifier.png" }, - module = "initiative", - view = "_details", - params = { - initiative = initiative, - members_selector = members_selector - } -} - -tabs.module = "initiative" -tabs.view = "show_tab" -tabs.static_params = { - initiative_id = initiative.id -} - -ui.tabs(tabs) - diff -r 9a2e5f4be58c -r e12f0348b191 app/main/issue/show_tab.lua --- a/app/main/issue/show_tab.lua Wed Jul 04 23:34:21 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -local issue -if request.get_json_request_slots() then - issue = Issue:by_id(param.get("issue_id")) -else - issue = param.get("issue", "table") -end - -local interested_members_selector = issue:get_reference_selector("interested_members_snapshot") - :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") - :add_field("direct_interest_snapshot.weight") - :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event") - -local delegations_selector = issue:get_reference_selector("delegations") - -local tabs = { - module = "issue", - view = "show_tab", - static_params = { issue_id = issue.id }, -} - -if app.session.member_id or config.public_access == "full" then - tabs[#tabs+1] = - { - name = "interested_members", - label = _"Interested" .. " (" .. tostring(interested_members_selector:count()) .. ")" , - module = "member", - view = "_list", - params = { - issue = issue, - members_selector = interested_members_selector - } - } - - tabs[#tabs+1] = - { - name = "delegations", - label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")" , - module = "delegation", - view = "_list", - params = { delegations_selector = delegations_selector } - } -end - -tabs[#tabs+1] = - { - name = "details", - label = _"Details", - module = "issue", - view = "_details", - params = { issue = issue } - } - -if config.etherpad and app.session.member_id then - tabs[#tabs+1] = - { - name = "pad", - label = _"Pad", - module = "issue", - view = "_pad", - params = { issue = issue } - } -end - -ui.tabs(tabs) - -