[FEATURE] Show link to online docs in extension manager 32/62032/8
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 18 Oct 2019 23:51:28 +0000 (19:51 -0400)
committerBenni Mack <benni@typo3.org>
Sat, 9 Nov 2019 17:58:48 +0000 (18:58 +0100)
The export of extensions provided by https://extensions.typo3.org
has been extended with the link to the documentation.

This link is now shown in the list and detail view of extensions
in the extensions manager.

Resolves: #89458
Releases: master
Change-Id: If1439bd7b97d9c60c2811716edef97a6e4ed870d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62032
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
12 files changed:
typo3/sysext/core/Documentation/Changelog/master/Feature-89458-ShowLinkToOnlineDocsInExtensionManager.rst [new file with mode: 0644]
typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php
typo3/sysext/extensionmanager/Classes/Utility/Importer/ExtensionListUtility.php
typo3/sysext/extensionmanager/Classes/Utility/Parser/AbstractExtensionXmlParser.php
typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPullParser.php
typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPushParser.php
typo3/sysext/extensionmanager/Configuration/TCA/tx_extensionmanager_domain_model_extension.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerSingleLine.html
typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerTable.html
typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html
typo3/sysext/extensionmanager/ext_tables.sql

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-89458-ShowLinkToOnlineDocsInExtensionManager.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-89458-ShowLinkToOnlineDocsInExtensionManager.rst
new file mode 100644 (file)
index 0000000..0a383c5
--- /dev/null
@@ -0,0 +1,22 @@
+.. include:: ../../Includes.txt
+
+===============================================================
+Feature: #89458 - Show link to online docs in extension manager
+===============================================================
+
+See :issue:`89458`
+
+Description
+===========
+
+The export of extensions provided by https://extensions.typo3.org has been extended with the link
+to the documentation of an extension. This link is now shown in the list of extension as well as the detail view
+of extensions in the extension manager.
+
+
+Impact
+======
+
+Extension authors can add a custom link to the manual in their TER extensions which is now shown in the TYPO3 backend.
+
+.. index:: Backend, ext:extensionmanager
index 7dca11f..6987751 100644 (file)
@@ -153,6 +153,11 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
     protected $dependencies;
 
     /**
+     * @var string
+     */
+    protected $documentationLink = '';
+
+    /**
      * @internal
      * @var int
      */
@@ -599,4 +604,20 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
     {
         return $this->alldownloadcounter;
     }
+
+    /**
+     * @return string
+     */
+    public function getDocumentationLink(): string
+    {
+        return $this->documentationLink;
+    }
+
+    /**
+     * @param string $documentationLink
+     */
+    public function setDocumentationLink(string $documentationLink): void
+    {
+        $this->documentationLink = $documentationLink;
+    }
 }
index 96ecb14..14429ae 100644 (file)
@@ -71,7 +71,8 @@ class ExtensionListUtility implements \SplObserver
         'category',
         'description',
         'serialized_dependencies',
