liquid_feedback_frontend

annotate app/main/index/index.lua @ 1859:02c34183b6df

Fixed wrong filename in INSTALL file
author bsw
date Tue Nov 28 18:54:51 2023 +0100 (17 months ago)
parents ed156969a447
children
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@1837 30 request.redirect{
bsw@1837 31 external = encode.url{
bsw@1837 32 module = "index", view = "index", params = {
bsw@1837 33 unit = unit_id
bsw@1837 34 }
bsw@1837 35 }
bsw@1837 36 }
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@1706 53 if not unit_id and not area_id then
bsw@1706 54 execute.view{ module = "index", view = "_sidebar_motd_intern_top" }
bsw@1706 55 end
bsw@1702 56
bsw/jbe@1309 57 execute.view{ module = "issue", view = "_list" }
bsw/jbe@1309 58 end }
bsw@462 59
bsw/jbe@1309 60 ui.cell_sidebar{ content = function()
bsw@1723 61 if not unit and not area and config.logo_startpage then
bsw@1722 62 config.logo_startpage()
bsw@1722 63 end
bsw@1602 64 execute.view{ module = "index", view = "_head" }
bsw@1602 65
bsw/jbe@1309 66 execute.view{ module = "index", view = "_sidebar_motd" }
bsw/jbe@1309 67 if app.session.member then
bsw/jbe@1309 68 execute.view{ module = "index", view = "_sidebar_notifications" }
bsw/jbe@1309 69 end
bsw/jbe@1309 70 if config.firstlife then
bsw/jbe@1309 71 ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
bsw/jbe@1309 72 ui.tag{ tag = "iframe", attr = { src = config.firstlife.areaviewer_url .. "?" .. config.firstlife.coordinates .. "&domain=" .. request.get_absolute_baseurl(), class = "map" }, content = "" }
bsw/jbe@1309 73 end }
bsw/jbe@1309 74 end
bsw/jbe@1309 75 if config.map then
bsw/jbe@1309 76 local initiatives = Initiative:new_selector():exec()
bsw/jbe@1309 77 local geo_objects = {}
bsw/jbe@1309 78 for i, initiative in ipairs(initiatives) do
bsw/jbe@1309 79 if initiative.location and initiative.location.coordinates then
bsw/jbe@1309 80 local geo_object = {
bsw/jbe@1309 81 lon = initiative.location.coordinates[1],
bsw/jbe@1309 82 lat = initiative.location.coordinates[2],
bsw/jbe@1309 83 label = "i" .. initiative.id,
bsw/jbe@1309 84 description = slot.use_temporary(function()
bsw/jbe@1309 85 ui.link{ module = "initiative", view = "show", id = initiative.id, text = initiative.display_name }
bsw/jbe@1309 86 end),
bsw/jbe@1309 87 type = "initiative"
bsw/jbe@1309 88 }
bsw/jbe@1309 89 table.insert(geo_objects, geo_object)
bsw/jbe@1309 90 end
bsw/jbe@1309 91 end
bsw/jbe@1309 92 if ontomap_get_instances then
bsw/jbe@1309 93 local instances = ontomap_get_instances()
bsw/jbe@1309 94 for i, instance in ipairs(instances) do
bsw/jbe@1309 95 table.insert(geo_objects, instance)
bsw/jbe@1309 96 end
bsw/jbe@1309 97 end
bsw/jbe@1309 98 ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
bsw/jbe@1309 99 ui.map(geo_objects)
bsw/jbe@1309 100 end }
bsw/jbe@1309 101 end
bsw/jbe@1309 102 if config.logo then
bsw/jbe@1309 103 config.logo()
bsw/jbe@1309 104 end
bsw/jbe@1309 105 if area then
bsw/jbe@1309 106 execute.view{ module = "area", view = "_sidebar_whatcanido", params = { area = area } }
bsw/jbe@1309 107 elseif unit then
bsw/jbe@1309 108 execute.view{ module = "unit", view = "_sidebar_whatcanido", params = { unit = unit } }
bsw/jbe@1309 109 else
bsw/jbe@1309 110 execute.view{ module = "index", view = "_sidebar_whatcanido" }
bsw/jbe@1309 111 end
bsw/jbe@1309 112
bsw/jbe@1309 113 execute.view { module = "index", view = "_sidebar_members" }
bsw/jbe@1309 114
bsw/jbe@1309 115 end }
bsw/jbe@1309 116 end }
bsw@1045 117

Impressum / About Us