%
--[[ Define some variables to make locating other resources easier.]]
local image = getImage( index )
local theRoot = ".."
local others = "."
local mySize = "large"
local pos = image.metadata.gps:gsub("°"," ")
local h,m,s,hem
local lat = nil
local long = mil
h,m,s,hem = pos:match("(%d*) (%d*)'(%d*)\" (%a)")
if hem ~= nil then
lat = h + (m / 60) + (s/3600)
if hem == "S" then lat = -lat end
lat = string.format("%.6f",lat)
h,m,s,hem = pos:match(hem .. " (%d*) (%d*)'(%d*)\" (%a)")
if hem ~= nil then
long = h + (m / 60) + (s/3600)
if hem == "W" then long = -long end
long = string.format("%.6f",long)
end
end
function formatInfoText(theField)
local theText = image.metadata[theField] or ""
if not model.nonCSS.infoitem.processing then
return theText
end
local cnt, _ = string.find(theText, "^\<")
if cnt ~= nil then
return theText
end
-- Trim spaces
theText = theText:match "^%s*(.-)%s*$"
-- Remove newlines
theText = theText:gsub("\n"," ")
-- Remove double commas
repeat
local oldText = theText
theText = theText:gsub("%s*,%s*,",",")
until theText == oldText
theText = theText:gsub(" ","\n")
-- Remove trailing commas
theText = theText:gsub("%s*,%s*[\n$]","")
-- Add styles to initial words
local buildText = ""
for v in theText:gmatch("([^\n]+)") do
local cPos = v:find(":")
if cPos ~= nil and cPos < 40 then
v = v:gsub('([^:]+):(.*)',"%1:%2")
end
buildText = buildText .. v .. "\n"
end
buildText = buildText:gsub("\n", " ")
-- Trim spaces again
theText = theText:match "^%s*(.-)%s*$"
return buildText
end
%>
" />
" />
<%= (model.metadata.siteTitle.value .. ' - ' .. image.metadata.caption):gsub('>','>'):gsub('<','<') %>
<%
if mode == "preview" then
%>
<%
end
%>
<%
local lastImage = getImage(numImages)
local currentPath = "./" .. lastImage.exportFilename .. "_" .. mySize .. ".html"
%>
<%
local lastImage = getImage(1)
local currentPath = "./" .. lastImage.exportFilename .. "_" .. mySize .. ".html"
%>
<% if model.nonCSS.allowSlideshow then %>
<% end %>
<%= image.metadata.mainsectiontitle or "" %>
<%= formatInfoText("mainsectiontext") %>
<%= LOC "$$$/LRPMapEngine/OtherPhotosHeading=Other Photos" %>
<%
local scanRange = 3
local minImage = index - scanRange
local maxImage = index + scanRange
if mode == "preview" then
%><%= LOC "$$$/LRPMapEngine/OtherIcons=Other icons not available in preview." %><%
else
local otherImg
local cnt = 0
%>
<%
for i = minImage, maxImage do
local actualIndex = (i + (numImages-1)) % (numImages-1)
if actualIndex ~= index then
otherImg = getImage(actualIndex+1) -- 1-based indexing here.
%>
<%
cnt = cnt + 1
end
end
%>
<%
end
%>
<%
if image.metadata.gps ~= "" then
%>
Map
<%= formatInfoText("map_text"):gsub('"','°') %>
<%
end
for s = 1, 10 do
local secText = formatInfoText("infosection" .. s)
if secText ~= "" then
local secTitle = image.metadata["infosection" .. s .. "title"]
secTitle = (secTitle or ""):match "^%s*(.-)%s*$"
%>