diff --git a/acdh_repo_gui.libraries.yml b/acdh_repo_gui.libraries.yml index dd7345e..55407de 100644 --- a/acdh_repo_gui.libraries.yml +++ b/acdh_repo_gui.libraries.yml @@ -6,6 +6,7 @@ repo-styles: css/dataTables.bootstrap4.min.css: {} css/font-awesome/css/font-awesome.min.css: {} css/jqtree/themes/default/style.min.css: {} + css/lightbox.css: {} js: js/jquery-1.12.3.min.js: {} js/citation-js-0.5.0.min.js: {} @@ -16,6 +17,7 @@ repo-styles: js/dataTables.bootstrap4.min.js: {} js/datatable_init.js: {} js/acdh_repo_gui_pager.js: {} + js/lightbox.js: {} dependencies: - core/drupal - core/drupal.form @@ -25,9 +27,11 @@ repo-root-view: css: base: css/acdh_repo_gui.css: {} + css/lightbox.css: {} js: js/jquery-1.12.3.min.js: {} js/acdh_repo_gui_pager.js: {} + js/lightbox.js: {} dependencies: - core/drupal - core/drupal.form diff --git a/inst/dbfunctions.sql b/inst/dbfunctions.sql index b02a6ff..d12a17b 100644 --- a/inst/dbfunctions.sql +++ b/inst/dbfunctions.sql @@ -1069,13 +1069,13 @@ CASE CREATE TEMPORARY TABLE type_data AS ( WITH type_data as ( SELECT - DISTINCT(fts.id), + DISTINCT(cd.acdhid) as id, cd.headline_title, cd.headline_desc, cd.headline_binary FROM collection_data as cd - LEFT JOIN full_text_search as fts on cd.acdhid = fts.id - LEFT JOIN metadata as m on m.mid = fts.mid + LEFT JOIN metadata as m on m.id = cd.acdhid + LEFT JOIN full_text_search as fts on m.mid = fts.mid WHERE ( m.property = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' diff --git a/src/Object/ResourceObject.php b/src/Object/ResourceObject.php index 8b58821..d039253 100644 --- a/src/Object/ResourceObject.php +++ b/src/Object/ResourceObject.php @@ -297,6 +297,30 @@ public function getTitleImage(string $width = '200px'): string return ''; } + /** + * Get the titleimage URL + * @param string $width + * @return string + */ + public function getTitleImageUrl(string $width = '200px'): string + { + $img = ''; + $imgBinary = ''; + $width = str_replace('px', '', $width); + //check the thumbnail service first + if ($acdhid = $this->getAcdhID()) { + $acdhid = str_replace('http://', '', $acdhid); + $acdhid = str_replace('https://', '', $acdhid); + if ($file = @fopen($this->thumbUrl.$acdhid, "r")) { + $type = fgets($file, 40); + if (!empty($type)) { + return $this->thumbUrl.$acdhid.'?width='.$width; + } + } + } + return ''; + } + /** * Check if we have a titleimage id or not * @return bool diff --git a/templates/acdh-repo-gui-detail-basic.html.twig b/templates/acdh-repo-gui-detail-basic.html.twig index 2889106..f1eb656 100644 --- a/templates/acdh-repo-gui-detail-basic.html.twig +++ b/templates/acdh-repo-gui-detail-basic.html.twig @@ -101,7 +101,8 @@ }, 'acdh:hasIdentifier': { 'icon': 'label', - 'label': 'Identifier(s)' + 'label': 'Identifier(s)', + 'delimiter': ',
' }, 'acdh:hasRelatedProject': { 'icon': 'track_changes', @@ -121,14 +122,14 @@ } } %} - +
{% set titleimage = basic.getTitleImage() %} - {% if titleimage %} -
-
- {% endif%} + {% if titleimage %} +
+
+ {% endif%} {% if basic.getTitle() %}
@@ -149,7 +150,7 @@ {% for value in basic.getRdfTypes() %} {{ value }} {% endfor %} - +
{% endif%} @@ -160,24 +161,29 @@ {'data': basic.getData('acdh:hasAlternativeTitle'), 'icon': "title", 'label': "Alternative Title" } ) }}
{% endif%} - - {% for key, value in properties %} - {% if basic.getData(key) %} - {{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': basic.getData(key), 'icon': value.icon, 'label': value.label, 'type': value.type, 'dateformat': value.dateformat, 'delimiter': value.delimiter } ) }} - {% endif%} - {% endfor %} - {% if titleimage %}
{% endif%} + + {% if titleimage %}
{% endif%} {% if titleimage %} - + {% endif%} + +
+
+ {% for key, value in properties %} + {% if basic.getData(key) %} + {{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': basic.getData(key), 'icon': value.icon, 'label': value.label, 'type': value.type, 'dateformat': value.dateformat, 'delimiter': value.delimiter } ) }} + {% endif%} + {% endfor %} +
+
\ No newline at end of file diff --git a/templates/acdh-repo-gui-main.html.twig b/templates/acdh-repo-gui-main.html.twig index b8a4686..119f40a 100644 --- a/templates/acdh-repo-gui-main.html.twig +++ b/templates/acdh-repo-gui-main.html.twig @@ -1,11 +1,11 @@ - {{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }} - - {% for item in data %} - {% if item.getTitle() %} -
- {% set titleimage = item.getTitleImage('150px') %} - {% if titleimage %}
{% endif%} +{{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }} + +{% for item in data %} + {% if item.getTitle() %} +
+ {% set titleimage = item.getTitleImage('150px') %} + {% if titleimage %}
{% endif%} {% if item.getTitle() %}
@@ -15,7 +15,7 @@
{% endif%} - + {% if item.getRdfTypes() %}
@@ -36,49 +36,48 @@ {% endif%} {% endif%} {% endif%} - - - {% if titleimage %}
{% endif%} - {% if titleimage %} - - - {% endif%} -
-
- {% if item.getData('acdh:hasDescription') %} -
- - {{ "Show Summary"|trans }} - {{ "Hide Summary"|trans }} -
- {% endif%} + {% if titleimage %}
{% endif%} - + {% if titleimage %} + + + {% endif%} + +
+
{% if item.getData('acdh:hasDescription') %} -
- - {{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': item.getData('acdh:hasDescription') , 'icon': 'info' } ) }} - +
+ + {{ "Show Summary"|trans }} + {{ "Hide Summary"|trans }}
{% endif%} -
-
- - {% endif %} - {% endfor %} - {{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }} + + +
+ {% if item.getData('acdh:hasDescription') %} +
+ + {{ include('/modules/contrib/arche-gui/templates/helper-displayFields.html.twig', {'data': item.getData('acdh:hasDescription') , 'icon': 'info' } ) }} + +
+ {% endif%} +
+
+ + {% endif %} +{% endfor %} +{{ include('/modules/contrib/arche-gui/templates/helper-paging.html.twig', {'data': paging } ) }} diff --git a/templates/acdh-repo-gui-search-full.html.twig b/templates/acdh-repo-gui-search-full.html.twig index 8ed0b0e..b3bfbea 100644 --- a/templates/acdh-repo-gui-search-full.html.twig +++ b/templates/acdh-repo-gui-search-full.html.twig @@ -47,7 +47,7 @@