rev |
line source |
bsw/jbe@1309
|
1 if not app.session:has_access("anonymous") then
|
bsw/jbe@1309
|
2 slot.put("<br /> Closed user group, please login.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />")
|
bsw/jbe@1309
|
3 return
|
bsw/jbe@1309
|
4 end
|
bsw/jbe@1309
|
5
|
bsw/jbe@1309
|
6 local unit_id = request.get_param{ name = "unit" }
|
bsw/jbe@1309
|
7 local area_id = request.get_param{ name = "area" }
|
bsw/jbe@1309
|
8
|
bsw/jbe@1309
|
9 if unit_id == "all" then
|
bsw/jbe@1309
|
10 unit_id = nil
|
bsw@1598
|
11 area_id = nil
|
bsw/jbe@1309
|
12 end
|
bsw/jbe@1309
|
13
|
bsw/jbe@1309
|
14 if area_id == "all" then
|
bsw/jbe@1309
|
15 area_id = nil
|
bsw/jbe@1309
|
16 end
|
bsw/jbe@1309
|
17
|
bsw/jbe@1309
|
18 local unit
|
bsw/jbe@1309
|
19 local area
|
bsw/jbe@1309
|
20
|
bsw/jbe@1309
|
21 if unit_id then
|
bsw/jbe@1309
|
22 unit = Unit:by_id(unit_id)
|
bsw@1504
|
23 if not unit or unit.attr.hidden then
|
bsw@1504
|
24 execute.view { module = "index", view = "404" }
|
bsw@1504
|
25 request.set_status("404 Not Found")
|
bsw@1504
|
26 return
|
bsw@1504
|
27 end
|
bsw@1602
|
28 unit:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw/jbe@1309
|
29 end
|
bsw/jbe@1309
|
30
|
bsw@1598
|
31
|
bsw/jbe@1309
|
32 if area_id then
|
bsw/jbe@1309
|
33 area = Area:by_id(area_id)
|
bsw@1595
|
34 if not area or area.unit_id ~= unit.id then
|
bsw@1595
|
35 execute.view { module = "index", view = "404" }
|
bsw@1595
|
36 request.set_status("404 Not Found")
|
bsw@1595
|
37 return
|
bsw@1595
|
38 end
|
bsw@1602
|
39 area:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw@1045
|
40 end
|
bsw@276
|
41
|
bsw@1602
|
42 if area then
|
bsw@1602
|
43 execute.view{ module = "area", view = "_head", params = { area = area } }
|
bsw@1602
|
44 elseif unit then
|
bsw@1602
|
45 execute.view{ module = "unit", view = "_head", params = { unit = unit } }
|
bsw@1602
|
46 end
|
bsw@1602
|
47
|
bsw@1602
|
48
|
bsw/jbe@1309
|
49 ui.grid{ content = function()
|
bsw/jbe@1309
|
50 ui.cell_main{ content = function()
|
bsw@276
|
51
|
bsw/jbe@1309
|
52 execute.view{ module = "index", view = "_sidebar_motd_public" }
|
bsw@1602
|
53
|
bsw/jbe@1309
|
54 execute.view{ module = "issue", view = "_list" }
|
bsw/jbe@1309
|
55 end }
|
bsw@462
|
56
|
bsw/jbe@1309
|
57 ui.cell_sidebar{ content = function()
|
bsw@1602
|
58 execute.view{ module = "index", view = "_head" }
|
bsw@1602
|
59
|
bsw/jbe@1309
|
60 execute.view{ module = "index", view = "_sidebar_motd" }
|
bsw/jbe@1309
|
61 if app.session.member then
|
bsw/jbe@1309
|
62 execute.view{ module = "index", view = "_sidebar_notifications" }
|
bsw/jbe@1309
|
63 end
|
bsw/jbe@1309
|
64 if config.firstlife then
|
bsw/jbe@1309
|
65 ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
|
bsw/jbe@1309
|
66 ui.tag{ tag = "iframe", attr = { src = config.firstlife.areaviewer_url .. "?" .. config.firstlife.coordinates .. "&domain=" .. request.get_absolute_baseurl(), class = "map" }, content = "" }
|
bsw/jbe@1309
|
67 end }
|
bsw/jbe@1309
|
68 end
|
bsw/jbe@1309
|
69 if config.map then
|
bsw/jbe@1309
|
70 local initiatives = Initiative:new_selector():exec()
|
bsw/jbe@1309
|
71 local geo_objects = {}
|
bsw/jbe@1309
|
72 for i, initiative in ipairs(initiatives) do
|
bsw/jbe@1309
|
73 if initiative.location and initiative.location.coordinates then
|
bsw/jbe@1309
|
74 local geo_object = {
|
bsw/jbe@1309
|
75 lon = initiative.location.coordinates[1],
|
bsw/jbe@1309
|
76 lat = initiative.location.coordinates[2],
|
bsw/jbe@1309
|
77 label = "i" .. initiative.id,
|
bsw/jbe@1309
|
78 description = slot.use_temporary(function()
|
bsw/jbe@1309
|
79 ui.link{ module = "initiative", view = "show", id = initiative.id, text = initiative.display_name }
|
bsw/jbe@1309
|
80 end),
|
bsw/jbe@1309
|
81 type = "initiative"
|
bsw/jbe@1309
|
82 }
|
bsw/jbe@1309
|
83 table.insert(geo_objects, geo_object)
|
bsw/jbe@1309
|
84 end
|
bsw/jbe@1309
|
85 end
|
bsw/jbe@1309
|
86 if ontomap_get_instances then
|
bsw/jbe@1309
|
87 local instances = ontomap_get_instances()
|
bsw/jbe@1309
|
88 for i, instance in ipairs(instances) do
|
bsw/jbe@1309
|
89 table.insert(geo_objects, instance)
|
bsw/jbe@1309
|
90 end
|
bsw/jbe@1309
|
91 end
|
bsw/jbe@1309
|
92 ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
|
bsw/jbe@1309
|
93 ui.map(geo_objects)
|
bsw/jbe@1309
|
94 end }
|
bsw/jbe@1309
|
95 end
|
bsw/jbe@1309
|
96 if config.logo then
|
bsw/jbe@1309
|
97 config.logo()
|
bsw/jbe@1309
|
98 end
|
bsw/jbe@1309
|
99 if area then
|
bsw/jbe@1309
|
100 execute.view{ module = "area", view = "_sidebar_whatcanido", params = { area = area } }
|
bsw/jbe@1309
|
101 elseif unit then
|
bsw/jbe@1309
|
102 execute.view{ module = "unit", view = "_sidebar_whatcanido", params = { unit = unit } }
|
bsw/jbe@1309
|
103 else
|
bsw/jbe@1309
|
104 execute.view{ module = "index", view = "_sidebar_whatcanido" }
|
bsw/jbe@1309
|
105 end
|
bsw/jbe@1309
|
106
|
bsw/jbe@1309
|
107 execute.view { module = "index", view = "_sidebar_members" }
|
bsw/jbe@1309
|
108
|
bsw/jbe@1309
|
109 end }
|
bsw/jbe@1309
|
110 end }
|
bsw@1045
|
111
|