[TASK] Page module edit icon for language overlay 99/13599/8
authorFelix Kopp <felix-source@phorax.com>
Mon, 20 May 2013 14:41:11 +0000 (16:41 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 22 Jun 2013 12:20:44 +0000 (14:20 +0200)
Page modules brings multiple views to work with multi-language
content: columns / language / quick. In columns mode a single
translation can be fixated by "language" drop down.

Adds ability to edit language overlay record in column view
with only one language.

Change-Id: I04594461cad4c8e4a0a296111c1a4c40e3263b4c
Resolves: #39107
Releases: 6.2
Reviewed-on: https://review.typo3.org/13599
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Resources/Private/Templates/db_layout.html
typo3/sysext/cms/layout/locallang.xlf

index aabe744..59c4d7a 100644 (file)
@@ -581,7 +581,8 @@ class PageLayoutController {
                                'closedok' => '',
                                'deletedok' => '',
                                'undo' => '',
-                               'history_record' => ''
+                               'history_record' => '',
+                               'edit_language' => ''
                        );
                        $markers = array(
                                'CSH' => BackendUtility::cshItem($this->descrTable, '', $GLOBALS['BACK_PATH'], '', TRUE),
@@ -1004,6 +1005,7 @@ class PageLayoutController {
                        'move_record' => '',
                        'new_page' => '',
                        'edit_page' => '',
+                       'edit_language' => '',
                        'csh' => '',
                        'shortcut' => '',
                        'cache' => '',
@@ -1030,11 +1032,46 @@ class PageLayoutController {
                        if (MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
                                $buttons['move_record'] = '<a href="' . htmlspecialchars(($GLOBALS['BACK_PATH'] . 'move_el.php?table=' . $this->eRParts[0] . '&uid=' . $this->eRParts[1] . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')))) . '">' . IconUtility::getSpriteIcon(('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move'), array('class' => 'c-inputButton', 'title' => $GLOBALS['LANG']->getLL(('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page')), 1))) . '</a>';
                        }
-                       // Edit page properties
+
+                       // Edit page properties and page language overlay icons
                        if ($this->CALC_PERMS & 2) {
-                               $params = '&edit[pages][' . $this->id . ']=edit';
-                               $buttons['edit_page'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $GLOBALS['LANG']->getLL('editPageProperties', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
+
+                               // Edit localized page_language_overlay only when one specific language is selected
+                               if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) {
+                                       $overlayRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                                               'uid',
+                                               'pages_language_overlay',
+                                               'pid = ' . intval($this->id) . ' ' .
+                                               'AND sys_language_uid = ' . intval($this->current_sys_language) .
+                                               \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages_language_overlay') .
+                                               \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('pages_language_overlay'),
+                                               '',
+                                               '',
+                                               '',
+                                               'sys_language_uid'
+                                       );
+
+                                       $editLanguageOnClick = htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick(
+                                               '&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit',
+                                               $GLOBALS['BACK_PATH'])
+                                       );
+                                       $buttons['edit_language'] = '<a href="#" ' .
+                                               'onclick="' . $editLanguageOnClick . '"' .
+                                               'title="' . $GLOBALS['LANG']->getLL('editPageLanguageOverlayProperties', TRUE) . '">' .
+                                               \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay') .
+                                               '</a>';
+                               }
+
+
+                               // Edit page properties
+                               $editPageOnClick = htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit', $GLOBALS['BACK_PATH']));
+                               $buttons['edit_page'] = '<a href="#" ' .
+                                       'onclick="' . $editPageOnClick . '"' .
+                                       'title="' . $GLOBALS['LANG']->getLL('editPageProperties', TRUE) . '">' .
+                                       \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-open') .
+                                       '</a>';
                        }
+
                        // Add CSH (Context Sensitive Help) icon to tool bar
                        if ($function == 'quickEdit') {
                                $buttons['csh'] = BackendUtility::cshItem($this->descrTable, 'quickEdit', $GLOBALS['BACK_PATH'], '', TRUE, 'margin-top: 0px; margin-bottom: 0px;');
index b92b52c..2658425 100644 (file)
@@ -27,7 +27,7 @@
 
 <!-- ###BUTTON_GROUPS_LEFT### -->
 <!-- ###BUTTON_GROUP1### -->###NEW_PAGE######NEW_CONTENT###<!-- ###BUTTON_GROUP1### -->
-<!-- ###BUTTON_GROUP2### -->###VIEW######EDIT_PAGE######MOVE_PAGE######HISTORY_PAGE###<!-- ###BUTTON_GROUP2### -->
+<!-- ###BUTTON_GROUP2### -->###VIEW######EDIT_PAGE######EDIT_LANGUAGE######MOVE_PAGE######HISTORY_PAGE###<!-- ###BUTTON_GROUP2### -->
 <!-- ###BUTTON_GROUPS_LEFT### -->
 
 <!-- ###BUTTON_GROUPS_RIGHT### -->
index 56d1ffc..f0ecd24 100644 (file)
                        <trans-unit id="editPageProperties" xml:space="preserve">
                                <source>Edit page properties</source>
                        </trans-unit>
+                       <trans-unit id="editPageLanguageOverlayProperties" xml:space="preserve">
+                               <source>Edit page language overlay properties</source>
+                       </trans-unit>
                        <trans-unit id="newRecordGeneral" xml:space="preserve">
                                <source>Create new record</source>
                        </trans-unit>