Commit 9db3b3a9 authored by speedprogs_de's avatar speedprogs_de
Browse files

added possibility to define version count and disable latest version in version history

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@52403 735d13b6-9817-0410-8766-e36946ffe9aa
parent d9e6538e
......@@ -171,8 +171,13 @@
$extension = $this->extensionRepository->findOneByExtKey($extensionKey);
}
$versionHistoryCount = (!empty($this->settings['versionHistoryCount']) ? $this->settings['versionHistoryCount'] : 5);
$skipLatestVersion = (isset($this->settings['skipLatestVersion']) ? $this->settings['skipLatestVersion'] : TRUE);
if ($extension !== NULL && $extension instanceof Tx_TerFe2_Domain_Model_Extension) {
$versionHistory = $this->versionRepository->getVersionHistory($extension, $versionHistoryCount, $skipLatestVersion);
$this->view->assign('extension', $extension);
$this->view->assign('versionHistory', $versionHistory);
}
}
......@@ -253,7 +258,7 @@
throw new Exception('A download action for the format "' . $format . '" is not implemented');
}
$version = $this->versionRepository->findByExtensionAndVersionString($extension, $versionString);
$version = $this->versionRepository->findOneByExtensionAndVersionString($extension, $versionString);
if (!$version) {
throw new Exception('Invalid version request', 1316542246);
}
......
......@@ -54,15 +54,15 @@
return $query->execute();
}
/**
* Get a version with the given extension and a related version string
*
* @param $extension
* @param $versionString
* @return
* @param Tx_TerFe2_Domain_Model_Extension $extension The extension object
* @param string $versionString The version string
* @return Tx_TerFe2_Domain_Model_Version Version object
*/
public function findByExtensionAndVersionString($extension, $versionString) {
public function findOneByExtensionAndVersionString(Tx_TerFe2_Domain_Model_Extension $extension, $versionString) {
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
$query->getQuerySettings()->setRespectSysLanguage(FALSE);
......@@ -75,5 +75,42 @@
return $query->execute()->getFirst();
}
/**
* Get version history
*
* @param Tx_TerFe2_Domain_Model_Extension $extension The extension object
* @param integer $count Count of versions to return
* @param boolean $skipLatest Skip latest version
* @return Tx_Extbase_Persistence_ObjectStorage Objects
*/
public function getVersionHistory($extension, $count = 0, $skipLatest = TRUE) {
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
$query->getQuerySettings()->setRespectSysLanguage(FALSE);
$query->setOrderings(
array('uploadDate' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING)
);
if (!empty($skipLatest)) {
$query->matching(
$query->logicalAnd(
$query->equals('extension', $extension),
$query->logicalNot(
$query->equals('uid', (int) $extension->getLastVersion()->getUid())
)
)
);
} else {
$query->matching($query->equals('extension', $extension));
}
if (!empty($count)) {
$query->setLimit((int) $count);
}
return $query->execute();
}
}
?>
\ No newline at end of file
......@@ -30,9 +30,15 @@ plugin.tx_terfe2 {
# cat=TER Frontend/settings/155; type=bool; label=Count downloads: Count extension downloads via download action
countDownloads = 0
# cat=TER Frontend/settings/155; type=int+; label=Default point count: Count fo points to show in chart
# cat=TER Frontend/settings/155; type=int+; label=Default point count: Count of points to show in chart
defaultPointCount = 5
# cat=TER Frontend/settings/156; type=int+; label=Version history count: Count of versions to show in history
versionHistoryCount = 5
# cat=TER Frontend/settings/157; type=int+; label=Skip latest version: Skip latest version in version history
skipLatestVersion = 1
terConnection {
# cat=TER Frontend/settings/160; type=string; label=TER WSDL URI: WSDL URI to connect TER server
wsdl = http://typo3.org/wsdl/tx_ter_wsdl.php
......
......@@ -4,41 +4,43 @@
plugin.tx_terfe2 {
## General settings
settings {
latestCount = {$plugin.tx_terfe2.settings.latestCount}
listCount = {$plugin.tx_terfe2.settings.listCount}
authorListCount = {$plugin.tx_terfe2.settings.authorListCount}
topRatedCount = {$plugin.tx_terfe2.settings.topRatedCount}
randomAuthorCount = {$plugin.tx_terfe2.settings.randomAuthorCount}
descriptionLength = {$plugin.tx_terfe2.settings.descriptionLength}
dateFormat = {$plugin.tx_terfe2.settings.dateFormat}
mediaRootPath = {$plugin.tx_terfe2.settings.mediaRootPath}
countDownloads = {$plugin.tx_terfe2.settings.countDownloads}
defaultPointCount = {$plugin.tx_terfe2.settings.defaultPointCount}
latestCount = {$plugin.tx_terfe2.settings.latestCount}
listCount = {$plugin.tx_terfe2.settings.listCount}
authorListCount = {$plugin.tx_terfe2.settings.authorListCount}
topRatedCount = {$plugin.tx_terfe2.settings.topRatedCount}
randomAuthorCount = {$plugin.tx_terfe2.settings.randomAuthorCount}
descriptionLength = {$plugin.tx_terfe2.settings.descriptionLength}
dateFormat = {$plugin.tx_terfe2.settings.dateFormat}
mediaRootPath = {$plugin.tx_terfe2.settings.mediaRootPath}
countDownloads = {$plugin.tx_terfe2.settings.countDownloads}
defaultPointCount = {$plugin.tx_terfe2.settings.defaultPointCount}
versionHistoryCount = {$plugin.tx_terfe2.settings.versionHistoryCount}
skipLatestVersion = {$plugin.tx_terfe2.settings.skipLatestVersion}
terConnection {
wsdl = {$plugin.tx_terfe2.settings.terConnection.wsdl}
username = {$plugin.tx_terfe2.settings.terConnection.username}
password = {$plugin.tx_terfe2.settings.terConnection.password}
wsdl = {$plugin.tx_terfe2.settings.terConnection.wsdl}
username = {$plugin.tx_terfe2.settings.terConnection.username}
password = {$plugin.tx_terfe2.settings.terConnection.password}
}
smallImage {
maxW = {$plugin.tx_terfe2.settings.smallImage.maxW}
maxH = {$plugin.tx_terfe2.settings.smallImage.maxH}
quality = {$plugin.tx_terfe2.settings.smallImage.quality}
ext = {$plugin.tx_terfe2.settings.smallImage.ext}
maxW = {$plugin.tx_terfe2.settings.smallImage.maxW}
maxH = {$plugin.tx_terfe2.settings.smallImage.maxH}
quality = {$plugin.tx_terfe2.settings.smallImage.quality}
ext = {$plugin.tx_terfe2.settings.smallImage.ext}
}
largeImage {
maxW = {$plugin.tx_terfe2.settings.largeImage.maxW}
maxH = {$plugin.tx_terfe2.settings.largeImage.maxH}
quality = {$plugin.tx_terfe2.settings.largeImage.quality}
ext = {$plugin.tx_terfe2.settings.largeImage.ext}
maxW = {$plugin.tx_terfe2.settings.largeImage.maxW}
maxH = {$plugin.tx_terfe2.settings.largeImage.maxH}
quality = {$plugin.tx_terfe2.settings.largeImage.quality}
ext = {$plugin.tx_terfe2.settings.largeImage.ext}
}
}
## Storage settings
persistence {
storagePid = {$plugin.tx_terfe2.persistence.storagePid}
storagePid = {$plugin.tx_terfe2.persistence.storagePid}
classes {
## Add model for extension manager cache entries (cache_extensions)
......@@ -53,9 +55,9 @@ plugin.tx_terfe2 {
## View specific settings
view {
templateRootPath = {$plugin.tx_terfe2.view.templateRootPath}
partialRootPath = {$plugin.tx_terfe2.view.partialRootPath}
layoutRootPath = {$plugin.tx_terfe2.view.layoutRootPath}
templateRootPath = {$plugin.tx_terfe2.view.templateRootPath}
partialRootPath = {$plugin.tx_terfe2.view.partialRootPath}
layoutRootPath = {$plugin.tx_terfe2.view.layoutRootPath}
}
}
......
<table>
<f:for each="{extension.reverseVersionsByDate}" as="version">
<f:for each="{versionHistory}" as="version">
<tr>
<td class="col1"><strong>{version.versionString}</strong></td>
<td class="col2"><p>{version.uploadComment}</p></td>
......
......@@ -112,7 +112,7 @@
</div>
<div class="ter-ext-single-versionhistory ter-toggle-show">
<f:render partial="ExtensionUploadHistoryList" arguments="{extension: extension}" />
<f:render partial="ExtensionUploadHistoryList" arguments="{versionHistory: versionHistory}" />
</div>
<f:link.action controller="Extension" action="index" class="bu bu-mini dark-grey"><f:translate key="back_to_extension_list" /></f:link.action>
......
Supports Markdown
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