-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from slub/dev
Dev
- Loading branch information
Showing
16 changed files
with
338 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Slub\MpdbPresentation\Controller; | ||
|
||
use \Illuminate\Support\Collection; | ||
use \Illuminate\Support\Str; | ||
use \Psr\Http\Message\ResponseInterface; | ||
use \TYPO3\CMS\Extbase\Utility\LocalizationUtility; | ||
use \Slub\MpdbPresentation\Domain\Model\Publisher; | ||
|
||
/*** | ||
* | ||
* This file is part of the "Publisher Database" Extension for TYPO3 CMS. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* (c) 2021 Matthias Richter <[email protected]>, 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') . ')'; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Presentation Module of the Music Publisher Database | ||
=================================================== | ||
|
||
[![TYPO3 11](https://img.shields.io/badge/TYPO3-11-orange.svg)](https://get.typo3.org/version/11) | ||
[![CC-BY](https://img.shields.io/github/license/slub/mpdb_presentation)](https://github.com/slub/mpdb_presentation/blob/main/LICENSE) | ||
|
||
This package provides a set of presentation tools for the music publisher database. | ||
|
||
# Presentation plugin | ||
|
||
After installing the extension, create a new content element of type "Insert Plugin" and choose "Music publisher database research plugin" in the Plugin tab. | ||
To get your data into the elasticsearch indices, run the following commands: | ||
|
||
```bash | ||
$ 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. | ||
- [Matthias Richter](https://github.com/dikastes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> | ||
|
||
{namespace mpdbpres=Slub\MpdbPresentation\ViewHelpers} | ||
|
||
<f:layout name="Research" /> | ||
|
||
<f:section name="wrap"> | ||
</f:section> | ||
|
||
<f:section name="sidebar"> | ||
</f:section> | ||
|
||
<f:section name="content"> | ||
|
||
<p class="welcome-text"> | ||
{processedText} | ||
</p> | ||
|
||
</f:section> |
Oops, something went wrong.