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