From fc875f1b34315f9dda1228aef47ef26ef46209a6 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 8 Feb 2024 10:33:57 +0100 Subject: [PATCH 01/38] Require mpdb core test branch --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4b29ddd..1f116e9 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "require": { "typo3/cms-core": "^11", "elasticsearch/elasticsearch": "^7", - "slub/mpdb-core": "dev-main", + "slub/mpdb-core": "dev-test", "fluidtypo3/vhs": "^6", "illuminate/collections": "^8" }, From 201a453b40e35ac23eb519fbbf4c302e737670af Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 23 Feb 2024 14:31:16 +0100 Subject: [PATCH 02/38] Erase uncommented stuff --- Classes/Command/IndexPublishersCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/Command/IndexPublishersCommand.php b/Classes/Command/IndexPublishersCommand.php index 6d670d6..2cdc49d 100644 --- a/Classes/Command/IndexPublishersCommand.php +++ b/Classes/Command/IndexPublishersCommand.php @@ -84,7 +84,6 @@ protected function execute(InputInterface $input, OutputInterface $output) Collection::wrap($qb->execute()->fetchAll())-> filter(function ($publisher) { return $this->isPublic($publisher); })-> - //pluck('uid', self::NAME_COLNAME, self::SHORTHAND_COLNAME)//-> each(function ($publisher) { $this->indexPublisher($publisher); }); return 0; From 378c25b8f960529c036f70ed77df10168e145b52 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 28 Feb 2024 15:33:55 +0100 Subject: [PATCH 03/38] Fix --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1f116e9..b6bc820 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "require": { "typo3/cms-core": "^11", "elasticsearch/elasticsearch": "^7", - "slub/mpdb-core": "dev-test", + "slub/mpdb-core": "dev-dev", "fluidtypo3/vhs": "^6", "illuminate/collections": "^8" }, From 2efafac246dde7a97e2790813526dc40a4a5ee3c Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Tue, 16 Apr 2024 16:46:10 +0200 Subject: [PATCH 04/38] Add logos for list view --- .gitignore | 5 ++ .../Private/Partials/Person/ListView.html | 1 + Resources/Public/Icons/mpdb_fe_icons.svg | 54 +++++++++++++++++++ Resources/Public/Icons/mpdb_icon_item.svg | 46 ++++++++++++++++ Resources/Public/Icons/mpdb_icon_person.svg | 44 +++++++++++++++ Resources/Public/Icons/mpdb_icon_work.svg | 44 +++++++++++++++ ext_localconf.php | 15 ++++++ 7 files changed, 209 insertions(+) create mode 100644 Resources/Public/Icons/mpdb_fe_icons.svg create mode 100644 Resources/Public/Icons/mpdb_icon_item.svg create mode 100644 Resources/Public/Icons/mpdb_icon_person.svg create mode 100644 Resources/Public/Icons/mpdb_icon_work.svg diff --git a/.gitignore b/.gitignore index 8540401..34aa121 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ Build/dist/* Build/node_modules/* +.idea/ +.Build/ +Build/testing-docker/.env +composer.lock +public/ diff --git a/Resources/Private/Partials/Person/ListView.html b/Resources/Private/Partials/Person/ListView.html index 332866b..b858f61 100644 --- a/Resources/Private/Partials/Person/ListView.html +++ b/Resources/Private/Partials/Person/ListView.html @@ -1,5 +1,6 @@
+ Person
diff --git a/Resources/Public/Icons/mpdb_fe_icons.svg b/Resources/Public/Icons/mpdb_fe_icons.svg new file mode 100644 index 0000000..2ff08f9 --- /dev/null +++ b/Resources/Public/Icons/mpdb_fe_icons.svg @@ -0,0 +1,54 @@ + + diff --git a/Resources/Public/Icons/mpdb_icon_item.svg b/Resources/Public/Icons/mpdb_icon_item.svg new file mode 100644 index 0000000..667f9aa --- /dev/null +++ b/Resources/Public/Icons/mpdb_icon_item.svg @@ -0,0 +1,46 @@ + + diff --git a/Resources/Public/Icons/mpdb_icon_person.svg b/Resources/Public/Icons/mpdb_icon_person.svg new file mode 100644 index 0000000..f11b5d7 --- /dev/null +++ b/Resources/Public/Icons/mpdb_icon_person.svg @@ -0,0 +1,44 @@ + + diff --git a/Resources/Public/Icons/mpdb_icon_work.svg b/Resources/Public/Icons/mpdb_icon_work.svg new file mode 100644 index 0000000..3a32a3d --- /dev/null +++ b/Resources/Public/Icons/mpdb_icon_work.svg @@ -0,0 +1,44 @@ + + diff --git a/ext_localconf.php b/ext_localconf.php index eef7933..656caed 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -80,6 +80,21 @@ function() ); $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); + $iconRegistry->registerIcon( + 'mpdb_presentation-work', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/mpdb_icon_work.svg'] + ); + $iconRegistry->registerIcon( + 'mpdb_presentation-person', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/mpdb_icon_person.svg'] + ); + $iconRegistry->registerIcon( + 'mpdb_presentation-item', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/mpdb_icon_item.svg'] + ); $iconRegistry->registerIcon( 'mpdb_presentation-plugin-fepublisherdb', \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, From 6e635d36c60f8265bb8cad7ea7ea164851ccf7d5 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 17 Apr 2024 16:36:29 +0200 Subject: [PATCH 05/38] Move SearchService to mpdb core --- Classes/Controller/AbstractController.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php index 7cfacbe..d2ec597 100644 --- a/Classes/Controller/AbstractController.php +++ b/Classes/Controller/AbstractController.php @@ -3,9 +3,9 @@ use Illuminate\Support\Collection; use Slub\MpdbCore\Controller\AbstractController as CoreAbstractController; +use Slub\MpdbCore\Services\SearchServiceInterface; +use Slub\MpdbCore\Services\SearchServiceNotFoundException; use Slub\MpdbPresentation\Command\IndexPublishersCommand; -use Slub\MpdbPresentation\Services\SearchServiceInterface; -use Slub\MpdbPresentation\Services\SearchServiceNotFoundException; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; @@ -43,7 +43,6 @@ abstract class AbstractController extends CoreAbstractController protected Collection $localizedIndices; protected Collection $publishers; - protected SearchServiceInterface $searchService; public function initializeShowAction() { @@ -58,20 +57,12 @@ public function initializeShowAction() /** * @throws SearchServiceNotFoundException */ - protected function initializeAction(): void + public function initializeAction(): void { + parent::initializeAction(); + $this->localizedIndices = Collection::wrap(self::INDICES)-> mapWithKeys(function ($array, $key) { return self::localizeIndex($array, $key); }); - - $searchService = GeneralUtility::makeInstanceService('search'); - if (is_object($searchService)) { - $this->searchService = $searchService; - } else { - throw new SearchServiceNotFoundException(); - } - - $this->searchService-> - setSize(self::RESULT_COUNT); } private static function localizeIndex(array $array, string $key): array From d6b5f07c35e0dd7c91ae0729ab152ec8829873f6 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 17 Apr 2024 16:36:51 +0200 Subject: [PATCH 06/38] Polish list view --- .../Private/Partials/Index/Pagination.html | 24 ++++--- .../Private/Partials/Index/SearchSlot.html | 9 +-- .../Private/Partials/Person/ListView.html | 69 ++++++++++--------- .../Partials/PublishedItem/ListView.html | 50 +++++++------- Resources/Private/Partials/Work/ListView.html | 67 ++++++++++-------- Resources/Private/Templates/Index/Search.html | 23 ++++--- Resources/Public/Icons/mpdb_icon_gnd.svg | 45 ++++++++++++ Resources/Public/Icons/mpdb_icon_search.svg | 41 +++++++++++ ext_localconf.php | 28 +++----- 9 files changed, 231 insertions(+), 125 deletions(-) create mode 100644 Resources/Public/Icons/mpdb_icon_gnd.svg create mode 100644 Resources/Public/Icons/mpdb_icon_search.svg diff --git a/Resources/Private/Partials/Index/Pagination.html b/Resources/Private/Partials/Index/Pagination.html index fc6b5a5..b5f5547 100644 --- a/Resources/Private/Partials/Index/Pagination.html +++ b/Resources/Private/Partials/Index/Pagination.html @@ -20,16 +20,20 @@ letzte Seite - {firstResult+1} bis - - - {lastResult} - - - {totalItems} - - - von {totalItems} + +

+ {firstResult+1} bis + + + {lastResult} + + + {totalItems} + + + von {totalItems} +

+ {firstResult + resultCount} {mpdbpres:setConfig(config:config,key:'from',value:from)} diff --git a/Resources/Private/Partials/Index/SearchSlot.html b/Resources/Private/Partials/Index/SearchSlot.html index c716141..fff9b0d 100644 --- a/Resources/Private/Partials/Index/SearchSlot.html +++ b/Resources/Private/Partials/Index/SearchSlot.html @@ -4,12 +4,13 @@
- Suchbegriff - +
- 🔎 + + + {mpdbpres:setConfig(config:searchConfig,key:'searchTerm',value:'')} - + 🗙
diff --git a/Resources/Private/Partials/Person/ListView.html b/Resources/Private/Partials/Person/ListView.html index b858f61..b6a95ce 100644 --- a/Resources/Private/Partials/Person/ListView.html +++ b/Resources/Private/Partials/Person/ListView.html @@ -1,41 +1,44 @@ -
- - Person -
-
- - {entity._source.name} - +
+
+ +
-
-
- - - {entity._source.date_of_birth -> f:format.date(format:"%Y")}–{entity._source.date_of_death -> f:format.date(format:"%Y")} +
+
+ + {entity._source.name} + +
+
+
+ + + {entity._source.date_of_birth -> f:format.date(format:"%Y")}–{entity._source.date_of_death -> f:format.date(format:"%Y")} + + + + + + {entity._id} + + + + + - - - - - {entity._id} +
+
+ + + {work.full_title} - - ℹ️ + + ({work.publishers}) - - -
-
- - - {work.full_title} - - - ({work.publishers}) - - , - + , + +
diff --git a/Resources/Private/Partials/PublishedItem/ListView.html b/Resources/Private/Partials/PublishedItem/ListView.html index 726ada5..c281da6 100644 --- a/Resources/Private/Partials/PublishedItem/ListView.html +++ b/Resources/Private/Partials/PublishedItem/ListView.html @@ -1,29 +1,33 @@ -
- Verlagsartikel -
-
- - {entity._source.title} - +
+
+ +
-
-
- - - {entity._source.works.0.composers.0.name} - - - - - {entity._source.date_of_production -> f:format.date(format:"%Y")} - - +
+
+ + {entity._source.title} +
-
- - {published_subitem.mvdb_id}, - +
+
+ + + {entity._source.works.0.composers.0.name} + + + + + {entity._source.date_of_production -> f:format.date(format:"%Y")} + + +
+
+ + {published_subitem.mvdb_id}, + +
diff --git a/Resources/Private/Partials/Work/ListView.html b/Resources/Private/Partials/Work/ListView.html index 83d27f8..5052c8f 100644 --- a/Resources/Private/Partials/Work/ListView.html +++ b/Resources/Private/Partials/Work/ListView.html @@ -1,37 +1,46 @@ -
- Werk -
-
- - {entity._source.full_title} - +
+
+ +
-
-
- - {entity._source.composers.0.name} - - - - {entity._source.date_of_production -> f:format.date(format:"%Y")} +
+
+ + {entity._source.full_title} + +
+
+
+ + {entity._source.composers.0.name} - - - - - {entity._id} + + + op. {entity._source.opus_no} - - ℹ️ + + + + {entity._source.date_of_production -> f:format.date(format:"%Y")} - - -
-
- - {published_item.mvdb_id}, - + + + + + {entity._id} + + + + + + +
+
+ + {published_item.mvdb_id}, + +
diff --git a/Resources/Private/Templates/Index/Search.html b/Resources/Private/Templates/Index/Search.html index ee5bcb8..50ec49e 100644 --- a/Resources/Private/Templates/Index/Search.html +++ b/Resources/Private/Templates/Index/Search.html @@ -5,14 +5,21 @@ -
- -
-
- -
- diff --git a/Resources/Private/Partials/Index/IndexPicker.html b/Resources/Private/Partials/Index/IndexPicker.html index 5e300a7..7a5609a 100644 --- a/Resources/Private/Partials/Index/IndexPicker.html +++ b/Resources/Private/Partials/Index/IndexPicker.html @@ -5,7 +5,7 @@ {mpdbpres:setConfig(config:searchconfig,key:'index',value:key)}
  • - {index.translation} +
  • diff --git a/Resources/Private/Partials/Index/Pagination.html b/Resources/Private/Partials/Index/Pagination.html index b5f5547..5edb01e 100644 --- a/Resources/Private/Partials/Index/Pagination.html +++ b/Resources/Private/Partials/Index/Pagination.html @@ -17,12 +17,13 @@ {firstResult - resultCount} {mpdbpres:setConfig(config:config,key:'from',value:from)} - letzte Seite +

    - {firstResult+1} bis + {firstResult+1} + {lastResult} @@ -31,14 +32,15 @@ {totalItems} - von {totalItems} + + {totalItems}

    {firstResult + resultCount} {mpdbpres:setConfig(config:config,key:'from',value:from)} - nächste Seite + diff --git a/Resources/Private/Partials/Index/SearchSlot.html b/Resources/Private/Partials/Index/SearchSlot.html index fff9b0d..c5d6b9f 100644 --- a/Resources/Private/Partials/Index/SearchSlot.html +++ b/Resources/Private/Partials/Index/SearchSlot.html @@ -4,7 +4,7 @@
    - +
    diff --git a/Resources/Private/Templates/Index/Search.html b/Resources/Private/Templates/Index/Search.html index 50ec49e..64910ee 100644 --- a/Resources/Private/Templates/Index/Search.html +++ b/Resources/Private/Templates/Index/Search.html @@ -8,16 +8,22 @@
    -

    Ergebnistyp

    +

    + +

    -

    Verlag

    +

    + +

    @@ -42,7 +48,7 @@

    Seite

    - Keine Suchergebnisse gefunden +
    diff --git a/Resources/Private/Templates/Person/Show.html b/Resources/Private/Templates/Person/Show.html index 40540a2..5291050 100755 --- a/Resources/Private/Templates/Person/Show.html +++ b/Resources/Private/Templates/Person/Show.html @@ -14,157 +14,125 @@

    - Personendatensatz +

    {person.name}

    +
    -
    -

    - Personendaten nach gemeinsamer Normdatei der DNB - - - - GND-ID {person.gnd_id} +

    +
    +
    +

    + + {person.gnd_id} + - - - - lokaler Personendatensatz - - - -

    - - - - - - - - - - - - - - - - - +

    +
    - Lebensdaten - - - - - {person.date_of_birth->f:format.date(format:'d.m.Y')} - - - ({person.place_of_birth}) - - – - - {person.date_of_death->f:format.date(format:'d.m.Y')} - - - ({person.place_of_death}) - - - - Lebensdaten unbekannt - - -
    - Wirkungsort - - {person.place_of_activitiy} -
    - Geografischer Code - - {person.geographic_area_code} -
    + + + + + + + + + + + + + + + + + + - - -
    - Geschlecht + - {person.gender} + + + + {person.date_of_birth->f:format.date(format:'d.m.Y')} + + + ({person.place_of_birth}) + + – + + {person.date_of_death->f:format.date(format:'d.m.Y')} + + + ({person.place_of_death}) + + + + + + + +
    + + + {person.place_of_activitiy} +
    + + + {person.geographic_area_code} +
    + + + {person.gender} +
    - -
    -
    -

    Wirtschaftsdaten Klicken zum Ausblenden

    -
    -

    Hilfe zur Grafik Klicken zum Anzeigen

    -
    -

    - Die Grafik zeigt die Lebensdaten der angezeigten Person im hellen Rechteck innerhalb der Zeitleiste. - Darüber trägt der Polygonzug die jahresdurchschnittliche Auflage (im gleitenden Mittelwert über fünf Jahre) ab. -

    -

    - Im Bereich darunter werden diese Auflagezahlen nach Einzelwerken aufgeschlüsselt. - Jedes Einzelwerk hat analog zur summierenden Grafik oben einen eigenen Polygonzug. - Diese sind in ihrer Höhe gemeinsam skaliert, sodass die Flächen der einzelnen Polygonzüge miteinander vergleichbar sind. - Unter jedem Polygonzug stellt ein Punkt eine einzelne Auflage dar. - Dessen Farbe richtet sich nach dem auflegenden Verlag. - Wenn Sie die Maus über einen Punkt bewegen, können Sie Datum, Auflagenhöhe und Verlag ablesen. + +

    +

    -
    -
    -
    -
    -

    Tabellen Klicken zum Ausblenden

    -
    +
    +
    +
    +
    +
    {personGraph} - -

    Werke von {person.name} in der mvdb

    +

    + +

    • - {work.full_title}, op. {work.opus_no} + {work.full_title}, op. {work.opus_no} - verlegt bei {work.publishers} +
    - Es sind keine Werke von {person.name} in einem Verlagsartikel in der mvdb gedruckt worden. + + +
    {visualizationCall->f:format.raw()} + + diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index 7d83c7f..9643f81 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -18,215 +18,174 @@ - - - - - - - +

    - Verlagsartikeldatensatz +

    {publishedItem.title}

    +
    -
    -
    -

    {publishedItem.mvdbId}

    - - {translation} - - - - - - - +
    +
    +
    +
    +

    {publishedItem.mvdbId}

    + + + +
    - Bearbeiter - - {publishedItem.editor.name} - - - ({publishedItem.editor.dateOfBirth->f:format.date(format:'Y')}– - {publishedItem.editor.dateOfDeath->f:format.date(format:'Y')}) - - -
    + + + + + + + + + + + + + + + + + + +
    + + + {publishedItem.editor.name} + + + ({publishedItem.editor.dateOfBirth->f:format.date(format:'Y')}– + {publishedItem.editor.dateOfDeath->f:format.date(format:'Y')}) + + +
    + + + + + {genre.name} + + +
    + + + + + {instrument.name} + + +
    +
    +
    +
    + +

    + +

    - - - - Gattung - - - - - {form.name} - - - - + +

    + +

    - - - - Instrumentierung - - - - - {instrument.name} - - - - + +

    + +

    - -
    -
    - - -

    Enthaltene Werke

    -
    - -

    Bearbeitetes Werk

    -
    - -

    Enthaltenes Werk

    -
    -
    - - -
      - -
    • -

      - - Werkdaten nach gemeinsamer Normdatei der DNB - - - - - GND-ID {work.gndId} - - - - - lokaler Werkdatensatz - - - -

      -

      - - - {work.fullTitle} - - -

      - -

      - - {work.firstcomposer.name} - - - - ({work.firstcomposer.dateOfBirth->f:format.date(format:'Y')}– - {work.firstcomposer.dateOfDeath->f:format.date(format:'Y')}) - - -

      -
      -

      - - - - {form.name} - +

      + + +
        + +
      • +

        + + + {work.gndId} + + +

        +

        + + + {work.fullTitle} + + +

        + +

        + + {work.firstcomposer.name} + + + + ({work.firstcomposer.dateOfBirth->f:format.date(format:'Y')}– + {work.firstcomposer.dateOfDeath->f:format.date(format:'Y')}) + + +

        +
        +

        + + + {genre.name} + + + + + + {instrument.name} + + +

        +
      • - - - für - - - {instrument.name} - - - -

        - - - -
      -
      - - Für diesen Verlagsartikel konnten keine Werkdaten erschlossen werden. - -
      -
      - -

      Wirtschaftsdaten

      - -
      -

      Grafische Darstellung Klicken zum Ausblenden

      -
      -

      Hilfe zur Grafik Klicken zum Anzeigen

      -
      -

      - Die Drucke des Verlagsartikels {publishedItem.title} lassen sich den Teilartikeln zuordnen. - Die Summe der Drucke aller Teilartikel zwischen und beträgt - Jeder Teiartikel liegt auf einem eigenen Zeitstrahl, auf dem jede Auflage durch einen Kreis dargestellt wird, dessen Größe die Auflagenhöhe spiegelt. - Sie können das Auflagedatum und die Auflagehöhe anzeigen lassen, indem Sie den Mauszeiger über dem jeweiligen Kreis halten. - Im darunterliegenden Dashplot wird summarisch die Dichte aller Druckaktionen dargestellt – ohne Rücksicht auf Auflagenhöhen. - Im Balkendiagramm (rechts) wird die Gesamtauflagenhöhe eines Teilartikels über den gesamten Druckzeitraum summiert dargestellt. -

      -

      - Der Artikel {publishedItem.title} wurde zwischen und insgesamt Mal gedruckt. - Jede Auflage wird auf dem Zeitstrahl durch einen Kreis dargestellt, dessen Größe die Auflagenhöhe spiegelt. - Sie können das Auflagedatum und die Auflagehöhe anzeigen lassen, indem Sie den Mauszeiger über dem jeweiligen Kreis halten. -

      -

      - Im unteren Bereich der Grafik werden alle Auflagen kumulativ zusammengefasst. -

      +
    +
    + + + +
    +
    -
    -
    -
    -
    -

    Tabellen Klicken zum Ausblenden

    -
    +
    +
    +
    +
    +
    {visualizationCall->f:format.raw()} diff --git a/Resources/Private/Templates/Work/Show.html b/Resources/Private/Templates/Work/Show.html index 4f9e120..f4da7ba 100755 --- a/Resources/Private/Templates/Work/Show.html +++ b/Resources/Private/Templates/Work/Show.html @@ -15,7 +15,7 @@

    - Werkdatensatz +

    @@ -29,177 +29,150 @@

    +
    - -
    -

    Alternativtitel klicken zum Anzeigen

    -

    {work.altTitles}

    -
    -
    - -
    -

    - Werkdaten nach gemeinsamer Normdatei der DNB - - +

    +
    +
    +

    - GND-ID {work.gndId} + {work.gndId} + - - - - lokaler Werkdatensatz - - - -

    - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
    - Normtitel - - {work.title} -
    - Ergänzende Titelinformationen - - - - Nummerierung: {work.titleNo} - - - - - Instrument: {work.titleInstrument} - - - - - Tonart: {work.tonality} - - -
    - Komponist - - - - - {work.firstcomposer.name} - - - - ({work.firstcomposer.dateOfBirth->f:format.date(format:'Y')}– - {work.firstcomposer.dateOfDeath->f:format.date(format:'Y')}) - +

    + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - -
    + + + {work.genericTitle} +
    + + + {work.altTitles} +
    + + + + + : + {work.titleNo} + + + + + : + {work.titleInstrument} + + + + + : + {work.tonality} + + +
    + + + + + + {work.firstcomposer.name} + + + + ({work.firstcomposer.dateOfBirth->f:format.date(format:'Y')}– + {work.firstcomposer.dateOfDeath->f:format.date(format:'Y')}) + + + + + + + + - - - Komponist unbekannt - +
    + : + + {work.dateOfProduction->f:format.date(format:'Y')} +
    - Produktionsjahr - - {work.dateOfProduction->f:format.date(format:'Y')} -
    - geografischer Code - - {work.geographicAreaCode} -
    - Gattung - - - - {form.name} - - -
    - Instrumentierung - - - - {instrument.name} - - -
    - - - -

    Wirtschaftsdaten

    - -
    -

    Grafische Darstellung Klicken zum Ausblenden

    -
    -

    Hilfe zur Grafik Klicken zum Anzeigen

    -
    -

    - Die Matrixdarstellung schlüsselt auf, in welchen Verlagsartikeln (also: Ausgaben) ein Werk in der mvdb erfasst ist. - Die Listen sind hierarchisiert geordnet zuerst nach Verlagskürzel, dann nach Verlagsartikel und schließlich nach den darin enthaltenen Teilartikeln. - Das ist an den Stammbaum-Strukturen ablesbar. -

    -

    - An den Punkten in den senkrechten Spalten lässt sich die jeweilige Ausgabeform ablesen: - Jeder Zeile entspricht genau eine Spalte. - Die Gesamtauflage des Verlagsartikels ist dann im Balken rechts summiert. -

    -

    - Unterhalb der Matrix werden die Häufigkeiten der verschiedenen Ausgabeformen im Querschnitt der Verlagsartikel summiert. -

    -

    - Datumsspannen und genaue Mengeangaben werden angezeigt, wenn man mit dem Mauszeiger über die Punkte und Balken fährt -

    + +
    + + + {work.geographicAreaCode} +
    + + + + + {form.name} + + +
    + + + + + {instrument.name} + + +
    -
    -
    -
    -
    -

    Tabellen Klicken zum Ausblenden

    -
    +
    +
    +
    +
    +
    -

    Teilwerke

    +

    + +

    • @@ -210,18 +183,11 @@

      Teilwerke

      {subWork.subWork.indexNo} - - - - ({subWork.subWork.gndId}) - - - - (lokaler Datensatz) - - + + ({subWork.subWork.gndId}) + - gedruckt in: + {makro.mvdbId}: {makro.title} @@ -233,24 +199,10 @@

      Teilwerke

    -
    - -
    -
    - {subWork.subWork.title} {subWork.subWork.titleNo} -
    -
    - {subWork.subWork.gndId} -
    -
    - -
    -
    -
    -
    - -

    Gedruckt in

    +

    + +

    @@ -265,7 +217,9 @@

    Gedruckt in

    - Das Werk ist in keinem Verlagsartikel in der mvdb gedruckt worden. + + +
    diff --git a/Resources/Public/JavaScript/VisualizationController.js b/Resources/Public/JavaScript/VisualizationController.js index 1a2d695..1dcbe96 100644 --- a/Resources/Public/JavaScript/VisualizationController.js +++ b/Resources/Public/JavaScript/VisualizationController.js @@ -9,8 +9,10 @@ let tx_publisherdb_visualizationController = { } const firstTwoCapitals = /\b[A-Z][A-Z]/; + console.log(tx_publisherdb_visualizationStatus.data); const realisedPublishers = tx_publisherdb_visualizationStatus.data.published_items - .map(d => firstTwoCapitals.exec(d.id)[0]); + ?.map(d => firstTwoCapitals.exec(d.id)[0]) ?? + firstTwoCapitals.exec(tx_publisherdb_visualizationStatus.data.id); const uniqueRealisedPublishers = [ ... new Set(realisedPublishers) ]; const publisherMap = uniqueRealisedPublishers .map(d => ({ From ee07026d1bae439902c91905bab9cba08326e103 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 27 May 2024 18:19:10 +0200 Subject: [PATCH 10/38] No graphs or dashboards are shown if there's only one print --- .../Public/JavaScript/TableController.js | 39 ++++++++++++++----- .../JavaScript/VisualizationController.js | 7 ++-- .../Public/JavaScript/VisualizationStatus.js | 23 +++++------ 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/Resources/Public/JavaScript/TableController.js b/Resources/Public/JavaScript/TableController.js index cef2f83..f0691bd 100644 --- a/Resources/Public/JavaScript/TableController.js +++ b/Resources/Public/JavaScript/TableController.js @@ -18,7 +18,6 @@ const tx_publisherdb_tableController = { asc: true }; this.render(); - //this.registerEvents(); this.colorSortButtons(); }, @@ -72,12 +71,20 @@ const tx_publisherdb_tableController = { const tableHead = table.append('thead'); const headRow = tableHead.append('tr'); - headRow.append('th') + const yearHead = headRow.append('th'); + yearHead .attr('scope', 'col') .attr('class', tx_publisherdb_tableSort) .attr('id', tx_publisherdb_tableYear) - .attr('class', 'text-right') - .html(createSortButton(`${tx_publisherdb_tableSortItem}-year`) + 'Jahr'); + .attr('class', 'text-right'); + + if (tx_publisherdb_visualizationStatus.singlePrint) { + yearHead.html('Jahr'); + } else { + yearHead.html(createSortButton(`${tx_publisherdb_tableSortItem}-year`) + ' Jahr'); + } + console.log(tx_publisherdb_tableYear); + headRow.selectAll(`th.${tx_publisherdb_tableYear}`) .data(tx_publisherdb_visualizationStatus.subitemIds) .join('th') @@ -85,10 +92,17 @@ const tx_publisherdb_tableController = { .attr('class', tx_publisherdb_tableYear) .attr('id', d => d) .attr('class', 'text-right') - .html( - d => createSortButton(`${tx_publisherdb_tableSortItem}-${d}`) + - createExcludeItemButton(`${tx_publisherdb_tableExcludeItem}-${d}`) + d - ); + .html(d => tx_publisherdb_visualizationStatus.singleItem ? d : createSortButton(`${tx_publisherdb_tableSortItem}-${d}`) + + createExcludeItemButton(`${tx_publisherdb_tableExcludeItem}-${d}`) + d); + + + if (tx_publisherdb_visualizationStatus.singlePrint) { + headRow.selectAll(`th.${tx_publisherdb_tableYear}`).html(d => d); + } else { + headRow.selectAll(`th.${tx_publisherdb_tableYear}`).html(d => createSortButton(`${tx_publisherdb_tableSortItem}-${d}`) + + createExcludeItemButton(`${tx_publisherdb_tableExcludeItem}-${d}`) + d); + } + if (!tx_publisherdb_visualizationStatus.singleItem) { headRow.append('th') .attr('scope', 'col') @@ -106,7 +120,7 @@ const tx_publisherdb_tableController = { .attr('class', tx_publisherdb_tableRow) .attr('scope', 'row') .attr('class', 'text-right') - .html(d => createExcludeYearButton(`${tx_publisherdb_tableExcludeYear}-${d.year}`) + d.year); + .html(d => /*createExcludeYearButton(`${tx_publisherdb_tableExcludeYear}-${d.year}`) +*/ d.year); bodyRows.selectAll(`td.${tx_publisherdb_tableData}`) .data(d => d.items) .join('td') @@ -121,7 +135,12 @@ const tx_publisherdb_tableController = { .html(d => formatNumber(d.total)); } - if (tx_publisherdb_visualizationStatus._config.cumulativity != tx_publisherdb_cumulativity.CUMULATIVE && !tx_publisherdb_visualizationStatus.singleYear) { + if ( + tx_publisherdb_visualizationStatus._config.cumulativity != + tx_publisherdb_cumulativity.CUMULATIVE && + !tx_publisherdb_visualizationStatus.singleYear && + !tx_publisherdb_visualizationStatus.singlePrint + ) { const tableFoot = table.append('tfoot'); const footRow = tableFoot.append('tr'); footRow.append('th') diff --git a/Resources/Public/JavaScript/VisualizationController.js b/Resources/Public/JavaScript/VisualizationController.js index 1dcbe96..a0140ab 100644 --- a/Resources/Public/JavaScript/VisualizationController.js +++ b/Resources/Public/JavaScript/VisualizationController.js @@ -9,7 +9,6 @@ let tx_publisherdb_visualizationController = { } const firstTwoCapitals = /\b[A-Z][A-Z]/; - console.log(tx_publisherdb_visualizationStatus.data); const realisedPublishers = tx_publisherdb_visualizationStatus.data.published_items ?.map(d => firstTwoCapitals.exec(d.id)[0]) ?? firstTwoCapitals.exec(tx_publisherdb_visualizationStatus.data.id); @@ -34,8 +33,10 @@ let tx_publisherdb_visualizationController = { reduce( (a, b) => a < b ? a : b ); tx_publisherdb_tableController.target = config.tableTarget; - tx_publisherdb_dashboardController.target = config.dashboardTarget; - tx_publisherdb_graphController.target = config.graphTarget; + if (!tx_publisherdb_visualizationStatus.singlePrint){ + tx_publisherdb_dashboardController.target = config.dashboardTarget; + tx_publisherdb_graphController.target = config.graphTarget; + } tx_publisherdb_visualizationStatus.registerView(tx_publisherdb_tableController); tx_publisherdb_visualizationStatus.registerView(tx_publisherdb_dashboardController); diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index da1d983..4f89ee1 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -28,6 +28,7 @@ let tx_publisherdb_visualizationStatus = { _publishers: [], singleItem: false, singleYear: false, + singlePrint: false, _years: [], _subitemIds: [], @@ -92,18 +93,6 @@ let tx_publisherdb_visualizationStatus = { return this._publishers; }, - /* - set granularity (granularity) { - this._granularity = granularity; - this.updateView(); - }, - - set cumulativity (cumulativity) { - this._cumulativity = cumulativity; - this.updateView(); - }, - */ - set excludedYears (excludedYears) { this._excludedYears = excludedYears; this.updateView(); @@ -122,6 +111,14 @@ let tx_publisherdb_visualizationStatus = { set data (data) { this._isPublishedItem = data.published_subitems ? true : false; this._data = data; + + if ( + this._data.published_subitems.length == 1 && + this._data.published_subitems[0].prints_per_year.length == 1 + ) { + this.singlePrint = true; + } + this.updateView(); }, @@ -218,7 +215,7 @@ let tx_publisherdb_visualizationStatus = { return targetData.map(print => print.date); }) .flat(); - this.years = d3.range(d3.min(years), d3.max(years)) + this.years = d3.range(+d3.min(years), +d3.max(years) + 1) .filter(year => !this.excludedYears.includes(year)); const yearData = this.years.map(year => ({ From 7eb24d19e0a778a044f782a228aab45790ae35d6 Mon Sep 17 00:00:00 2001 From: Matthias Richter <50573614+dikastes@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:19:48 +0200 Subject: [PATCH 11/38] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1f116e9..40e4fd0 100755 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ ], "require": { "typo3/cms-core": "^11", - "elasticsearch/elasticsearch": "^7", + "elasticsearch/elasticsearch": "^8", "slub/mpdb-core": "dev-test", "fluidtypo3/vhs": "^6", "illuminate/collections": "^8" From 0b40d1f32876585f6551433453d4eb93b6d7231c Mon Sep 17 00:00:00 2001 From: Matthias Richter <50573614+dikastes@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:20:33 +0200 Subject: [PATCH 12/38] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 40e4fd0..c9f07b2 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "require": { "typo3/cms-core": "^11", "elasticsearch/elasticsearch": "^8", - "slub/mpdb-core": "dev-test", + "slub/mpdb-core": "dev-dev", "fluidtypo3/vhs": "^6", "illuminate/collections": "^8" }, From c3af5da998fa5439b3c3598bd2ab907c6b17d872 Mon Sep 17 00:00:00 2001 From: Matthias Richter <50573614+dikastes@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:48:40 +0200 Subject: [PATCH 13/38] Update VisualizationStatus.js --- Resources/Public/JavaScript/VisualizationStatus.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index 4f89ee1..0ba0afb 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -113,6 +113,7 @@ let tx_publisherdb_visualizationStatus = { this._data = data; if ( + this._data.published_subitems && this._data.published_subitems.length == 1 && this._data.published_subitems[0].prints_per_year.length == 1 ) { From 084996842efb12643caaffb82e25bd17429bb68c Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 6 Jun 2024 14:18:55 +0200 Subject: [PATCH 14/38] Split titles and render in table --- Classes/Controller/WorkController.php | 72 +--------------------- Resources/Private/Templates/Work/Show.html | 20 +++--- 2 files changed, 13 insertions(+), 79 deletions(-) diff --git a/Classes/Controller/WorkController.php b/Classes/Controller/WorkController.php index 852108f..655a76b 100755 --- a/Classes/Controller/WorkController.php +++ b/Classes/Controller/WorkController.php @@ -41,81 +41,16 @@ class WorkController extends AbstractController */ public function showAction(GndWork $work) { - if (isset($GLOBALS['BE_USER'])) { - $level = -1; - } else { - $level = 2; - } if ($work->getSuperWork()) { $work = $work->getSuperWork(); } - //$publisherMakroItems = $this->publisherMakroItemRepository->lookupByWork($work);//->toArray(); - //$publisherMikroItems = $this->publisherMikroItemRepository->lookupByWork($work)->toArray(); - - $outMakros = []; - $outMikros = []; - //foreach ($publisherMakroItems as $makro) { - //if ($makro->getFinal() >= $level) { - //$outMakros[] = $makro; - //$outMikros = array_merge($outMikros, $makro->getPublisherMikroItems()->toArray()); - //} - //} - - $publisherActions = []; - foreach ($outMikros as $publisherMikroItem) { - $publisherActions = array_merge( - $publisherActions, - $this->publisherActionRepository->findByPublisherMikroItem($publisherMikroItem)->toArray() - ); - } - - $getPublishedItems = function ($subWork) { - $makros = $this->publisherMakroItemRepository->lookupByWork($subWork, $this->level); - foreach ($makros as $makro) { - foreach ($makro->getPublisherMikroItems() as $mikro) { - $mikros[] = $mikro; - } - } - return [ - 'subWork' => $subWork, - 'makros' => $makros, - 'mikros' => $mikros ?? [] - ]; - }; - - /* - $subWorks = (new DbArray()) - ->set($this->workRepository->findBySuperWork($work)->toArray()) - ->map( $getPublishedItems ) - ->filter( function ($subwork) { return $subwork['makros'] != []; }) - ->toArray(); - - $sw = $this->workRepository->findBySuperWork($work); - foreach ($subWorks as $subWork) { - $subPublisherMakroItems = $this->publisherMakroItemRepository->lookupByWork($work); - - $outMikros = []; - $publisherActions = []; - foreach ($subPublisherMakroItems as $makro) { - if ($makro->getFinal() >= $level) { - $outMakros[] = $makro; - $outMikros = array_merge($outMikros, $makro->getPublisherMikroItems()->toArray()); - } - } - foreach ($outMikros as $mikro) { - $publisherActions = array_merge($publisherActions, $mikro->getPublisherActions()->toArray()); - } - foreach ($subWork['mikros'] as $mikro) { - $publisherActions = array_merge($publisherActions, $mikro->getPublisherActions()->toArray()); - } - } - */ $document = $this->searchService-> reset()-> setIndex(self::TABLE_INDEX_NAME)-> setId($work->getGndId())-> search(); + $altTitles = explode(' $ ', $work->getAltTitles()); $visualizationCall = $this->getJsCall($document, $this->publishers, $work->getFullTitle()); $this->view->assign('publishers', $this->publishers); @@ -124,9 +59,6 @@ public function showAction(GndWork $work) $this->view->assign('dashboardTarget', self::DASHBOARD_TARGET); $this->view->assign('graphTarget', self::GRAPH_TARGET); $this->view->assign('work', $work); - //$this->view->assign('subWorks', $subWorks); - //$this->view->assign('publisherMikroItems', $outMikros); - //$this->view->assign('publisherActions', $publisherActions); - //$this->view->assign('publisherMakroItems', $outMakros); + $this->view->assign('altTitles', $altTitles); } } diff --git a/Resources/Private/Templates/Work/Show.html b/Resources/Private/Templates/Work/Show.html index f4da7ba..4fa3741 100755 --- a/Resources/Private/Templates/Work/Show.html +++ b/Resources/Private/Templates/Work/Show.html @@ -49,15 +49,17 @@

    {work.genericTitle} - - - - - - - {work.altTitles} - - + + + + + + + + {title} + + + From c5424505ea21d655180f074b647aa78126cf08fe Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 7 Jun 2024 14:11:12 +0200 Subject: [PATCH 15/38] Fix column sorting --- .../Public/JavaScript/TableController.js | 50 +++++-------------- .../Public/JavaScript/VisualizationStatus.js | 32 ++++++++++++ 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/Resources/Public/JavaScript/TableController.js b/Resources/Public/JavaScript/TableController.js index f0691bd..81a5a75 100644 --- a/Resources/Public/JavaScript/TableController.js +++ b/Resources/Public/JavaScript/TableController.js @@ -13,47 +13,19 @@ const tx_publisherdb_tableController = { set target(target) { this._target = target; - this._sorting = { - by: 'year', - asc: true - }; this.render(); this.colorSortButtons(); }, - sort(a, b) { - if (tx_publisherdb_tableController._sorting.by == 'year') { - return tx_publisherdb_tableController._sorting.asc ? - a.year - b.year : b.year - a.year; - } else if (tx_publisherdb_tableController._sorting.by == 'total') { - const totalA = a.items.reduce((a, b) => a.quantity + b.quantity); - const totalB = b.items.reduce((a, b) => a.quantity + b.quantity); - const quantityDiff = tx_publisherdb_tableController._sorting.asc ? - totalA - totalB : totalB - totalA; - if (quantityDiff) { - return quantityDiff; - } - return a.year - b.year; - } else { - const quantityA = a.items.filter(item => item.id == tx_publisherdb_tableController._sorting.by)[0]['quantity']; - const quantityB = b.items.filter(item => item.id == tx_publisherdb_tableController._sorting.by)[0]['quantity']; - const quantityDiff = tx_publisherdb_tableController._sorting.asc ? - quantityA - quantityB : quantityB - quantityA; - if (quantityDiff) { - return quantityDiff; - } - return a.year - b.year; - } - }, - colorSortButtons() { - const ascSelector = this._sorting.asc ? 'asc' : 'desc'; - const sortSelector = `${tx_publisherdb_tableSortItem}-${this._sorting.by}`; + const ascSelector = tx_publisherdb_visualizationStatus.sorting.asc ? 'asc' : 'desc'; + const sortSelector = `${tx_publisherdb_tableSortItem}-${tx_publisherdb_visualizationStatus.sorting.by}`; d3.selectAll('a.sort-btn span').style('color', ''); d3.selectAll(`a.sort-btn#${sortSelector} span.${ascSelector}`).style('color', 'black'); }, render() { + // set formatters const formatNumber = x => Intl.NumberFormat('de-DE').format(x); const createButton = (cl, label) => id => ` ${label} `; const createSortButton = tx_publisherdb_visualizationStatus._config.cumulativity == tx_publisherdb_cumulativity.CUMULATIVE ? @@ -61,9 +33,12 @@ const tx_publisherdb_tableController = { createButton('sort-btn', ''); const createExcludeYearButton = tx_publisherdb_visualizationStatus.singleYear ? _ => '' : createButton('exclude-btn', 'x'); const createExcludeItemButton = tx_publisherdb_visualizationStatus.singleItem ? _ => '' : createButton('exclude-btn', 'x'); + + // init const target = d3.select(`#${this._target}`); target.html(''); + // create table and header const table = target.append('table') .attr('class', 'table') .attr('class', tx_publisherdb_tableClass); @@ -83,7 +58,6 @@ const tx_publisherdb_tableController = { } else { yearHead.html(createSortButton(`${tx_publisherdb_tableSortItem}-year`) + ' Jahr'); } - console.log(tx_publisherdb_tableYear); headRow.selectAll(`th.${tx_publisherdb_tableYear}`) .data(tx_publisherdb_visualizationStatus.subitemIds) @@ -112,6 +86,7 @@ const tx_publisherdb_tableController = { .html(createSortButton(`${tx_publisherdb_tableSortItem}-total`) + 'Total'); } + // create body const tableBody = table.append('tbody'); const bodyRows = tableBody.selectAll('tr') .data(tx_publisherdb_visualizationStatus.summedYearData) @@ -172,16 +147,17 @@ const tx_publisherdb_tableController = { registerEvents() { $('a.sort-btn').click( e => { const id = e.currentTarget.id.replace(`${tx_publisherdb_tableSortItem}-`, ''); - if (this._sorting.by == id) { - this._sorting.asc = !this._sorting.asc; + if (tx_publisherdb_visualizationStatus.sorting.by == id) { + tx_publisherdb_visualizationStatus.sorting.asc = !tx_publisherdb_visualizationStatus.sorting.asc; } else { - this._sorting.by = id; + tx_publisherdb_visualizationStatus.sorting.by = id; if (id == 'year') { - this._sorting.asc = true; + tx_publisherdb_visualizationStatus.sorting.asc = true; } else { - this._sorting.asc = false; + tx_publisherdb_visualizationStatus.sorting.asc = false; } } + tx_publisherdb_visualizationStatus.updateData(); this.render(); this.colorSortButtons(); }); diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index 0ba0afb..943c37b 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -32,6 +32,11 @@ let tx_publisherdb_visualizationStatus = { _years: [], _subitemIds: [], + sorting: { + by: 'year', + asc: true + }, + set subitemIds (subitemIds) { this._subitemIds = subitemIds; if (this._subitemIds.length == 1) { @@ -72,6 +77,8 @@ let tx_publisherdb_visualizationStatus = { }, set config (config) { + console.log(this); + console.log(this.sorting); this._config = config; this.updateView(); }, @@ -255,5 +262,30 @@ let tx_publisherdb_visualizationStatus = { registerView: function (view) { this._views.push(view); + }, + + sort(a, b) { + if (tx_publisherdb_visualizationStatus.sorting.by == 'year') { + return tx_publisherdb_visualizationStatus.sorting.asc ? + a.year - b.year : b.year - a.year; + } else if (tx_publisherdb_visualizationStatus.sorting.by == 'total') { + const totalA = a.items.map(item => item.quantity).reduce((c, d) => c + d); + const totalB = b.items.map(item => item.quantity).reduce((c, d) => c + d); + const quantityDiff = tx_publisherdb_visualizationStatus.sorting.asc ? + totalA - totalB : totalB - totalA; + if (quantityDiff) { + return quantityDiff; + } + return a.year - b.year; + } else { + const quantityA = a.items.filter(item => item.id == tx_publisherdb_visualizationStatus.sorting.by)[0]['quantity']; + const quantityB = b.items.filter(item => item.id == tx_publisherdb_visualizationStatus.sorting.by)[0]['quantity']; + const quantityDiff = tx_publisherdb_visualizationStatus.sorting.asc ? + quantityA - quantityB : quantityB - quantityA; + if (quantityDiff) { + return quantityDiff; + } + return a.year - b.year; + } } } From 9da79aa054b3379b7ed952c579eb0f2b89f7add1 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 7 Jun 2024 17:51:04 +0200 Subject: [PATCH 16/38] Strictly index arrays instead of objects --- Classes/Command/CalculateTablesCommand.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/Command/CalculateTablesCommand.php b/Classes/Command/CalculateTablesCommand.php index 6c98cf4..ae524f6 100644 --- a/Classes/Command/CalculateTablesCommand.php +++ b/Classes/Command/CalculateTablesCommand.php @@ -310,7 +310,7 @@ protected static function samplePublishedItemData(array $publishedItem): array { $publishedSubitems = Collection::wrap($publishedItem['_source']['published_subitems'])-> map(function ($item) { return self::samplePublishedSubitemData($item); })-> - toArray(); + all(); return [ $publishedItem['_id'] => @@ -356,10 +356,10 @@ protected static function samplePublishedSubitemData(array $publishedSubitem): a $result = [ 'id' => $publishedSubitem['mvdb_id'], - 'prints_by_date' => $printsByDate->toArray(), - 'prints_per_year' => $printsPerYear->toArray(), - 'prints_by_date_cumulative' => $printsByDateCumulative->toArray(), - 'prints_per_year_cumulative' => $printsPerYearCumulative->toArray() + 'prints_by_date' => $printsByDate->values(), + 'prints_per_year' => $printsPerYear->values(), + 'prints_by_date_cumulative' => $printsByDateCumulative->values(), + 'prints_per_year_cumulative' => $printsPerYearCumulative->values() ]; foreach(explode(',', $extConf['movingAverages']) as $years) { From 19740dfe1785597061069cd6650bdb29d491830b Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 7 Jun 2024 18:01:08 +0200 Subject: [PATCH 17/38] Fix namespaces --- Classes/Command/CalculateTablesCommand.php | 2 +- Classes/Command/IndexPublishersCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Command/CalculateTablesCommand.php b/Classes/Command/CalculateTablesCommand.php index ae524f6..13eb709 100644 --- a/Classes/Command/CalculateTablesCommand.php +++ b/Classes/Command/CalculateTablesCommand.php @@ -1,6 +1,6 @@ Date: Mon, 10 Jun 2024 11:23:44 +0200 Subject: [PATCH 18/38] Make display per date available --- .../Public/JavaScript/DashboardController.js | 12 +- .../Public/JavaScript/TableController.js | 37 +++-- .../Public/JavaScript/VisualizationStatus.js | 128 ++++++++++-------- 3 files changed, 109 insertions(+), 68 deletions(-) diff --git a/Resources/Public/JavaScript/DashboardController.js b/Resources/Public/JavaScript/DashboardController.js index 043650a..74b65b2 100644 --- a/Resources/Public/JavaScript/DashboardController.js +++ b/Resources/Public/JavaScript/DashboardController.js @@ -64,10 +64,12 @@ 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') @@ -99,7 +101,7 @@ const tx_publisherdb_dashboardController = { $('a.dashboard-set-cumulativity').click ( e => { if (e.currentTarget.id == 'dashboard-set-cumulative') { tx_publisherdb_visualizationStatus.config = { - granularity: tx_publisherdb_visualizationStatus.config.granularity, + granularity: tx_publisherdb_granularity.PER_YEAR, cumulativity: tx_publisherdb_cumulativity.CUMULATIVE, movingAverage: -1 } @@ -115,14 +117,14 @@ const tx_publisherdb_dashboardController = { $('a.dashboard-set-granularity').click ( e => { if (e.currentTarget.id == 'dashboard-set-per-year') { tx_publisherdb_visualizationStatus.config = { - granularity: tx_publisherdb_visualizationStatus.config.granularity, - cumulativity: tx_publisherdb_cumulativity.PER_YEAR, + cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, + granularity: tx_publisherdb_granularity.PER_YEAR, movingAverage: -1 } } else { tx_publisherdb_visualizationStatus.config = { - granularity: tx_publisherdb_visualizationStatus.config.granularity, - cumulativity: tx_publisherdb_cumulativity.BY_DATE, + cumulativity: tx_publisherdb_cumulativity.ABSOLUTE, + granularity: tx_publisherdb_granularity.BY_DATE, movingAverage: -1 } } diff --git a/Resources/Public/JavaScript/TableController.js b/Resources/Public/JavaScript/TableController.js index 81a5a75..8f076bb 100644 --- a/Resources/Public/JavaScript/TableController.js +++ b/Resources/Public/JavaScript/TableController.js @@ -27,6 +27,7 @@ const tx_publisherdb_tableController = { render() { // set formatters const formatNumber = x => Intl.NumberFormat('de-DE').format(x); + const formatDate = x => d3.timeFormat('%d.%m.%Y')(d3.isoParse(x)); const createButton = (cl, label) => id => ` ${label} `; const createSortButton = tx_publisherdb_visualizationStatus._config.cumulativity == tx_publisherdb_cumulativity.CUMULATIVE ? _ => '' : @@ -77,7 +78,10 @@ const tx_publisherdb_tableController = { createExcludeItemButton(`${tx_publisherdb_tableExcludeItem}-${d}`) + d); } - if (!tx_publisherdb_visualizationStatus.singleItem) { + if ( + !tx_publisherdb_visualizationStatus.singleItem && + tx_publisherdb_visualizationStatus.targetData != 'prints_by_date' + ) { headRow.append('th') .attr('scope', 'col') .attr('class', tx_publisherdb_tableSort) @@ -88,26 +92,36 @@ const tx_publisherdb_tableController = { // create body const tableBody = table.append('tbody'); + const bodyRows = tableBody.selectAll('tr') - .data(tx_publisherdb_visualizationStatus.summedYearData) + .data( + tx_publisherdb_visualizationStatus.targetData == 'prints_by_date' ? + tx_publisherdb_visualizationStatus.printsByDates : + tx_publisherdb_visualizationStatus.summedYearData + ) .join('tr'); bodyRows.append('th') .attr('class', tx_publisherdb_tableRow) .attr('scope', 'row') .attr('class', 'text-right') - .html(d => /*createExcludeYearButton(`${tx_publisherdb_tableExcludeYear}-${d.year}`) +*/ d.year); + .html(d => tx_publisherdb_visualizationStatus.targetData == 'prints_by_date' ? + formatDate(d.date) : d.year); + bodyRows.selectAll(`td.${tx_publisherdb_tableData}`) .data(d => d.items) .join('td') .attr('class', tx_publisherdb_tableData) .attr('class', 'text-right') .html(d => formatNumber(d)); - if (!tx_publisherdb_visualizationStatus.singleItem) { - bodyRows.append('th') - .attr('class', `${tx_publisherdb_tableYear}-total`) - .attr('class', 'text-right') - .attr('scope', 'row') - .html(d => formatNumber(d.total)); + + if (tx_publisherdb_visualizationStatus.targetData != 'prints_by_date') { + if (!tx_publisherdb_visualizationStatus.singleItem) { + bodyRows.append('th') + .attr('class', `${tx_publisherdb_tableYear}-total`) + .attr('class', 'text-right') + .attr('scope', 'row') + .html(d => formatNumber(d.total)); + } } if ( @@ -130,7 +144,10 @@ const tx_publisherdb_tableController = { .attr('scope', 'col') .attr('class', 'text-right') .html(d => formatNumber(d.sum)); - if (!tx_publisherdb_visualizationStatus.singleItem) { + if ( + !tx_publisherdb_visualizationStatus.singleItem && + tx_publisherdb_visualizationStatus.targetData != 'prints_by_date' + ) { const total = tx_publisherdb_visualizationStatus.sums .map(d => +d.sum) .reduce((a, b) => a + b); diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index 943c37b..169c16d 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -77,8 +77,6 @@ let tx_publisherdb_visualizationStatus = { }, set config (config) { - console.log(this); - console.log(this.sorting); this._config = config; this.updateView(); }, @@ -127,6 +125,27 @@ let tx_publisherdb_visualizationStatus = { this.singlePrint = true; } + const suborder = this._isPublishedItem ? data.published_subitems : + data.published_items + .map(published_item => published_item.published_subitems) + .flat(); + const dates = suborder.filter(published_subitem => published_subitem.prints_by_date) + .map(published_subitem => published_subitem.prints_by_date) + .flat() + .map(print => print.date); + const uniqueDates = [ ... new Set(dates) ]; + + this.printsByDates = uniqueDates.map(date => ({ + date: date, items: + suborder.map( subitem => + subitem.prints_by_date?.filter(print => print.date== date).length > 0 ? + subitem.prints_by_date.filter(print => print.date == date)[0]['quantity'] : 0 + ) + }) + ).sort( (printA, printB) => + printA.date < printB.date ? -1 : 1 + ); + this.updateView(); }, @@ -185,6 +204,7 @@ let tx_publisherdb_visualizationStatus = { }, updateView () { + console.log(this._config); if (this._config.cumulativity == tx_publisherdb_cumulativity.ABSOLUTE) { if (this._config.granularity == tx_publisherdb_granularity.BY_DATE) { this._targetData = 'prints_by_date'; @@ -206,58 +226,60 @@ let tx_publisherdb_visualizationStatus = { }, updateData() { - // retrieve published subitems - const publishedSubitems = this.isPublishedItem ? this.data.published_subitems : - this.data.published_items.map(d => d.published_subitems).flat(); - const currentPublisherShorthand = this.currentPublisher ?? null; - const currentPublisherRegex = currentPublisherShorthand ? new RegExp(`\\b${currentPublisherShorthand}_\w*`) : null; - - // retrieve ids for table header - this.subitemIds = publishedSubitems.map(d => d.id) - .filter(d => !this.excludedElements.includes(d)) - .filter(d => currentPublisherRegex ? currentPublisherRegex.test(d) : true); - - // retrieve per year data including totals for table body - const years = publishedSubitems.map(subitem => { - const targetData = subitem[this.targetData] ?? []; - return targetData.map(print => print.date); - }) - .flat(); - this.years = d3.range(+d3.min(years), +d3.max(years) + 1) - .filter(year => !this.excludedYears.includes(year)); - - const yearData = this.years.map(year => ({ - year: year, - items: publishedSubitems - .filter(item => !this.excludedElements.includes(item.id)) - .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) - .map(prints => { - const targetData = prints[this.targetData] ?? []; - const targetPrint = targetData.filter(print => print.date == year); - return { - id: prints.id, - quantity: targetPrint.length > 0 ? targetPrint[0].quantity : 0 - }; - }), - })) - .sort(this.sort) - .map(item => ({ year: item.year, items: item.items.map(i => i.quantity) })); - this.summedYearData = yearData.map(({year, items}) => ({ - year, items, - total: items.reduce((a, b) => +a + b) - })); - - // retrieve per item sums for table footer - this.sums = publishedSubitems.filter(item => !this.excludedElements.includes(item.id)) - .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) - .map( - subitem => { + if (this._targetData != 'prints_by_date') { + // retrieve published subitems + const publishedSubitems = this.isPublishedItem ? this.data.published_subitems : + this.data.published_items.map(d => d.published_subitems).flat(); + const currentPublisherShorthand = this.currentPublisher ?? null; + const currentPublisherRegex = currentPublisherShorthand ? new RegExp(`\\b${currentPublisherShorthand}_\w*`) : null; + + // retrieve ids for table header + this.subitemIds = publishedSubitems.map(d => d.id) + .filter(d => !this.excludedElements.includes(d)) + .filter(d => currentPublisherRegex ? currentPublisherRegex.test(d) : true); + + // retrieve per year data including totals for table body + const years = publishedSubitems.map(subitem => { const targetData = subitem[this.targetData] ?? []; - const filteredTargetData = targetData.filter(print => !this.excludedYears.includes(print.date)); - const sum = filteredTargetData.length ? filteredTargetData.map(print => print.quantity) - ?.reduce( (a, b) => +a + b ) : null - return { id: subitem.id, sum: sum }; - }); + return targetData.map(print => print.date); + }) + .flat(); + this.years = d3.range(+d3.min(years), +d3.max(years) + 1) + .filter(year => !this.excludedYears.includes(year)); + + const yearData = this.years.map(year => ({ + year: year, + items: publishedSubitems + .filter(item => !this.excludedElements.includes(item.id)) + .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) + .map(prints => { + const targetData = prints[this.targetData] ?? []; + const targetPrint = targetData.filter(print => print.date == year); + return { + id: prints.id, + quantity: targetPrint.length > 0 ? targetPrint[0].quantity : 0 + }; + }), + })) + .sort(this.sort) + .map(item => ({ year: item.year, items: item.items.map(i => i.quantity) })); + this.summedYearData = yearData.map(({year, items}) => ({ + year, items, + total: items.reduce((a, b) => +a + b) + })); + + // retrieve per item sums for table footer + this.sums = publishedSubitems.filter(item => !this.excludedElements.includes(item.id)) + .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) + .map( + subitem => { + const targetData = subitem[this.targetData] ?? []; + const filteredTargetData = targetData.filter(print => !this.excludedYears.includes(print.date)); + const sum = filteredTargetData.length ? filteredTargetData.map(print => print.quantity) + ?.reduce( (a, b) => +a + b ) : null + return { id: subitem.id, sum: sum }; + }); + } }, registerView: function (view) { From a8f047dd2d81973aafb066a08c381f37b85555d4 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 17 Jun 2024 13:10:06 +0200 Subject: [PATCH 19/38] Use asBool output of exists endpoint --- Classes/Command/CalculateTablesCommand.php | 8 ++++---- Classes/Command/IndexPublishersCommand.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/Command/CalculateTablesCommand.php b/Classes/Command/CalculateTablesCommand.php index 13eb709..81cf357 100644 --- a/Classes/Command/CalculateTablesCommand.php +++ b/Classes/Command/CalculateTablesCommand.php @@ -135,7 +135,7 @@ protected function groupPublishedItems(): void */ protected function fetchPublishedItems(): void { - $coreExtConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('mpdb_core'); + $coreExtConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('mpdb_core'); $prefix = $coreExtConf['prefix']; $params = [ @@ -243,13 +243,13 @@ protected function commitChunk(Collection $chunk, string $index): void */ protected function commitPublishedItemTables(): void { - if ($this->client->indices()->exists(['index' => $this->prefix . PublishedItemController::TABLE_INDEX_NAME])) { + if ($this->client->indices()->exists(['index' => $this->prefix . PublishedItemController::TABLE_INDEX_NAME])->asBool()) { $this->client->indices()->delete(['index' => $this->prefix . PublishedItemController::TABLE_INDEX_NAME]); } - if ($this->client->indices()->exists(['index' => $this->prefix . WorkController::TABLE_INDEX_NAME])) { + if ($this->client->indices()->exists(['index' => $this->prefix . WorkController::TABLE_INDEX_NAME])->asBool()) { $this->client->indices()->delete(['index' => $this->prefix . WorkController::TABLE_INDEX_NAME]); } - if ($this->client->indices()->exists(['index' => $this->prefix . PersonController::TABLE_INDEX_NAME])) { + if ($this->client->indices()->exists(['index' => $this->prefix . PersonController::TABLE_INDEX_NAME])->asBool()) { $this->client->indices()->delete(['index' => $this->prefix . PersonController::TABLE_INDEX_NAME]); } diff --git a/Classes/Command/IndexPublishersCommand.php b/Classes/Command/IndexPublishersCommand.php index 90a264f..5be9a6b 100644 --- a/Classes/Command/IndexPublishersCommand.php +++ b/Classes/Command/IndexPublishersCommand.php @@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output) )-> from(self::TABLE_NAME); - if ($this->client->indices()->exists(['index' => $prefix . self::INDEX_NAME])) { + if ($this->client->indices()->exists(['index' => $prefix . self::INDEX_NAME])->asBool()) { $this->client->indices()->delete(['index' => $prefix . self::INDEX_NAME]); } From f6f4c2f78ddce531bd45606c66f5c33ef64cf078 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 17 Jun 2024 13:10:46 +0200 Subject: [PATCH 20/38] Use searchservice for retrieving person information --- Classes/Controller/PersonController.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Classes/Controller/PersonController.php b/Classes/Controller/PersonController.php index d1b972d..22e2d06 100755 --- a/Classes/Controller/PersonController.php +++ b/Classes/Controller/PersonController.php @@ -51,20 +51,12 @@ public function showAction(GndPerson $person) $this->view->assign('graphTarget', self::GRAPH_TARGET); } - protected function get(GndPerson $person): array + protected function get(GndPerson $person): Collection { - $params = [ - 'index' => 'person', - 'body' => [ - 'query' => [ - 'match' => [ - 'uid' => $person->getUid() - ] - ] - ] - ]; - - $personData = $this->elasticClient->search($params); - return $personData['hits']['hits'][0]['_source']; + return $this->searchService-> + reset()-> + setIndex('person')-> + setId($person->getGndId())-> + search(); } } From 9cd57083086180753ace67c4ec7e356303cfa376 Mon Sep 17 00:00:00 2001 From: Matthias Richter <50573614+dikastes@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:27:23 +0200 Subject: [PATCH 21/38] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c9f07b2..40e4fd0 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "require": { "typo3/cms-core": "^11", "elasticsearch/elasticsearch": "^8", - "slub/mpdb-core": "dev-dev", + "slub/mpdb-core": "dev-test", "fluidtypo3/vhs": "^6", "illuminate/collections": "^8" }, From dfb0c0bccf3d2d44cd617d80ecf25c35474aeb4d Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 17 Jun 2024 16:46:53 +0200 Subject: [PATCH 22/38] Add titles to graph views --- Resources/Public/JavaScript/GraphController.js | 2 ++ Resources/Public/JavaScript/SubitemController.js | 2 ++ Resources/Public/JavaScript/TimeseriesView.js | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Resources/Public/JavaScript/GraphController.js b/Resources/Public/JavaScript/GraphController.js index 1491695..9e26dda 100644 --- a/Resources/Public/JavaScript/GraphController.js +++ b/Resources/Public/JavaScript/GraphController.js @@ -51,6 +51,7 @@ const tx_publisherdb_graphController = { tAxis: this._yearAxis, tScale: this._yearScale, margin: margin, + title: '', isMain: true }; const mainTimeseries = new TimeseriesView(timeseriesConfig); @@ -74,6 +75,7 @@ const tx_publisherdb_graphController = { tAxis: this._yearAxis, data: tx_publisherdb_visualizationStatus.summedYearData, tScale: this._yearScale, + titles: tx_publisherdb_visualizationStatus.subitemIds, margin: margin }; tx_publisherdb_subitemController.config = subitemConfig; diff --git a/Resources/Public/JavaScript/SubitemController.js b/Resources/Public/JavaScript/SubitemController.js index 69306b0..15c9e89 100644 --- a/Resources/Public/JavaScript/SubitemController.js +++ b/Resources/Public/JavaScript/SubitemController.js @@ -7,6 +7,7 @@ const tx_publisherdb_subitemController = { this.tAxis = config.tAxis; this.tScale = config.tScale; this.data = config.data; + this.titles = config.titles; this.margin = config.margin; this.init(); }, @@ -29,6 +30,7 @@ const tx_publisherdb_subitemController = { tScale: this.tScale, qScale: qScale, data: data, + title: this.titles[i], margin: this.margin, isMain: false }; diff --git a/Resources/Public/JavaScript/TimeseriesView.js b/Resources/Public/JavaScript/TimeseriesView.js index fb68554..4f12904 100644 --- a/Resources/Public/JavaScript/TimeseriesView.js +++ b/Resources/Public/JavaScript/TimeseriesView.js @@ -13,6 +13,7 @@ class TimeseriesView { this.data = config.data; this.margin = config.margin; this.isMain = config.isMain; + this.title = config.title; this.init(); } @@ -29,6 +30,8 @@ class TimeseriesView { } render() { + this.target.append('text') + .text(this.title); const qScale = this.qScale.range([this._height, 0]); const qAxis = d3.axisRight() .scale(this.qScale) From 78b2ffb2e70ae6b75e3d5610fab90c3accb9d7c9 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 17 Jun 2024 18:26:41 +0200 Subject: [PATCH 23/38] Fix --- Classes/Controller/PublishedItemController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Controller/PublishedItemController.php b/Classes/Controller/PublishedItemController.php index 36217b0..dcb58d7 100755 --- a/Classes/Controller/PublishedItemController.php +++ b/Classes/Controller/PublishedItemController.php @@ -55,7 +55,7 @@ public function showAction(PublishedItem $publishedItem) foreach ($publisherMikroItems as $publisherMikroItem) { $publisherActions = array_merge( $publisherActions, - $this->publisherActionRepository->findByPublisherMikroItem($publisherMikroItem)->toArray() + $this->publisherActionRepository->findByPublishedsubitem($publisherMikroItem)->toArray() ); } usort($publisherActions, $sortByDate); From c6d40f6a62507008df18495cdef5b1877d63bc4b Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 21 Jun 2024 12:57:58 +0200 Subject: [PATCH 24/38] Fix cumulative view --- Resources/Public/JavaScript/GraphController.js | 2 +- .../Public/JavaScript/VisualizationStatus.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Resources/Public/JavaScript/GraphController.js b/Resources/Public/JavaScript/GraphController.js index 9e26dda..51aebb4 100644 --- a/Resources/Public/JavaScript/GraphController.js +++ b/Resources/Public/JavaScript/GraphController.js @@ -37,7 +37,7 @@ const tx_publisherdb_graphController = { .attr('transform', `translate(${margin},${margin})`); const qScale = d3.scaleLinear() - .domain(d3.extent(tx_publisherdb_visualizationStatus.summedYearData, d => d.total)); + .domain([0, d3.max(tx_publisherdb_visualizationStatus.summedYearData, d => d.total)]); const qAxis = d3.axisRight() .scale(this.qScale); diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index 169c16d..4fdc32f 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -204,7 +204,6 @@ let tx_publisherdb_visualizationStatus = { }, updateView () { - console.log(this._config); if (this._config.cumulativity == tx_publisherdb_cumulativity.ABSOLUTE) { if (this._config.granularity == tx_publisherdb_granularity.BY_DATE) { this._targetData = 'prints_by_date'; @@ -263,6 +262,21 @@ let tx_publisherdb_visualizationStatus = { })) .sort(this.sort) .map(item => ({ year: item.year, items: item.items.map(i => i.quantity) })); + + if (this.targetData == 'prints_per_year_cumulative') { + for(let i = 0; i < yearData.length; i++) { + for (let j = 0; j < yearData[i].items.length; j++) { + if (yearData[i].items[j] == 0 && i > 0) { + let runner = i - 1; + while (runner > 0 && yearData[runner].items[j] == 0) { + runner--; + } + yearData[i].items[j] = yearData[runner].items[j]; + } + } + } + } + this.summedYearData = yearData.map(({year, items}) => ({ year, items, total: items.reduce((a, b) => +a + b) From 4b007df6e864f443edf2fe17730662f59e127d49 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 21 Jun 2024 13:13:56 +0200 Subject: [PATCH 25/38] Disable barplot in cumulative view --- .../Public/JavaScript/GraphController.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Resources/Public/JavaScript/GraphController.js b/Resources/Public/JavaScript/GraphController.js index 51aebb4..87d439a 100644 --- a/Resources/Public/JavaScript/GraphController.js +++ b/Resources/Public/JavaScript/GraphController.js @@ -23,7 +23,10 @@ const tx_publisherdb_graphController = { const width = $(`#${this._target}`).width(); const margin = Math.log2(width) * 3 + 10; - this.barplotWidth = tx_publisherdb_visualizationStatus.singleItem ? 0 : (width - 3 * margin) / 4; + this.barplotWidth = + tx_publisherdb_visualizationStatus.singleItem || + tx_publisherdb_visualizationStatus.targetData == 'prints_per_year_cumulative' ? + 0 : (width - 3 * margin) / 4; this.timeseriesWidth = width - 3 * margin - this.barplotWidth; this.calculateAxis(); @@ -64,9 +67,6 @@ const tx_publisherdb_graphController = { const subitemsTarget = svg.append('g') .attr('id', 'graph-subitems') .attr('transform', `translate(${margin},${2 * margin + timeseriesHeight})`); - const barplotTarget = svg.append('g') - .attr('id', 'graph-barplot') - .attr('transform', `translate(${2 * margin + this.timeseriesWidth},${2 * margin + mainTimeseries.height})`); const subitemConfig = { target: subitemsTarget, @@ -82,12 +82,17 @@ const tx_publisherdb_graphController = { svg.attr('height', mainTimeseries.height + tx_publisherdb_subitemController.height + margin * 4); - const barplotConfig = { - target: barplotTarget, - width: this.barplotWidth, - height: tx_publisherdb_subitemController.height - }; - tx_publisherdb_barplotController.config = barplotConfig; + if (tx_publisherdb_visualizationStatus.targetData != 'prints_per_year_cumulative') { + const barplotTarget = svg.append('g') + .attr('id', 'graph-barplot') + .attr('transform', `translate(${2 * margin + this.timeseriesWidth},${2 * margin + mainTimeseries.height})`); + const barplotConfig = { + target: barplotTarget, + width: this.barplotWidth, + height: tx_publisherdb_subitemController.height + }; + tx_publisherdb_barplotController.config = barplotConfig; + } } } } From 806420e5cec5982b65bc9f2785a369f6804e9911 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 21 Jun 2024 14:15:14 +0200 Subject: [PATCH 26/38] Introduce bar plot for per year views --- .../Public/JavaScript/GraphController.js | 10 ++++-- .../Public/JavaScript/SubitemController.js | 4 ++- Resources/Public/JavaScript/TimeseriesView.js | 35 ++++++++++++------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Resources/Public/JavaScript/GraphController.js b/Resources/Public/JavaScript/GraphController.js index 87d439a..47e5d49 100644 --- a/Resources/Public/JavaScript/GraphController.js +++ b/Resources/Public/JavaScript/GraphController.js @@ -18,6 +18,10 @@ const tx_publisherdb_graphController = { }, render() { + const graphType = + tx_publisherdb_visualizationStatus.targetData == 'prints_per_year' || + tx_publisherdb_visualizationStatus.targetData == 'prints_by_date' ? + 'columns' : 'area'; const target = d3.select(`#${this._target}`); target.html(''); @@ -55,7 +59,8 @@ const tx_publisherdb_graphController = { tScale: this._yearScale, margin: margin, title: '', - isMain: true + isMain: true, + type: graphType }; const mainTimeseries = new TimeseriesView(timeseriesConfig); @@ -76,7 +81,8 @@ const tx_publisherdb_graphController = { data: tx_publisherdb_visualizationStatus.summedYearData, tScale: this._yearScale, titles: tx_publisherdb_visualizationStatus.subitemIds, - margin: margin + margin: margin, + type: graphType }; tx_publisherdb_subitemController.config = subitemConfig; diff --git a/Resources/Public/JavaScript/SubitemController.js b/Resources/Public/JavaScript/SubitemController.js index 15c9e89..1bf6f89 100644 --- a/Resources/Public/JavaScript/SubitemController.js +++ b/Resources/Public/JavaScript/SubitemController.js @@ -9,6 +9,7 @@ const tx_publisherdb_subitemController = { this.data = config.data; this.titles = config.titles; this.margin = config.margin; + this.type = config.type; this.init(); }, @@ -32,7 +33,8 @@ const tx_publisherdb_subitemController = { data: data, title: this.titles[i], margin: this.margin, - isMain: false + isMain: false, + type: this.type }; const view = new TimeseriesView(config); diff --git a/Resources/Public/JavaScript/TimeseriesView.js b/Resources/Public/JavaScript/TimeseriesView.js index 4f12904..7e178c0 100644 --- a/Resources/Public/JavaScript/TimeseriesView.js +++ b/Resources/Public/JavaScript/TimeseriesView.js @@ -14,6 +14,7 @@ class TimeseriesView { this.margin = config.margin; this.isMain = config.isMain; this.title = config.title; + this.type = config.type; this.init(); } @@ -46,22 +47,32 @@ class TimeseriesView { .y1(d => this.qScale(d.quantity)) .curve(d3.curveBumpX); - this.target.append('path') - .attr('d', area(this.data)) - .attr('fill', 'hsla(45,100%,80%,100%)'); + const bandScale = d3.scaleBand() + .range([0, this.width]) + .domain(d3.extent(this.data, d => +d.year)) + .align(0) + .paddingOuter(.25) + .paddingInner(.5); this.target.append('g') .attr('transform', `translate(${this.width},0)`) .call(qAxis); - /* - this.target.selectAll('circle') - .data(this.data) - .join('circle') - .attr('cx', d => this.tScale(+d.year)) - .attr('cy', d => this.qScale(d.quantity)) - .attr('fill', 'black') - .attr('r', d => d.quantity > 0 ? 2 : 0); -*/ + if (this.type == 'area') { + this.target.append('path') + .attr('d', area(this.data)) + .attr('fill', 'hsla(45,100%,80%,100%)'); + + } else { + this.target.selectAll('rect') + .data(this.data) + .join('rect') + .attr('y', d => this.qScale(d.quantity)) + .attr('x', d => bandScale(+d.year)) + .attr('width', d => bandScale.bandwidth()) + .attr('height', d => this._height - this.qScale(d.quantity)) + .attr('fill', 'hsl(45,100%,80%)'); + } + } } From 59cd6cdd77b6df183945e8d34f11cc610f822356 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 28 Jun 2024 15:18:31 +0200 Subject: [PATCH 27/38] Fix views for items without retrievable print data --- Classes/Controller/PersonController.php | 8 + Classes/Controller/WorkController.php | 18 +- Resources/Private/Language/de.locallang.xlf | 98 ++-- Resources/Private/Language/locallang.xlf | 84 ++-- .../Private/Partials/Index/IndexPicker.html | 21 +- .../Partials/Index/PublisherPicker.html | 6 +- Resources/Private/Templates/Person/Show.html | 20 +- .../Private/Templates/PublishedItem/Show.html | 20 +- Resources/Private/Templates/Work/Show.html | 417 +++++++++--------- .../Public/JavaScript/TableController.js | 2 +- .../Public/JavaScript/VisualizationStatus.js | 21 +- 11 files changed, 399 insertions(+), 316 deletions(-) diff --git a/Classes/Controller/PersonController.php b/Classes/Controller/PersonController.php index 22e2d06..111c1c6 100755 --- a/Classes/Controller/PersonController.php +++ b/Classes/Controller/PersonController.php @@ -41,6 +41,13 @@ public function showAction(GndPerson $person) setIndex(self::TABLE_INDEX_NAME)-> setId($person->getGndId())-> search(); + $hasPrints = $document-> + get('published_items')-> + pluck('published_subitems')-> + flatten(1)-> + pluck('prints_by_date')-> + filter()-> + count(); $visualizationCall = $this->getJsCall($document, $this->publishers, $personData['name']); $this->view->assign('publishers', $this->publishers->all()); @@ -49,6 +56,7 @@ public function showAction(GndPerson $person) $this->view->assign('dashboardTarget', self::DASHBOARD_TARGET); $this->view->assign('person', $personData); $this->view->assign('graphTarget', self::GRAPH_TARGET); + $this->view->assign('hasPrints', $hasPrints); } protected function get(GndPerson $person): Collection diff --git a/Classes/Controller/WorkController.php b/Classes/Controller/WorkController.php index 655a76b..55d68d5 100755 --- a/Classes/Controller/WorkController.php +++ b/Classes/Controller/WorkController.php @@ -7,6 +7,7 @@ use \TYPO3\CMS\Extbase\Pagination\QueryResultPaginator; use \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser; +use \Slub\MpdbCore\Command\IndexCommand; use \Slub\MpdbCore\Domain\Model\Publisher; use \Slub\MpdbCore\Domain\Model\PublisherMakroItem; use \Slub\MpdbCore\Lib\DbArray; @@ -45,11 +46,24 @@ public function showAction(GndWork $work) $work = $work->getSuperWork(); } + $indexedWork = $this->searchService-> + reset()-> + setIndex(IndexCommand::WORK_INDEX)-> + setId($work->getGndId())-> + search(); $document = $this->searchService-> reset()-> setIndex(self::TABLE_INDEX_NAME)-> setId($work->getGndId())-> search(); + $hasPrints = $document-> + get('published_items')-> + pluck('published_subitems')-> + flatten(1)-> + pluck('prints_by_date')-> + filter()-> + count(); + $publishedItems = $this->publishedItemRepository->findByContainedWorks($work->getUid()); $altTitles = explode(' $ ', $work->getAltTitles()); $visualizationCall = $this->getJsCall($document, $this->publishers, $work->getFullTitle()); @@ -58,7 +72,9 @@ public function showAction(GndWork $work) $this->view->assign('tableTarget', self::TABLE_TARGET); $this->view->assign('dashboardTarget', self::DASHBOARD_TARGET); $this->view->assign('graphTarget', self::GRAPH_TARGET); - $this->view->assign('work', $work); + $this->view->assign('work', $indexedWork); + $this->view->assign('publishedItems', $publishedItems); $this->view->assign('altTitles', $altTitles); + $this->view->assign('hasPrints', $hasPrints); } } diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 15df231..1d96104 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -1,121 +1,121 @@ - -
    - - - next page - nächste Seite - - - previous page - vorherige Seite - + +
    + + + next page + nächste Seite + + + previous page + vorherige Seite + to bis - + of von - + result type Ergebnistyp - + publisher Verlag - + page Seite - + no results found keine Ergebnisse gefunden - + Search Suchen + + + Music Publisher Database Entry + Musikverlagsdatenbank Einstieg + + + The research plugin of the Music Publisher Database. + Das Rechercheplugin der Musikverlagsdatenbank. - - Music Publisher Database Entry - Musikverlagsdatenbank Einstieg - - - The research plugin of the Music Publisher Database. - Das Rechercheplugin der Musikverlagsdatenbank. - Person Person - + Work Werk - + Published Item Verlagsartikel - + These data are retrieved from the Integrated Authority File (Gemeinsame Normdatei). Diese Daten stammen aus der Gemeinsamen Normdatei (GND). - + Life data Lebensdaten - + supplementary title information Ergänzende Titelinformationen - + printed in gedruckt in - + partial works Teilwerke - + There are no prints of this work recorded in the database. Von diesem Werk sind keine Drucke in der Datenbank aufgezeichnet. - + No works by %s have been found. Es wurden keine Werke von %s gefunden. - + published by %s verlegt von %s - + Works by %s in the Music Publisher Database Werke von %s in der Musikverlagsdatenbank - + unknown unbekannt - + We differentiate prints of single works, versions and collections. Collections are classified as explored, if all contained work have been reconstructed. They are classified as partially explored, if only some contained works have been reconstructed, and as unexplored otherwise. Apart from that we differentiate some educational and theoretical works. - + In der mvdb wird zwischen Drucken von Einzelwerken, Variationen bzw. Bearbeitungen und Sammlungen unterschieden. Sammlungen werden als erschlossen bezeichnet, falls alle enthaltenen Werke rekonstruiert werden, als teilerschlossen, falls nur einige enthaltene Werke bekannt sind, und andernfalls als unerschlossen. Daneben werden vereinzelt Schulwerke und theoretische Werke erfasst. - - + + contained work enthaltenes Werk - + contained works enthaltene Werke @@ -135,11 +135,19 @@ No work data could be found for this published item. Für diesen Verlagsartikel konnten keine Werkdaten erschlossen werden. - + Economic data Wirtschaftsdaten - - + + No economic data + Keine Wirtschaftsdaten + + + No economic data could be retrieved for several published items. + Für einige Verlagsartikel konnten keine Wirtschaftsdaten gefunden werden. + + + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index f94e4f5..be631ee 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -1,89 +1,95 @@ - -
    - - - next page - - - previous page - + +
    + + + next page + + + previous page + to - + of - + result type - + publisher - + page - + no results found - + Search - - - Music Publisher Database Entry - - - The research plugin of the Music Publisher Database. - + + + Music Publisher Database Entry + + + The research plugin of the Music Publisher Database. + Person - + Work - + Published Item - + These data are retrieved from the Integrated Authority File (Gemeinsame Normdatei). - + Life data - + unknown - + Works by %s in the Music Publisher Database - + published by %s - + No works by %s have been found. - + There are no prints of this work recorded in the database. - + supplementary title information - + printed in - + partial works - + for - + No work data could be found for this published item. - + Economic data - - + + No economic data + + + No economic data could be retrieved for several published items. + + + diff --git a/Resources/Private/Partials/Index/IndexPicker.html b/Resources/Private/Partials/Index/IndexPicker.html index 7a5609a..28aec43 100644 --- a/Resources/Private/Partials/Index/IndexPicker.html +++ b/Resources/Private/Partials/Index/IndexPicker.html @@ -3,11 +3,22 @@
      {mpdbpres:setConfig(config:searchconfig,key:'index',value:key)} -
    • - - - -
    • + + +
    • + + + +
    • +
      + +
    • + + + +
    • +
      +
    • {mpdbpres:setConfig(config:searchconfig,key:'index',value:'')} diff --git a/Resources/Private/Partials/Index/PublisherPicker.html b/Resources/Private/Partials/Index/PublisherPicker.html index 71765de..7feda01 100644 --- a/Resources/Private/Partials/Index/PublisherPicker.html +++ b/Resources/Private/Partials/Index/PublisherPicker.html @@ -3,11 +3,11 @@
        {mpdbpres:setConfig(config:searchconfig,key:'publisher',value:publisher.shorthand)} - + -
      • +
      • - {publisher.name} + {publisher.shorthand}
      • diff --git a/Resources/Private/Templates/Person/Show.html b/Resources/Private/Templates/Person/Show.html index 5291050..b437402 100755 --- a/Resources/Private/Templates/Person/Show.html +++ b/Resources/Private/Templates/Person/Show.html @@ -96,9 +96,22 @@

        {person.name}

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

    + +

    +

    + +

    +
    +
    @@ -129,7 +142,6 @@

    - {visualizationCall->f:format.raw()} diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index 9643f81..d2727d9 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -182,13 +182,25 @@

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

    + +

    +

    + +

    +
    +
    - {visualizationCall->f:format.raw()} diff --git a/Resources/Private/Templates/Work/Show.html b/Resources/Private/Templates/Work/Show.html index 4fa3741..84517b0 100755 --- a/Resources/Private/Templates/Work/Show.html +++ b/Resources/Private/Templates/Work/Show.html @@ -1,235 +1,244 @@ - + -This Template is responsible for displaying a single view for a domain object + This Template is responsible for displaying a single view for a domain object -If you modify this template, do not forget to change the overwrite settings -in /Configuration/ExtensionBuilder/settings.yaml: - Resources: + If you modify this template, do not forget to change the overwrite settings + in /Configuration/ExtensionBuilder/settings.yaml: + Resources: Private: - Templates: - Show.html: keep + Templates: + Show.html: keep -Otherwise your changes will be overwritten the next time you save the extension in the extension builder + Otherwise your changes will be overwritten the next time you save the extension in the extension builder - - -

    - -

    -

    - - {work.fullTitle} - - - op. {work.opusNo} - - - {work.indexNo} - -

    - -
    + + +

    + +

    +

    + + {work.full_title} + + + op. {work.opus_no} + + + {work.index_no} + +

    + +
    -
    -
    -
    -

    - - {work.gndId} - - -

    - - - - - - - - - - - - - - +
    +
    +
    +

    + + {work.gnd_id} + + +

    +
    - - - {work.genericTitle} -
    - - - {title} -
    - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + : + {work.title_instrument} + + + + + : + {work.tonality} + + + + + - -
    - + - - - : - {work.titleNo} - - - - - : - {work.titleInstrument} - - - - - : - {work.tonality} - - + {work.generic_title}
    - - - - - - {work.firstcomposer.name} - - - - ({work.firstcomposer.dateOfBirth->f:format.date(format:'Y')}– - {work.firstcomposer.dateOfDeath->f:format.date(format:'Y')}) + + +
    + + + {title} +
    + + + + + : + {work.title_no} - - - - - - - -
    - : - - {work.dateOfProduction->f:format.date(format:'Y')} -
    - - - {work.geographicAreaCode} -
    - - - - - {form.name} - - -
    - + - - - {instrument.name} - - + + + + {work.composers.0.name} + + + + ({work.composers.0.dateOfBirth->f:format.date(format:'Y')}– + {work.composers.0.dateOfDeath->f:format.date(format:'Y')}) + + + + + + + + +
    + + + + + + + {work.date_of_production->f:format.date(format:'Y')} + + + + + + + + + + {work.geographic_area_code} + + + + + + + + + + + + {genre.name} + + + + + + + + + + + + + + {instrument.name} + + + + + + +
    +
    +
    + + +
    +
    +
    + {visualizationCall->f:format.raw()} +
    + +

    + +

    +

    + +

    +
    +
    -
    -
    -
    -
    -
    -
    - -

    - -

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

    + +

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

    - -

    + + +

    + +

    - - -
      - -
    • - - {publisherMakroItem.mvdbId}: {publisherMakroItem.title} - -
    • -
      -
    -
    - - +
      + +
    • + + {item.mvdb_id}: {item.title} + +
    • +
      +
    +
    + + - -
    -
    - - {visualizationCall->f:format.raw()} - + + + - - + + diff --git a/Resources/Public/JavaScript/TableController.js b/Resources/Public/JavaScript/TableController.js index 8f076bb..86cbd89 100644 --- a/Resources/Public/JavaScript/TableController.js +++ b/Resources/Public/JavaScript/TableController.js @@ -55,7 +55,7 @@ const tx_publisherdb_tableController = { .attr('class', 'text-right'); if (tx_publisherdb_visualizationStatus.singlePrint) { - yearHead.html('Jahr'); + yearHead.html('Datum'); } else { yearHead.html(createSortButton(`${tx_publisherdb_tableSortItem}-year`) + ' Jahr'); } diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index 4fdc32f..b407119 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -123,6 +123,7 @@ let tx_publisherdb_visualizationStatus = { this._data.published_subitems[0].prints_per_year.length == 1 ) { this.singlePrint = true; + this._config.granularity = tx_publisherdb_granularity.BY_DATE; } const suborder = this._isPublishedItem ? data.published_subitems : @@ -225,18 +226,18 @@ let tx_publisherdb_visualizationStatus = { }, updateData() { - if (this._targetData != 'prints_by_date') { - // retrieve published subitems - const publishedSubitems = this.isPublishedItem ? this.data.published_subitems : - this.data.published_items.map(d => d.published_subitems).flat(); - const currentPublisherShorthand = this.currentPublisher ?? null; - const currentPublisherRegex = currentPublisherShorthand ? new RegExp(`\\b${currentPublisherShorthand}_\w*`) : null; + // retrieve published subitems + const publishedSubitems = this.isPublishedItem ? this.data.published_subitems : + this.data.published_items.map(d => d.published_subitems).flat(); + const currentPublisherShorthand = this.currentPublisher ?? null; + const currentPublisherRegex = currentPublisherShorthand ? new RegExp(`\\b${currentPublisherShorthand}_\w*`) : null; - // retrieve ids for table header - this.subitemIds = publishedSubitems.map(d => d.id) - .filter(d => !this.excludedElements.includes(d)) - .filter(d => currentPublisherRegex ? currentPublisherRegex.test(d) : true); + // retrieve ids for table header + this.subitemIds = publishedSubitems.map(d => d.id) + .filter(d => !this.excludedElements.includes(d)) + .filter(d => currentPublisherRegex ? currentPublisherRegex.test(d) : true); + if (this._targetData != 'prints_by_date') { // retrieve per year data including totals for table body const years = publishedSubitems.map(subitem => { const targetData = subitem[this.targetData] ?? []; From bc4e37697ecb74041271a0c644dc862bd44d269b Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 1 Jul 2024 10:58:24 +0200 Subject: [PATCH 28/38] Adjust dashboard behavior to new stylings --- .../Public/JavaScript/DashboardController.js | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Resources/Public/JavaScript/DashboardController.js b/Resources/Public/JavaScript/DashboardController.js index 74b65b2..2419e58 100644 --- a/Resources/Public/JavaScript/DashboardController.js +++ b/Resources/Public/JavaScript/DashboardController.js @@ -19,24 +19,32 @@ const tx_publisherdb_dashboardController = { const excludedItems = target.append('div') .attr('id', 'dashboard-excluded-items'); + excludedItems.append('h3') + .text('Ausgeschlossene Verlagsartikel'); if (tx_publisherdb_visualizationStatus.excludedElements.length) { - excludedItems.append('h3') - .text('Ausgeschlossene Einheiten'); 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) { - excludedYears.append('h3') - .text('Ausgeschlossene Jahre'); const excludedYearList = excludedYears.append('div') .attr('class', 'tiny button-group'); excludedYearList.selectAll(`a.${tx_publisherdb_dashboardExcludedYear}`) @@ -46,11 +54,12 @@ const tx_publisherdb_dashboardController = { .attr('id', d => d) .html(d => d); } + */ const movingAverages = target.append('div') .attr('id', 'dashboard-moving-averages') movingAverages.append('h3') - .html('Gleitende Mittelwerte'); + .html('Anzeige'); const movingAveragesList = movingAverages.append('div') .attr('class', 'tiny button-group'); tx_publisherdb_visualizationStatus.movingAverages.forEach( ma => { @@ -130,9 +139,9 @@ const tx_publisherdb_dashboardController = { } }); - const publishers = target.append('div') - .attr('id', 'dashboard-publishers'); if (!tx_publisherdb_visualizationStatus.isPublishedItem) { + const publishers = target.append('div') + .attr('id', 'dashboard-publishers'); publishers.append('h3') .text('Verlage'); const publisherList = publishers.append('div') From 8dc719190d1d8fdec9c89661ab552c8b7cd2244c Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 12 Jul 2024 16:08:28 +0200 Subject: [PATCH 29/38] Fix translations and symbols --- Resources/Private/Language/de.locallang.xlf | 6 +++++- Resources/Private/Language/locallang.xlf | 12 ++++++++++++ Resources/Private/Partials/Index/IndexPicker.html | 2 +- .../Private/Partials/Index/PublisherPicker.html | 2 +- Resources/Private/Partials/Index/SearchSlot.html | 2 +- Resources/Private/Templates/PublishedItem/Show.html | 9 +++++---- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 1d96104..97de15e 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -124,7 +124,7 @@ edited work bearbeitetes Werk - + No workdata could be found for this item. Für diesen Verlagsartikel konnten keine Werkdaten erschlossen werden. @@ -148,6 +148,10 @@ No economic data could be retrieved for several published items. Für einige Verlagsartikel konnten keine Wirtschaftsdaten gefunden werden. + + The type of the published item indicates, whether it is a simple work print, a collection print, a version or something else. + Der Typ des Verlagsartikels gibt an, ob es sich um einen einfachen Werkdruck, einen Sammeldruck, eine Bearbeitung oder etwas anderes handelt. + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index be631ee..2ffa612 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -90,6 +90,18 @@ No economic data could be retrieved for several published items. + + contained work + + + contained works + + + edited work + + + 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/Partials/Index/IndexPicker.html b/Resources/Private/Partials/Index/IndexPicker.html index 28aec43..0a3e6f7 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 7feda01..06c0cc3 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 c5d6b9f..2fef497 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/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index d2727d9..78c0013 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -58,16 +58,17 @@

    {publishedItem.title}

    {publishedItem.mvdbId}

    - + - + {publishedItem} +
    - + - {publishedItem.editor.name} + {publishedItem.editors.0.name} ({publishedItem.editor.dateOfBirth->f:format.date(format:'Y')}– From 4725b64502c6ddcc205fd04af46f8403537878b2 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 15 Jul 2024 18:22:23 +0200 Subject: [PATCH 30/38] Adapt singlePrint val to work and person view --- Resources/Public/JavaScript/VisualizationStatus.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index b407119..dda50a0 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -117,10 +117,11 @@ let tx_publisherdb_visualizationStatus = { this._isPublishedItem = data.published_subitems ? true : false; this._data = data; + const publishedSubitems = this._data.published_subitems ?? + this._data.published_items.flatMap(({id, published_subitems}) => published_subitems); if ( - this._data.published_subitems && - this._data.published_subitems.length == 1 && - this._data.published_subitems[0].prints_per_year.length == 1 + publishedSubitems.length == 1 && + publishedSubitems[0].prints_per_year.length == 1 ) { this.singlePrint = true; this._config.granularity = tx_publisherdb_granularity.BY_DATE; From 4494ac7a1057786d809d15a917a7a19fc3324642 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 15 Jul 2024 18:25:36 +0200 Subject: [PATCH 31/38] Fix --- Resources/Private/Templates/PublishedItem/Show.html | 1 - 1 file changed, 1 deletion(-) diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index 78c0013..2e9f3f8 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -61,7 +61,6 @@

    {publishedItem.mvdbId}

    - {publishedItem}
    From b1abc84cff69650fa2240c3525bb16b26c732794 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 22 Jul 2024 17:12:39 +0200 Subject: [PATCH 32/38] Fix barplot views --- .../Public/JavaScript/GraphController.js | 10 +- Resources/Public/JavaScript/TimeseriesView.js | 8 +- .../Public/JavaScript/VisualizationStatus.js | 106 +++++++++--------- 3 files changed, 65 insertions(+), 59 deletions(-) diff --git a/Resources/Public/JavaScript/GraphController.js b/Resources/Public/JavaScript/GraphController.js index 47e5d49..b5b62f8 100644 --- a/Resources/Public/JavaScript/GraphController.js +++ b/Resources/Public/JavaScript/GraphController.js @@ -10,10 +10,16 @@ const tx_publisherdb_graphController = { .domain(d3.extent(tx_publisherdb_visualizationStatus.years)) .range([0, this.timeseriesWidth]) .nice(); + this._yearBandScale = d3.scaleBand() + .range([0, this.timeseriesWidth]) + .domain(tx_publisherdb_visualizationStatus.years); this._yearAxis = d3.axisBottom() .tickFormat(d3.format(' ')) .scale(this._yearScale); + this._yearBandAxis = d3.axisBottom() + .tickFormat(d3.format(' ')) + .scale(this._yearBandScale); }, @@ -55,7 +61,7 @@ const tx_publisherdb_graphController = { data: tx_publisherdb_visualizationStatus.summedYearData.map(d => ({year: d.year, quantity: d.total})), qAxis: qAxis, qScale: qScale, - tAxis: this._yearAxis, + tAxis: graphType == 'area' ? this._yearAxis : this._yearBandAxis, tScale: this._yearScale, margin: margin, title: '', @@ -77,7 +83,7 @@ const tx_publisherdb_graphController = { target: subitemsTarget, startY: timeseriesHeight + margin * 2, width: this.timeseriesWidth, - tAxis: this._yearAxis, + tAxis: graphType == 'area' ? this._yearAxis : this._yearBandAxis, data: tx_publisherdb_visualizationStatus.summedYearData, tScale: this._yearScale, titles: tx_publisherdb_visualizationStatus.subitemIds, diff --git a/Resources/Public/JavaScript/TimeseriesView.js b/Resources/Public/JavaScript/TimeseriesView.js index 7e178c0..a74562e 100644 --- a/Resources/Public/JavaScript/TimeseriesView.js +++ b/Resources/Public/JavaScript/TimeseriesView.js @@ -49,10 +49,10 @@ class TimeseriesView { const bandScale = d3.scaleBand() .range([0, this.width]) - .domain(d3.extent(this.data, d => +d.year)) - .align(0) - .paddingOuter(.25) - .paddingInner(.5); + .domain(this.data.map(d => d.year)) + .align(.5) + .paddingOuter(.1) + .paddingInner(.2); this.target.append('g') .attr('transform', `translate(${this.width},0)`) diff --git a/Resources/Public/JavaScript/VisualizationStatus.js b/Resources/Public/JavaScript/VisualizationStatus.js index dda50a0..379c89d 100644 --- a/Resources/Public/JavaScript/VisualizationStatus.js +++ b/Resources/Public/JavaScript/VisualizationStatus.js @@ -227,6 +227,8 @@ let tx_publisherdb_visualizationStatus = { }, updateData() { + // unification function + const unify = date => d3.isoParse(`${date}`).getYear() + 1900; // retrieve published subitems const publishedSubitems = this.isPublishedItem ? this.data.published_subitems : this.data.published_items.map(d => d.published_subitems).flat(); @@ -238,64 +240,62 @@ let tx_publisherdb_visualizationStatus = { .filter(d => !this.excludedElements.includes(d)) .filter(d => currentPublisherRegex ? currentPublisherRegex.test(d) : true); - if (this._targetData != 'prints_by_date') { - // retrieve per year data including totals for table body - const years = publishedSubitems.map(subitem => { - const targetData = subitem[this.targetData] ?? []; - return targetData.map(print => print.date); - }) - .flat(); - this.years = d3.range(+d3.min(years), +d3.max(years) + 1) - .filter(year => !this.excludedYears.includes(year)); - - const yearData = this.years.map(year => ({ - year: year, - items: publishedSubitems - .filter(item => !this.excludedElements.includes(item.id)) - .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) - .map(prints => { - const targetData = prints[this.targetData] ?? []; - const targetPrint = targetData.filter(print => print.date == year); - return { - id: prints.id, - quantity: targetPrint.length > 0 ? targetPrint[0].quantity : 0 - }; - }), - })) - .sort(this.sort) - .map(item => ({ year: item.year, items: item.items.map(i => i.quantity) })); - - if (this.targetData == 'prints_per_year_cumulative') { - for(let i = 0; i < yearData.length; i++) { - for (let j = 0; j < yearData[i].items.length; j++) { - if (yearData[i].items[j] == 0 && i > 0) { - let runner = i - 1; - while (runner > 0 && yearData[runner].items[j] == 0) { - runner--; - } - yearData[i].items[j] = yearData[runner].items[j]; + // retrieve per year data including totals for table body + const years = publishedSubitems.map(subitem => { + const targetData = subitem[this.targetData] ?? []; + return targetData.map(print => unify(print.date)); + }) + .flat(); + this.years = d3.range(+d3.min(years), +d3.max(years) + 1) + .filter(year => !this.excludedYears.includes(year)); + + const yearData = this.years.map(year => ({ + year: year, + items: publishedSubitems + .filter(item => !this.excludedElements.includes(item.id)) + .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) + .map(prints => { + const targetData = prints[this.targetData] ?? []; + const targetPrint = targetData.filter(print => unify(print.date) == year); + return { + id: prints.id, + quantity: targetPrint.length > 0 ? targetPrint[0].quantity : 0 + }; + }), + })) + .sort(this.sort) + .map(item => ({ year: item.year, items: item.items.map(i => i.quantity) })); + + if (this.targetData == 'prints_per_year_cumulative') { + for(let i = 0; i < yearData.length; i++) { + for (let j = 0; j < yearData[i].items.length; j++) { + if (yearData[i].items[j] == 0 && i > 0) { + let runner = i - 1; + while (runner > 0 && yearData[runner].items[j] == 0) { + runner--; } + yearData[i].items[j] = yearData[runner].items[j]; } } } - - this.summedYearData = yearData.map(({year, items}) => ({ - year, items, - total: items.reduce((a, b) => +a + b) - })); - - // retrieve per item sums for table footer - this.sums = publishedSubitems.filter(item => !this.excludedElements.includes(item.id)) - .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) - .map( - subitem => { - const targetData = subitem[this.targetData] ?? []; - const filteredTargetData = targetData.filter(print => !this.excludedYears.includes(print.date)); - const sum = filteredTargetData.length ? filteredTargetData.map(print => print.quantity) - ?.reduce( (a, b) => +a + b ) : null - return { id: subitem.id, sum: sum }; - }); } + + this.summedYearData = yearData.map(({year, items}) => ({ + year, items, + total: items.reduce((a, b) => +a + b) + })); + + // retrieve per item sums for table footer + this.sums = publishedSubitems.filter(item => !this.excludedElements.includes(item.id)) + .filter(item => currentPublisherRegex ? currentPublisherRegex.test(item.id) : true) + .map( + subitem => { + const targetData = subitem[this.targetData] ?? []; + const filteredTargetData = targetData.filter(print => !this.excludedYears.includes(print.date)); + const sum = filteredTargetData.length ? filteredTargetData.map(print => print.quantity) + ?.reduce( (a, b) => +a + b ) : null + return { id: subitem.id, sum: sum }; + }); }, registerView: function (view) { From 5c776a95f54b5d846e1c5ae34694edbdfd3306d3 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 7 Oct 2024 10:58:26 +0200 Subject: [PATCH 33/38] Add new welcome plugin --- Classes/Controller/WelcomeController.php | 62 +++++++++++++++ Configuration/Icons.php | 4 + Configuration/TCA/Overrides/tt_content.php | 34 ++++----- Configuration/TypoScript/constants.typoscript | 11 +++ Configuration/TypoScript/setup.typoscript | 22 ++++++ Resources/Private/Language/de.locallang.xlf | 12 +++ Resources/Private/Language/locallang.xlf | 9 +++ .../Private/Templates/Welcome/Welcome.html | 19 +++++ Resources/Public/Icons/mpdb_wel_icon.svg | 76 +++++++++++++++++++ composer.json | 3 +- ext_localconf.php | 34 +++++++-- 11 files changed, 261 insertions(+), 25 deletions(-) create mode 100644 Classes/Controller/WelcomeController.php create mode 100644 Resources/Private/Templates/Welcome/Welcome.html create mode 100644 Resources/Public/Icons/mpdb_wel_icon.svg diff --git a/Classes/Controller/WelcomeController.php b/Classes/Controller/WelcomeController.php new file mode 100644 index 0000000..8949cbc --- /dev/null +++ b/Classes/Controller/WelcomeController.php @@ -0,0 +1,62 @@ +, SLUB Dresden + * + ***/ +/** + * PublishedItemController + */ +class WelcomeController extends AbstractController +{ + + /** + * action welcome + * + * @return void + */ + public function welcomeAction(): ResponseInterface + { + $bodyText = $this->configurationManager->getContentObject()->getFieldVal('bodytext'); + $and = LocalizationUtility::translate('LLL:EXT:mpdb_presentation/Resources/Private/Language/locallang:and'); + + $entityCount = $this->searchService-> + setIndex(PublishedItemController::TABLE_INDEX_NAME)-> + count(); + + $publishers = $this->searchService-> + reset()-> + setIndex(Publisher::INDEX_NAME)-> + search()-> + pluck('_source')-> + map(function ($publisher) { return self::getPublisherName($publisher); })-> + join(', ', ' ' . $and . ' '); + + $processedText = Str::of($bodyText)->replace('{{ publishers }}', $publishers)-> + replace('{{ count }}', $entityCount); + + $this->view->assign('processedText', $processedText); + + return $this->htmlResponse(); + } + + private static function getPublisherName(Collection $publisher): string + { + return $publisher->get('name') . ' (' . $publisher->get('shorthand') . ')'; + } + +} diff --git a/Configuration/Icons.php b/Configuration/Icons.php index 3fe7b90..4410d20 100644 --- a/Configuration/Icons.php +++ b/Configuration/Icons.php @@ -10,5 +10,9 @@ 'mpdb_res_icon' => [ 'provider' => SvgIconProvider::class, 'source' => 'EXT:mpdb_presentation/Resources/Public/Icons/mpdb_res_icon.svg' + ], + 'mpdb_wel_icon' => [ + 'provider' => SvgIconProvider::class, + 'source' => 'EXT:mpdb_presentation/Resources/Public/Icons/mpdb_wel_icon.svg' ] ]; diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index e589f73..d86952a 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -2,7 +2,6 @@ declare(strict_types=1); -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; defined('TYPO3') or die(); @@ -18,23 +17,20 @@ ); })(); +(static function (): void { + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + // extension name, matching the PHP namespaces (but without the vendor) + 'MpdbPresentation', + // arbitrary, but unique plugin name (not visible in the backend) + 'Mpdbwelcome', + // plugin title, as visible in the drop-down in the backend, use "LLL:" for localization + 'Music publisher database welcome plugin' + ); +})(); + $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['tx_mpdbpresentation_mpdbresearch'] = 'mpdb_res_icon'; -$GLOBALS['TCA']['tt_content']['types']['tx_mpdbpresentation_mpdbresearch'] = [ - 'showitem' => ' - --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, - --palette--;;general, - header; Title, - bodytext;LLL:EXT:core/Resources/Private/Language/Form/locallang_ttc.xlf:bodytext_formlabel, - --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, - --palette--;;hidden, - --palette--;;acces, - ', - 'columnsOverrides' => [ - 'bodytext' => [ - 'config' => [ - 'enableRichtext' => true, - 'richtextConfiguration' => 'default' - ] - ] - ] +$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['tx_mpdbpresentation_mpdbwelcome'] = 'mpdb_wel_icon'; + +$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'] = [ + 'mpdbpresentation_mpdbwelcome' => 'bodytext' ]; diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index d18c84d..4d70b76 100755 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -13,6 +13,17 @@ plugin.tx_mpdbpresentation_mpdbapi { } } +plugin.tx_mpdbpresentation_mpdbwelcome { + view { + # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template root (FE) + templateRootPath = EXT:mpdb_presentation/Resources/Private/Templates/ + # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template partials (FE) + partialRootPath = EXT:mpdb_presentation/Resources/Private/Partials/ + # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template layouts (FE) + layoutRootPath = EXT:mpdb_presentation/Resources/Private/Layouts/ + } +} + plugin.tx_mpdbpresentation_mpdbresearch { view { # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template root (FE) diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 60fd904..ebd3ca4 100755 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -56,6 +56,28 @@ plugin.tx_mpdbpresentation_mpdbresearch { } } +plugin.mpdbpresentation_mpdbwelcome { + view { + templateRootPaths.0 = EXT:tx_mpdb_presentation/Resources/Private/Templates/ + templateRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbresearch.view.templateRootPath} + partialRootPaths.0 = EXT:tx_mpdb_presentation/Resources/Private/Partials/ + partialRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbresearch.view.partialRootPath} + layoutRootPaths.0 = EXT:tx_mpdb_presentation/Resources/Private/Layouts/ + layoutRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbresearch.view.layoutRootPath} + } + persistence { + storagePid = {$plugin.tx_mpdbpresentation_mpdbwelcome.persistence.storagePid} + #recursive = 1 + } + features { + #skipDefaultArguments = 1 + # if set to 1, the enable fields are ignored in BE context + ignoreAllEnableFieldsInBe = 0 + # Should be on by default, but can be disabled if all action in the plugin are uncached + requireCHashArgumentForActionArguments = 1 + } +} + page { includeJSFooterlibs { d3 = EXT:guv_sitepackage/Resources/Public/JavaScript/Dist/d3.min.js diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 97de15e..b2b7f63 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -47,6 +47,14 @@ The research plugin of the Music Publisher Database. Das Rechercheplugin der Musikverlagsdatenbank. + + Music Publisher Database Welcome + Musikverlagsdatenbank Willkommen + + + The welcome plugin of the Music Publisher Database. + Das Begrüßungsplugin der Musikverlagsdatenbank + Person Person @@ -152,6 +160,10 @@ The type of the published item indicates, whether it is a simple work print, a collection print, a version or something else. Der Typ des Verlagsartikels gibt an, ob es sich um einen einfachen Werkdruck, einen Sammeldruck, eine Bearbeitung oder etwas anderes handelt. + + and + und + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 2ffa612..a3bd08a 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -36,6 +36,12 @@ The research plugin of the Music Publisher Database. + + Music Publisher Database Welcome + + + The welcome plugin of the Music Publisher Database. + Person @@ -102,6 +108,9 @@ The type of the published item indicates, whether it is a simple work print, a collection print, a version or something else. + + and + diff --git a/Resources/Private/Templates/Welcome/Welcome.html b/Resources/Private/Templates/Welcome/Welcome.html new file mode 100644 index 0000000..97f7ea1 --- /dev/null +++ b/Resources/Private/Templates/Welcome/Welcome.html @@ -0,0 +1,19 @@ + + +{namespace mpdbpres=Slub\MpdbPresentation\ViewHelpers} + + + + + + + + + + + +

    + {processedText} +

    + +
    diff --git a/Resources/Public/Icons/mpdb_wel_icon.svg b/Resources/Public/Icons/mpdb_wel_icon.svg new file mode 100644 index 0000000..b5ee1a7 --- /dev/null +++ b/Resources/Public/Icons/mpdb_wel_icon.svg @@ -0,0 +1,76 @@ + + + + + + + + mpdb + Wel + + diff --git a/composer.json b/composer.json index c9f07b2..137ad3d 100755 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "elasticsearch/elasticsearch": "^8", "slub/mpdb-core": "dev-dev", "fluidtypo3/vhs": "^6", - "illuminate/collections": "^8" + "illuminate/collections": "^8", + "illuminate/support": "^8" }, "config": { "vendor-dir": ".Build/vendor", diff --git a/ext_localconf.php b/ext_localconf.php index 5d9e778..0555cef 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -6,7 +6,7 @@ use \Slub\MpdbPresentation\Controller\PublishedItemController; use \Slub\MpdbPresentation\Controller\InstrumentController; use \Slub\MpdbPresentation\Controller\FormController; -use \Slub\MpdbPresentation\Services\ElasticSearchService; +use \Slub\MpdbPresentation\Controller\WelcomeController; use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3_MODE') || die('Access denied.'); @@ -17,9 +17,19 @@ function() \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'MpdbPresentation', - 'Fepublisherapi', + 'Mpdbpublisherapi', [ - \SLUB\MpdbPresentation\Controller\ApiController::class => 'api' + \Slub\MpdbPresentation\Controller\ApiController::class => 'api' + ], + // non-cacheable actions + [ ] + ); + + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'MpdbPresentation', + 'Mpdbwelcome', + [ + WelcomeController::class => 'welcome' ], // non-cacheable actions [ ] @@ -55,12 +65,22 @@ function() list_type = tx_mpdbpresentation_mpdbresearch } } + mpdbpresentation_mpdbwelcome { + iconIdentifier = mpdb_wel_icon + title = LLL:EXT:mpdb_presentation/Resources/Private/Language/locallang.xlf:welcome_title + description = LLL:EXT:mpdb_presentation/Resources/Private/Language/locallang.xlf:welcome_description + tt_content_defValues { + CType = list + list_type = tx_mpdbpresentation_mpdbwelcome + } + } } show = * } }' ); - $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); + + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $iconRegistry->registerIcon( 'mpdb_presentation-work', @@ -92,6 +112,10 @@ function() \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/user_plugin_fepublisherdb.svg'] ); - + $iconRegistry->registerIcon( + 'mpdb_presentation-plugin-fewelcome', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:mpdb_presentation/Resources/Public/Icons/user_plugin_welcome.svg'] + ); } ); From 9a48b956ae7353cadb5fd9f38246b66121ba7316 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 7 Oct 2024 14:46:50 +0200 Subject: [PATCH 34/38] Fix searchslot redirect --- Configuration/TypoScript/constants.typoscript | 6 +++--- Configuration/TypoScript/setup.typoscript | 19 +++++++++++++++---- .../Private/Partials/Index/SearchSlot.html | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index 4d70b76..9acc57d 100755 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -15,11 +15,11 @@ plugin.tx_mpdbpresentation_mpdbapi { plugin.tx_mpdbpresentation_mpdbwelcome { view { - # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template root (FE) + # cat=plugin.tx_mpdbpresentation_mpdbwelcome/file; type=string; label=Path to template root (FE) templateRootPath = EXT:mpdb_presentation/Resources/Private/Templates/ - # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template partials (FE) + # cat=plugin.tx_mpdbpresentation_mpdbwelcome/file; type=string; label=Path to template partials (FE) partialRootPath = EXT:mpdb_presentation/Resources/Private/Partials/ - # cat=plugin.tx_mpdbpresentation_mpdbresearch/file; type=string; label=Path to template layouts (FE) + # cat=plugin.tx_mpdbpresentation_mpdbwelcome/file; type=string; label=Path to template layouts (FE) layoutRootPath = EXT:mpdb_presentation/Resources/Private/Layouts/ } } diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index ebd3ca4..0ece0f2 100755 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -53,17 +53,23 @@ plugin.tx_mpdbpresentation_mpdbresearch { teamPage { pid = {$config.teamPage.pid} } + guidelinePage { + pid = {$config.guidelinePage.pid} + } + abbrPage { + pid = {$config.abbrPage.pid} + } } } -plugin.mpdbpresentation_mpdbwelcome { +plugin.tx_mpdbpresentation_mpdbwelcome { view { templateRootPaths.0 = EXT:tx_mpdb_presentation/Resources/Private/Templates/ - templateRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbresearch.view.templateRootPath} + templateRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbwelcome.view.templateRootPath} partialRootPaths.0 = EXT:tx_mpdb_presentation/Resources/Private/Partials/ - partialRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbresearch.view.partialRootPath} + partialRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbwelcome.view.partialRootPath} layoutRootPaths.0 = EXT:tx_mpdb_presentation/Resources/Private/Layouts/ - layoutRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbresearch.view.layoutRootPath} + layoutRootPaths.1 = {$plugin.tx_mpdbpresentation_mpdbwelcome.view.layoutRootPath} } persistence { storagePid = {$plugin.tx_mpdbpresentation_mpdbwelcome.persistence.storagePid} @@ -76,6 +82,11 @@ plugin.mpdbpresentation_mpdbwelcome { # Should be on by default, but can be disabled if all action in the plugin are uncached requireCHashArgumentForActionArguments = 1 } + settings { + researchPage { + pid = {$config.researchPage.pid} + } + } } page { diff --git a/Resources/Private/Partials/Index/SearchSlot.html b/Resources/Private/Partials/Index/SearchSlot.html index 2fef497..379da0c 100644 --- a/Resources/Private/Partials/Index/SearchSlot.html +++ b/Resources/Private/Partials/Index/SearchSlot.html @@ -2,7 +2,7 @@ {namespace mpdbpres=Slub\MpdbPresentation\ViewHelpers} - +
    From 97eb5bb76a9a8938d7246f5eaecaf2b05b4ff13d Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 7 Oct 2024 14:57:14 +0200 Subject: [PATCH 35/38] Add documentation --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 5242489..6e4947b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,44 @@ $ typo3 mpdb_presentation:indexpublishers $ typo3 mpdb_presentation:calculatetables ``` +# Welcome plugin + +The extension comes with a welcome plugin which displays a text that may be set in the "Plugin" tab of the plugin properties. +Inside that text, you can use `{{ count }}` to get the number of published items in your elasticsearch index and `{{ publishers }}` to get a localized list of the publishers in the index. +A sample text may look like + +```txt +Willkommen auf der Homepage der mvdb. + +Die Musikverlagsdatenbank enthält {{ count }} Datensätze zu Ausgaben der Musikverlage {{ publishers }}. Die Daten wurden anhand der Geschäftsbücher der Verlage erschlossen, und enthalten neben Angaben zu Verlagsnummern und Druckauflagen auch bibliograhischen Normdateninformationen der GND. + +Nach welcher Ausgabe suchen Sie? +(Achtung: Bitte beachten Sie die Hinweise zu Verlässlichkeit, Umfang und Interpretation der Daten in den Datenerfassungsrichtlinien.) +``` + +# Plugin configuration + +In order to get all links and redirects running, you need to provide your researchPage, teamPage, guidelinePage and abbrPage as constants in your Typoscript template as well as the storagePid. +An example configuration is here: + +```txt +config { + researchPage { + pid = + } + teamPage { + pid = + } + guidelinePage { + pid = + } + abbrPage { + pid = + } +} +plugin.tx_mpdbpresentation_mpdbresearch.persistence.storagePid = +``` + # Maintainer If you have any questions or encounter any problems, please do not hesitate to contact me. From 065ade60fe93a9a454740e3cffbd17fd12594bdb Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 10 Oct 2024 17:51:59 +0200 Subject: [PATCH 36/38] Fix comparison --- Resources/Private/Partials/Index/IndexPicker.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Private/Partials/Index/IndexPicker.html b/Resources/Private/Partials/Index/IndexPicker.html index 0a3e6f7..8b44ef6 100644 --- a/Resources/Private/Partials/Index/IndexPicker.html +++ b/Resources/Private/Partials/Index/IndexPicker.html @@ -3,7 +3,7 @@
      {mpdbpres:setConfig(config:searchconfig,key:'index',value:key)} - +
    • From ad30d61f8dcd10c2c5b847f389aa11c38efc5d01 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 11 Oct 2024 12:28:14 +0200 Subject: [PATCH 37/38] Sort out tick values --- Resources/Public/JavaScript/GraphController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/Public/JavaScript/GraphController.js b/Resources/Public/JavaScript/GraphController.js index b5b62f8..47edf95 100644 --- a/Resources/Public/JavaScript/GraphController.js +++ b/Resources/Public/JavaScript/GraphController.js @@ -8,8 +8,7 @@ const tx_publisherdb_graphController = { calculateAxis() { this._yearScale = d3.scaleLinear() .domain(d3.extent(tx_publisherdb_visualizationStatus.years)) - .range([0, this.timeseriesWidth]) - .nice(); + .range([0, this.timeseriesWidth]); this._yearBandScale = d3.scaleBand() .range([0, this.timeseriesWidth]) .domain(tx_publisherdb_visualizationStatus.years); @@ -19,7 +18,8 @@ const tx_publisherdb_graphController = { .scale(this._yearScale); this._yearBandAxis = d3.axisBottom() .tickFormat(d3.format(' ')) - .scale(this._yearBandScale); + .scale(this._yearBandScale) + .tickValues(this._yearScale.ticks()); }, From 2cb9410ef18a2d68216bab868ee2b05ecf7f4779 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 14 Oct 2024 16:32:29 +0200 Subject: [PATCH 38/38] Display public comment --- Resources/Private/Templates/PublishedItem/Show.html | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/Private/Templates/PublishedItem/Show.html b/Resources/Private/Templates/PublishedItem/Show.html index 2e9f3f8..3ecfe9d 100755 --- a/Resources/Private/Templates/PublishedItem/Show.html +++ b/Resources/Private/Templates/PublishedItem/Show.html @@ -182,6 +182,7 @@

    +

    {publishedItem.publicComment}