From 4b0be4d1a5cbe298b2b023b0e2bc8f80f2b79e63 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 23 Sep 2024 11:31:14 +0200 Subject: [PATCH 01/10] Repeat dashboard --- Resources/Private/Templates/Person/Show.html | 4 +- .../Private/Templates/PublishedItem/Show.html | 4 +- Resources/Private/Templates/Work/Show.html | 4 +- .../Public/JavaScript/DashboardController.js | 119 ++++++++---------- 4 files changed, 60 insertions(+), 71 deletions(-) diff --git a/Resources/Private/Templates/Person/Show.html b/Resources/Private/Templates/Person/Show.html index b437402..ad6768f 100755 --- a/Resources/Private/Templates/Person/Show.html +++ b/Resources/Private/Templates/Person/Show.html @@ -98,9 +98,11 @@

{person.name}

+
-
+
+
{visualizationCall->f:format.raw()}
diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index 2e9f3f8..b51d04f 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -184,9 +184,11 @@

+
-
+
+
{visualizationCall->f:format.raw()}
diff --git a/Resources/Private/Templates/Work/Show.html b/Resources/Private/Templates/Work/Show.html index 84517b0..a8bc84b 100755 --- a/Resources/Private/Templates/Work/Show.html +++ b/Resources/Private/Templates/Work/Show.html @@ -167,9 +167,11 @@

