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