liquid_feedback_frontend

diff lib/ontomap/ontomap.lua @ 1519:056bccb61eee

Added object reference for geo references
author bsw
date Thu Aug 20 15:08:00 2020 +0200 (2020-08-20)
parents 32cc544d5a5b
children 802245716e0a
line diff
     1.1 --- a/lib/ontomap/ontomap.lua	Thu Aug 20 14:36:56 2020 +0200
     1.2 +++ b/lib/ontomap/ontomap.lua	Thu Aug 20 15:08:00 2020 +0200
     1.3 @@ -63,10 +63,11 @@
     1.4    }
     1.5  end
     1.6  
     1.7 -local function new_reference_object(url, application)
     1.8 +local function new_reference_object(url, application, type)
     1.9    return json.object{
    1.10      application = application or config.ontomap.application_ident,
    1.11 -    external_url = url
    1.12 +    external_url = url,
    1.13 +    type = type
    1.14    }
    1.15  end
    1.16  
    1.17 @@ -204,17 +205,28 @@
    1.18      ))
    1.19      log_event.details.new_issue_state = event.state
    1.20      table.insert(log_events, log_event)
    1.21 -    
    1.22 +
    1.23      local log_event = new_log_event(event, event.member_id, "object_created")
    1.24 -    table.insert(log_event.activity_objects, new_activity_object{
    1.25 +
    1.26 +    local location = event.initiative.location
    1.27 +    if location.marker_link then
    1.28 +      local marker_link = location.marker_link
    1.29 +      location.marker_link = nil
    1.30 +      table.insert(log_event.references, new_reference_object(
    1.31 +        marker_link, config.firstlife.application_ident, "BELONGS_TO"
    1.32 +      ))
    1.33 +    end 
    1.34 +    
    1.35 +    local activity_object = new_activity_object{
    1.36        type = "initiative",
    1.37        url = url_for("initiative", event.initiative_id),
    1.38 -      geometry = event.initiative.location
    1.39 -    })
    1.40 +      geometry = location
    1.41 +    }
    1.42 +    activity_object.properties.name = event.initiative.name
    1.43 +    table.insert(log_event.activity_objects, activity_object)
    1.44      table.insert(log_event.references, new_reference_object(
    1.45        url_for("issue", event.issue_id)
    1.46      ))
    1.47 -    log_event.details.name = event.initiative.name
    1.48      table.insert(log_events, log_event)
    1.49  
    1.50      log_to_ontomap(log_events)
    1.51 @@ -222,15 +234,24 @@
    1.52  
    1.53    initiative_created_in_existing_issue = function(event)
    1.54      local log_event = new_log_event(event, event.member_id, "object_created")
    1.55 -    table.insert(log_event.activity_objects, new_activity_object{
    1.56 +    local location = event.initiative.location
    1.57 +    if location and location.marker_link then
    1.58 +      local marker_link = location.marker_link
    1.59 +      location.marker_link = nil
    1.60 +      table.insert(log_event.references, new_reference_object(
    1.61 +        marker_link, config.firstlife.application_ident, "BELONGS_TO"
    1.62 +      ))
    1.63 +    end 
    1.64 +    local activity_object = new_activity_object{
    1.65        type = "initiative",
    1.66        url = url_for("initiative", event.initiative_id),
    1.67 -      geometry = event.initiative.location
    1.68 -    })
    1.69 +      geometry = location
    1.70 +    }
    1.71 +    activity_object.properties.name = event.initiative.name
    1.72 +    table.insert(log_event.activity_objects, activity_object)
    1.73      table.insert(log_event.references, new_reference_object(
    1.74        url_for("issue", event.issue_id)
    1.75      ))
    1.76 -    log_event.details.name = event.initiative.name
    1.77      log_to_ontomap(log_event)
    1.78    end,
    1.79  

Impressum / About Us