-        'update_comment'
+        'update_comment',
+        'documentation_link'
     ];
 
     /**
@@ -251,7 +252,8 @@ class ExtensionListUtility implements \SplObserver
             $this->extensionModel->getCategoryIndexFromStringOrNumber($subject->getCategory() ?: ''),
             $subject->getDescription() ?: '',
             $subject->getDependencies() ?: '',
-            $subject->getUploadcomment() ?: ''
+            $subject->getUploadcomment() ?: '',
+            $subject->getDocumentationLink() ?: '',
         ];
         ++$this->sumRecords;
     }
index e376131..08284c1 100644 (file)
@@ -140,6 +140,13 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
     protected $versionDownloadCounter;
 
     /**
+     * Link to the documentation
+     *
+     * @var string
+     */
+    protected $documentationLink;
+
+    /**
      * Returns an associative array of all extension version properties.
      *
      * Valid array keys of returned array are:
@@ -169,6 +176,7 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
         $versionProperties['authorcompany'] = $this->authorcompany;
         $versionProperties['ownerusername'] = $this->ownerusername;
         $versionProperties['t3xfilemd5'] = $this->t3xfilemd5;
+        $versionProperties['documentationlink'] = $this->documentationLink;
         return $versionProperties;
     }
 
@@ -360,6 +368,14 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
     }
 
     /**
+     * @return string
+     */
+    public function getDocumentationLink()
+    {
+        return $this->documentationLink;
+    }
+
+    /**
      * Method resets version class properties.
      *
      * @param bool $resetAll If TRUE, additionally extension properties are reset
@@ -369,7 +385,7 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser
         // resetting at least class property "version" is mandatory
         // as we need to do some magic in regards to
         // an extension's and version's child node "downloadcounter"
-        $this->version = $this->title = $this->versionDownloadCounter = $this->description = $this->state = $this->reviewstate = $this->category = $this->lastuploaddate = $this->uploadcomment = $this->dependencies = $this->authorname = $this->authoremail = $this->authorcompany = $this->ownerusername = $this->t3xfilemd5 = null;
+        $this->version = $this->title = $this->versionDownloadCounter = $this->description = $this->state = $this->reviewstate = $this->category = $this->lastuploaddate = $this->uploadcomment = $this->dependencies = $this->authorname = $this->authoremail = $this->authorcompany = $this->ownerusername = $this->t3xfilemd5 = $this->documentationLink = null;
         if ($resetAll) {
             $this->extensionKey = $this->extensionDownloadCounter = null;
         }
index 7a4a4a3..0d56611 100644 (file)
@@ -133,6 +133,9 @@ class ExtensionXmlPullParser extends AbstractExtensionXmlParser
             case 't3xfilemd5':
                 $this->t3xfilemd5 = $this->getElementValue($elementName);
                 break;
+            case 'documentation_link':
+                $this->documentationLink = $this->getElementValue($elementName);
+                break;
         }
     }
 
index cb96fa5..f7b1f56 100644 (file)
@@ -168,6 +168,9 @@ class ExtensionXmlPushParser extends AbstractExtensionXmlParser
             case 't3xfilemd5':
                 $this->t3xfilemd5 = $this->elementData;
                 break;
+            case 'documentation_link':
+                $this->documentationLink = $this->elementData;
+                break;
         }
     }
 
index df26160..e29d5cf 100644 (file)
@@ -12,7 +12,7 @@ return [
         ]
     ],
     'interface' => [
-        'showRecordFieldList' => 'extension_key,version,integer_version,title,description,state,category,last_updated,update_comment,author_name,author_email,md5hash,serialized_dependencies'
+        'showRecordFieldList' => 'extension_key,version,integer_version,title,description,state,category,last_updated,update_comment,author_name,author_email,md5hash,serialized_dependencies,documentation_link'
     ],
     'columns' => [
         'extension_key' => [
@@ -132,9 +132,15 @@ return [
                 'size' => 30,
             ],
         ],
+        'documentation_link' => [
+            'label' => 'LLL:EXT:extensionmanager/Resources/Private/Language/locallang_db.xlf:tx_extensionmanager_domain_model_extension.documentation_link',
+            'config' => [
+                'type' => 'input',
+            ],
+        ],
     ],
     'types' => [
-        '0' => ['showitem' => 'extensionkey, version, integer_version, title, description, state, category, last_updated, update_comment, author_name, author_email, review_state, md5hash, serialized_dependencies']
+        '0' => ['showitem' => 'extensionkey, version, integer_version, title, description, state, category, last_updated, update_comment, author_name, author_email, review_state, md5hash, serialized_dependencies, documentation_link']
     ],
     'palettes' => [
         '1' => ['showitem' => '']
index e9e64e9..ff936c4 100644 (file)
                        <trans-unit id="extensionList.header.author" resname="extensionList.header.author">
                                <source>Author</source>
                        </trans-unit>
+                       <trans-unit id="extensionList.header.manual" resname="extensionList.header.manual">
+                               <source>Manual</source>
+                       </trans-unit>
                        <trans-unit id="searchTemplate.searchExtensions" resname="searchTemplate.searchExtensions">
                                <source>Search extensions</source>
                        </trans-unit>
index ec68a31..def32ee 100644 (file)
     </div>
 </td>
 <td>
+    <f:if condition="{extension.documentationLink}">
+        <a href="{extension.documentationLink}" class="btn btn-default" target="_blank" rel="noreferrer" title="{f:translate(key: 'extensionList.showAllVersions.readOnline')}">
+            <core:icon identifier="actions-system-extension-documentation" size="small" />
+        </a>
+    </f:if>
+</td>
+<td>
     <span class="label label-{extension.stateString}">{extension.stateString}</span>
 </td>
index 3a9ec76..7f652cb 100644 (file)
@@ -7,6 +7,7 @@
         <th><f:translate key="extensionList.header.version"/></th>
         <th><f:translate key="extensionList.header.lastUpdate"/></th>
         <th><f:translate key="extensionList.header.description"/></th>
+        <th><f:translate key="extensionList.header.manual"/></th>
         <th><f:translate key="extensionList.header.extensionState"/></th>
     </tr>
 </thead>
index f25eec7..aaebad9 100644 (file)
@@ -47,7 +47,7 @@
             <tr class="ter-ext-single-info-manual">
                 <th><f:translate key="extensionList.showAllVersions.manual" /></th>
                 <td>
-                    <a href="https://docs.typo3.org/typo3cms/extensions/{currentVersion.extensionKey}/" target="_blank" rel="noopener noreferrer">
+                    <a href="{f:if(condition:currentVersion.documentationLink,then:currentVersion.documentationLink,else:'https://docs.typo3.org/typo3cms/extensions/{currentVersion.extensionKey}/')}" target="_blank" rel="noopener noreferrer">
                         <f:translate key="extensionList.showAllVersions.readOnline" />
                     </a>
                 </td>
index 295145e..d03cf56 100644 (file)
@@ -35,6 +35,7 @@ CREATE TABLE tx_extensionmanager_domain_model_extension (
   integer_version int(11) NOT NULL default '0',
   current_version int(3) NOT NULL default '0',
   lastreviewedversion int(3) NOT NULL default '0',
+  documentation_link varchar(2048),
 
   KEY index_extrepo (extension_key,repository),
   KEY index_versionrepo (integer_version,repository,extension_key),