Skip to content

Commit

Permalink
Allow to hide document types in list views.
Browse files Browse the repository at this point in the history
  • Loading branch information
haogatyp authored and claussni committed Jun 4, 2021
1 parent 1991ecb commit 391449e
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 22 deletions.
16 changes: 9 additions & 7 deletions Classes/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,14 @@ public function releasePublishAction(\EWW\Dpf\Domain\Model\Document $document, $
$this->redirect('showDetails', 'Document', null, ['document' => $document]);
return FALSE;
}

$this->updateDocument($document, DocumentWorkflow::TRANSITION_RELEASE_PUBLISH, null);

/** @var Notifier $notifier */
$notifier = $this->objectManager->get(Notifier::class);
$notifier->sendReleasePublishNotification($document);
}

/**
* releaseActivateAction
*
Expand All @@ -738,11 +738,11 @@ public function releaseActivateAction(\EWW\Dpf\Domain\Model\Document $document,
$this->redirect('showDetails', 'Document', null, ['document' => $document]);
return FALSE;
}

$this->updateDocument($document, DocumentWorkflow::TRANSITION_RELEASE_ACTIVATE, null);

}

/**
* action register
*
Expand Down Expand Up @@ -824,7 +824,9 @@ public function showDetailsAction(Document $document)

$documentTypes = [0 => ''];
foreach ($this->documentTypeRepository->getDocumentTypesAlphabetically() as $documentType) {
$documentTypes[$documentType->getUid()] = $documentType->getDisplayName();
if (!$documentType->isHiddenInList()) {
$documentTypes[$documentType->getUid()] = $documentType->getDisplayName();
}
}

$this->view->assign('documentTypes', $documentTypes);
Expand All @@ -839,7 +841,7 @@ public function cancelListTaskAction()
{
$this->redirectToDocumentList();
}

/**
* action suggest restore
*
Expand Down
21 changes: 21 additions & 0 deletions Classes/Domain/Model/DocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class DocumentType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $virtualType = false;

/**
* @var bool
*/
protected $hiddenInList = false;

/**
* metadataPage
*
Expand Down Expand Up @@ -310,4 +315,20 @@ public function getPubmedTransformation(): \TYPO3\CMS\Extbase\Persistence\Object
return $this->pubmedTransformation;
}

/**
* @return bool
*/
public function isHiddenInList(): bool
{
return $this->hiddenInList;
}

/**
* @param bool $hiddenInList
*/
public function setHiddenInList(bool $hiddenInList): void
{
$this->hiddenInList = $hiddenInList;
}

}
2 changes: 2 additions & 0 deletions Classes/Domain/Repository/DocumentTypeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;

