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