Modul:Faktenbox/Zeilen: Unterschied zwischen den Versionen

Tel/E-Mail Behandlung optimiert
(- smw.addAttrToList(fbdata.attr.list, "Seite", fbdata.fullpagename) verschoben nach Modul:Faktenbox/Common)
(Tel/E-Mail Behandlung optimiert)
Zeile 218: Zeile 218:
if not wik.pageExists("Attribut:" .. attr_name) then -- Spezialbehandlung Attribut nicht vorhanden
if not wik.pageExists("Attribut:" .. attr_name) then -- Spezialbehandlung Attribut nicht vorhanden
t = t .. p.setStandardAttr(args.fbdata.attr.list, attr_name, val, args.exclude_bracket_values, args.val_show_only)
t = t .. p.setStandardAttr(args.fbdata.attr.list, attr_name, val, args.exclude_bracket_values, args.val_show_only)
elseif mw.smw.getPropertyType(attr_name) == "_wpg" then -- Seiten-Attribute Spezialbehandlung
else
t = t .. p.setPageAttr(args.fbdata.attr.list, attr_name, val, args.val_show_only)
mw.logObject(attr_name, "attr_name")
elseif mw.smw.getPropertyType(attr_name) == "_tel" then -- Telefon-Attribute Spezialbehandlung
local attr_type = mw.smw.getPropertyType(attr_name)
t = t .. p.setTelAttr(args.fbdata.attr.list, attr_name, val, args.val_show_only)
mw.logObject(attr_type, "attr_type")
else -- Standard-Attribute
if attr_type == "_wpg" then -- Seiten-Attribute Spezialbehandlung
t = t .. p.setStandardAttr(args.fbdata.attr.list, attr_name, val, args.exclude_bracket_values, args.val_show_only)
t = t .. p.setPageAttr(args.fbdata.attr.list, attr_name, val, args.val_show_only)
elseif attr_type == "_ema" then -- E-Mail-Attribute Spezialbehandlung
t = t .. p.setEmailAttr(args.fbdata.attr.list, attr_name, val, args.val_show_only)
elseif attr_type == "_tel" then -- Telefon-Attribute Spezialbehandlung
t = t .. p.setTelAttr(args.fbdata.attr.list, attr_name, val, args.val_show_only)
else -- Standard-Attribute
t = t .. p.setStandardAttr(args.fbdata.attr.list, attr_name, val, args.exclude_bracket_values, args.val_show_only)
end
end
end
end
end
Zeile 263: Zeile 270:
end
end
-- mw.logObject(t, "t")
-- mw.logObject(t, "t")
return t
end
function p.setEmailAttr(attrlist, name, val, val_show_only)
local t = ""
local val_pre_bracket, email, val_post_bracket = str.bracketSplitAndStrip(val) -- nach Klammern suchen und aufteilen
if val_pre_bracket ~= "" then
t = t .. val_pre_bracket .. " "
end
t = t .. "[mailto:" .. email .. " " .. email .. "]"
if val_post_bracket ~= "" then
t = t .. " " .. val_post_bracket
end
if not val_show_only then
smw.addAttrToList(attrlist, name, email)
end
mw.logObject(t, "t")
return t
return t
end
end
Zeile 268: Zeile 292:
function p.setTelAttr(attrlist, name, val, val_show_only)
function p.setTelAttr(attrlist, name, val, val_show_only)
local t = ""
local t = ""
local val_pre_bracket, tel, val_post_bracket = str.bracketSplitAndStrip(val) -- nach Klammern suchen und aufteilen
local val_pre_bracket, tel, val_post_bracket = -- nach Klammern suchen und aufteilen
local tel = val_pre_bracket .. " " .. tel -- Klammer am Anfang wieder anfügen
str.bracketSplitAndStrip(val)
tel = val_pre_bracket .. " " .. tel -- Klammer am Anfang wieder anfügen
tel = p.getTelUri(tel)
tel = p.getTelUri(tel)
if string.sub(tel, 1, 1) == "+" then
if string.sub(tel, 1, 1) == "+" then
t = t .. "[tel:" .. tel .. " " .. val .. "]"
t = t .. "[tel:" .. tel .. " " .. tel .. "]"
if val_post_bracket ~= "" then
t = t .. " " .. val_post_bracket
end
else
else
t = t .. val
t = t .. val
end
end
if not val_show_only then
if not val_show_only then
smw.addAttrToList(attrlist, name, val)
smw.addAttrToList(attrlist, name, tel)
end
end
-- mw.logObject(t, "t")
-- mw.logObject(t, "t")