/**
* The repository for DocumentTypes
*/
Expand Down
15 changes: 12 additions & 3 deletions Configuration/TCA/tx_dpf_domain_model_documenttype.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'name, display_name, virtual_type, transformation_file_output, transformation_file_input, crossref_transformation, crossref_types,
'searchFields' => 'name, display_name, virtual_type, hidden_in_list, transformation_file_output, transformation_file_input, crossref_transformation, crossref_types,
datacite_transformation, datacite_types, k10plus_transformation,
pubmed_transformation, pubmed_types, bibtex_transformation, bibtex_types, riswos_transformation, riswos_types, metadata_page',
'iconfile' => 'EXT:dpf/Resources/Public/Icons/default.gif',
),
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden,
name, display_name, virtual_type, transformation_file_output, transformation_file_input, crossref_transformation, crossref_types,
name, display_name, virtual_type, hidden_in_list, transformation_file_output, transformation_file_input, crossref_transformation, crossref_types,
datacite_transformation, datacite_types, k10plus_transformation,
pubmed_transformation, pubmed_types, bibtex_transformation, bibtex_types, riswos_transformation, riswos_types, metadata_page',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, --palette--;;1,
name, display_name, virtual_type, transformation_file_output, transformation_file_input, crossref_transformation, crossref_types,
name, display_name, virtual_type, hidden_in_list, transformation_file_output, transformation_file_input, crossref_transformation, crossref_types,
datacite_transformation, datacite_types, k10plus_transformation,
pubmed_transformation, pubmed_types, bibtex_transformation, bibtex_types, riswos_transformation, riswos_types, metadata_page,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'),
Expand Down Expand Up @@ -169,6 +169,15 @@
'default' => 0,
),
),
'hidden_in_list' => array(
'exclude' => 1,
'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dpf/Resources/Private/Language/locallang_db.xlf:tx_dpf_domain_model_documenttype.hidden_in_list',
'config' => array(
'type' => 'check',
'default' => 0,
),
),
'transformation_file_output' => [
'exclude' => 1,
'l10n_mode' => 'exclude',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<source>virtual</source>
<target>Virtuell</target>
</trans-unit>
<trans-unit id="hidden_in_list.description" approved="yes">
<source>hide in list</source>
<target>In Liste verbergen</target>
</trans-unit>
<trans-unit id="metadata_page.description" approved="yes">
<source>metadataPage</source>
<target>Metadaten-Seite</target>
Expand All @@ -23,4 +27,4 @@
</trans-unit>
</body>
</file>
</xliff>
</xliff>
6 changes: 5 additions & 1 deletion Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@
<source>virtual</source>
<target>Virtuell</target>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_documenttype.hidden_in_list" approved="yes">
<source>hide in list</source>
<target>In Liste verbergen</target>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_documenttype.transformation_file_input" approved="yes">
<source>Transformation file input</source>
<target>Transformations Datei Import</target>
Expand Down Expand Up @@ -1075,4 +1079,4 @@
</trans-unit>
</body>
</file>
</xliff>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<trans-unit id="virtual_type.description">
<source>virtual</source>
</trans-unit>
<trans-unit id="hidden_in_list.description" approved="yes">
<source>hide in list</source>
</trans-unit>
<trans-unit id="metadata_page.description">
<source>metadataPage</source>
</trans-unit>
Expand All @@ -19,4 +22,4 @@
</trans-unit>
</body>
</file>
</xliff>
</xliff>
5 changes: 4 additions & 1 deletion Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
<trans-unit id="tx_dpf_domain_model_documenttype.virtual_type">
<source>virtual</source>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_documenttype.hidden_in_list" approved="yes">
<source>hide in list</source>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_documenttype.transformation_file_input" approved="yes">
<source>Transformation file input</source>
</trans-unit>
Expand Down Expand Up @@ -811,4 +814,4 @@
</trans-unit>
</body>
</file>
</xliff>
</xliff>
10 changes: 6 additions & 4 deletions Resources/Private/Templates/DocumentForm/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@

<ol>
<f:for each="{documentTypes}" as="documentType">
<li>
<f:link.action action="new" controller="DocumentForm" arguments="{documentType:documentType}" noCacheHash="TRUE">{documentType.displayName}
</f:link.action>
</li>
<f:if condition="{documentType.hiddenInList} == 0">
<li>
<f:link.action action="new" controller="DocumentForm" arguments="{documentType:documentType}" noCacheHash="TRUE">{documentType.displayName}
</f:link.action>
</li>
</f:if>
</f:for>
</ol>
</f:section>
10 changes: 6 additions & 4 deletions Resources/Private/Templates/DocumentFormBackoffice/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ <h1 class="h2">{f:translate(key: 'manager.control.createNewDocument')}</h1>

<ol>
<f:for each="{documentTypes}" as="documentType">
<li>
<f:link.action action="new" controller="DocumentFormBackoffice" arguments="{documentType:documentType}" noCacheHash="TRUE">{documentType.displayName}
</f:link.action>
</li>
<f:if condition="{documentType.hiddenInList} == 0">
<li>
<f:link.action action="new" controller="DocumentFormBackoffice" arguments="{documentType:documentType}" noCacheHash="TRUE">{documentType.displayName}
</f:link.action>
</li>
</f:if>
</f:for>
</ol>
</f:section>
1 change: 1 addition & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CREATE TABLE tx_dpf_domain_model_documenttype (
name varchar(255) DEFAULT '' NOT NULL,
display_name varchar(255) DEFAULT '' NOT NULL,
virtual_type tinyint(1) unsigned DEFAULT '0' NOT NULL,
hidden_in_list tinyint(1) unsigned DEFAULT '0' NOT NULL,
metadata_page int(11) unsigned DEFAULT '0' NOT NULL,
transformation_file_output int(11) unsigned DEFAULT '0' NOT NULL,
transformation_file_input int(11) unsigned DEFAULT '0' NOT NULL,
Expand Down

0 comments on commit 391449e

Please sign in to comment.