liquid_feedback_frontend

view app/main/lf2/_sidebar_unit.lua @ 218:7ea52c710503

Some little changes for next generation frontend
author bsw
date Sun Mar 13 16:53:33 2011 +0100 (2011-03-13)
parents 73dbc9e2bfd4
children
line source
1 local unit = param.get("unit", "table")
3 local current_area_id = param.get("current_area_id", atom.integer)
4 local current_phase = param.get_all_cgi()["phase"]
6 local records = {
7 { id = 0, name = _"All units" },
8 { id = "disabled", name = "" },
9 { id = "disabled", name = _"Units, you are member of:" },
10 }
13 for i, unit in ipairs(Unit:get_flattened_tree()) do
14 records[#records+1] = { id = unit.id, name = unit.flattened_tree_name }
15 end
17 records[#records+1] = { id = "disabled", name = "" }
18 records[#records+1] = { id = -1, name = _"Other units..." }
20 ui.box{ content = function()
21 ui.box_row{ class = "head", content = function()
22 ui.box_col{ class = "head", content = function()
23 ui.form{
24 method = "GET",
25 module = "lf2", view = "index",
26 content = function()
27 ui.field.select{
28 attr = { onchange = "this.form.submit();" },
29 name = "_webmcp_id",
30 foreign_records = records,
31 foreign_id = "id",
32 foreign_name = "name",
33 disabled_records = { disabled = true },
34 value = unit and unit.id or 0
35 }
36 end
37 }
38 end }
39 end }
41 if unit then
42 local trustees = Member:new_selector()
43 :add_field("delegation_chain.*")
44 :join({ "delegation_chain(?, ?, NULL, NULL)", app.session.member.id, unit.id }, "delegation_chain", "member.id = delegation_chain.member_id")
45 :add_order_by("index")
46 :exec()
48 if #trustees > 1 then
49 ui.box_row{ content = function() ui.box_col{ content = function()
50 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
51 end } end }
52 end
54 ui.box_row{ content = function() ui.box_col{ content = function()
55 if trustees[1].scope_out == "global" then
56 text = _"Change or revoke unit delegation"
57 else
58 text = _"Set unit delegation"
59 end
60 ui.link{
61 text = text,
62 module = "lf2", view = "delegation", params = { unit_id = unit.id }
63 }
64 end } end }
65 end
67 end }
69 if unit then
70 local member_areas_selector = Area:build_selector{
71 unit_id = unit.id,
72 member_id = app.session.member_id,
73 order = "name"
74 }
75 local other_areas_selector = Area:build_selector{
76 unit_id = unit.id,
77 not_member_id = app.session.member_id,
78 order = "name"
79 }
81 if member_areas_selector:count() > 0 then
82 ui.box{ content = function()
83 ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
84 ui.link{ text = _"Areas, you are member of", module = "lf2", view = "index", id = unit.id }
85 end } end }
87 execute.view{
88 module = "lf2", view = "_areas", params = {
89 areas_selector = member_areas_selector,
90 current_area_id = current_area_id,
91 current_phase = current_phase
92 }
93 }
94 end }
95 end
97 if other_areas_selector:count() > 0 then
98 ui.box{ content = function()
99 ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
100 --ui.link{ content = _"Areas", module = "lf2", view = "index", view = "index", id = unit.id }
101 ui.tag{ content = _"Areas" }
102 end } end }
104 execute.view{
105 module = "lf2", view = "_areas", params = {
106 areas_selector = other_areas_selector,
107 current_area_id = current_area_id,
108 current_phase = current_phase
109 }
110 }
111 end }
112 end
113 end
115 execute.view{ module = "lf2", view = "_search", params = { area = area } }

Impressum / About Us