|
@@ -145,11 +145,6 @@ end
|
|
|
local function generate_coll(s, mconf)
|
|
|
local pref_rep, pref_rep_url
|
|
|
_, pref_rep = next(repo.gr:attr(s, model.id_to_uri.pref_rep))
|
|
|
- if pref_rep then
|
|
|
- pref_rep_url = pkar.gen_pairtree("/res", pref_rep.data, ".html", true)
|
|
|
- -- Collection page uses full size image, shrunk to size if necessary.
|
|
|
- pref_rep_file = get_tn_url(pref_rep):gsub(TN_WEB_PATH, MEDIA_WEB_PATH)
|
|
|
- end
|
|
|
|
|
|
local members = {}
|
|
|
local child_s
|
|
@@ -163,6 +158,16 @@ local function generate_coll(s, mconf)
|
|
|
)
|
|
|
end
|
|
|
--]]
|
|
|
+
|
|
|
+ -- First child is the alternative pref representation.
|
|
|
+ if not pref_rep then pref_rep = child_s end
|
|
|
+
|
|
|
+ if pref_rep then
|
|
|
+ pref_rep_url = pkar.gen_pairtree("/res", pref_rep.data, ".html", true)
|
|
|
+ -- Collection page uses full size image, shrunk to size if necessary.
|
|
|
+ pref_rep_file = get_tn_url(pref_rep):gsub(TN_WEB_PATH, MEDIA_WEB_PATH)
|
|
|
+ end
|
|
|
+
|
|
|
local child_ref, child_label, child_mconf
|
|
|
while child_s do
|
|
|
_, child_ref = next(repo.gr:attr(child_s, model.id_to_uri.ref))
|
|
@@ -177,6 +182,7 @@ local function generate_coll(s, mconf)
|
|
|
tn = get_tn_url(child_s),
|
|
|
href = pkar.gen_pairtree("/res", child_ref.data, ".html", true),
|
|
|
label = child_label.data,
|
|
|
+ ctype_label = child_mconf.label,
|
|
|
})
|
|
|
_, child_s = next(repo.gr:attr(child_s, model.id_to_uri.next))
|
|
|
end
|
|
@@ -221,6 +227,10 @@ local function generate_dres(s, mconf)
|
|
|
local title
|
|
|
-- Metadata
|
|
|
local attrs = repo.gr:connections(s, term.LINK_OUTBOUND)
|
|
|
+
|
|
|
+ local pref_rep, pref_rep_url
|
|
|
+ _, pref_rep = next(repo.gr:attr(s, model.id_to_uri.pref_rep))
|
|
|
+
|
|
|
for p, ots in pairs(attrs) do
|
|
|
local pname = model.uri_to_id[nsm.denormalize_uri(p.data)] or p.data
|
|
|
logger:debug("DRES pname: " .. pname)
|
|
@@ -232,6 +242,8 @@ local function generate_dres(s, mconf)
|
|
|
for _, o in pairs(ots) do
|
|
|
-- Loop through all first children.
|
|
|
local child_s = o
|
|
|
+ if not pref_rep then pref_rep = child_s end
|
|
|
+
|
|
|
logger:debug("local child_s: ", child_s.data)
|
|
|
local ll = {}
|
|
|
|
|
@@ -312,10 +324,9 @@ local function generate_dres(s, mconf)
|
|
|
logger:debug("Children:", pp.write(children))
|
|
|
logger:debug("Breadcrumbs:", pp.write(get_breadcrumbs(mconf)))
|
|
|
|
|
|
- local pref_rep, pref_rep_url
|
|
|
- _, pref_rep = next(repo.gr:attr(s, model.id_to_uri.pref_rep))
|
|
|
if pref_rep then
|
|
|
pref_rep_url = pkar.gen_pairtree("/res", pref_rep.data, ".html", true)
|
|
|
+ pref_rep_file = get_tn_url(pref_rep):gsub(TN_WEB_PATH, MEDIA_WEB_PATH)
|
|
|
end
|
|
|
|
|
|
out_html = templates.dres.data({
|
|
@@ -331,7 +342,10 @@ local function generate_dres(s, mconf)
|
|
|
children = children,
|
|
|
ls_next = ls_next,
|
|
|
tn_url = get_tn_url(s),
|
|
|
- pref_rep = pref_rep_url,
|
|
|
+ pref_rep = {
|
|
|
+ url = pref_rep_url,
|
|
|
+ file = pref_rep_file,
|
|
|
+ },
|
|
|
icon_url = get_icon_url(mconf.lineage),
|
|
|
breadcrumbs = get_breadcrumbs(mconf),
|
|
|
rdf_href = pkar.gen_pairtree("/res", s.data, ".ttl", true),
|