EDM/commit
More CSS and Proxy playing
author | Jan Wielemaker |
---|---|
Thu Nov 25 14:49:12 2010 +0100 | |
committer | Jan Wielemaker |
Thu Nov 25 14:49:12 2010 +0100 | |
commit | 4207783a3be3171d297b844b43134a25bece655e |
tree | abbb3598bd639dd20a40d1f681712c59bad4906c |
parent | 0dbdc29e5d5629297263cde9f35e9f916f319a7a |
Diff style: patch stat
diff --git a/components/edm/components.pl b/components/edm/components.pl index 1b1f21b..f7e01cd 100644 --- a/components/edm/components.pl +++ b/components/edm/components.pl @@ -43,6 +43,7 @@ :- use_module(components(label)). :- use_module(library(http/http_dispatch)). :- use_module(library(http/http_wrapper)). +:- use_module(user(preferences)). /** <module> Domain-specific components for EDM models @@ -88,10 +89,15 @@ edm_proxy_view(URI, _Options) --> }, html_requires(css('edm.css')), html(div(class(Styles), - [ \divs(URI, dcterms:title), - \divs(URI, ore:proxyIn -> ens:hasThumbnail), - \divs(URI, dcterms:creator), - \divs(URI, dcterms:description), + [ \values(div, URI, dcterms:title), + \values(div, URI, ore:proxyIn -> ens:hasThumbnail), + \values(div, URI, dcterms:creator), + div(class(created), \values(span, URI, dcterms:created)), + \values(div, URI, dcterms:description), + div(class(owner), + [ \values(span, URI, dcterms:rights), + \values(span, URI, dcterms:identifier) + ]), div(class(fullview), a(href(FullHREF), 'Full view')) ])). @@ -102,15 +108,16 @@ type_style(URI, Class) :- rdf_has(URI, rdf:type, Type), uri_css_class(Type, Class). -divs(URI, Path) --> +values(Element, URI, Path) --> { has_values(URI, Path, Pairs) }, - divs(Pairs). + values(Pairs, Element). -divs([]) --> []. -divs([V-Classes|T]) --> - html(div(class(Classes), \value(V))), - divs(T). +values([], _) --> []. +values([V-Classes|T], Element) --> + { HTML =.. [Element, class(Classes), \value(V)] }, + html(HTML), + values(T, Element). %% has_values(+URI, +Path, -Pairs) is det. @@ -118,7 +125,15 @@ divs([V-Classes|T]) --> % Pairs is a list of Value-Classes pairs. has_values(URI, Path, Pairs) :- - findall(Value-Classes, has_value(Path, URI, Classes, Value), Pairs). + findall(Value-Classes, has_value(Path, URI, Classes, Value), Pairs0), + partition(pair_preferred_lang, Pairs0, Preferred, NonPreferred), + ( Preferred == [] + -> Pairs = NonPreferred + ; Pairs = Preferred + ). + +pair_preferred_lang(Value-_CSS) :- + preferred_lang(Value). has_value(P0->P, URI, Classes, Value) :- !, has_value(P0, URI, Classes0, Value0), @@ -156,3 +171,27 @@ value(Literal) --> html(Text). value(R) --> rdf_link(R). + +%% preferred_lang(+Object) +% +% True if Object is stated in the preferred language of the user +% or language-neutral. + +preferred_lang(Literal) :- + literal_lang(Literal, Lang), !, + user_preference(user:lang, literal(PrefLang)), + lang_matches(PrefLang, Lang). +preferred_lang(R) :- % see bnode_label//1. + rdf_label(R, Value), + literal_lang(Value, Lang), !, + user_preference(user:lang, literal(PrefLang)), + lang_matches(PrefLang, Lang). +preferred_lang(BNode) :- % see bnode_label//1. + rdf_is_bnode(BNode), + rdf_has(BNode, rdf:value, Value), + literal_lang(Value, Lang), !, + user_preference(user:lang, literal(PrefLang)), + lang_matches(PrefLang, Lang). +preferred_lang(_). + +literal_lang(literal(lang(Lang, _)), Lang). diff --git a/web/css/edm.css b/web/css/edm.css index aa09d37..c219f79 100644 --- a/web/css/edm.css +++ b/web/css/edm.css @@ -1,18 +1,71 @@ -div.description a +/* Peudo elements: http://www.w3schools.com/CSS/CSS_pseudo_elements.asp +*/ + +div.Proxy a { color: #000; } +div.ahmteksten:first-letter +{ font-size: 300%; + display: block; + float: left; + margin: 0.1em 0 0; + color: #ccc; +} + div.Proxy div.title { font-size: 200%; font-weight: bold; } +div.Proxy div.creator +{ font-size: 130%; + font-weight: bold; + font-style: italic; +} + +div.Proxy div.created span +{ margin: 0 5px; +} + +div.Proxy div.owner span +{ margin: 0 5px; +} + +div.Proxy span.alternativenumber,span.priref +{ display: none; +} + div.Proxy img.thumbnail { border: 0px; max-height: 250px; float: left; } +div.Proxy div.documentation:before +{ content: "Documentation: "; + font-style: italic; + color: #888; +} + +div.Proxy div.technique:before +{ content: "Technique: "; + font-style: italic; + color: #888; +} + +div.Proxy div.objectCategory:before +{ content: "Category: "; + font-style: italic; + color: #888; +} + +div.Proxy div.productionPlace:before +{ content: "Produced in: "; + font-style: italic; + color: #888; +} + div.Proxy div.fullview { border-top: 1px solid; text-align: right;