liquid_feedback_frontend

annotate app/main/index/index.lua @ 1729:ae45894bbf08

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

Impressum / About Us