[TASK] Show unassigned sites in site module 92/58192/2
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 5 Sep 2018 17:52:49 +0000 (19:52 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 7 Sep 2018 15:53:49 +0000 (17:53 +0200)
The site module displays now also sites with no valid related page anymore.
This can happen if the page is being removed.

Resolves: #86150
Releases: master
Change-Id: If75a33e6c2d189abd42746b52d0b828b7a7b38cb
Reviewed-on: https://review.typo3.org/58192
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Riny van Tiggelen <info@online-gamer.nl>
Reviewed-by: Timo Hund <timo.hund@yahoo.com>
Tested-by: Timo Hund <timo.hund@yahoo.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php
typo3/sysext/backend/Resources/Private/Language/locallang_siteconfiguration.xlf
typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.html

index d7330f0..1d5faf5 100644 (file)
@@ -105,14 +105,20 @@ class SiteConfigurationController
         $this->configureOverViewDocHeader();
         $allSites = $this->siteFinder->getAllSites();
         $pages = $this->getAllSitePages();
+        $unassignedSites = [];
         foreach ($allSites as $identifier => $site) {
             $rootPageId = $site->getRootPageId();
             if (isset($pages[$rootPageId])) {
                 $pages[$rootPageId]['siteIdentifier'] = $identifier;
                 $pages[$rootPageId]['siteConfiguration'] = $site;
+            } else {
+                $unassignedSites[] = $site;
             }
         }
-        $this->view->assign('pages', $pages);
+        $this->view->assignMultiple([
+            'pages' => $pages,
+            'unassignedSites' => $unassignedSites
+        ]);
     }
 
     /**
index 6e1a23a..7314ed2 100644 (file)
                        <trans-unit id="overview.baseUrl">
                                <source>Base URLs</source>
                        </trans-unit>
+                       <trans-unit id="overview.unassignedSites.title">
+                               <source>Unassigned site configurations</source>
+                       </trans-unit>
+                       <trans-unit id="overview.unassignedSites.description">
+                               <source>The following sites don't belong to any page anymore and can be removed.</source>
+                       </trans-unit>
                        <trans-unit id="validation.identifierRenamed.title">
                                <source>Renamed identifier</source>
                        </trans-unit>
index 6f3ec94..e313e61 100644 (file)
@@ -85,7 +85,7 @@
                                                                </table>
                                                        </f:if>
                                                </td>
-                                               <td>
+                                               <td class="col-control nowrap">
                                                        <div class="btn-group">
                                                                <f:if condition="{page.siteIdentifier}">
                                                                        <f:be.link route="site_configuration" parameters="{action: 'edit', site: page.siteIdentifier}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:edit')}" class="btn btn-default">
                </f:be.infobox>
        </f:else>
 </f:if>
+
+<f:if condition="{unassignedSites}">
+       <h3>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration.xlf:overview.unassignedSites.title')}</h3>
+       <p>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration.xlf:overview.unassignedSites.description')}</p>
+
+       <table class="table table-striped table-hover table-condensed">
+               <thead>
+               <tr>
+                       <th><f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration.xlf:overview.configuration" /></th>
+                       <th>&nbsp;</th>
+               </tr>
+               </thead>
+               <tbody>
+               <f:for each="{unassignedSites}" as="unassignedSite">
+                       <tr>
+                               <td>    <code>{unassignedSite.identifier}</code></td>
+                               <td class="col-control nowrap">
+                                       <div class="btn-group">
+                                                       <f:be.link
+                                                               route="site_configuration"
+                                                               parameters="{action: 'delete', site:unassignedSite.identifier}"
+                                                               class="btn btn-default t3js-modal-trigger"
+                                                               title="{f:translate(key:'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration.xlf:overview.deleteSiteConfiguration')}"
+                                                               data="{
+                                                                                       severity: 'error',
+                                                                                       title: '{f:translate(key:\'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration.xlf:overview.deleteSiteConfiguration\')}',
+                                                                                       button-ok-text: '{f:translate(key:\'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete\')}'
+                                                                               }"
+                                                       >
+                                                               <core:icon identifier="actions-delete" />
+                                                       </f:be.link>
+                                       </div>
+                               </td>
+                       </tr>
+               </f:for>
+               </tbody>
+       </table>
+</f:if>
 </html>