liquid_feedback_frontend
annotate app/main/delegation/_show_box.lua @ 10:72c5e0ee7c98
Version beta6
Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed
New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers
In area listing the number of closed issues is shown too
Renamed "author" field of initiative to "last author"
Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution
Help texts updated
Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed
New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers
In area listing the number of closed issues is shown too
Renamed "author" field of initiative to "last author"
Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution
Help texts updated
| author | bsw |
|---|---|
| date | Sun Jan 10 12:00:00 2010 +0100 (2010-01-10) |
| parents | afd9f769c7ae |
| children | 00d1004545f1 |
| rev | line source |
|---|---|
| bsw/jbe@4 | 1 slot.select("actions", function() |
| bsw/jbe@0 | 2 |
| bsw/jbe@5 | 3 local delegation |
| bsw/jbe@5 | 4 local area_id |
| bsw/jbe@5 | 5 local issue_id |
| bsw/jbe@5 | 6 |
| bsw/jbe@5 | 7 local scope = "global" |
| bsw/jbe@5 | 8 |
| bsw/jbe@5 | 9 if param.get("initiative_id", atom.integer) then |
| bsw/jbe@5 | 10 issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id |
| bsw/jbe@5 | 11 scope = "issue" |
| bsw/jbe@5 | 12 end |
| bsw/jbe@5 | 13 |
| bsw/jbe@5 | 14 if param.get("issue_id", atom.integer) then |
| bsw/jbe@5 | 15 issue_id = param.get("issue_id", atom.integer) |
| bsw/jbe@5 | 16 scope = "issue" |
| bsw/jbe@5 | 17 end |
| bsw/jbe@5 | 18 |
| bsw/jbe@5 | 19 if param.get("area_id", atom.integer) then |
| bsw/jbe@5 | 20 area_id = param.get("area_id", atom.integer) |
| bsw/jbe@5 | 21 scope = "area" |
| bsw/jbe@5 | 22 end |
| bsw/jbe@5 | 23 |
| bsw/jbe@5 | 24 |
| bsw/jbe@5 | 25 |
| bsw/jbe@5 | 26 local delegation |
| bsw/jbe@5 | 27 local issue |
| bsw/jbe@5 | 28 if issue_id then |
| bsw/jbe@5 | 29 issue = Issue:by_id(issue_id) |
| bsw/jbe@5 | 30 delegation = Delegation:by_pk(app.session.member.id, nil, issue_id) |
| bsw/jbe@5 | 31 if not delegation then |
| bsw/jbe@5 | 32 delegation = Delegation:by_pk(app.session.member.id, issue.area_id) |
| bsw/jbe@5 | 33 end |
| bsw/jbe@5 | 34 elseif area_id then |
| bsw/jbe@5 | 35 delegation = Delegation:by_pk(app.session.member.id, area_id) |
| bsw/jbe@5 | 36 end |
| bsw/jbe@5 | 37 |
| bsw/jbe@5 | 38 if not delegation then |
| bsw/jbe@5 | 39 delegation = Delegation:by_pk(app.session.member.id) |
| bsw/jbe@5 | 40 end |
| bsw/jbe@5 | 41 if delegation then |
| bsw/jbe@5 | 42 ui.container{ |
| bsw/jbe@5 | 43 attr = { class = "delegation vote_info"}, |
| bsw/jbe@5 | 44 content = function() |
| bsw@2 | 45 ui.container{ |
| bsw@2 | 46 attr = { |
| bsw/jbe@4 | 47 title = _"Click for details", |
| bsw/jbe@4 | 48 class = "head head_active", |
| bsw@2 | 49 style = "cursor: pointer;", |
| bsw/jbe@4 | 50 onclick = "document.getElementById('delegation_content').style.display = 'block';" |
| bsw@2 | 51 }, |
| bsw/jbe@4 | 52 content = function() |
| bsw/jbe@4 | 53 ui.image{ |
| bsw/jbe@4 | 54 static = "icons/16/error.png" |
| bsw/jbe@4 | 55 } |
| bsw/jbe@4 | 56 if delegation.issue_id then |
| bsw/jbe@4 | 57 slot.put(_"Issue delegation active") |
| bsw/jbe@4 | 58 elseif delegation.area_id then |
| bsw/jbe@4 | 59 slot.put(_"Area wide delegation active") |
| bsw/jbe@4 | 60 else |
| bsw/jbe@4 | 61 slot.put(_"Global delegation active") |
| bsw/jbe@4 | 62 end |
| bsw/jbe@4 | 63 ui.image{ |
| bsw/jbe@4 | 64 static = "icons/16/dropdown.png" |
| bsw/jbe@4 | 65 } |
| bsw/jbe@4 | 66 end |
| bsw@2 | 67 } |
| bsw/jbe@4 | 68 ui.container{ |
| bsw/jbe@4 | 69 attr = { class = "content", id = "delegation_content" }, |
| bsw/jbe@4 | 70 content = function() |
| bsw@2 | 71 ui.container{ |
| bsw/jbe@4 | 72 attr = { |
| bsw/jbe@4 | 73 class = "close", |
| bsw/jbe@4 | 74 style = "cursor: pointer;", |
| bsw/jbe@4 | 75 onclick = "document.getElementById('delegation_content').style.display = 'none';" |
| bsw/jbe@4 | 76 }, |
| bsw@2 | 77 content = function() |
| bsw/jbe@4 | 78 ui.image{ static = "icons/16/cross.png" } |
| bsw/jbe@4 | 79 end |
| bsw/jbe@4 | 80 } |
| bsw/jbe@4 | 81 |
| bsw/jbe@4 | 82 local delegation_chain = Member:new_selector() |
| bsw/jbe@4 | 83 :add_field("delegation_chain.*") |
| bsw/jbe@4 | 84 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", " .. tostring(area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") |
| bsw/jbe@4 | 85 :add_order_by("index") |
| bsw/jbe@4 | 86 :exec() |
| bsw/jbe@4 | 87 |
| bsw/jbe@4 | 88 for i, record in ipairs(delegation_chain) do |
| bsw/jbe@4 | 89 local style |
| bsw/jbe@4 | 90 local overridden = record.overridden |
| bsw/jbe@4 | 91 if record.scope_in then |
| bsw@2 | 92 ui.container{ |
| bsw/jbe@4 | 93 attr = { class = "delegation_info" }, |
| bsw@2 | 94 content = function() |
| bsw/jbe@4 | 95 if not overridden then |
| bsw/jbe@4 | 96 ui.image{ |
| bsw/jbe@4 | 97 attr = { class = "delegation_arrow" }, |
| bsw/jbe@4 | 98 static = "delegation_arrow_vertical.jpg" |
| bsw/jbe@4 | 99 } |
| bsw/jbe@4 | 100 else |
| bsw/jbe@4 | 101 ui.image{ |
| bsw/jbe@4 | 102 attr = { class = "delegation_arrow delegation_arrow_overridden" }, |
| bsw/jbe@4 | 103 static = "delegation_arrow_vertical.jpg" |
| bsw/jbe@4 | 104 } |
| bsw/jbe@4 | 105 end |
| bsw/jbe@4 | 106 ui.container{ |
| bsw/jbe@4 | 107 attr = { class = "delegation_scope" .. (overridden and " delegation_scope_overridden" or "") }, |
| bsw/jbe@4 | 108 content = function() |
| bsw/jbe@4 | 109 if record.scope_in == "global" then |
| bsw/jbe@4 | 110 slot.put(_"Global delegation") |
| bsw/jbe@4 | 111 elseif record.scope_in == "area" then |
| bsw/jbe@4 | 112 slot.put(_"Area delegation") |
| bsw/jbe@4 | 113 elseif record.scope_in == "issue" then |
| bsw/jbe@4 | 114 slot.put(_"Issue delegation") |
| bsw/jbe@4 | 115 end |
| bsw/jbe@4 | 116 end |
| bsw/jbe@4 | 117 } |
| bsw/jbe@4 | 118 if i == 2 then |
| bsw/jbe@5 | 119 if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then |
| bsw/jbe@5 | 120 ui.link{ |
| bsw/jbe@5 | 121 attr = { class = "revoke" }, |
| bsw/jbe@5 | 122 content = function() |
| bsw/jbe@5 | 123 ui.image{ static = "icons/16/delete.png" } |
| bsw/jbe@5 | 124 slot.put(_"Revoke") |
| bsw/jbe@5 | 125 end, |
| bsw/jbe@5 | 126 module = "delegation", |
| bsw/jbe@5 | 127 action = "update", |
| bsw/jbe@5 | 128 params = { issue_id = delegation.issue_id, area_id = delegation.area_id, delete = true }, |
| bsw/jbe@5 | 129 routing = { |
| bsw/jbe@5 | 130 default = { |
| bsw/jbe@5 | 131 mode = "redirect", |
| bsw/jbe@5 | 132 module = request.get_module(), |
| bsw/jbe@5 | 133 view = request.get_view(), |
| bsw/jbe@5 | 134 id = param.get_id_cgi(), |
| bsw/jbe@5 | 135 params = param.get_all_cgi() |
| bsw/jbe@5 | 136 } |
| bsw/jbe@4 | 137 } |
| bsw/jbe@4 | 138 } |
| bsw/jbe@5 | 139 end |
| bsw@2 | 140 end |
| bsw@2 | 141 end |
| bsw@2 | 142 } |
| bsw/jbe@4 | 143 end |
| bsw/jbe@4 | 144 ui.container{ |
| bsw/jbe@4 | 145 attr = { class = overridden and "delegation_overridden" or "" }, |
| bsw/jbe@4 | 146 content = function() |
| bsw/jbe@4 | 147 execute.view{ |
| bsw/jbe@4 | 148 module = "member", |
| bsw/jbe@4 | 149 view = "_show_thumb", |
| bsw/jbe@4 | 150 params = { member = record } |
| bsw@2 | 151 } |
| bsw@2 | 152 end |
| bsw/jbe@4 | 153 } |
| bsw/jbe@4 | 154 if record.participation and not record.overridden then |
| bsw/jbe@4 | 155 ui.container{ |
| bsw/jbe@4 | 156 attr = { class = "delegation_participation" }, |
| bsw/jbe@4 | 157 content = function() |
| bsw/jbe@4 | 158 slot.put("<br /><br />-----> Participation<br />") |
| bsw/jbe@4 | 159 end |
| bsw/jbe@4 | 160 } |
| bsw@2 | 161 end |
| bsw/jbe@4 | 162 slot.put("<br style='clear: left'/>") |
| bsw/jbe@4 | 163 end |
| bsw/jbe@0 | 164 end |
| bsw/jbe@4 | 165 } |
| bsw/jbe@0 | 166 end |
| bsw/jbe@5 | 167 } |
| bsw/jbe@5 | 168 |
| bsw/jbe@5 | 169 |
| bsw/jbe@5 | 170 end |
| bsw/jbe@5 | 171 ui.link{ |
| bsw/jbe@5 | 172 content = function() |
| bsw/jbe@5 | 173 if scope == "global" and delegation then |
| bsw/jbe@5 | 174 ui.image{ static = "icons/16/table_go.png" } |
| bsw/jbe@5 | 175 slot.put(_"Change global delegation") |
| bsw/jbe@5 | 176 elseif scope == "global" and not delegation then |
| bsw/jbe@5 | 177 ui.image{ static = "icons/16/table_go.png" } |
| bsw/jbe@5 | 178 slot.put(_"Set global delegation") |
| bsw/jbe@5 | 179 elseif scope == "area" and delegation and delegation.area_id then |
| bsw/jbe@5 | 180 ui.image{ static = "icons/16/table_go.png" } |
| bsw/jbe@5 | 181 slot.put(_"Change area delegation") |
| bsw/jbe@5 | 182 elseif scope == "area" and not (delegation and delegation.area_id) then |
| bsw/jbe@5 | 183 ui.image{ static = "icons/16/table_go.png" } |
| bsw/jbe@5 | 184 slot.put(_"Set area delegation") |
| bsw/jbe@5 | 185 elseif scope == "issue" then |
| bsw/jbe@5 | 186 if delegation and delegation.issue_id then |
| bsw/jbe@4 | 187 ui.image{ static = "icons/16/table_go.png" } |
| bsw/jbe@5 | 188 slot.put(_"Change issue delegation") |
| bsw/jbe@5 | 189 elseif issue.state ~= "finished" and issue.state ~= "cancelled" then |
| bsw/jbe@5 | 190 ui.image{ static = "icons/16/table_go.png" } |
| bsw/jbe@5 | 191 slot.put(_"Set issue delegation") |
| bsw/jbe@5 | 192 end |
| bsw/jbe@5 | 193 end |
| bsw/jbe@5 | 194 end, |
| bsw/jbe@5 | 195 module = "delegation", |
| bsw/jbe@5 | 196 view = "new", |
| bsw/jbe@5 | 197 params = { |
| bsw/jbe@5 | 198 area_id = area_id, |
| bsw/jbe@5 | 199 issue_id = issue_id |
| bsw/jbe@5 | 200 } |
| bsw/jbe@4 | 201 } |
| bsw/jbe@0 | 202 end) |