liquid_feedback_frontend

annotate env/ui/field/location.lua @ 1859:02c34183b6df

Fixed wrong filename in INSTALL file
author bsw
date Tue Nov 28 18:54:51 2023 +0100 (17 months ago)
parents 056bccb61eee
children
rev   line source
bsw/jbe@1309 1 function ui.field.location(args)
bsw/jbe@1309 2 if config.map then
bsw/jbe@1309 3 ui.form_element(args, {fetch_value = true}, function(args)
bsw/jbe@1309 4 ui.tag{
bsw/jbe@1309 5 tag = "input",
bsw/jbe@1309 6 attr = { type = "hidden", name = args.name, value = args.value, id = "ui_field_location_value" }
bsw/jbe@1309 7 }
bsw/jbe@1309 8 end)
bsw/jbe@1309 9 ui.map({}, "ui_field_location_value")
bsw/jbe@1309 10 elseif config.firstlife then
bsw/jbe@1309 11 ui.form_element(args, {fetch_value = true}, function(args)
bsw/jbe@1309 12 ui.tag{
bsw/jbe@1309 13 tag = "input",
bsw/jbe@1309 14 attr = { type = "hidden", name = args.name, value = args.value, id = "ui_field_location_value" }
bsw/jbe@1309 15 }
bsw@1519 16 ui.tag{
bsw@1519 17 tag = "input",
bsw@1519 18 attr = { type = "hidden", name = args.name .. "_marker_link", value = args.value_marker_link, id = "ui_field_location_marker_link" }
bsw@1519 19 }
bsw@1519 20 ui.tag{ tag = "iframe", attr = { src = config.firstlife.inputmap_url .. "/src/index.html?domain=" .. request.get_absolute_baseurl() .. "&" .. config.firstlife.coordinates .. "&lightArea=false&contrast=false&mode=lite&onlypointer=false", id = "ui_field_location", class = "ui_field_location" }, content = "" }
bsw/jbe@1309 21
bsw/jbe@1309 22 ui.script{ script = [[
bsw/jbe@1309 23
bsw/jbe@1309 24 window.addEventListener("message", function (e) {
bsw/jbe@1309 25 if (e.origin !== "]] .. config.firstlife.inputmap_url .. [[") return;
bsw/jbe@1309 26 var data = e.data;
bsw/jbe@1309 27 if (data.src == "InputMap") {
bsw@1519 28 var feature = { "type": "Point", "coordinates": [data.lng, data.lat], "zoom_level": data.zoom_level };
bsw@1519 29 if (data.feature) {
bsw@1519 30 feature.marker_link = data.feature.marker_link;
bsw@1519 31 }
bsw/jbe@1309 32 var el = document.getElementById("ui_field_location_value");
bsw@1519 33 el.value = JSON.stringify(feature);
bsw/jbe@1309 34 }
bsw/jbe@1309 35 });
bsw/jbe@1309 36 ]] }
bsw/jbe@1309 37 end)
bsw/jbe@1309 38 end
bsw/jbe@1309 39 end

Impressum / About Us