+
-
+
+
{visualizationCall->f:format.raw()}
diff --git a/Resources/Public/JavaScript/DashboardController.js b/Resources/Public/JavaScript/DashboardController.js index 2419e58..d321608 100644 --- a/Resources/Public/JavaScript/DashboardController.js +++ b/Resources/Public/JavaScript/DashboardController.js @@ -3,59 +3,16 @@ const tx_publisherdb_dashboardExcludedYear = 'excluded-year'; const tx_publisherdb_dashboardPublisher = 'publisher'; const tx_publisherdb_dashboardController = { - + set target(target) { this._target = target; this.render(); }, - render() { - const createIncludeButton = type => id => ` + `; - const createYearIncludeButton = createIncludeButton('year'); - const createElementIncludeButton = createIncludeButton('element'); - - const target = d3.select(`#${this._target}`); + draw(targetElement) { + const target = d3.select(targetElement); target.html(''); - const excludedItems = target.append('div') - .attr('id', 'dashboard-excluded-items'); - excludedItems.append('h3') - .text('Ausgeschlossene Verlagsartikel'); - if (tx_publisherdb_visualizationStatus.excludedElements.length) { - const excludedItemList = excludedItems.append('div') - .attr('class', 'tiny button-group'); - d3.select('tx_mpdbpresentation_excludeinfo'); - excludedItemList.selectAll(`a.${tx_publisherdb_dashboardExcludedItem}`) - .data(tx_publisherdb_visualizationStatus.excludedElements.sort()) - .join('a') - .attr('class', `${tx_publisherdb_dashboardExcludedItem} primary button hollow include-element`) - .attr('id', d => d) - .html(d => d); - } else { - excludedItems.append('p') - .style('font-style', 'italic') - .style('font-size', '80%') - .attr('id', 'tx_mpdbpresentation_excludeinfo') - .text('keine Verlagsartikel ausgeschlossen') - } - - /* - const excludedYears = target.append('div') - .attr('id', 'dashboard-excluded-years'); - excludedYears.append('h3') - .text('Ausgeschlossene Jahre'); - if (tx_publisherdb_visualizationStatus.excludedYears.length) { - const excludedYearList = excludedYears.append('div') - .attr('class', 'tiny button-group'); - excludedYearList.selectAll(`a.${tx_publisherdb_dashboardExcludedYear}`) - .data(tx_publisherdb_visualizationStatus.excludedYears.sort()) - .join('a') - .attr('class', `${tx_publisherdb_dashboardExcludedYear} primary button hollow include-year`) - .attr('id', d => d) - .html(d => d); - } - */ - const movingAverages = target.append('div') .attr('id', 'dashboard-moving-averages') movingAverages.append('h3') @@ -73,12 +30,6 @@ const tx_publisherdb_dashboardController = { .attr('id', 'dashboard-set-cumulative') .attr('class', 'primary button hollow dashboard-set-cumulativity') .html('kumulativ'); - /* - movingAveragesList.append('a') - .attr('id', 'dashboard-set-absolute') - .attr('class', 'primary button hollow dashboard-set-cumulativity') - .html('absolut'); - */ movingAveragesList.append('a') .attr('id', 'dashboard-set-per-year') .attr('class', 'primary button hollow dashboard-set-granularity') @@ -88,6 +39,54 @@ const tx_publisherdb_dashboardController = { .attr('class', 'primary button hollow dashboard-set-granularity') .html('nach Datum'); + if (!tx_publisherdb_visualizationStatus.isPublishedItem) { + const publishers = target.append('div') + .attr('id', 'dashboard-publishers'); + publishers.append('h3') + .text('Verlage'); + const publisherList = publishers.append('div') + .attr('class', 'tiny button-group'); + publisherList.selectAll(`a.${tx_publisherdb_dashboardPublisher}`) + .data(tx_publisherdb_visualizationStatus.publishers) + .join('a') + .attr('class', `${tx_publisherdb_dashboardPublisher} primary button hollow include-year`) + .attr('id', d => d.id) + .html(d => d.id) + .attr('title', d => d.name); + } + + const excludedItems = target.append('div') + .attr('id', 'dashboard-excluded-items'); + excludedItems.append('h3') + .text('Ausgeschlossene Verlagsartikel'); + if (tx_publisherdb_visualizationStatus.excludedElements.length) { + const excludedItemList = excludedItems.append('div') + .attr('class', 'tiny button-group'); + d3.select('tx_mpdbpresentation_excludeinfo'); + excludedItemList.selectAll(`a.${tx_publisherdb_dashboardExcludedItem}`) + .data(tx_publisherdb_visualizationStatus.excludedElements.sort()) + .join('a') + .attr('class', `${tx_publisherdb_dashboardExcludedItem} primary button hollow include-element`) + .attr('id', d => d) + .html(d => d); + } else { + excludedItems.append('p') + .style('font-style', 'italic') + .style('font-size', '80%') + .attr('id', 'tx_mpdbpresentation_excludeinfo') + .text('keine Verlagsartikel ausgeschlossen') + } + + }, + + render() { + const createIncludeButton = type => id => ` + `; + const createYearIncludeButton = createIncludeButton('year'); + const createElementIncludeButton = createIncludeButton('element'); + + const target = d3.selectAll(`.${this._target}`); + target.nodes().forEach(target => this.draw(target)); + $('a.include-year').click( e => { const year = e.currentTarget.id; tx_publisherdb_visualizationStatus.includeYear(year); @@ -139,22 +138,6 @@ const tx_publisherdb_dashboardController = { } }); - if (!tx_publisherdb_visualizationStatus.isPublishedItem) { - const publishers = target.append('div') - .attr('id', 'dashboard-publishers'); - publishers.append('h3') - .text('Verlage'); - const publisherList = publishers.append('div') - .attr('class', 'tiny button-group'); - publisherList.selectAll(`a.${tx_publisherdb_dashboardPublisher}`) - .data(tx_publisherdb_visualizationStatus.publishers) - .join('a') - .attr('class', `${tx_publisherdb_dashboardPublisher} primary button hollow include-year`) - .attr('id', d => d.id) - .html(d => d.id) - .attr('title', d => d.name); - } - $(`a.${tx_publisherdb_dashboardPublisher}`).click ( e => { tx_publisherdb_visualizationStatus.currentPublisher = e.currentTarget.id; }); From e52893c4c86fe4c051e940ad9a7b4bc4254c97ab Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 27 Sep 2024 10:47:48 +0200 Subject: [PATCH 02/10] Show current state by button color --- .../Public/JavaScript/DashboardController.js | 96 +++++++++++-------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/Resources/Public/JavaScript/DashboardController.js b/Resources/Public/JavaScript/DashboardController.js index d321608..c98edd6 100644 --- a/Resources/Public/JavaScript/DashboardController.js +++ b/Resources/Public/JavaScript/DashboardController.js @@ -2,6 +2,14 @@ const tx_publisherdb_dashboardExcludedItem = 'excluded-item'; const tx_publisherdb_dashboardExcludedYear = 'excluded-year'; const tx_publisherdb_dashboardPublisher = 'publisher'; +const prefix = 'dashboard'; +const movingAverages = `${prefix}-moving-averages`; +const setMovingAverage = `${prefix}-set-moving-average`; +const setCumulative = `${prefix}-set-cumulative`; +const setPerYear = `${prefix}-set-per-year`; +const setByDate = `${prefix}-set-by-date`; +const btnClassList = 'primary button hollow'; + const tx_publisherdb_dashboardController = { set target(target) { @@ -14,7 +22,7 @@ const tx_publisherdb_dashboardController = { target.html(''); const movingAverages = target.append('div') - .attr('id', 'dashboard-moving-averages') + .attr('class', 'display') movingAverages.append('h3') .html('Anzeige'); const movingAveragesList = movingAverages.append('div') @@ -22,26 +30,27 @@ const tx_publisherdb_dashboardController = { tx_publisherdb_visualizationStatus.movingAverages.forEach( ma => { movingAveragesList .append('a') - .attr('id', `dashboard-set-moving-average-${ma}`) - .attr('class', 'dashboard-set-moving-average primary button hollow') + .attr('data', ma) + .attr('type', setMovingAverage) + .attr('class', btnClassList) .html(`gleitender MW ${ma}`); }); movingAveragesList.append('a') - .attr('id', 'dashboard-set-cumulative') - .attr('class', 'primary button hollow dashboard-set-cumulativity') + .attr('type', setCumulative) + .attr('class', btnClassList) .html('kumulativ'); movingAveragesList.append('a') - .attr('id', 'dashboard-set-per-year') - .attr('class', 'primary button hollow dashboard-set-granularity') + .attr('type', setPerYear) + .attr('class', btnClassList) .html('pro Jahr'); movingAveragesList.append('a') - .attr('id', 'dashboard-set-by-date') - .attr('class', 'primary button hollow dashboard-set-granularity') + .attr('type', setByDate) + .attr('class', btnClassList) .html('nach Datum'); if (!tx_publisherdb_visualizationStatus.isPublishedItem) { const publishers = target.append('div') - .attr('id', 'dashboard-publishers'); + .attr('class', 'dashboard-publishers'); publishers.append('h3') .text('Verlage'); const publisherList = publishers.append('div') @@ -50,13 +59,13 @@ const tx_publisherdb_dashboardController = { .data(tx_publisherdb_visualizationStatus.publishers) .join('a') .attr('class', `${tx_publisherdb_dashboardPublisher} primary button hollow include-year`) - .attr('id', d => d.id) + .attr('class', d => d.id) .html(d => d.id) .attr('title', d => d.name); } const excludedItems = target.append('div') - .attr('id', 'dashboard-excluded-items'); + .attr('class', 'dashboard-excluded-items'); excludedItems.append('h3') .text('Ausgeschlossene Verlagsartikel'); if (tx_publisherdb_visualizationStatus.excludedElements.length) { @@ -80,9 +89,10 @@ const tx_publisherdb_dashboardController = { }, render() { - const createIncludeButton = type => id => ` + `; + const createIncludeButton = type => id => ` + `; const createYearIncludeButton = createIncludeButton('year'); const createElementIncludeButton = createIncludeButton('element'); + const displayBtnList = `a[type=${setMovingAverage}], a[type=${setCumulative}], a[type=${setPerYear}], a[type=${setByDate}]`; const target = d3.selectAll(`.${this._target}`); target.nodes().forEach(target => this.draw(target)); @@ -97,45 +107,49 @@ const tx_publisherdb_dashboardController = { tx_publisherdb_visualizationStatus.includeElement(element); }); - $('a.dashboard-set-moving-average').click ( e => { - const ma = e.currentTarget.id.replace('dashboard-set-moving-average-', ''); + $(`a[type=${setMovingAverage}]`).click ( e => { + const ma = e.currentTarget.attributes.data.nodeValue; tx_publisherdb_visualizationStatus.config = { granularity: tx_publisherdb_granularity.PER_YEAR, cumulativity: tx_publisherdb_cumulativity.MOVING_AVERAGE, movingAverage: ma }; + + $(displayBtnList).addClass('hollow'); + $(`a[type=${setMovingAverage}][data=${ma}]`).removeClass('hollow'); }); - $('a.dashboard-set-cumulativity').click ( e => { - if (e.currentTarget.id == 'dashboard-set-cumulative') { - tx_publisherdb_visualizationStatus.config = { - granularity: tx_publisherdb_granularity.PER_YEAR, - cumulativity: tx_publisherdb_cumulativity.CUMULATIVE, - movingAverage: -1 - } - } else { - tx_publisherdb_visualizationStatus.config = { - granularity: tx_publisherdb_visualizationStatus.config.granularity, - cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, - movingAverage: -1 - } + $(`a[type=${setCumulative}]`).click ( e => { + tx_publisherdb_visualizationStatus.config = { + granularity: tx_publisherdb_granularity.PER_YEAR, + cumulativity: tx_publisherdb_cumulativity.CUMULATIVE, + movingAverage: -1 } + + $(displayBtnList).addClass('hollow'); + $(`a[type=${setCumulative}]`).removeClass('hollow'); }); - $('a.dashboard-set-granularity').click ( e => { - if (e.currentTarget.id == 'dashboard-set-per-year') { - tx_publisherdb_visualizationStatus.config = { - cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, - granularity: tx_publisherdb_granularity.PER_YEAR, - movingAverage: -1 - } - } else { - tx_publisherdb_visualizationStatus.config = { - cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, - granularity: tx_publisherdb_granularity.BY_DATE, - movingAverage: -1 - } + $(`a[type=${setPerYear}]`).click ( e => { + tx_publisherdb_visualizationStatus.config = { + cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, + granularity: tx_publisherdb_granularity.PER_YEAR, + movingAverage: -1 } + + $(displayBtnList).addClass('hollow'); + $(`a[type=${setPerYear}]`).removeClass('hollow'); + }); + + $(`a[type=${setByDate}]`).click ( e => { + tx_publisherdb_visualizationStatus.config = { + cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, + granularity: tx_publisherdb_granularity.BY_DATE, + movingAverage: -1 + } + + $(displayBtnList).addClass('hollow'); + $(`a[type=${setByDate}]`).removeClass('hollow'); }); $(`a.${tx_publisherdb_dashboardPublisher}`).click ( e => { From 96bdbc972b982cae46e2f9d018ea13a11f06874c Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Tue, 8 Oct 2024 21:56:16 +0200 Subject: [PATCH 03/10] Restructure views --- Resources/Private/Templates/Person/Show.html | 51 ++++----- Resources/Private/Templates/Work/Show.html | 108 +++++++++---------- 2 files changed, 80 insertions(+), 79 deletions(-) diff --git a/Resources/Private/Templates/Person/Show.html b/Resources/Private/Templates/Person/Show.html index b437402..28be875 100755 --- a/Resources/Private/Templates/Person/Show.html +++ b/Resources/Private/Templates/Person/Show.html @@ -95,7 +95,33 @@

{person.name}

+
+

+ +

+ + +
    + +
  • + + {work.full_title}, op. {work.opus_no} + + + + +
  • +
    +
+
+ + + + + +
+
@@ -117,31 +143,6 @@

{personGraph} -

- -

- - -
    - -
  • - - {work.full_title}, op. {work.opus_no} - - - - -
  • -
    -
-
- - - - - -
- diff --git a/Resources/Private/Templates/Work/Show.html b/Resources/Private/Templates/Work/Show.html index 84517b0..01ac929 100755 --- a/Resources/Private/Templates/Work/Show.html +++ b/Resources/Private/Templates/Work/Show.html @@ -165,6 +165,59 @@

+ +

+ +

+
    + +
  • + {subWork.subWork.fullTitle} + + op. {subWork.subWork.opusNo} + + + {subWork.subWork.indexNo} + + + ({subWork.subWork.gndId}) + + + + + + {makro.mvdbId}: {makro.title} + + + +
  • +
    +
+
+ + + +

+ +

+ +
    + +
  • + + {item.mvdb_id}: {item.title} + +
  • +
    +
+
+ + + + + +
+
@@ -183,60 +236,7 @@

- - -

- -

- -
- - - -

- -

- -
    - -
  • - - {item.mvdb_id}: {item.title} - -
  • -
    -
-
- - - - - -
- + From 71a31c9ea7b4d5e23480ac6cba2f0ca5a29e2fff Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Tue, 8 Oct 2024 21:56:33 +0200 Subject: [PATCH 04/10] Fix hasPrints check --- Classes/Controller/PublishedItemController.php | 15 +++++---------- .../Private/Templates/PublishedItem/Show.html | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Classes/Controller/PublishedItemController.php b/Classes/Controller/PublishedItemController.php index dcb58d7..22ae1fe 100755 --- a/Classes/Controller/PublishedItemController.php +++ b/Classes/Controller/PublishedItemController.php @@ -50,27 +50,22 @@ public function showAction(PublishedItem $publishedItem) ( $a->getDateOfAction() == $b->getDateOfAction() ? 0 : 1 ); }; $publisherMikroItems = $publishedItem->getPublishedSubitems()->toArray(); - $publisherActions = []; - // use collection - foreach ($publisherMikroItems as $publisherMikroItem) { - $publisherActions = array_merge( - $publisherActions, - $this->publisherActionRepository->findByPublishedsubitem($publisherMikroItem)->toArray() - ); - } - usort($publisherActions, $sortByDate); $document = $this->searchService-> reset()-> setIndex(self::TABLE_INDEX_NAME)-> setId($publishedItem->getMvdbId())-> search(); + $hasPrints = $document-> + get('published_subitems')-> + pluck('prints_by_date')-> + count(); $visualizationCall = $this->getJsCall($document, $this->publishers, $publishedItem->getMvdbId()); $publishers = $this->publisherRepository->findAll(); $this->view->assign('publishedItem', $publishedItem); $this->view->assign('publisherMikroItems', $publisherMikroItems); - $this->view->assign('publisherActions', $publisherActions); + $this->view->assign('hasPrints', $hasPrints); $this->view->assign('visualizationCall', $visualizationCall); $this->view->assign('tableTarget', self::TABLE_TARGET); $this->view->assign('graphTarget', self::GRAPH_TARGET); diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index 2e9f3f8..481c656 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -182,7 +182,7 @@

- +
From 329d3de5b1b42fc6ab83cced3ca5813fb7665502 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Tue, 8 Oct 2024 21:58:22 +0200 Subject: [PATCH 05/10] Change label --- Resources/Private/Language/de.locallang.xlf | 8 ++++---- Resources/Private/Language/locallang.xlf | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index b2b7f63..fe1474a 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -80,8 +80,8 @@ Ergänzende Titelinformationen - printed in - gedruckt in + related published items + zugehörige Verlagsartikel partial works @@ -153,8 +153,8 @@ Keine Wirtschaftsdaten - No economic data could be retrieved for several published items. - Für einige Verlagsartikel konnten keine Wirtschaftsdaten gefunden werden. + The evaluated sources did not contain any economic data. + Die ausgewerteten Quellen enthielten keine Wirtschaftsdaten. The type of the published item indicates, whether it is a simple work print, a collection print, a version or something else. diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index a3bd08a..e949621 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -76,7 +76,7 @@ supplementary title information - printed in + related published items partial works @@ -94,7 +94,7 @@ No economic data - No economic data could be retrieved for several published items. + The evaluated sources did not contain any economic data. contained work From acd69845bfca0656bac6a5d52a0815f820fa3506 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 9 Oct 2024 21:23:32 +0200 Subject: [PATCH 06/10] Add symbolic X --- .../Private/Partials/Index/IndexPicker.html | 2 +- .../Partials/Index/PublisherPicker.html | 2 +- .../Private/Partials/Index/SearchSlot.html | 2 +- Resources/Public/Icons/x-inv.svg | 51 +++++++++++++++++++ Resources/Public/Icons/x.svg | 51 +++++++++++++++++++ ext_localconf.php | 10 ++++ 6 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 Resources/Public/Icons/x-inv.svg create mode 100644 Resources/Public/Icons/x.svg diff --git a/Resources/Private/Partials/Index/IndexPicker.html b/Resources/Private/Partials/Index/IndexPicker.html index 0a3e6f7..7572618 100644 --- a/Resources/Private/Partials/Index/IndexPicker.html +++ b/Resources/Private/Partials/Index/IndexPicker.html @@ -23,7 +23,7 @@
  • {mpdbpres:setConfig(config:searchconfig,key:'index',value:'')} - X +
  • diff --git a/Resources/Private/Partials/Index/PublisherPicker.html b/Resources/Private/Partials/Index/PublisherPicker.html index 06c0cc3..a0a4252 100644 --- a/Resources/Private/Partials/Index/PublisherPicker.html +++ b/Resources/Private/Partials/Index/PublisherPicker.html @@ -23,7 +23,7 @@
  • {mpdbpres:setConfig(config:searchconfig,key:'publisher',value:'')} - X +
  • diff --git a/Resources/Private/Partials/Index/SearchSlot.html b/Resources/Private/Partials/Index/SearchSlot.html index 379da0c..c2f2523 100644 --- a/Resources/Private/Partials/Index/SearchSlot.html +++ b/Resources/Private/Partials/Index/SearchSlot.html @@ -11,7 +11,7 @@ {mpdbpres:setConfig(config:searchConfig,key:'searchTerm',value:'')} - X +
    diff --git a/Resources/Public/Icons/x-inv.svg b/Resources/Public/Icons/x-inv.svg new file mode 100644 index 0000000..ba9d4e2 --- /dev/null +++ b/Resources/Public/Icons/x-inv.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + diff --git a/Resources/Public/Icons/x.svg b/Resources/Public/Icons/x.svg new file mode 100644 index 0000000..16e74ad --- /dev/null +++ b/Resources/Public/Icons/x.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + diff --git a/ext_localconf.php b/ext_localconf.php index 0555cef..d3efa66 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -117,5 +117,15 @@ function() \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/user_plugin_welcome.svg'] ); + $iconRegistry->registerIcon( + 'mpdb_presentation-x', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/x.svg'] + ); + $iconRegistry->registerIcon( + 'mpdb_presentation-xinv', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/x-inv.svg'] + ); } ); From 13737cd540b213957ca4ff560ea3626ae2818132 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 10 Oct 2024 16:49:06 +0200 Subject: [PATCH 07/10] Add old translation mechanism for frontend --- Configuration/TypoScript/setup.typoscript | 5 +- .../Public/JavaScript/SubitemController.js | 1 + .../Public/JavaScript/TableController.js | 20 +- Resources/Public/JavaScript/TimeseriesView.js | 10 +- Resources/Public/JavaScript/Translate.js | 266 ++++++++++++++++++ 5 files changed, 297 insertions(+), 5 deletions(-) create mode 100644 Resources/Public/JavaScript/Translate.js diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 0ece0f2..fc97fcb 100755 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -94,8 +94,9 @@ page { d3 = EXT:guv_sitepackage/Resources/Public/JavaScript/Dist/d3.min.js } includeJSFooter { - research = EXT:guv_sitepackage/Resources/Public/JavaScript/Dist/research.js - lastVisited = EXT:mpdb_presentation/Resources/Public/JavaScript/LastVisitedFe.js + translate = EXT:mpdb_presentation/Resources/Public/JavaScript/Translate.js + #research = EXT:guv_sitepackage/Resources/Public/JavaScript/Dist/research.js + #lastVisited = EXT:mpdb_presentation/Resources/Public/JavaScript/LastVisitedFe.js visualizationController = EXT:mpdb_presentation/Resources/Public/JavaScript/VisualizationController.js tableController = EXT:mpdb_presentation/Resources/Public/JavaScript/TableController.js dashboardController = EXT:mpdb_presentation/Resources/Public/JavaScript/DashboardController.js diff --git a/Resources/Public/JavaScript/SubitemController.js b/Resources/Public/JavaScript/SubitemController.js index 1bf6f89..db515ef 100644 --- a/Resources/Public/JavaScript/SubitemController.js +++ b/Resources/Public/JavaScript/SubitemController.js @@ -32,6 +32,7 @@ const tx_publisherdb_subitemController = { qScale: qScale, data: data, title: this.titles[i], + subtitle: tx_mpdbpresentation_translate(this.titles[i]), margin: this.margin, isMain: false, type: this.type diff --git a/Resources/Public/JavaScript/TableController.js b/Resources/Public/JavaScript/TableController.js index 86cbd89..856a376 100644 --- a/Resources/Public/JavaScript/TableController.js +++ b/Resources/Public/JavaScript/TableController.js @@ -1,6 +1,7 @@ const tx_publisherdb_tableClass = 'data-table'; const tx_publisherdb_tableSort = 'datatable-sort'; const tx_publisherdb_tableYear = 'datatable-year'; +const tx_publisherdb_tableTranslation = 'datatable-translation'; const tx_publisherdb_tableItem = 'datatable-item'; const tx_publisherdb_tableRow = 'datatable-row'; const tx_publisherdb_tableData = 'datatable-data'; @@ -45,8 +46,25 @@ const tx_publisherdb_tableController = { .attr('class', tx_publisherdb_tableClass); const tableHead = table.append('thead'); - const headRow = tableHead.append('tr'); + const translationHeadRow = tableHead.append('tr'); + translationHeadRow.append('th'); + translationHeadRow.selectAll(`th.${tx_publisherdb_tableTranslation}`) + .data(tx_publisherdb_visualizationStatus.subitemIds) + .join('th') + .attr('scope', 'col') + .attr('class', tx_publisherdb_tableTranslation) + .attr('id', d => d) + .attr('class', 'text-right') + .html(d => tx_mpdbpresentation_translate(d)); + if ( + !tx_publisherdb_visualizationStatus.singleItem && + tx_publisherdb_visualizationStatus.targetData != 'prints_by_date' + ) { + translationHeadRow.append('th'); + } + + const headRow = tableHead.append('tr'); const yearHead = headRow.append('th'); yearHead .attr('scope', 'col') diff --git a/Resources/Public/JavaScript/TimeseriesView.js b/Resources/Public/JavaScript/TimeseriesView.js index a74562e..569e996 100644 --- a/Resources/Public/JavaScript/TimeseriesView.js +++ b/Resources/Public/JavaScript/TimeseriesView.js @@ -14,12 +14,13 @@ class TimeseriesView { this.margin = config.margin; this.isMain = config.isMain; this.title = config.title; + this.subtitle = config.subtitle; this.type = config.type; this.init(); } get height() { - return this._height + this.margin; + return this._height + 2 * this.margin; } init() { @@ -32,7 +33,12 @@ class TimeseriesView { render() { this.target.append('text') - .text(this.title); + .text(this.title) + .attr('style', 'font-weight: bold') + .attr('transform', 'translate(0,-25)'); + this.target.append('text') + .text(this.subtitle) + .attr('transform', 'translate(0,-5)'); const qScale = this.qScale.range([this._height, 0]); const qAxis = d3.axisRight() .scale(this.qScale) diff --git a/Resources/Public/JavaScript/Translate.js b/Resources/Public/JavaScript/Translate.js new file mode 100644 index 0000000..8e48054 --- /dev/null +++ b/Resources/Public/JavaScript/Translate.js @@ -0,0 +1,266 @@ +function tx_mpdbpresentation_translate (input) { + let multiPartMap = + { + 'A': 'Alt', + 'B' : 'Bass', + 'Ba': 'Bariton', + 'BC': 'Basso Continuo', + 'C': 'Cembalo', + 'Div': 'Diverse', + 'Fg': 'Fagott', + 'Fl': 'Flöte', + 'Gi': 'Gitarre', + 'Gs': 'Gesang', + 'Hr': 'Horn', + 'Kl': 'Klarinette', + 'K': 'Klavier', + 'K4h': 'Klavier vierhändig', + 'Kb': 'Kontrabass', + 'Ma': 'Mandola', + 'Ml': 'Mandoline', + 'Ms': 'Mezzosopran', + 'Ob': 'Oboe', + 'Or': 'Orgel', + 'Pa': 'Pauke', + 'Po': 'Posaune', + 'S': 'Sopran', + 'Tm': 'Tamborin', + 'T': 'Tenor', + 'Ti': 'Timpani', + 'Tn': 'Triangel', + 'TnTm': 'Triangel und Tamburin', + 'Tr': 'Trompete', + 'Tu': 'Tuba', + 'Va': 'Viola', + 'Vl': 'Violine', + 'Vc': 'Violoncello', + 'Zi': 'Zither', + 'Blä': 'Bläsersatz/-stimmen', + 'Qu': 'Quartettstimmen', + 'Str': 'Streichersatz', + 'Prc': 'Schlag-/Percussionstimmen' + }; + + const onePartMap = + { + 'N': '', + 'Cplt': 'Complett', + 'PStC': 'Partitur und Stimmen', + '2K4h': '2 Klaviere (4hd.)', + '2K8h': '2 Klaviere (8hd.)', + 'K4h': 'Klavier (4hd.)', + 'KA4h': 'Klavierauszug vierhändig', + 'KAmT': 'Klavierauszug mit Text', + 'KAoT': 'Klavierauszug ohne Text', + 'KA': 'Klavierauszug', + 'StC': 'Stimmen Complett', + 'KAB': 'Klavierauszug Begleitung', + 'K': 'Klavier (2hd.)', + 'P': 'Partitur', + 'PCh': 'Chorstimmenpartitur', + 'POr': 'Orchesterstimmenpartitur', + 'StCOr': 'Kompletter Orchesterstimmensatz', + 'StCCh': 'Kompletter Chorstimmensatz', + 'StCChSoloGs': 'Kompletter Chorstimmensatz, Solostimme Gesang', + 'StCChSATB': 'Kompletter Chorstimmensatz SATB', + 'StCChTTBB': 'Kompletter Chorstimmensatz TTBB', + 'StCSolo': 'Kompletter Solostimmensatz', + 'StInc': 'Inkompletter Stimmensatz', + 'hS': 'Hohe Stimme', + 'mS': 'Mittlere Stimme', + 'tS': 'Tiefe Stimme', + 'tA': 'Tiefer Alt', + 'Nbsp': 'Notenbeispiele', + 'Kad': 'Kadenzen' + }; + + const voiceMap = { + 'N': 1, + 'Cplt': 2, + 'P': 3, + 'K': 11, + 'K4h': 12, + '2K4h': 13, + '2K8h': 14, + 'C': 15, + 'BC': 16, + 'Or': 17, + 'KA': 21, + 'KA4h': 22, + 'KAmT': 23, + 'KAoT': 24, + 'StC': 31, + 'PCh': 101, + 'Or': 102, + 'POr': 103, + 'KAB': 111, + 'StCOr': 121, + 'StCCh': 122, + 'StCChSATB': 123, + 'StCChTTBB': 124, + 'StCSolo': 125, + 'StInc': 126, + 'StInst': 127, + 'StOber': 128, + 'St': 129, + 'hS': 131, + 'mS': 132, + 'tS': 133, + 'tA': 134, + 'TrA': 141, + 'Nbsp': 151, + 'Kad': 152, + 'S1': 201, + 'S2': 202, + 'S3': 203, + 'EStS': 204, + 'EStS1': 205, + 'EStS2': 206, + 'EStS3': 207, + 'Ms1': 211, + 'Ms2': 212, + 'Ms3': 213, + 'EStMs': 214, + 'EStMs1': 215, + 'EStMs2': 216, + 'EStMs3': 217, + 'A1': 221, + 'A2': 222, + 'A3': 223, + 'EStA': 224, + 'EStA1': 225, + 'EStA2': 226, + 'EStA3': 227, + 'T1': 231, + 'T2': 232, + 'T3': 233, + 'EStT': 234, + 'EStT1': 235, + 'EStT2': 236, + 'EStT3': 237, + 'Ba1': 241, + 'Ba2': 242, + 'Ba3': 243, + 'EStBa': 244, + 'EStBa1': 245, + 'EStBa2': 246, + 'EStBa3': 247, + 'B1': 251, + 'B2': 252, + 'B3': 253, + 'EStB': 254, + 'EStB1': 255, + 'EStB2': 256, + 'EStB3': 257, + 'Vl': 401, + 'EStVl': 402, + 'EStVl1': 403, + 'EStVl2': 404, + 'Va': 412, + 'EStVa': 413, + 'Vc': 414, + 'EStVc': 415, + 'Kb': 416, + 'EStKb': 417, + 'Pi': 500, + 'EStPi': 501, + 'Fl': 502, + 'EStFl': 503, + 'Kl': 504, + 'EStKl': 505, + 'Ob': 506, + 'EStOb': 507, + 'Fg': 508, + 'EStFg': 509, + 'Tr': 601, + 'EStTr': 601, + 'Hr': 603, + 'EStHr': 604, + 'Po': 604, + 'EStPo': 606, + 'Tu': 609, + 'EStTu': 610, + 'Gi': 701, + 'Gs': 702, + 'Ha': 703, + 'Ma': 704, + 'Ml': 705, + 'Zi': 901, + 'Pa': 911, + 'Tm': 912, + 'Ti': 913, + 'Tn': 914, + 'Div': 990, + 'Blä': 1001, + 'EStBlä': 1002, + 'Qu': 1010, + 'EStQu': 1011, + 'Str': 1020, + 'EStStr': 1021, + 'Qui': 1003, + 'Str': 1004, + 'Prc': 1005 } + + const publisherMap = + { + 'PE': 'C. F. Peters', + 'HO': 'Hofmeister', + 'RB': 'Rieter-Biedermann' + }; + + const keys = input.split('_'); + let part = ''; + if (keys[3] == 'NN') { + part = ''; + } else if (keys[3].includes('N')) { + part = 'Nummer ' + keys[3].match(/\d+/)[0]; + } else if (keys[3].includes('H')) { + part = 'Heft ' + keys[3].match(/\d+/)[0]; + } else if (keys[3].includes('Bd')) { + part = 'Band ' + keys[3].match(/\d+/)[0]; + } else if (keys[3] == 'Ouv') { + part = 'Ouvertüre' + ', '; + } else if (keys[3] == 'Text') { + part = 'Textband' + ', '; + } + + let voice = ''; + if (onePartMap[keys[4]] != undefined) { + voice = onePartMap[keys[4]]; + } else { + const vs = keys[4].match( + /(ESt|Solo|)[A-Z][C\da-z]?[T\da-z]?[a-z]?/g); + for (let v of vs) { + if (v.includes('ESt')) { + voice += 'Einzelstimme '; + v = v.replace('ESt', ''); + } else if (v.includes('Solo')) { + voice += 'Solostimme '; + v = v.replace('Solo', ''); + } + let number = ''; + if (v.match(/\d/)) { + number = v.match(/\d/); + v = v.replace(/\d/, ''); + } + voice += multiPartMap[v] + ' ' + number; + } + } + + const plateId = keys[2].match(/[1-9]\d*[a-f]?/); + + const publisher = publisherMap[keys[0]]; + + let partVoice = part; + let parentheses = [ '(', ')' ]; + if (part == '' && voice == '') { + parentheses = [ '', '' ]; + } + if (part != '' && voice != '') { + partVoice += ', '; + } + partVoice += voice; + + return partVoice + ' ' + parentheses[0] + publisher + ', Plattennr. ' + plateId + parentheses[1]; + +} From 67b6218d04dbf2ca458f4d4144c830a275095f20 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 10 Oct 2024 16:51:33 +0200 Subject: [PATCH 08/10] Change exlusion label --- Resources/Public/JavaScript/DashboardController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Public/JavaScript/DashboardController.js b/Resources/Public/JavaScript/DashboardController.js index 2419e58..0761712 100644 --- a/Resources/Public/JavaScript/DashboardController.js +++ b/Resources/Public/JavaScript/DashboardController.js @@ -36,7 +36,7 @@ const tx_publisherdb_dashboardController = { .style('font-style', 'italic') .style('font-size', '80%') .attr('id', 'tx_mpdbpresentation_excludeinfo') - .text('keine Verlagsartikel ausgeschlossen') + .text('Sie können in der tabellarischen Ansicht auf das "X" klicken, um einzelne Verlagsteilartikel aus den Ansichten auszuschließen.') } /* From 38a57c56ed5d86722b76e3e92dc2dafac38913fa Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Tue, 15 Oct 2024 12:34:54 +0200 Subject: [PATCH 09/10] Suppress dashboard --- Classes/Controller/PersonController.php | 1 + Classes/Controller/WorkController.php | 1 + Resources/Private/Templates/Person/Show.html | 12 +++++++++--- Resources/Private/Templates/Work/Show.html | 12 +++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Classes/Controller/PersonController.php b/Classes/Controller/PersonController.php index 111c1c6..74ac386 100755 --- a/Classes/Controller/PersonController.php +++ b/Classes/Controller/PersonController.php @@ -46,6 +46,7 @@ public function showAction(GndPerson $person) pluck('published_subitems')-> flatten(1)-> pluck('prints_by_date')-> + flatten(1)-> filter()-> count(); diff --git a/Classes/Controller/WorkController.php b/Classes/Controller/WorkController.php index 55d68d5..bc6dfc7 100755 --- a/Classes/Controller/WorkController.php +++ b/Classes/Controller/WorkController.php @@ -61,6 +61,7 @@ public function showAction(GndWork $work) pluck('published_subitems')-> flatten(1)-> pluck('prints_by_date')-> + flatten(1)-> filter()-> count(); $publishedItems = $this->publishedItemRepository->findByContainedWorks($work->getUid()); diff --git a/Resources/Private/Templates/Person/Show.html b/Resources/Private/Templates/Person/Show.html index ad6768f..5b20124 100755 --- a/Resources/Private/Templates/Person/Show.html +++ b/Resources/Private/Templates/Person/Show.html @@ -98,11 +98,17 @@

    {person.name}

    -
    + +
    +
    -
    + +
    +
    -
    + +
    +
    {visualizationCall->f:format.raw()}
    diff --git a/Resources/Private/Templates/Work/Show.html b/Resources/Private/Templates/Work/Show.html index a8bc84b..b6e6a0d 100755 --- a/Resources/Private/Templates/Work/Show.html +++ b/Resources/Private/Templates/Work/Show.html @@ -167,11 +167,17 @@

    -
    + +
    +
    -
    + +
    +
    -
    + +
    +
    {visualizationCall->f:format.raw()}
    From cc0e311f0176d89031eda6ba76171bc883bb960a Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Tue, 15 Oct 2024 12:49:06 +0200 Subject: [PATCH 10/10] Adjust suppression mechanism --- Classes/Controller/PublishedItemController.php | 1 + .../Private/Templates/PublishedItem/Show.html | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Classes/Controller/PublishedItemController.php b/Classes/Controller/PublishedItemController.php index 22ae1fe..7f76680 100755 --- a/Classes/Controller/PublishedItemController.php +++ b/Classes/Controller/PublishedItemController.php @@ -59,6 +59,7 @@ public function showAction(PublishedItem $publishedItem) $hasPrints = $document-> get('published_subitems')-> pluck('prints_by_date')-> + flatten(1)-> count(); $visualizationCall = $this->getJsCall($document, $this->publishers, $publishedItem->getMvdbId()); diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index d3f4c6e..57cbc32 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -185,11 +185,17 @@

    {publishedItem.publicComment}

    -
    -
    -
    -
    -
    + +
    +
    +
    + +
    +
    +
    + +
    +
    {visualizationCall->f:format.raw()}