Commit 23455c34 authored by Thomas Löffler's avatar Thomas Löffler

Adds possibility in admin view to set last version of an extension

parent 37b445c4
Pipeline #2384 passed with stages
in 1 minute and 22 seconds
......@@ -331,6 +331,26 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
}
}
/**
* @param \T3o\TerFe2\Domain\Model\Extension $extension
* @param \T3o\TerFe2\Domain\Model\Version $version
* @return void
*/
public function setAsLastVersionAction(\T3o\TerFe2\Domain\Model\Extension $extension, \T3o\TerFe2\Domain\Model\Version $version)
{
$extension->setLastVersion($version);
$this->extensionRepository->update($extension);
$this->redirectWithMessage(
'Version ' . $version->getVersionString() . ' set as latest version!',
'admin',
'New last version',
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
null,
null,
['extensionKey' => $extension->getExtKey()]
);
}
/**
* resolve the error key and get the corresponding translation
*
......
......@@ -420,19 +420,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
public function setLastVersion(Version $lastVersion)
{
if (empty($this->lastVersion)) {
$this->lastVersion = $lastVersion;
return;
}
$curVersionNumber = $this->lastVersion->getVersionNumber();
$newVersionNumber = $lastVersion->getVersionNumber();
// Add lastVersion only if newer
if ($newVersionNumber > $curVersionNumber) {
$this->lastVersion = $lastVersion;
}
$this->lastVersion = $lastVersion;
}
......
......@@ -26,7 +26,7 @@
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:ter_fe2/Resources/Private/Language/locallang_db.xml:tt_content.flexform_pi1.s_def.switchableControllerActions.1</numIndex>
<numIndex index="1">Registerkey->index;Registerkey->admin;Registerkey->create;Registerkey->delete;Registerkey->deleteExtensionVersion;Registerkey->transfer;Extension->uploadVersion;Extension->createVersion;Extension->edit;Extension->update;Extension->removeTag;Registerkey->keep</numIndex>
<numIndex index="1">Registerkey->index;Registerkey->admin;Registerkey->create;Registerkey->delete;Registerkey->deleteExtensionVersion;Registerkey->transfer;Extension->uploadVersion;Extension->createVersion;Extension->edit;Extension->update;Extension->removeTag;Registerkey->keep;Registerkey->setAsLastVersion</numIndex>
</numIndex>
</items>
</config>
......
......@@ -65,7 +65,13 @@
<f:translate key="delete-button" />
</f:link.action>
</td>
<td colspan="2">&nbsp;</td>
<td colspan="2">
<f:if condition="{extension.lastVersion} != {version}">
<f:link.action class="btn btn-success" action="setAsLastVersion" controller="Registerkey" arguments="{extension: extension, version: version}">
<i class="fa fa-arrow-circle-right"></i> Set as latest version
</f:link.action>
</f:if>
</td>
</tr>
</f:for>
</f:for>
......
......@@ -11,14 +11,14 @@ if (!defined('TYPO3_MODE')) {
'Extension' => 'index, search, show, new, create, edit, update, delete, download, list, listLatest, uploadVersion, createVersion, removeTag',
'Tag' => 'list, new, create, edit, update, delete, show',
'Author' => 'list, edit, update, show',
'Registerkey' => 'index, admin, deleteExtensionVersion, create, manage, transfer, delete, salvage, keep',
'Registerkey' => 'index, admin, deleteExtensionVersion, create, manage, transfer, delete, salvage, keep, setAsLastVersion',
'Review' => 'update',
],
[
'Extension' => 'search, create, update, edit, delete, download, uploadVersion, createVersion, removeTag',
'Tag' => 'create, delete',
'Author' => 'update',
'Registerkey' => 'index, admin, deleteExtensionVersion, create, manage, transfer, delete, salvage, keep',
'Registerkey' => 'index, admin, deleteExtensionVersion, create, manage, transfer, delete, salvage, keep, setAsLastVersion',
'Review' => 'update',
]
);
......
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