Commit 55593ec9 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen

Merge branch '116-show-links-to-documentation' into 'develop'

Resolve "Show links to documentation"

Closes #116

See merge request !139
parents a961c33d 08a9bfdc
Pipeline #1939 failed with stages
in 2 minutes and 48 seconds
......@@ -197,8 +197,6 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
$versionHistoryCount = (!empty($this->settings['versionHistoryCount']) ? $this->settings['versionHistoryCount'] : 5);
$skipLatestVersion = (isset($this->settings['skipLatestVersion']) ? $this->settings['skipLatestVersion'] : TRUE);
//$loggedInUser = $this->ownerRepository->findCurrent();
if ($extension !== NULL &&
$extension instanceof \T3o\TerFe2\Domain\Model\Extension &&
(
......@@ -210,11 +208,10 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
$this->view->assign('owner', $owner);
$this->view->assign('extension', $extension);
$this->view->assign('versionHistory', $versionHistory);
$this->view->assign('loggedInUser', $loggedInUser);
/** @var \T3o\TerFe2\Service\Documentation $documentationService */
//$documentationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\T3o\TerFe2\Service\Documentation');
//$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString());
$documentationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\T3o\TerFe2\Service\Documentation::class);
$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString());
$this->view->assign('documentationLink', $documentationLink);
$pageRenderer = $this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class);
......
......@@ -69,19 +69,21 @@ class Documentation implements \TYPO3\CMS\Core\SingletonInterface
/**
* Get documentation link
*
* @throws Exception
* @throws \Exception
* @param string $extensionKey Extension key
* @param string $versionString Version string
* @param bool $returnUrlOnly
* @return string|NULL HTML link to the documentation
*/
public function getDocumentationLink($extensionKey, $versionString)
public function getDocumentationLink($extensionKey, $versionString, $returnUrlOnly = false)
{
if (empty($extensionKey) || empty($versionString)) {
throw new \Exception('Extension key and version string are required to build a documentation url');
}
$manualExists = isset($this->docsInformation->$extensionKey);
$documentationLink = NULL;
$documentationLink = null;
$url = null;
if ($manualExists) {
// link to extension to get the latest manual
......@@ -92,6 +94,6 @@ class Documentation implements \TYPO3\CMS\Core\SingletonInterface
}
}
return $documentationLink;
return $returnUrlOnly ? $url : $documentationLink;
}
}
......@@ -101,6 +101,13 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer {
$document->setField('extensionDependency_stringS', $dependencyString ?: 'N/A');
$document->setField('outdated_boolS', $extension->getLastVersion()->getReviewState() === -2);
// add documentation link
/** @var \T3o\TerFe2\Service\Documentation $documentationService */
$documentationService = GeneralUtility::makeInstance(\T3o\TerFe2\Service\Documentation::class);
$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString(), true);
$document->setField('extensionDocumentationLink_stringS', $documentationLink);
}
return $document;
......@@ -111,7 +118,7 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer {
*
* @param \T3o\TerFe2\Domain\Model\Extension $extension
* @param string $relationName The dependency to get the version from (e.g. "typo3" to get the minimum typo3 version)
* @return string
* @return array
*/
protected function getDependencyVersionForPackage(\T3o\TerFe2\Domain\Model\Extension $extension, $relationName) {
$versions = array(
......
......@@ -161,22 +161,6 @@ plugin {
typolink.returnLast = url
}
extensionDocumentationLink_stringS = USER
extensionDocumentationLink_stringS {
includeLibs = EXT:t3org_base/userfunc/ter_generate_extension_doc_link.php
userFunc = user_generateExtensionDocumentationLink
# ToDo remove this parameter
urlPrefix = TEXT
urlPrefix.value =
extensionKey = TEXT
extensionKey.data = register:extensionKey
extensionVersion = TEXT
extensionVersion.data = register:extensionVersion
}
extensionReviewState_intS = SOLR_RELATION
extensionReviewState_intS {
localField = last_version
......
......@@ -36,7 +36,7 @@
<dd>
<f:if condition="{documentationLink}">
<f:then>
<terfe2:raw>{documentationLink}</terfe2:raw>
<f:format.raw>{documentationLink}</f:format.raw>
<f:if condition="{extension.externalManual}">
<br />
<f:link.external rel="nofollow" uri="{extension.externalManual}" target="_blank">
......
......@@ -171,10 +171,12 @@
Uploaded:
</dt>
<dd>###DATE:###RESULT_DOCUMENT.extensionLastUpload_intS######</dd>
###IF:###RESULT_DOCUMENT.extensionDocumentationLink_stringS###|!=|###
<dt>
Manual:
</dt>
<dd>###RESULT_DOCUMENT.extensionDocumentationLink_stringS###</dd>
<dd>###LINK:Extension manual|###RESULT_DOCUMENT.extensionDocumentationLink_stringS######</dd>
###IF:###RESULT_DOCUMENT.extensionDocumentationLink_stringS###|!=|###
</dl>
</div>
</div>
......
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