Commit 32f218d5 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Merge branch '532-create-nomination-and-voting-possibility' into 'develop'

Resolve "Create nomination and voting possibility"

See merge request !677
parents 6cf9a0a9 e6f97d8b
Pipeline #18375 canceled with stages
in 2 minutes and 56 seconds
......@@ -157,6 +157,11 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implement
*/
protected $downloadRepository;
/**
* @var int
*/
protected $nominations = 0;
public function injectDownloadRepository(DownloadRepository $downloadRepository)
{
$this->downloadRepository = $downloadRepository;
......@@ -482,6 +487,22 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implement
return $this->repositoryUrl;
}
/**
* @return int
*/
public function getNominations(): int
{
return $this->nominations;
}
/**
* @param int $nominations
*/
public function setNominations(int $nominations): void
{
$this->nominations = $nominations;
}
/**
* Returns all votes for the extension
*
......
......@@ -26,6 +26,11 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
protected $notifiedExtensions;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Extension>
*/
protected $nominatedExtensions;
public function __construct()
{
parent::__construct();
......@@ -97,4 +102,19 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
}
$this->notifiedExtensions->detach($extension);
}
public function getNominatedExtensions(): \TYPO3\CMS\Extbase\Persistence\ObjectStorage
{
return $this->nominatedExtensions;
}
public function addNominatedExtension(Extension $extension): void
{
$this->nominatedExtensions->attach($extension);
}
public function removeNominatedExtension(Extension $extension): void
{
$this->nominatedExtensions->detach($extension);
}
}
......@@ -22,7 +22,18 @@ $columns = [
'MM' => 'tx_terfe2_extension_feuser_notification_mm',
'MM_opposite_field' => 'notifications'
]
]
],
'nominated_extensions' => [
'exclude' => 1,
'label' => 'Nominated extensions',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_terfe2_domain_model_extension',
'MM' => 'tx_terfe2_extension_feuser_nomination_mm',
'MM_opposite_field' => 'nominations'
]
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $columns);
......@@ -80,6 +80,12 @@
'forms'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'ter_fe2',
'Nomination',
'Nomination list',
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
......
......@@ -238,6 +238,16 @@ return [
'type' => 'input',
'eval' => 'date'
],
]
],
'nominations' => [
'exclude' => 1,
'label' => 'Nominations',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'fe_users',
'MM' => 'tx_terfe2_extension_feuser_nomination_mm',
],
],
],
];
......@@ -70,6 +70,10 @@ plugin.tx_terfe2 {
partialRootPath = {$plugin.tx_terfe2.view.partialRootPath}
layoutRootPath = {$plugin.tx_terfe2.view.layoutRootPath}
}
settings {
nominationPage = 412
}
}
@import 'EXT:ter_fe2/Configuration/TypoScript/Default/Plugins/Solr.typoscript'
......
......@@ -34,6 +34,17 @@ if (!defined('TYPO3_MODE')) {
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'ter_fe2',
'Nomination',
[
\T3o\TerFe2\Controller\NominationController::class => 'listNominations,addNomination,removeNomination'
],
[
\T3o\TerFe2\Controller\NominationController::class => 'listNominations,addNomination,removeNomination'
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'ter_fe2',
'AccessToken',
......
......@@ -32,6 +32,7 @@ CREATE TABLE tx_terfe2_domain_model_extension (
crowdin_key varchar(255) DEFAULT '' NOT NULL,
localization_status mediumtext,
last_download_sync int(11) unsigned DEFAULT '0' NOT NULL,
nominations int(11) unsigned DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
......@@ -161,7 +162,8 @@ CREATE TABLE tx_terfe2_domain_model_author (
CREATE TABLE fe_users (
liked_extensions int(11) unsigned DEFAULT '0' NOT NULL,
notified_extensions int(11) unsigned DEFAULT '0' NOT NULL
notified_extensions int(11) unsigned DEFAULT '0' NOT NULL,
nominated_extensions int(11) unsigned DEFAULT '0' NOT NULL
);
CREATE TABLE `tx_terfe2_domain_model_download` (
......@@ -218,3 +220,21 @@ CREATE TABLE `tx_terfe2_extension_feuser_notification_mm` (
KEY `uid_local` (`uid_local`),
KEY `uid_foreign` (`uid_foreign`)
);
CREATE TABLE `tx_terfe2_extension_feuser_nomination_mm` (
`uid_local` int(10) unsigned DEFAULT 0 NOT NULL,
`uid_foreign` int(10) unsigned DEFAULT 0 NOT NULL,
`sorting` int(10) unsigned DEFAULT 0 NOT NULL,
`sorting_foreign` int(10) unsigned DEFAULT 0 NOT NULL,
KEY `uid_local`(`uid_local`),
KEY `uid_foreign`(`uid_foreign`)
);
CREATE TABLE `tx_terfe2_domain_model_documentationvoting` (
`extension_key` varchar(255) DEFAULT '' NOT NULL,
`username` varchar(255) DEFAULT '' NOT NULL,
`voting` int(11) DEFAULT 0 NOT NULL,
KEY `extension_user_voting` (`extension_key`, `username`, `voting`)
);
......@@ -101,6 +101,20 @@ plugin.tx_solr {
}
}
view.templateFiles.results.availableTemplates {
default {
label = Default Searchresults Template
file = Results
}
nominate {
label = Nomination Template
file = ResultsNomination
}
}
cssFiles.results =
settings.maximumNumberOfLinks = 6
settings {
maximumNumberOfLinks = 6
nominationOverview = 413
}
}
......@@ -77,13 +77,20 @@
</div>
</f:if>
<div class="btn-group d-flex" role="group">
<f:if condition="{document.insecure_boolS}">
<f:if condition="{document.insecure_boolS} || {nomination}">
<f:else>
<f:link.action pageUid="3" rel="nofollow" class="btn {f:if(condition:exactMatchFound, then: 'btn-lg')} btn-primary btn-block mb-0 w-100" action="download" extensionName="TerFe2" controller="Extension" pluginName="Pi1" arguments="{extension: document.uid}" title="Downlad version {document.extensionVersion_stringS} of TYPO3 extension {document.extensionKey_stringS}">
<i class="fa fa-download"></i> v{document.extensionVersion_stringS}
</f:link.action>
</f:else>
</f:if>
<f:if condition="{nomination}">
<f:then>
<f:link.action pageUid="{settings.nominationOverview}" controller="Nomination" extensionName="TerFe2" pluginName="Nomination" action="addNomination" arguments="{extension: document.uid}" class="btn btn-primary btn-block mb-0 w-100" title="Nominate extension {document.extensionKey_stringS}">
Nominate for award
</f:link.action>
</f:then>
</f:if>
<f:if condition="{document.hasManual_boolS}">
<f:link.external class="btn {f:if(condition:exactMatchFound, then: 'btn-lg ')} btn-info btn-block mb-0 w-100" uri="{document.extensionDocumentationLink_stringS}" rel="nofollow" title="Go to documentation of extension {document.extensionKey_stringS}">
<i class="fa fa-book"></i> Documentation
......
......@@ -139,7 +139,8 @@ return [
'checkFeUserPid' => false,
'debug' => true,
'loginSecurityLevel' => 'normal',
'pageNotFoundOnCHashError' => false,
'pageNotFoundOnCHashError' => true,
'disableNoCacheParameter' => true,
],
'GFX' => [
'jpg_quality' => '80',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment