[TASK] EM: Split Distributions in official and community-based packages 40/28640/4
authorBenjamin Mack <benni@typo3.org>
Sat, 22 Mar 2014 13:31:02 +0000 (14:31 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 22 Mar 2014 16:15:12 +0000 (17:15 +0100)
The output of the distributions should be handled for the introduction
package and all other packages.

As there is no distinction between official (published by the Core Team)
and community-based distributions, the check is done via the username
for now, but could be easily modified in one place.

Releases: 6.2
Resolves: #57181
Change-Id: I8f2584532dda4738c66bd27e69743bcff91bc422
Reviewed-on: https://review.typo3.org/28640
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Controller/ListController.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Partials/List/Distribution.html [new file with mode: 0644]
typo3/sysext/extensionmanager/Resources/Private/Templates/List/Distributions.html

index 5996b50..08c395e 100644 (file)
@@ -104,8 +104,11 @@ class ListController extends \TYPO3\CMS\Extensionmanager\Controller\AbstractCont
                        $repositoryHelper->updateExtList();
                }
 
-               $distributions = $this->extensionRepository->findAllDistributions();
-               $this->view->assign('distributions', $distributions);
+               $officialDistributions = $this->extensionRepository->findAllOfficialDistributions();
+               $this->view->assign('officialDistributions', $officialDistributions);
+
+               $communityDistributions = $this->extensionRepository->findAllCommunityDistributions();
+               $this->view->assign('communityDistributions', $communityDistributions);
        }
 
        /**
index ad4a506..9f181e9 100644 (file)
@@ -199,18 +199,46 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
        }
 
        /**
-        * Finds all extensions with category "distribution"
+        * Finds all extensions with category "distribution" not published by the TYPO3 CMS Team
         *
         * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
         */
-       public function findAllDistributions() {
+       public function findAllCommunityDistributions() {
                $query = $this->createQuery();
                $query->matching(
                        $query->logicalAnd(
                                $query->equals('category', \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::DISTRIBUTION_CATEGORY),
-                               $query->equals('currentVersion', 1)
+                               $query->equals('currentVersion', 1),
+                               $query->logicalNot($query->equals('ownerusername', 'typo3v4'))
+                       )
+               );
+
+               $query->setOrderings(array(
+                       'alldownloadcounter' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
+               ));
+
+               return $query->execute();
+       }
+
+       /**
+        * Finds all extensions with category "distribution" that are published by the TYPO3 CMS Team
+        *
+        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
+        */
+       public function findAllOfficialDistributions() {
+               $query = $this->createQuery();
+               $query->matching(
+                       $query->logicalAnd(
+                               $query->equals('category', \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::DISTRIBUTION_CATEGORY),
+                               $query->equals('currentVersion', 1),
+                               $query->equals('ownerusername', 'typo3v4')
                        )
                );
+
+               $query->setOrderings(array(
+                       'alldownloadcounter' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
+               ));
+
                return $query->execute();
        }
 
index f37c137..7668db5 100644 (file)
                                <source>Read online</source>
                        </trans-unit>
                        <trans-unit id="extensionList.distribution.key" xml:space="preserve">
-                               <source>Distribution-Key:</source>
+                               <source>Distribution Key:</source>
                        </trans-unit>
                        <trans-unit id="distributions" xml:space="preserve">
                                <source>Get preconfigured distribution</source>
diff --git a/typo3/sysext/extensionmanager/Resources/Private/Partials/List/Distribution.html b/typo3/sysext/extensionmanager/Resources/Private/Partials/List/Distribution.html
new file mode 100644 (file)
index 0000000..167cb65
--- /dev/null
@@ -0,0 +1,21 @@
+{namespace em=TYPO3\CMS\Extensionmanager\ViewHelpers}
+<div class="distribution">
+       <div class="distributionInner">
+               <div class="distributionName"><h2>{distribution.title}</h2></div>
+               <div class="distributionImage">
+                       <em:image
+                               src="EXT:{distribution.extensionKey}/Resources/Public/Images/Distribution.png" alt="{distribution.title}"
+                               fallbackImage="EXT:extensionmanager/Resources/Public/Images/Distribution.png"
+                               height="150px"
+                               width="220px"
+                               />
+               </div>
+               <div class="distributionKey"><strong><f:translate key="extensionList.distribution.key" /> </strong>{distribution.extensionKey}</div>
+               <div class="distributionDescription expandable">{distribution.description} </div>
+               <div class="distributionInstall">
+                       <f:link.action action="installDistribution" controller="Download" arguments="{extension:distribution}">
+                               <f:translate key="extensionList.installDistribution">Install Distribution</f:translate>
+                       </f:link.action>
+               </div>
+       </div>
+</div>
\ No newline at end of file
index 1a53095..b922419 100644 (file)
 
 <f:section name="Content">
        <f:flashMessages renderMode="div" />
-       <f:for each="{distributions}" as="distribution">
-               <div class="distribution">
-                       <div class="distributionInner">
-                               <div class="distributionName"><h2>{distribution.title}</h2></div>
-                               <div class="distributionImage">
-                                       <em:image
-                                               src="EXT:{distribution.extensionKey}/Resources/Public/Images/Distribution.png" alt="{distribution.title}"
-                                               fallbackImage="EXT:extensionmanager/Resources/Public/Images/Distribution.png"
-                                               height="150px"
-                                               width="220px"
-                                       />
-                               </div>
-                               <div class="distributionKey"><strong><f:translate key="extensionList.distribution.key" /> </strong>{distribution.extensionKey}</div>
-                               <div class="distributionDescription expandable">{distribution.description} </div>
-                               <div class="distributionInstall">
-                                       <f:link.action action="installDistribution" controller="Download" arguments="{extension:distribution}">
-                                               <f:translate key="extensionList.installDistribution">Install Distribution</f:translate>
-                                       </f:link.action>
-                               </div>
-                       </div>
-               </div>
+       <f:for each="{officialDistributions}" as="distribution">
+               <f:render partial="List/Distribution" arguments="{distribution: distribution}" />
+       </f:for>
+       <hr />
+       <f:for each="{communityDistributions}" as="distribution">
+               <f:render partial="List/Distribution" arguments="{distribution: distribution}" />
        </f:for>
 </f:section>
\ No newline at end of file