Browse Source

support + copy to frontend + queries desc and exhib

master
jules 3 years ago
parent
commit
12102370f8
  1. 52
      daapinterface.py
  2. 5
      templates/artwork.html
  3. 4
      templates/copy.html
  4. 10
      templates/item.html
  5. 2
      templates/layout.html

52
daapinterface.py

@ -388,13 +388,26 @@ def artwork():
#####right middle #####right middle
# description + id to be changed # description + id to be changed
sparql.setQuery(''' sparql.setQuery('''
SELECT ?accessURLdescriptionPage ?authordescriptionPage ?authordescriptionPageLabel ?datedescriptionPage ?sourcedescriptionPage ?sourcedescriptionPageLabel SELECT ?accessURLdescriptionPage ?authordescriptionPageLabel ?datedescriptionPage ?sourcedescriptionPage
WHERE WHERE
{ {
VALUES ?work {wd:'''+artwork_id+'''} VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P65 ?descriptionPage. ?work wdt:P65 ?descriptionPage.
OPTIONAL { ?descriptionPage wdt:P4 ?accessURLdescriptionPage. } OPTIONAL { ?descriptionPage wdt:P4 ?accessURLdescriptionPage. }
OPTIONAL { ?descriptionPage wdt:P9 ?authordescriptionPage. } {
SELECT DISTINCT ?descriptionPage (group_concat(?authorsdescriptionPageLabel; separator="; ") as ?authordescriptionPageLabel)
WHERE
{
VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P65 ?descriptionPage.
OPTIONAL { ?descriptionPage wdt:P9 ?authorsdescriptionPage. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
?authorsdescriptionPage rdfs:label ?authorsdescriptionPageLabel.
?authordescriptionPage rdfs:label ?authordescriptionPageLabel. }
}
GROUP BY ?descriptionPage
ORDER BY ?descriptionPage
}
OPTIONAL { ?descriptionPage wdt:P13 ?datedescriptionPage. } OPTIONAL { ?descriptionPage wdt:P13 ?datedescriptionPage. }
OPTIONAL { ?descriptionPage wdt:P50 ?sourcedescriptionPage. } OPTIONAL { ?descriptionPage wdt:P50 ?sourcedescriptionPage. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
@ -403,6 +416,8 @@ def artwork():
sparql.setReturnFormat(JSON) sparql.setReturnFormat(JSON)
artworkdescriptiondata = sparql.query().convert() artworkdescriptiondata = sparql.query().convert()
print(artworkdescriptiondata)
for x in artworkdescriptiondata['results']['bindings']: for x in artworkdescriptiondata['results']['bindings']:
if "accessURLdescriptionPage" in x: if "accessURLdescriptionPage" in x:
@ -426,7 +441,7 @@ def artwork():
text="<p>Information not available</p>" text="<p>Information not available</p>"
x["text"] = text x["text"] = text
# print(artworkdescriptiondata)
# exhibitions + id to be changed # exhibitions + id to be changed
sparql.setQuery(''' sparql.setQuery('''
@ -436,7 +451,21 @@ def artwork():
VALUES ?work {wd:'''+artwork_id+'''} VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P66 ?exhibitionHisPage. ?work wdt:P66 ?exhibitionHisPage.
OPTIONAL { ?exhibitionHisPage wdt:P4 ?accessURLexhibitionHisPage. } OPTIONAL { ?exhibitionHisPage wdt:P4 ?accessURLexhibitionHisPage. }
OPTIONAL { ?exhibitionHisPage wdt:P9 ?authorexhibitionHisPage. } { SELECT DISTINCT ?exhibitionHisPage (group_concat(?authorsexhibitionHisPageLabel; separator="; ") as ?authorexhibitionHisPageLabel)
WHERE
{
VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P66 ?exhibitionHisPage.
OPTIONAL { ?exhibitionHisPage wdt:P9 ?authorsexhibitionHisPage. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
?authorsexhibitionHisPage rdfs:label ?authorsexhibitionHisPageLabel.
?authorexhibitionHisPage rdfs:label ?authorexhibitionHisPageLabel. }
}
GROUP BY ?exhibitionHisPage
ORDER BY ?exhibitionHisPage
}
OPTIONAL { ?exhibitionHisPage wdt:P13 ?dateexhibitionHisPage. } OPTIONAL { ?exhibitionHisPage wdt:P13 ?dateexhibitionHisPage. }
OPTIONAL { ?exhibitionHisPage wdt:P50 ?sourceexhibitionHisPage. } OPTIONAL { ?exhibitionHisPage wdt:P50 ?sourceexhibitionHisPage. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
@ -1110,6 +1139,21 @@ def searchtools():
text=Markup(text) text=Markup(text)
return render_template('searchtools.html', text=text) return render_template('searchtools.html', text=text)
# #################### SUPPORT
@app.route("/support")
def support():
url="https://daap.bannerrepeater.org/w/index.php?title=Support&action=render"
# Make a GET request to fetch the raw HTML content
html_content = requests.get(url).text
# Parse the html content
soup = BeautifulSoup(html_content, "lxml")
# print(soup.prettify()) # print the parsed data of html
text=soup.find("html")
text=Markup(text)
return render_template('support.html', text=text)
######################### TUTORIAL ######################### TUTORIAL
@app.route("/tutorials") @app.route("/tutorials")
def tutorials(): def tutorials():

5
templates/artwork.html

@ -288,10 +288,15 @@
<!-- right ride with author etc LATER--> <!-- right ride with author etc LATER-->
<div class="text-date-author"> <div class="text-date-author">
{% if "authordescriptionPageLabel" in x %} {% if "authordescriptionPageLabel" in x %}
<!-- IF VARIABLE NOT EMPTY ADD AUTHOR -->
{% if x['authordescriptionPageLabel']['value'] |length %}
<p class="label-item">AUTHOR</p> <p class="label-item">AUTHOR</p>
<p>{{ x['authordescriptionPageLabel']['value'] }}</p> <p>{{ x['authordescriptionPageLabel']['value'] }}</p>
{% endif %}
{% endif %} {% endif %}
<!-- if there is an author name then add here otherwise info non available --> <!-- if there is an author name then add here otherwise info non available -->

4
templates/copy.html

@ -101,7 +101,7 @@
{% else %} {% else %}
{% for x in copyof['results']['bindings'] %} {% for x in copyof['results']['bindings'] %}
<div class="metadata-link"> <div class="metadata-link">
<a target="_blank" href="{{ x['work']['value'] }}"> <a href="/artwork?id={{ x['work']['value'] | replace('http://daap.bannerrepeater.org/entity/', '') }}">
<span>{{ x['workLabel']['value'] }}</span> <span>{{ x['workLabel']['value'] }}</span>
</a> </a>
@ -117,7 +117,7 @@
{% else %} {% else %}
{% for x in copycollection['results']['bindings'] %} {% for x in copycollection['results']['bindings'] %}
<div class="metadata-link"> <div class="metadata-link">
<a target="_blank" href="{{ x['collection']['value'] }}"> <a href="/item?id={{ x['collection']['value'] | replace('http://daap.bannerrepeater.org/entity/', '') }}">
<span>{{ x['collectionLabel']['value'] }}</span> <span>{{ x['collectionLabel']['value'] }}</span>
</a> </a>

10
templates/item.html

@ -175,7 +175,9 @@
{% else %} {% else %}
<!-- else loop through available data --> <!-- else loop through available data -->
{% for x in orglocation['results']['bindings'] %} {% for x in orglocation['results']['bindings'] %}
<span>{{ x['locationLabel']['value'] }}</span> <span>{{ x['locationLabel']['value'] }}
{{ ", " if not loop.last else "" }}
</span>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<!-- end location --> <!-- end location -->
@ -188,7 +190,11 @@
{% else %} {% else %}
<!-- else loop through available data --> <!-- else loop through available data -->
{% for x in orgcountry['results']['bindings'] %} {% for x in orgcountry['results']['bindings'] %}
<span>{{ x['countryLabel']['value'] }}</span> <span>{{ x['countryLabel']['value'] }}
{% if not loop.last %}
,
{% endif %}
</span>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<!-- end country --> <!-- end country -->

2
templates/layout.html

@ -66,7 +66,7 @@
<div id="nav-tutorials"><a href="{{ url_for('tutorials') }}">Tutorials</a></div> <div id="nav-tutorials"><a href="{{ url_for('tutorials') }}">Tutorials</a></div>
<div id="nav-upload"><a href="{{ url_for('upload') }}">Upload</a></div> <div id="nav-upload"><a href="{{ url_for('upload') }}">Upload</a></div>
<div id="nav-login"><a href="https://daap.bannerrepeater.org/w/index.php?title=Special:UserLogin&returnto=Main+Page">Log in</a></div> <div id="nav-login"><a href="https://daap.bannerrepeater.org/w/index.php?title=Special:UserLogin&returnto=Main+Page">Log in</a></div>
<a id="nav-heart" href="https://daap.network/support"> <a id="nav-heart" href="{{ url_for('support') }}">
<img <img
src="css/Icons/heart-solid.svg" src="css/Icons/heart-solid.svg"
alt="heart icon and link to donation page" alt="heart icon and link to donation page"

Loading…
Cancel
Save