[TASK] Set a flash msg if no subpages available
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 21 Sep 2012 21:01:17 +0000 (23:01 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Sat, 22 Sep 2012 17:11:01 +0000 (19:11 +0200)
Set a flash message in wizard_sortpages if no
subpages are available, instead of rendering an
empty table header

Change-Id: Ic4c01a64436230f261cb37f7e98f885a8db4c8fa
Resolves: #41216
Releases: 6.0
Reviewed-on: http://review.typo3.org/14884
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
typo3/sysext/wizard_sortpages/Classes/View/SortPagesWizardModuleFunction.php
typo3/sysext/wizard_sortpages/locallang.xlf

index 8cd54b8..26136ad 100644 (file)
@@ -84,26 +84,27 @@ class SortPagesWizardModuleFunction extends \TYPO3\CMS\Backend\Module\AbstractFu
                                }
                        }
                        $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
-                       $lines = array();
-                       $lines[] = '<tr class="t3-row-header">
+
+                       if (count($menuItems)) {
+                               $lines = array();
+                               $lines[] = '<tr class="t3-row-header">
                                <td>' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'), 'title') . '</td>
                                ' . (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms') ? '<td> ' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'), 'subtitle') . '</td>' : '') . '
                                <td>' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'), 'tstamp') . '</td>
                                <td>' . $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'), 'crdate') . '</td>
                                </tr>';
-                       foreach ($menuItems as $rec) {
-                               $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2);
-                               // edit permissions for that page!
-                               $pRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $rec['uid'], 'uid', ' AND ' . $m_perms_clause);
-                               $lines[] = '<tr><td nowrap="nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec) . (!is_array($pRec) ? $GLOBALS['TBE_TEMPLATE']->rfw('<strong>' . $LANG->getLL('wiz_W', 1) . '</strong> ') : '') . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '&nbsp;</td>
+                               foreach ($menuItems as $rec) {
+                                       $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2);
+                                       // edit permissions for that page!
+                                       $pRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $rec['uid'], 'uid', ' AND ' . $m_perms_clause);
+                                       $lines[] = '<tr><td nowrap="nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec) . (!is_array($pRec) ? $GLOBALS['TBE_TEMPLATE']->rfw('<strong>' . $LANG->getLL('wiz_W', 1) . '</strong> ') : '') . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '&nbsp;</td>
                                        ' . (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms') ? '<td nowrap="nowrap">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($rec['subtitle'], $GLOBALS['BE_USER']->uc['titleLen'])) . '&nbsp;</td>' : '') . '
                                        <td nowrap="nowrap">' . \t3lib_Befunc::datetime($rec['tstamp']) . '&nbsp;&nbsp;</td>
                                        <td nowrap="nowrap">' . \t3lib_Befunc::datetime($rec['crdate']) . '&nbsp;&nbsp;</td>
                                        </tr>';
-                       }
-                       $theCode .= '<h4>' . $LANG->getLL('wiz_currentPageOrder', TRUE) . '</h4>
+                               }
+                               $theCode .= '<h4>' . $LANG->getLL('wiz_currentPageOrder', TRUE) . '</h4>
                        <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">' . implode('', $lines) . '</table><br />';
-                       if (count($menuItems)) {
                                // Menu:
                                $lines = array();
                                $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'), 'title');
@@ -115,6 +116,9 @@ class SortPagesWizardModuleFunction extends \TYPO3\CMS\Backend\Module\AbstractFu
                                $lines[] = '';
                                $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_REVERSE'), 'REV');
                                $theCode .= '<h4>' . $LANG->getLL('wiz_changeOrder') . '</h4>' . implode('<br />', $lines);
+                       } else {
+                               $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('no_subpages'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
+                               $theCode .= $flashMessage->render();
                        }
                        // CSH:
                        $theCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_web_func', 'tx_wizardsortpages', $GLOBALS['BACK_PATH'], '<br />|');
index 560b7ef..e21aa6f 100644 (file)
@@ -33,6 +33,9 @@
                        <trans-unit id="wiz_changeOrder_msg1" xml:space="preserve">
                                <source>You're about to change the order of the above pages. Are you sure you want to continue?</source>
                        </trans-unit>
+                       <trans-unit id="no_subpages" xml:space="preserve">
+                               <source>Please select a page with subpages.</source>
+                       </trans-unit>
                </body>
        </file>
-</xliff>
+</xliff>
\ No newline at end of file