Merge pull request #5 from albig/chrizzor-dev-extbase-fluid-queries

Fixes of the extbase integrations - work in progress
This commit is contained in:
Christopher 2021-11-22 09:26:23 +01:00 committed by GitHub
commit 1255ff432d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 675 additions and 776 deletions

View File

@ -477,13 +477,15 @@ class Solr implements LoggerAwareInterface
$cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
$resultSet = [];
if (($entry = $cache->get($cacheIdentifier)) === false) {
$selectQuery = $this->service->createSelect(array_merge($this->params, $parameters));
$selectQuery = $this->service->createSelect($parameters);
$result = $this->service->select($selectQuery);
foreach ($result as $doc) {
$resultSet[] = $doc;
}
// Save value in cache.
$cache->set($cacheIdentifier, $resultSet);
if ($resultSet) {
$cache->set($cacheIdentifier, $resultSet);
}
} else {
// Return cache hit.
$resultSet = $entry;

View File

@ -14,6 +14,8 @@ namespace Kitodo\Dlf\Controller;
use Kitodo\Dlf\Common\Document;
use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Domain\Model\ActionLog;
use Kitodo\Dlf\Domain\Repository\ActionLogRepository;
use Kitodo\Dlf\Domain\Repository\MailRepository;
use Kitodo\Dlf\Domain\Repository\BasketRepository;
use Kitodo\Dlf\Domain\Repository\PrinterRepository;
@ -30,16 +32,6 @@ class BasketController extends AbstractController
*/
protected $basketRepository;
/**
* @var MailRepository
*/
protected $mailRepository;
/**
* @var PrinterRepository
*/
protected $printerRepository;
/**
* @param BasketRepository $basketRepository
*/
@ -48,6 +40,11 @@ class BasketController extends AbstractController
$this->basketRepository = $basketRepository;
}
/**
* @var MailRepository
*/
protected $mailRepository;
/**
* @param MailRepository $mailRepository
*/
@ -56,6 +53,11 @@ class BasketController extends AbstractController
$this->mailRepository = $mailRepository;
}
/**
* @var PrinterRepository
*/
protected $printerRepository;
/**
* @param PrinterRepository $printerRepository
*/
@ -64,6 +66,19 @@ class BasketController extends AbstractController
$this->printerRepository = $printerRepository;
}
/**
* @var ActionLogRepository
*/
protected $actionLogRepository;
/**
* @param ActionLogRepository $actionLogRepository
*/
public function injectActionLogRepository(ActionLogRepository $actionLogRepository)
{
$this->actionLogRepository = $actionLogRepository;
}
/**
* Different actions which depends on the choosen action (form)
*
@ -170,7 +185,7 @@ class BasketController extends AbstractController
$this->view->assign('mailSelect', $mailSelect);
}
$allPrinter = $this->printerRepository->findAllWithPid($this->settings['pages']);
$allPrinter = $this->printerRepository->findAll();
$printSelect = [];
if ($allPrinter->count() > 0) {
@ -556,31 +571,25 @@ class BasketController extends AbstractController
->setTo([$mailObject->getMail() => $mailObject->getName()])
->setBody($mailBody, 'text/html')
->send();
// protocol
$insertArray = [
'pid' => $this->settings['pages'],
'file_name' => $pdfUrl,
'count_pages' => $numberOfPages,
'crdate' => time(),
];
// create entry for action log
$newActionLog = $this->objectManager->get(ActionLog::class);
$newActionLog->setFileName($pdfUrl);
$newActionLog->setCountPages($numberOfPages);
$newActionLog->setLabel('Mail: ' . $mailObject->getMail());
if ($GLOBALS["TSFE"]->loginUser) {
// internal user
$insertArray['user_id'] = $GLOBALS["TSFE"]->fe_user->user['uid'];
$insertArray['name'] = $GLOBALS["TSFE"]->fe_user->user['username'];
$insertArray['label'] = 'Mail: ' . $mailObject->getMail();
$newActionLog->setUserId($GLOBALS["TSFE"]->fe_user->user['uid']);
$newActionLog->setName($GLOBALS["TSFE"]->fe_user->user['username']);
} else {
// external user
$insertArray['user_id'] = 0;
$insertArray['name'] = 'n/a';
$insertArray['label'] = 'Mail: ' . $mailObject->getMail();
$newActionLog->setUserId(0);
$newActionLog->setName('n/a');
}
// add action to protocol
GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_dlf_actionlog')
->insert(
'tx_dlf_actionlog',
$insertArray
);
$this->actionLogRepository->add($newActionLog);
$this->redirect('main');
}
@ -650,5 +659,4 @@ class BasketController extends AbstractController
$this->redirectToUri($pdfUrl);
}
}

View File

@ -27,6 +27,9 @@ class CalendarController extends AbstractController
*/
protected $allIssues = [];
/**
* @var DocumentRepository
*/
protected $documentRepository;
/**
@ -97,10 +100,10 @@ class CalendarController extends AbstractController
unset($requestData['__referrer'], $requestData['__trustedProperties']);
// access arguments passed by the mainAction()
$mainrquestData = $this->request->getArguments();
$mainrequestData = $this->request->getArguments();
// merge both arguments together --> passing id by GET parameter tx_dlf[id] should win
$requestData = array_merge($requestData, $mainrquestData);
$requestData = array_merge($requestData, $mainrequestData);
// Load current document.
$this->loadDocument($requestData);
@ -109,7 +112,7 @@ class CalendarController extends AbstractController
return;
}
$documents = $this->documentRepository->getChildrenOfYearAnchor($this->doc->uid, $this->doc->cPid, 'issue');
$documents = $this->documentRepository->getChildrenOfYearAnchor($this->doc->uid, 'issue');
$issues = [];
@ -204,10 +207,10 @@ class CalendarController extends AbstractController
unset($requestData['__referrer'], $requestData['__trustedProperties']);
// access arguments passed by the mainAction()
$mainrquestData = $this->request->getArguments();
$mainrequestData = $this->request->getArguments();
// merge both arguments together --> passing id by GET parameter tx_dlf[id] should win
$requestData = array_merge($requestData, $mainrquestData);
$requestData = array_merge($requestData, $mainrequestData);
// Load current document.
$this->loadDocument($requestData);
@ -217,7 +220,7 @@ class CalendarController extends AbstractController
}
// Get all children of anchor. This should be the year anchor documents
$documents = $this->documentRepository->getChildrenOfYearAnchor($this->doc->cPid, $this->doc->uid, 'year');
$documents = $this->documentRepository->getChildrenOfYearAnchor($this->doc->uid, 'year');
$years = [];
// Process results.

View File

@ -15,6 +15,7 @@ use Kitodo\Dlf\Common\DocumentList;
use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
use Kitodo\Dlf\Domain\Model\Document;
use Kitodo\Dlf\Domain\Model\Collection;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Frontend\Page\PageRepository;
@ -31,6 +32,9 @@ class CollectionController extends AbstractController
*/
protected $hookObjects = [];
/**
* @var CollectionRepository
*/
protected $collectionRepository;
/**
@ -41,6 +45,9 @@ class CollectionController extends AbstractController
$this->collectionRepository = $collectionRepository;
}
/**
* @var DocumentRepository
*/
protected $documentRepository;
/**
@ -72,7 +79,7 @@ class CollectionController extends AbstractController
// TODO: $this->hookObjects = Helper::getHookObjects($this->scriptRelPath);
if ($collection) {
$this->showSingleCollection($collection);
$this->showSingleCollection($this->collectionRepository->findByUid($collection[0]));
} else {
$this->showCollectionList();
}
@ -86,81 +93,64 @@ class CollectionController extends AbstractController
*/
protected function showCollectionList()
{
$result = $this->collectionRepository->getCollections($this->settings, $GLOBALS['TSFE']->fe_user->user['uid'], $GLOBALS['TSFE']->sys_language_uid);
$count = $result['count'];
$result = $result['result'];
if ($count == 1 && empty($this->settings['dont_show_single'])) {
$resArray = $result->fetch();
$this->showSingleCollection(intval($resArray['uid']));
}
$solr = Solr::getInstance($this->settings['solrcore']);
if (!$solr->ready) {
$this->logger->error('Apache Solr not available');
//return $content;
return;
}
// We only care about the UID and partOf in the results and want them sorted
$params['fields'] = 'uid,partof';
$params['sort'] = ['uid' => 'asc'];
$collections = [];
// Get language overlay if on alterative website language.
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
while ($collectionData = $result->fetch()) {
if ($collectionData['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content) {
$collections[$collectionData['uid']] = $pageRepository->getRecordOverlay('tx_dlf_collections', $collectionData, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
// keep the index_name of the default language
$collections[$collectionData['uid']]['index_name'] = $collectionData['index_name'];
} else {
$collections[$collectionData['uid']] = $collectionData;
}
}
// Sort collections according to flexform configuration
if ($this->settings['collections']) {
$sortedCollections = [];
foreach (GeneralUtility::intExplode(',', $this->settings['collections']) as $uid) {
$sortedCollections[$uid] = $collections[$uid];
$sortedCollections[$uid] = $this->collectionRepository->findByUid($uid);
}
$collections = $sortedCollections;
}
if (count($collections) == 1 && empty($this->settings['dont_show_single'])) {
$this->showSingleCollection(array_pop($collections));
}
$processedCollections = [];
// Process results.
foreach ($collections as $collection) {
$solr_query = '';
if ($collection['index_query'] != '') {
$solr_query .= '(' . $collection['index_query'] . ')';
if ($collection->getIndexSearch() != '') {
$solr_query .= '(' . $collection->getIndexSearch() . ')';
} else {
$solr_query .= 'collection:("' . $collection['index_name'] . '")';
$solr_query .= 'collection:("' . Solr::escapeQuery($collection->getIndexName()) . '")';
}
$partOfNothing = $solr->search_raw($solr_query . ' AND partof:0 AND toplevel:true', $params);
$partOfSomething = $solr->search_raw($solr_query . ' AND NOT partof:0 AND toplevel:true', $params);
// Titles are all documents that are "root" elements i.e. partof == 0
$collection['titles'] = [];
$collectionInfo['titles'] = [];
foreach ($partOfNothing as $doc) {
$collection['titles'][$doc->uid] = $doc->uid;
$collectionInfo['titles'][$doc->uid] = $doc->uid;
}
// Volumes are documents that are both
// a) "leaf" elements i.e. partof != 0
// b) "root" elements that are not referenced by other documents ("root" elements that have no descendants)
$collection['volumes'] = $collection['titles'];
$collectionInfo['volumes'] = $collectionInfo['titles'];
foreach ($partOfSomething as $doc) {
$collection['volumes'][$doc->uid] = $doc->uid;
$collectionInfo['volumes'][$doc->uid] = $doc->uid;
// If a document is referenced via partof, its not a volume anymore.
unset($collection['volumes'][$doc->partof]);
unset($collectionInfo['volumes'][$doc->partof]);
}
// Generate random but unique array key taking priority into account.
do {
$_key = ($collection['priority'] * 1000) + mt_rand(0, 1000);
$_key = ($collectionInfo['priority'] * 1000) + mt_rand(0, 1000);
} while (!empty($processedCollections[$_key]));
$collection['countTitles'] = count($collection['titles']);
$collection['countVolumes'] = count($collection['volumes']);
$processedCollections[$_key] = $collection;
$processedCollections[$_key]['collection'] = $collection;
$processedCollections[$_key]['info'] = $collectionInfo;
}
// Randomize sorting?
@ -184,33 +174,21 @@ class CollectionController extends AbstractController
*
* @access protected
*
* @param int $id: The collection's UID
* @param \Kitodo\Dlf\Domain\Model\Collection The collection object
*
* @return void
*/
protected function showSingleCollection($id)
protected function showSingleCollection(\Kitodo\Dlf\Domain\Model\Collection $collection)
{
$collection = $this->collectionRepository->getSingleCollection($this->settings, $id, $GLOBALS['TSFE']->sys_language_uid);
// access storagePid from TypoScript
$pageSettings = $this->configurationManager->getConfiguration($this->configurationManager::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$this->settings['pages'] = $pageSettings["plugin."]["tx_dlf."]["persistence."]["storagePid"];
// Get language overlay if on alterative website language.
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
if ($resArray = $collection->fetch()) {
if ($resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content) {
$collectionData = $pageRepository->getRecordOverlay('tx_dlf_collections', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
// keep the index_name of the default language
$collectionData['index_name'] = $resArray['index_name'];
} else {
$collectionData = $resArray;
}
} else {
$this->logger->warning('No collection with UID ' . $id . ' found.');
return;
}
// Fetch corresponding document UIDs from Solr.
if ($collectionData['index_search'] != '') {
$solr_query = '(' . $collectionData['index_search'] . ')';
if ($collection->getIndexSearch() != '') {
$solr_query = '(' . $collection->getIndexSearch() . ')';
} else {
$solr_query = 'collection:("' . $collectionData['index_name'] . '") AND toplevel:true';
$solr_query = 'collection:("' . Solr::escapeQuery($collection->getIndexName()) . '") AND toplevel:true';
}
$solr = Solr::getInstance($this->settings['solrcore']);
if (!$solr->ready) {
@ -229,7 +207,9 @@ class CollectionController extends AbstractController
}
$documentSet = array_unique($documentSet);
$documents = $this->documentRepository->getDocumentsFromDocumentset($documentSet, $this->settings['pages']);
$this->settings['documentSets'] = implode(',', $documentSet);
$documents = $this->documentRepository->findDocumentsBySettings($this->settings);
$toplevel = [];
$subparts = [];
@ -239,16 +219,15 @@ class CollectionController extends AbstractController
foreach ($documents as $document) {
if (empty($listMetadata)) {
$listMetadata = [
'label' => htmlspecialchars($collectionData['label']),
'description' => $collectionData['description'],
'thumbnail' => htmlspecialchars($collectionData['thumbnail']),
'label' => htmlspecialchars($collection->getLabel()),
'description' => $collection->getDescription(),
'thumbnail' => htmlspecialchars($collection->getThumbnail()),
'options' => [
'source' => 'collection',
'select' => $id,
'userid' => $collectionData['userid'],
'params' => ['filterquery' => [['query' => 'collection_faceting:("' . $collectionData['index_name'] . '")']]],
'userid' => $collection->getFeCruserId(),
'params' => ['filterquery' => [['query' => 'collection_faceting:("' . $collection->getIndexName() . '")']]],
'core' => '',
'pid' => $this->settings['pages'],
'order' => 'title',
'order.asc' => true
]

View File

@ -25,8 +25,6 @@ class FeedsController extends AbstractController
*/
protected $libraryRepository;
protected $documentRepository;
/**
* @param LibraryRepository $libraryRepository
*/
@ -35,6 +33,11 @@ class FeedsController extends AbstractController
$this->libraryRepository = $libraryRepository;
}
/**
* @var DocumentRepository
*/
protected $documentRepository;
/**
* @param DocumentRepository $documentRepository
*/
@ -81,49 +84,44 @@ class FeedsController extends AbstractController
|| GeneralUtility::inList($this->settings['collections'], $requestData['collection'])
) {
$result = $this->documentRepository->getDocumentsForFeeds($this->settings, $requestData['collection']);
$documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $requestData['collection'], true), $this->settings['limit']);
$rows = $result->fetchAll();
foreach ($rows as $resArray) {
foreach ($documents as $document) {
$title = '';
// Get title of superior document.
if ((empty($resArray['title']) || !empty($this->settings['prependSuperiorTitle']))
&& !empty($resArray['partof'])
if ((empty($document->getTitle()) || !empty($this->settings['prependSuperiorTitle']))
&& !empty($document->getPartof())
) {
$superiorTitle = Document::getTitle($resArray['partof'], true);
$superiorTitle = Document::getTitle($document->getPartof(), true);
if (!empty($superiorTitle)) {
$title .= '[' . $superiorTitle . ']';
}
}
// Get title of document.
if (!empty($resArray['title'])) {
$title .= ' ' . $resArray['title'];
if (!empty($document->getTitle())) {
$title .= ' ' . $document->getTitle();
}
// Set default title if empty.
if (empty($title)) {
$title = LocalizationUtility::translate('noTitle', 'dlf');
}
// Append volume information.
if (!empty($resArray['volume'])) {
$title .= ', ' . LocalizationUtility::translate('volume', 'dlf') . ' ' . $resArray['volume'];
if (!empty($document->getVolume())) {
$title .= ', ' . LocalizationUtility::translate('volume', 'dlf') . ' ' . $document->getVolume();
}
// Is this document new or updated?
if ($resArray['crdate'] == $resArray['tstamp']) {
if ($document->getCrdate() == $document->getTstamp()) {
$title = LocalizationUtility::translate('plugins.feeds.new', 'dlf') . ' ' . trim($title);
} else {
$title = LocalizationUtility::translate('plugins.feeds.update', 'dlf') . ' ' . trim($title);
}
$resArray['title'] = $title;
$documents[] = $resArray;
$document->setTitle($title);
}
}
$this->view->assign('documents', $documents);
$this->view->assign('feedMeta', $feedMeta);
}
}

View File

@ -15,7 +15,10 @@ use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Kitodo\Dlf\Common\DocumentList;
use Kitodo\Dlf\Common\Solr;
use Kitodo\Dlf\Domain\Model\Token;
use Kitodo\Dlf\Domain\Repository\CollectionRepository;
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
use Kitodo\Dlf\Domain\Repository\LibraryRepository;
use Kitodo\Dlf\Domain\Repository\TokenRepository;
/**
@ -28,6 +31,9 @@ use Kitodo\Dlf\Domain\Repository\TokenRepository;
*/
class OaiPmhController extends AbstractController
{
/**
* @var DocumentRepository
*/
protected $documentRepository;
/**
@ -38,6 +44,9 @@ class OaiPmhController extends AbstractController
$this->documentRepository = $documentRepository;
}
/**
* @var TokenRepository
*/
protected $tokenRepository;
/**
@ -48,6 +57,9 @@ class OaiPmhController extends AbstractController
$this->tokenRepository = $tokenRepository;
}
/**
* @var CollectionRepository
*/
protected $collectionRepository;
/**
@ -58,6 +70,9 @@ class OaiPmhController extends AbstractController
$this->collectionRepository = $collectionRepository;
}
/**
* @var LibraryRepository
*/
protected $libraryRepository;
/**
@ -130,12 +145,7 @@ class OaiPmhController extends AbstractController
protected function deleteExpiredTokens()
{
// Delete expired resumption tokens.
$result = $this->tokenRepository->deleteExpiredTokens($GLOBALS['EXEC_TIME'], $this->settings['expired']);
if ($result === -1) {
// Deletion failed.
$this->logger->warning('Could not delete expired resumption tokens');
}
$this->tokenRepository->deleteExpiredTokens($this->settings['expired']);
}
/**
@ -207,7 +217,7 @@ class OaiPmhController extends AbstractController
$record[] = ['dc:type' => $record['Text']];
if (!empty($record['partof'])) {
$document = $this->documentRepository->findOneByPartOf($metadata['partof']);
$document = $this->documentRepository->findOneByPartof($metadata['partof']);
if ($document) {
$metadata[] = ['dc:relation' => $document->getRecordId()];
@ -316,10 +326,13 @@ class OaiPmhController extends AbstractController
*/
protected function resume(): ?DocumentList
{
$result = $this->tokenRepository->getResumptionToken($this->parameters['resumptionToken']);
$token = $this->tokenRepository->findOneByToken($this->parameters['resumptionToken']);
if ($resArray = $result->fetch()) {
return unserialize($resArray['options']);
if ($token) {
$options = $token->getOptions();
}
if ($options instanceof DocumentList) {
return $options;
} else {
// No resumption token found or resumption token expired.
$this->error = 'badResumptionToken';
@ -340,43 +353,44 @@ class OaiPmhController extends AbstractController
$this->error = 'badArgument';
return;
}
if (!array_key_exists($this->parameters['metadataPrefix'], $this->formats)) {
$this->error = 'cannotDisseminateFormat';
return;
}
$resArray = $this->documentRepository->getOaiRecord($this->settings, $this->parameters);
$document = $this->documentRepository->getOaiRecord($this->settings, $this->parameters);
if (!$resArray['uid']) {
if (!$document['uid']) {
$this->error = 'idDoesNotExist';
return;
}
// Check for required fields.
foreach ($this->formats[$this->parameters['metadataPrefix']]['requiredFields'] as $required) {
if (empty($resArray[$required])) {
if (empty($document[$required])) {
$this->error = 'cannotDisseminateFormat';
return;
}
}
// we need the collections as array later
$resArray['collections'] = explode(' ', $resArray['collections']);
$document['collections'] = explode(' ', $document['collections']);
// Add metadata
switch ($this->parameters['metadataPrefix']) {
case 'oai_dc':
$resArray['metadata'] = $this->getDcData($resArray);
$document['metadata'] = $this->getDcData($document);
break;
case 'epicur':
$resArray['metadata'] = $resArray;
$document['metadata'] = $document;
break;
case 'mets':
$resArray['metadata'] = $this->getMetsData($resArray);
$document['metadata'] = $this->getMetsData($document);
break;
}
$this->view->assign('record', $resArray);
$this->view->assign('record', $document);
}
/**
@ -388,30 +402,40 @@ class OaiPmhController extends AbstractController
*/
protected function verbIdentify()
{
$result = $this->libraryRepository->getLibraryByUidAndPid($this->settings['library'], $this->settings['pages']);
$library = $this->libraryRepository->findByUid($this->settings['library']);
$oaiIdentifyInfo = [];
$oaiIdentifyInfo = $result->fetch();
if (!$oaiIdentifyInfo) {
$this->logger->notice('Incomplete plugin configuration');
}
$oaiIdentifyInfo['oai_label'] = $library->getOaiLabel();
// Use default values for an installation with incomplete plugin configuration.
if (empty($oaiIdentifyInfo['oai_label'])) {
$oaiIdentifyInfo['oai_label'] = 'Kitodo.Presentation OAI-PMH Interface (default configuration)';
$this->logger->notice('Incomplete plugin configuration (oai_label is missing)');
}
$oaiIdentifyInfo['contact'] = $library->getContact();
if (empty($oaiIdentifyInfo['contact'])) {
$oaiIdentifyInfo['contact'] = 'unknown@example.org';
$this->logger->notice('Incomplete plugin configuration (contact is missing)');
}
$document = $this->documentRepository->oaiDocumentByTstmp($this->settings['pages']);
$document = $this->documentRepository->findOldestDocument();
if ($document) {
$oaiIdentifyInfo['earliestDatestamp'] = gmdate('Y-m-d\TH:i:s\Z', $document->getTstmp());
$oaiIdentifyInfo['earliestDatestamp'] = gmdate('Y-m-d\TH:i:s\Z', $document->getTstamp()->getTimestamp());
} else {
$this->logger->notice('No records found with PID ' . $this->settings['pages']);
// access storagePid from TypoScript
$pageSettings = $this->configurationManager->getConfiguration($this->configurationManager::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$storagePid = $pageSettings["plugin."]["tx_dlf."]["persistence."]["storagePid"];
if ($storagePid > 0) {
$this->logger->notice('No records found with PID ' . $storagePid);
} else {
$this->logger->notice('No records found');
}
}
$this->view->assign('oaiIdentifyInfo', $oaiIdentifyInfo);
}
@ -483,7 +507,7 @@ class OaiPmhController extends AbstractController
$resArray = [];
// check for the optional "identifier" parameter
if (isset($this->parameters['identifier'])) {
$resArray = $this->documentRepository->getOaiMetadataFormats($this->settings['pages'], $this->parameters['identifier']);
$resArray = $this->documentRepository->findOneByRecordId($this->parameters['identifier']);
}
$resultSet = [];
@ -491,7 +515,8 @@ class OaiPmhController extends AbstractController
if (!empty($resArray)) {
// check, if all required fields are available for a given identifier
foreach ($details['requiredFields'] as $required) {
if (empty($resArray[$required])) {
$methodName = 'get' . GeneralUtility::underscoredToUpperCamelCase($required);
if (empty($resArray->$methodName())) {
// Skip metadata formats whose requirements are not met.
continue 2;
}
@ -568,9 +593,12 @@ class OaiPmhController extends AbstractController
*/
protected function verbListSets()
{
$allResults = $this->collectionRepository->getOaiRecord($this->settings, $this->parameters);
// It is required to set a oai_name inside the collection record to be shown in oai-pmh plugin.
$this->settings['hideEmptyOaiNames'] = true;
$this->view->assign('oaiSets', $allResults);
$oaiSets = $this->collectionRepository->findCollectionsBySettings($this->settings);
$this->view->assign('oaiSets', $oaiSets);
}
/**
@ -745,17 +773,15 @@ class OaiPmhController extends AbstractController
protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet)
{
if ($documentListSet->count() !== 0) {
$token = uniqid('', false);
$resumptionToken = uniqid('', false);
$affectedRows = $this->tokenRepository->generateResumptionToken($token, $documentListSet);
// create new token
$newToken = $this->objectManager->get(Token::class);
$newToken->setToken($resumptionToken);
$newToken->setOptions($documentListSet);
if ($affectedRows === 1) {
$resumptionToken = $token;
} else {
$this->logger->error('Could not create resumption token');
$this->error = 'badResumptionToken';
return;
}
// add to tokenRepository
$this->tokenRepository->add($newToken);
} else {
// Result set complete. We don't need a token.
$resumptionToken = '';

View File

@ -24,8 +24,9 @@ use Kitodo\Dlf\Domain\Repository\DocumentRepository;
*/
class StatisticsController extends AbstractController
{
protected $collectionRepository;
/**
* @var DocumentRepository
*/
protected $documentRepository;
/**
@ -43,21 +44,8 @@ class StatisticsController extends AbstractController
*/
public function mainAction()
{
// Quit without doing anything if required configuration variables are not set.
if (empty($this->settings['pages'])) {
$this->logger->warning('Incomplete plugin configuration');
}
// Check for selected collections.
if ($this->settings['collections']) {
// Include only selected collections.
$result = $this->documentRepository->getStatisticsForSelectedCollection($this->settings);
} else {
$result = $this->documentRepository->getStatisticsForCollection($this->settings);
}
$countTitles = $result['titles'];
$countVolumes = $result['volumes'];
$countTitles = $this->documentRepository->countAllTitles($this->settings);
$countVolumes = $this->documentRepository->countAllVolumes($this->settings);
// Set replacements.
$args['###TITLES###'] = $countTitles . ' ' . htmlspecialchars(

View File

@ -14,10 +14,15 @@ namespace Kitodo\Dlf\Domain\Model;
class Collection extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* @var int
*/
protected $feCruserId;
/**
* @var string
*/
protected $fe_group;
protected $feGroup;
/**
* @var string
@ -69,20 +74,36 @@ class Collection extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
*/
protected $status;
/**
* @return int
*/
public function getFeCruserId(): int
{
return $this->feCruserId;
}
/**
* @param string $feCruserId
*/
public function setFeCruserId(string $feCruserId): void
{
$this->feCruserId = $feCruserId;
}
/**
* @return string
*/
public function getFeGroup(): string
{
return $this->fe_group;
return $this->feGroup;
}
/**
* @param string $fe_group
* @param string $feGroup
*/
public function setFeGroup(string $fe_group): void
public function setFeGroup(string $feGroup): void
{
$this->fe_group = $fe_group;
$this->feGroup = $feGroup;
}
/**

View File

@ -14,6 +14,16 @@ namespace Kitodo\Dlf\Domain\Model;
class Document extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* @var \DateTime
*/
protected $crdate;
/**
* @var \DateTime
*/
protected $tstamp;
/**
* @var string
*/
@ -553,16 +563,19 @@ class Document extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
$this->rightsInfo = $rightsInfo;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
* Returns the collections
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections
*/
public function getCollections(): ?\TYPO3\CMS\Extbase\Persistence\ObjectStorage
public function getCollections()
{
return $this->collections;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $collections
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections
*/
public function setCollections(?\TYPO3\CMS\Extbase\Persistence\ObjectStorage $collections): void
{
@ -665,4 +678,44 @@ class Document extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
$this->documentFormat = $documentFormat;
}
/**
* Returns the timestamp
*
* @return \DateTime
*/
public function getTstamp(): \DateTime
{
return $this->tstamp;
}
/**
* Sets the timestamp
*
* @param \DateTime $tstamp
*/
public function setTstamp($tstamp): void
{
$this->tstamp = $tstamp;
}
/**
* Returns the creation date
*
* @return \DateTime
*/
public function getCrdate(): \DateTime
{
return $this->crdate;
}
/**
* Sets the creation date
*
* @param \DateTime $crdate
*/
public function setCrdate($crdate): void
{
$this->crdate = $crdate;
}
}

View File

@ -14,7 +14,6 @@ namespace Kitodo\Dlf\Domain\Model;
class Token extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* @var string
*/
@ -47,19 +46,19 @@ class Token extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
}
/**
* @return string
* @return \Kitodo\Dlf\Common\DocumentList
*/
public function getOptions(): string
public function getOptions(): \Kitodo\Dlf\Common\DocumentList
{
return $this->options;
return unserialize($this->options);
}
/**
* @param string $options
* @param \Kitodo\Dlf\Common\DocumentList $options
*/
public function setOptions(string $options): void
public function setOptions(\Kitodo\Dlf\Common\DocumentList $options): void
{
$this->options = $options;
$this->options = serialize($options);
}
/**
@ -78,4 +77,4 @@ class Token extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
$this->ident = $ident;
}
}
}

View File

@ -10,9 +10,9 @@
* LICENSE.txt file that was distributed with this source code.
*/
namespace Kitodo\Dlf\Domain\Model;
namespace Kitodo\Dlf\Domain\Repository;
class ActionlogRepository extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
class ActionLogRepository extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
}
}

View File

@ -12,8 +12,9 @@
namespace Kitodo\Dlf\Domain\Repository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use Kitodo\Dlf\Common\Helper;
class CollectionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
@ -159,34 +160,45 @@ class CollectionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return $query->execute();
}
public function getOai1($settings) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_collections');
/**
* Finds all collection for the given settings
*
* @param array $settings
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findCollectionsBySettings($settings = [])
{
$query = $this->createQuery();
$where = '';
if (!$settings['show_userdefined']) {
$where = $queryBuilder->expr()->eq('tx_dlf_collections.fe_cruser_id', 0);
$constraints = [];
if ($settings['collections']) {
$constraints[] = $query->in('uid', GeneralUtility::intExplode(',', $settings['collections']));
}
$result = $queryBuilder
->select(
'tx_dlf_collections.oai_name AS oai_name',
'tx_dlf_collections.label AS label'
)
->from('tx_dlf_collections')
->where(
$queryBuilder->expr()->in('tx_dlf_collections.sys_language_uid', [-1, 0]),
$queryBuilder->expr()->eq('tx_dlf_collections.pid', intval($settings['pages'])),
$queryBuilder->expr()->neq('tx_dlf_collections.oai_name', $queryBuilder->createNamedParameter('')),
$where,
Helper::whereExpression('tx_dlf_collections')
)
->orderBy('tx_dlf_collections.oai_name')
->execute();
// do not find user created collections (used by oai-pmh plugin)
if (!$settings['show_userdefined']) {
$constraints[] = $query->equals('fe_cruser_id', 0);
}
$allResults = $result->fetchAll();
// do not find collections without oai_name set (used by oai-pmh plugin)
if ($settings['hideEmptyOaiNames']) {
$constraints[] = $query->logicalNot($query->equals('oai_name', ''));
}
return $allResults;
if (count($constraints)) {
$query->matching(
$query->logicalAnd($constraints)
);
}
// order by oai_name
$query->setOrderings(
array('oai_name' => QueryInterface::ORDER_ASCENDING)
);
return $query->execute();
}
public function getIndexNameForSolr($settings, $set) {
@ -219,4 +231,4 @@ class CollectionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return $result;
}
}
}

View File

@ -21,6 +21,14 @@ use TYPO3\CMS\Extbase\Persistence\QueryInterface;
class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/**
* Array of all document structures
*
* @var array
*/
protected $documentStructures;
public function findByUidAndPartOf($uid, $partOf)
{
$query = $this->createQuery();
@ -31,25 +39,33 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return $query->execute();
}
public function oaiDocumentByTstmp($pid) {
$query = $this->createQuery();
$query->matching($query->equals('pid', $pid));
$query->setOrderings(['tstmp' => QueryInterface::ORDER_ASCENDING]);
$query->setLimit(1);
}
/**
* @param $structure
* @param $partOf
* @param $indexName
* Find the oldest document
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function getChildrenOfYearAnchor($structure, $partOf, $indexName)
public function findOldestDocument()
{
$query = $this->createQuery();
$query->matching($query->equals('structure', Helper::getUidFromIndexName($indexName, 'tx_dlf_structures', $structure)));
$query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]);
$query->setLimit(1);
return $query->execute()->getFirst();
}
/**
* @param int $partOf
* @param string $structure
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function getChildrenOfYearAnchor($partOf, $structure)
{
$this->documentStructures = $this->getDocumentStructures();
$query = $this->createQuery();
$query->matching($query->equals('structure', $this->documentStructures[$structure]));
$query->matching($query->equals('partof', $partOf));
$query->setOrderings([
@ -59,83 +75,118 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return $query->execute();
}
public function getDocumentsFromDocumentset($documentSet, $pages) {
/**
* Finds all documents for the given settings
*
* @param array $settings
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findDocumentsBySettings($settings = [])
{
$query = $this->createQuery();
$query->matching($query->equals('pid', $pages));
$query->matching($query->in('uid', $documentSet));
$constraints = [];
if ($settings['documentSets']) {
$constraints[] = $query->in('uid', GeneralUtility::intExplode(',', $settings['documentSets']));
}
if (count($constraints)) {
$query->matching(
$query->logicalAnd($constraints)
);
}
return $query->execute();
}
public function getDocumentsForFeeds($settings, $collectionUid) {
$additionalWhere = '';
// Check for pre-selected collections.
if (!empty($collectionUid)) {
$additionalWhere = 'tx_dlf_collections.uid=' . intval($collectionUid);
} elseif (!empty($settings['collections'])) {
$additionalWhere = 'tx_dlf_collections.uid IN (' . implode(',', GeneralUtility::intExplode(',', $settings['collections'])) . ')';
/**
* Finds all documents for the given collections
*
* @param array $collections separated by comma
* @param int $limit
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findAllByCollectionsLimited($collections, $limit = 50)
{
$query = $this->createQuery();
// order by start_date -> start_time...
$query->setOrderings(
['tstamp' => QueryInterface::ORDER_DESCENDING]
);
$constraints = [];
if ($collections) {
$constraints[] = $query->in('collections.uid', $collections);
}
// get documents
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
$result = $queryBuilder
->select(
'tx_dlf_documents.uid AS uid',
'tx_dlf_documents.partof AS partof',
'tx_dlf_documents.title AS title',
'tx_dlf_documents.volume AS volume',
'tx_dlf_documents.author AS author',
'tx_dlf_documents.record_id AS record_id',
'tx_dlf_documents.tstamp AS tstamp',
'tx_dlf_documents.crdate AS crdate'
)
->from('tx_dlf_documents')
->join(
'tx_dlf_documents',
'tx_dlf_relations',
'tx_dlf_documents_collections_mm',
$queryBuilder->expr()->eq('tx_dlf_documents.uid', $queryBuilder->quoteIdentifier('tx_dlf_documents_collections_mm.uid_local'))
)
->join(
'tx_dlf_documents_collections_mm',
'tx_dlf_collections',
'tx_dlf_collections',
$queryBuilder->expr()->eq('tx_dlf_collections.uid', $queryBuilder->quoteIdentifier('tx_dlf_documents_collections_mm.uid_foreign'))
)
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.pid', $queryBuilder->createNamedParameter((int) $settings['pages'])),
$queryBuilder->expr()->eq('tx_dlf_documents_collections_mm.ident', $queryBuilder->createNamedParameter('docs_colls')),
$queryBuilder->expr()->eq('tx_dlf_collections.pid', $queryBuilder->createNamedParameter((int) $settings['pages'])),
$additionalWhere
)
->groupBy('tx_dlf_documents.uid')
->orderBy('tx_dlf_documents.tstamp', 'DESC')
->setMaxResults((int) $settings['limit'])
->execute();
return $result;
if (count($constraints)) {
$query->matching(
$query->logicalAnd($constraints)
);
}
$query->setLimit((int) $limit);
return $query->execute();
}
public function getStatisticsForCollection($settings) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
/**
* Find all the titles
*
* documents with partof == 0
*
* @param array $settings
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findAllTitles($settings = [])
{
$query = $this->createQuery();
// Include all collections.
$countTitles = $queryBuilder
->count('tx_dlf_documents.uid')
->from('tx_dlf_documents')
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.pid', intval($settings['pages'])),
$queryBuilder->expr()->eq('tx_dlf_documents.partof', 0),
Helper::whereExpression('tx_dlf_documents')
)
->execute()
->fetchColumn(0);
$constraints = [];
$constraints[] = $query->equals('partof', 0);
if ($settings['collections']) {
$constraints[] = $query->in('collections.uid', GeneralUtility::intExplode(',', $settings['collections']));
}
if (count($constraints)) {
$query->matching(
$query->logicalAnd($constraints)
);
}
return $query->execute();
}
/**
* Count the titles
*
* documents with partof == 0
*
* @param array $settings
*
* @return int
*/
public function countAllTitles($settings = [])
{
return $this->findAllTitles($settings)->count();
}
/**
* Count the volumes
*
* documents with partof != 0
*
* @param array $settings
*
* @return int
*/
public function countAllVolumes($settings = [])
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
$subQueryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@ -160,10 +211,11 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
->execute()
->fetchColumn(0);
return ['titles' => $countTitles, 'volumes' => $countVolumes];
return $countVolumes;
}
public function getStatisticsForSelectedCollection($settings) {
public function getStatisticsForSelectedCollection($settings)
{
// Include only selected collections.
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
@ -253,7 +305,8 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return ['titles' => $countTitles, 'volumes' => $countVolumes];
}
public function getTableOfContentsFromDb($uid, $pid, $settings) {
public function getTableOfContentsFromDb($uid, $pid, $settings)
{
// Build table of contents from database.
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
@ -293,65 +346,57 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return $result;
}
public function getOaiRecord($settings, $parameters) {
/**
* Find one document by given settings and identifier
*
* @param array $settings
* @param array $parameters
*
* @return array The found document object
*/
public function getOaiRecord($settings, $parameters)
{
$where = '';
if (!$settings['show_userdefined']) {
$where .= 'AND tx_dlf_collections.fe_cruser_id=0 ';
}
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_dlf_documents');
$connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_dlf_documents');
$sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
'FROM `tx_dlf_documents` ' .
'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
'WHERE `tx_dlf_documents`.`record_id` = ? ' .
'AND `tx_dlf_documents`.`pid` = ? ' .
'AND `tx_dlf_collections`.`pid` = ? ' .
'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
$where .
'AND ' . Helper::whereExpression('tx_dlf_collections');
$where;
$values = [
$parameters['identifier'],
$settings['pages'],
$settings['pages']
$parameters['identifier']
];
$types = [
Connection::PARAM_STR,
Connection::PARAM_INT,
Connection::PARAM_INT
Connection::PARAM_STR
];
// Create a prepared statement for the passed SQL query, bind the given params with their binding types and execute the query
$statement = $connection->executeQuery($sql, $values, $types);
$resArray = $statement->fetch();
return $resArray;
return $statement->fetch();
}
public function getOaiMetadataFormats($pid, $id) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
// Check given identifier.
$result = $queryBuilder
->select('tx_dlf_documents.*')
->from('tx_dlf_documents')
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.pid', intval($pid)),
$queryBuilder->expr()->eq('tx_dlf_documents.record_id',
$queryBuilder->expr()->literal($id))
)
->orderBy('tx_dlf_documents.tstamp')
->setMaxResults(1)
->execute();
$resArray = $result->fetch();
return $resArray;
}
public function getOaiDocumentList($settings, $documentsToProcess) {
/**
* Finds all documents for the given settings
*
* @param array $settings
* @param array $documentsToProcess
*
* @return array The found document objects
*/
public function getOaiDocumentList($settings, $documentsToProcess)
{
$connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_dlf_documents');
@ -360,28 +405,47 @@ class DocumentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' .
'AND `tx_dlf_documents`.`pid` = ? ' .
'AND `tx_dlf_collections`.`pid` = ? ' .
'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' .
'GROUP BY `tx_dlf_documents`.`uid` ' .
'LIMIT ?';
'GROUP BY `tx_dlf_documents`.`uid` ';
$values = [
$documentsToProcess,
$settings['pages'],
$settings['pages'],
$settings['limit']
];
$types = [
Connection::PARAM_INT_ARRAY,
Connection::PARAM_INT,
Connection::PARAM_INT,
Connection::PARAM_INT
];
// Create a prepared statement for the passed SQL query, bind the given params with their binding types and execute the query
$documents = $connection->executeQuery($sql, $values, $types);
return $documents;
}
}
/**
* Get all document structures as array
*
* @return array
*/
private function getDocumentStructures()
{
// make lookup-table of structures uid -> indexName
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_structures');
// Fetch document info for UIDs in $documentSet from DB
$kitodoStructures = $queryBuilder
->select(
'tx_dlf_structures.uid AS uid',
'tx_dlf_structures.index_name AS indexName'
)
->from('tx_dlf_structures')
->execute();
$allStructures = $kitodoStructures->fetchAll();
// make lookup-table uid -> indexName
$allStructures = array_column($allStructures, 'indexName', 'uid');
return $allStructures;
}
}

View File

@ -18,25 +18,4 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
class LibraryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
public function getLibraryByUidAndPid($uid, $pid) {
// Get repository name and administrative contact.
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_libraries');
$result = $queryBuilder
->select(
'tx_dlf_libraries.oai_label AS oai_label',
'tx_dlf_libraries.contact AS contact'
)
->from('tx_dlf_libraries')
->where(
$queryBuilder->expr()->eq('tx_dlf_libraries.pid', intval($pid)),
$queryBuilder->expr()->eq('tx_dlf_libraries.uid', intval($uid))
)
->setMaxResults(1)
->execute();
return $result;
}
}

View File

@ -15,12 +15,4 @@ namespace Kitodo\Dlf\Domain\Repository;
class PrinterRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
public function findAllWithPid($pid)
{
$querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
$querySettings->setStoragePageIds(array($pid));
$this->setDefaultQuerySettings($querySettings);
return $this->findAll();
}
}
}

View File

@ -18,54 +18,29 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class TokenRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
public function deleteExpiredTokens($execTime, $expired) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens');
/**
* Delete all expired token
*
* @param int $expireTime
*
* @return void
*/
public function deleteExpiredTokens($expireTime)
{
$query = $this->createQuery();
$result = $queryBuilder
->delete('tx_dlf_tokens')
->where(
$queryBuilder->expr()->eq('tx_dlf_tokens.ident', $queryBuilder->createNamedParameter('oai')),
$queryBuilder->expr()->lt('tx_dlf_tokens.tstamp',
$queryBuilder->createNamedParameter((int) ($execTime - $expired)))
)
->execute();
$constraints = [];
return $result;
$constraints[] = $query->lessThan('tstamp', (int) (time() - $expireTime));
if (count($constraints)) {
$query->matching($query->logicalAnd($constraints));
}
$tokensToBeRemoved = $query->execute();
foreach($tokensToBeRemoved as $token) {
$this->remove($token);
}
}
public function getResumptionToken($token) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_tokens');
// Get resumption token.
$result = $queryBuilder
->select('tx_dlf_tokens.options AS options')
->from('tx_dlf_tokens')
->where(
$queryBuilder->expr()->eq('tx_dlf_tokens.ident', $queryBuilder->createNamedParameter('oai')),
$queryBuilder->expr()->eq('tx_dlf_tokens.token',
$queryBuilder->expr()->literal($token)
)
)
->setMaxResults(1)
->execute();
return $result;
}
public function generateResumptionToken($token, $documentListSet) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens');
$affectedRows = $queryBuilder
->insert('tx_dlf_tokens')
->values([
'tstamp' => $GLOBALS['EXEC_TIME'],
'token' => $token,
'options' => serialize($documentListSet),
'ident' => 'oai',
])
->execute();
return $affectedRows;
}
}
}

View File

@ -20,26 +20,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.excludeOther>
<TCEforms>
<exclude>1</exclude>
@ -61,21 +41,6 @@
</config>
</TCEforms>
</settings.elementId>
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>tmpl,tpl,html,htm,txt</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<disable_controls>upload</disable_controls>
</config>
</TCEforms>
</settings.templateFile>
</el>
</ROOT>
</sDEF>

View File

@ -20,20 +20,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
</config>
</TCEforms>
</settings.pages>
<settings.pregeneration>
<TCEforms>
<exclude>1</exclude>
@ -128,21 +114,6 @@
</config>
</TCEforms>
</settings.targetBasket>
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>tmpl,tpl,html,htm,txt</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<disable_controls>upload</disable_controls>
</config>
</TCEforms>
</settings.templateFile>
</el>
</ROOT>
</sDEF>

View File

@ -20,26 +20,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.targetPid>
<TCEforms>
<exclude>1</exclude>
@ -90,21 +70,6 @@
</config>
</TCEforms>
</settings.showEmptyMonths>
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>tmpl,tpl,html,htm,txt</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<disable_controls>upload</disable_controls>
</config>
</TCEforms>
</settings.templateFile>
</el>
</ROOT>
</sDEF>

View File

@ -20,36 +20,17 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<onChange>reload</onChange>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.collections>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.collection.flexform.collections</label>
<config>
<type>select</type>
<items type="array"/>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->collectionList</itemsProcFunc>
<renderType>selectMultipleSideBySide</renderType>
<foreign_table>tx_dlf_collections</foreign_table>
<foreign_table_where>AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_collections.label ASC
</foreign_table_where>
<size>5</size>
<autoSizeMax>15</autoSizeMax>
<maxitems>1024</maxitems>
@ -60,13 +41,15 @@
</settings.collections>
<settings.solrcore>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.solrcore</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->solrList</itemsProcFunc>
<renderType>selectSingle</renderType>
<foreign_table>tx_dlf_solrcores</foreign_table>
<foreign_table_where>ORDER BY
tx_dlf_solrcores.label ASC
</foreign_table_where>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
@ -153,21 +136,6 @@
</config>
</TCEforms>
</settings.targetFeed>
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>tmpl,tpl,html,htm,txt</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<disable_controls>upload</disable_controls>
</config>
</TCEforms>
</settings.templateFile>
</el>
</ROOT>
</sDEF>

View File

@ -20,36 +20,17 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<onChange>reload</onChange>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.collections>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.collections</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->collectionList</itemsProcFunc>
<renderType>selectMultipleSideBySide</renderType>
<foreign_table>tx_dlf_collections</foreign_table>
<foreign_table_where>AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_collections.label ASC
</foreign_table_where>
<size>5</size>
<autoSizeMax>15</autoSizeMax>
<maxitems>1024</maxitems>
@ -70,13 +51,15 @@
</settings.excludeOther>
<settings.library>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.library</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->libraryList</itemsProcFunc>
<renderType>selectSingle</renderType>
<foreign_table>tx_dlf_libraries</foreign_table>
<foreign_table_where>AND tx_dlf_libraries.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_libraries.label ASC
</foreign_table_where>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>

View File

@ -20,26 +20,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.features>
<TCEforms>
<exclude>1</exclude>

View File

@ -20,38 +20,17 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<onChange>reload</onChange>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<onChange>reload</onChange>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.library>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.library</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->libraryList</itemsProcFunc>
<foreign_table>tx_dlf_libraries</foreign_table>
<foreign_table_where>AND tx_dlf_libraries.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_libraries.label ASC
</foreign_table_where>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
@ -92,13 +71,13 @@
</settings.show_userdefined>
<settings.solrcore>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.solrcore</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->solrList</itemsProcFunc>
<renderType>selectSingle</renderType>
<foreign_table>tx_dlf_solrcores</foreign_table>
<foreign_table_where>ORDER BY tx_dlf_solrcores.label ASC</foreign_table_where>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
@ -107,7 +86,6 @@
</settings.solrcore>
<settings.solr_limit>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.oaipmh.flexform.solr_limit</label>
<config>

View File

@ -20,26 +20,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.paginate.itemsPerPage>
<TCEforms>
<exclude>1</exclude>
@ -85,21 +65,6 @@
</config>
</TCEforms>
</settings.targetPid>
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>tmpl,tpl,html,htm,txt</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<disable_controls>upload</disable_controls>
</config>
</TCEforms>
</settings.templateFile>
</el>
</ROOT>
</sDEF>

View File

@ -20,28 +20,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<onChange>reload</onChange>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<onChange>reload</onChange>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.fulltext>
<TCEforms>
<exclude>1</exclude>
@ -65,13 +43,13 @@
</settings.fulltext>
<settings.solrcore>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.solrcore</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->solrList</itemsProcFunc>
<renderType>selectSingle</renderType>
<foreign_table>tx_dlf_solrcores</foreign_table>
<foreign_table_where>ORDER BY tx_dlf_solrcores.label ASC</foreign_table_where>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
@ -80,7 +58,6 @@
</settings.solrcore>
<settings.extendedSlotCount>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.extSearch.slotCount</label>
<config>
@ -96,7 +73,6 @@
</settings.extendedSlotCount>
<settings.extendedFields>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.extSearch.fields</label>
<config>
@ -143,13 +119,15 @@
</settings.searchIn>
<settings.collections>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.collections</label>
<config>
<type>select</type>
<items type="array"/>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->collectionList</itemsProcFunc>
<renderType>selectMultipleSideBySide</renderType>
<foreign_table>tx_dlf_collections</foreign_table>
<foreign_table_where>AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_collections.label ASC
</foreign_table_where>
<size>5</size>
<autoSizeMax>15</autoSizeMax>
<maxitems>1024</maxitems>
@ -160,7 +138,6 @@
</settings.collections>
<settings.facets>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets</label>
<config>
@ -177,13 +154,15 @@
</settings.facets>
<settings.facetCollections>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets.collections</label>
<config>
<type>select</type>
<items type="array"/>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->collectionList</itemsProcFunc>
<renderType>selectMultipleSideBySide</renderType>
<foreign_table>tx_dlf_collections</foreign_table>
<foreign_table_where>AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_collections.label ASC
</foreign_table_where>
<size>5</size>
<autoSizeMax>15</autoSizeMax>
<maxitems>1024</maxitems>
@ -194,7 +173,6 @@
</settings.facetCollections>
<settings.limitFacets>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.facets.limit</label>
<config>
@ -306,21 +284,6 @@
</config>
</TCEforms>
</settings.targetPidPageView>
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>tmpl,tpl,html,htm,txt</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<disable_controls>upload</disable_controls>
</config>
</TCEforms>
</settings.templateFile>
</el>
</ROOT>
</sDEF>

View File

@ -20,36 +20,16 @@
</TCEforms>
<type>array</type>
<el>
<settings.pages>
<TCEforms>
<onChange>reload</onChange>
<exclude>1</exclude>
<label>LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.startingpoint</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</settings.pages>
<settings.collections>
<TCEforms>
<displayCond>FIELD:settings.pages:REQ:true</displayCond>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.collections</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->collectionList</itemsProcFunc>
<foreign_table>tx_dlf_collections</foreign_table>
<foreign_table_where>AND tx_dlf_collections.hidden = 0 AND tx_dlf_collections.sys_language_uid IN (-1,0)
ORDER BY tx_dlf_collections.label ASC
</foreign_table_where>
<size>5</size>
<autoSizeMax>15</autoSizeMax>
<maxitems>1024</maxitems>

View File

@ -46,6 +46,7 @@
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.toolbox.flexform.tools</label>
<config>
<type>select</type>
<renderType>selectMultipleSideBySide</renderType>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->toolList</itemsProcFunc>
<size>5</size>
@ -62,8 +63,9 @@
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.solrcore</label>
<config>
<type>select</type>
<items type="array"></items>
<itemsProcFunc>Kitodo\Dlf\Hooks\ItemsProcFunc->solrList</itemsProcFunc>
<renderType>selectSingle</renderType>
<foreign_table>tx_dlf_solrcores</foreign_table>
<foreign_table_where>ORDER BY tx_dlf_solrcores.label ASC</foreign_table_where>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>

View File

@ -40,15 +40,31 @@ return [
'columns' => [
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.hidden',
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
'default' => 0,
],
],
'tstamp' => [
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.timestamp',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
]
],
'crdate' => [
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.creationDate',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
]
],
'starttime' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
@ -59,7 +75,7 @@ return [
],
'endtime' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
@ -70,14 +86,14 @@ return [
],
'fe_group' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.fe_group',
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.fe_group',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'items' => [
['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', '-1'],
['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.any_login', '-2'],
['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', '--div--'],
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', '-1'],
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', '-2'],
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', '--div--'],
],
'foreign_table' => 'fe_groups',
'size' => 5,

View File

@ -0,0 +1,57 @@
<?php
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
return [
'ctrl' => [
'title' => 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_tokens',
'label' => 'token',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY token',
'iconfile' => 'EXT:dlf/Resources/Public/Icons/txdlfsolrcores.png',
'rootLevel' => -1,
'searchFields' => 'token',
],
'feInterface' => [
'fe_admin_fieldList' => '',
],
'interface' => [
'showRecordFieldList' => 'token,options',
],
'columns' => [
'token' => [
'label' => 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_tokens.label',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
'eval' => 'required,trim',
'default' => '',
],
],
'options' => [
'label' => 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_tokens.index_name',
'config' => [
'type' => 'input',
'eval' => 'alphanum,nospace',
'default' => '',
],
],
],
'types' => [
'0' => ['showitem' => '--div--;LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_tokens.tab1,token,options'],
],
'palettes' => [
'1' => ['showitem' => ''],
],
];

View File

@ -0,0 +1,6 @@
plugin.tx_dlf {
persistence {
# cat=plugin.tx_dlf/100/a; type=int+; label=Default storage PID
storagePid =
}
}

View File

@ -1,8 +1,7 @@
# Model database table mapping
plugin.tx_dlf {
persistence {
#storagePid = {$plugin.tx_dlf.persistence.storagePid}
#storagePid = 2
storagePid = {$plugin.tx_dlf.persistence.storagePid}
classes {
Kitodo\Dlf\Domain\Model\ActionLog {
mapping {

View File

@ -13,40 +13,40 @@
<div class="tx-dlf-collection">
<ul class="tx-dlf-collection-list">
<f:for each="{collections}" as="collection">
<f:for each="{collections}" as="item">
<li>
<h2>
<f:link.action action="main"
arguments="{collection : collection.uid}"
arguments="{collection : item.collection.uid}"
pageUid="{currentPageUid}">
{collection.label}
{item.collection.label}
</f:link.action>
<f:if condition="{settings.targetFeed}">
<span>
<f:link.page
pageUid="{settings.targetFeed}"
additionalParams="{'tx_dlf_feeds[collection]':collection.uid}"
additionalParams="{'tx_dlf_feeds[collection]': item.collection.uid}"
target="_blank">
<f:image src="EXT:dlf/Resources/Public/Icons/txdlffeeds.png"
title="{f:translate(key:'collection.feed.title')}"
alt="{f:translate(key:'collection.feed.alt')}" />
title="{f:translate(key:' item.collection.feed.title')}"
alt="{f:translate(key:' item.collection.feed.alt')}" />
</f:link.page>
</span>
</f:if>
</h2>
<div class="tx-dlf-collection-thumbnail">
<f:if condition="{collection.thumbnail}">
<f:image src="{collection.thumbnail}" alt="{f:translate(key: 'thumbnail')} {collection.label}" title="{collection.label}" maxWidth="250" />
<f:if condition="{item.collection.thumbnail}">
<f:image src="{item.collection.thumbnail}" alt="{f:translate(key: 'thumbnail')} {item.collection.label}" title="{item.collection.label}" maxWidth="250" />
</f:if>
</div>
<f:format.html>{collection.description}</f:format.html>
<f:format.html>{item.collection.description}</f:format.html>
<p class="tx-dlf-collection-counts">
({collection.countTitles}
<f:translate key="{f:if(condition:'{collection.countTitles} > 1', then: 'titles', else: 'title')}" />
({item.info.titles -> f:count()}
<f:translate key="{f:if(condition:'{item.info.titles -> f:count()} > 1', then: 'titles', else: 'title')}" />
/
{collection.countVolumes}
<f:translate key="{f:if(condition:'{collection.countTitles} > 1', then: 'volumes', else: 'volume')}" />)
{item.info.volumes -> f:count()}
<f:translate key="{f:if(condition:'{item.info.volumes -> f:count()} > 1', then: 'volumes', else: 'volume')}" />)
</p>
</li>
</f:for>

View File

@ -22,7 +22,7 @@
<author>{document.author}</author>
</f:if>
<pubDate><f:format.date format="r">{document.crdate}</f:format.date></pubDate>
<guid>{document.record_id}</guid>
<guid>{document.recordId}</guid>
</item>
</f:for>
</channel>

View File

@ -85,7 +85,7 @@
<ListSets>
<f:for each="{oaiSets}" as="set">
<set>
<setSpec>{set.oai_name}</setSpec>
<setSpec>{set.oaiName}</setSpec>
<setName>{set.label}</setName>
</set>
</f:for>

View File

@ -248,12 +248,14 @@ CREATE TABLE tx_dlf_libraries (
--
CREATE TABLE tx_dlf_tokens (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
token varchar(255) DEFAULT '' NOT NULL,
options mediumtext NOT NULL,
ident varchar(30) DEFAULT '' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid),
KEY token (token)
);