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

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 ...@@ -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 * resolve the error key and get the corresponding translation
* *
......
...@@ -420,19 +420,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -420,19 +420,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/ */
public function setLastVersion(Version $lastVersion) public function setLastVersion(Version $lastVersion)
{ {
if (empty($this->lastVersion)) { $this->lastVersion = $lastVersion;
$this->lastVersion = $lastVersion;
return;
}
$curVersionNumber = $this->lastVersion->getVersionNumber();
$newVersionNumber = $lastVersion->getVersionNumber();
// Add lastVersion only if newer
if ($newVersionNumber > $curVersionNumber) {
$this->lastVersion = $lastVersion;
}
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</numIndex> </numIndex>
<numIndex index="1" type="array"> <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="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> </numIndex>
</items> </items>
</config> </config>
......
...@@ -65,7 +65,13 @@ ...@@ -65,7 +65,13 @@
<f:translate key="delete-button" /> <f:translate key="delete-button" />
</f:link.action> </f:link.action>
</td> </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> </tr>
</f:for> </f:for>
</f:for> </f:for>
......
...@@ -11,14 +11,14 @@ if (!defined('TYPO3_MODE')) { ...@@ -11,14 +11,14 @@ if (!defined('TYPO3_MODE')) {
'Extension' => 'index, search, show, new, create, edit, update, delete, download, list, listLatest, uploadVersion, createVersion, removeTag', 'Extension' => 'index, search, show, new, create, edit, update, delete, download, list, listLatest, uploadVersion, createVersion, removeTag',
'Tag' => 'list, new, create, edit, update, delete, show', 'Tag' => 'list, new, create, edit, update, delete, show',
'Author' => 'list, edit, update, 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', 'Review' => 'update',
], ],
[ [
'Extension' => 'search, create, update, edit, delete, download, uploadVersion, createVersion, removeTag', 'Extension' => 'search, create, update, edit, delete, download, uploadVersion, createVersion, removeTag',
'Tag' => 'create, delete', 'Tag' => 'create, delete',
'Author' => 'update', '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', '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