/** * Renders the HTML code for a selectorbox for selecting the language version of the current * page. * * @return mixed HTML code for the selectorbox or FALSE if no language is available. * @access protected */ function sidebar_renderItem_renderLanguageSelectorbox() { global $LANG, $BE_USER, $BACK_PATH; $availableLanguagesArr = $this->pObj->translatedLanguagesArr; $newLanguagesArr = $this->pObj->getAvailableLanguages(0, true, false); if (count($availableLanguagesArr) <= 1) { return FALSE; } $optionsArr = array(); foreach ($availableLanguagesArr as $languageArr) { unset($newLanguagesArr[$languageArr['uid']]); // Remove this language from possible new translation languages array (PNTLA ;-) if ($languageArr['uid'] <= 0 || $BE_USER->checkLanguageAccess($languageArr['uid'])) { $grayedOut = $languageArr['PLO_hidden'] ? ' style="Filter: alpha(opacity=25); -moz-opacity: 0.25; opacity: 0.25"' : ''; $flag = tx_templavoila_icons::getFlagIconFileForLanguage($languageArr['flagIcon']); $style = isset($languageArr['flagIcon']) ? 'background-image: url(' . $flag . '); background-repeat: no-repeat; padding-left: 22px;' : ''; $optionsArr[] = '<option style="' . $style . '" value="' . $languageArr['uid'] . '"' . ($this->pObj->MOD_SETTINGS['language'] == $languageArr['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($languageArr['title']) . '</option>'; // Link to editing of language header: $availableTranslationsFlags .= '<a href="index.php?' . htmlspecialchars($this->pObj->link_getParameters() . '&editPageLanguageOverlay=' . $languageArr['uid']) . '">' . '<span ' . $grayedOut . '>' . tx_templavoila_icons::getFlagIconForLanguage($languageArr['flagIcon'], array('title' => $languageArr['title'], 'alt' => $languageArr['title'])) . '</span></a>'; } } $link = '\'index.php?' . $this->pObj->link_getParameters() . '&SET[language]=\'+this.options[this.selectedIndex].value'; $output .= ' <tr class="bgColor4"> <td width="20"> ' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'selectlanguageversion', $this->doc->backPath) . ' </td><td width="200" style="vertical-align:middle;"> ' . $LANG->getLL('selectlanguageversion', 1) . ': </td> <td style="vertical-align:middle;"><select onchange="document.location=' . htmlspecialchars($link) . '">' . implode('', $optionsArr) . '</select></td> </tr> '; if ($this->pObj->currentLanguageUid >= 0 && ($this->pObj->rootElementLangMode === 'disable' || $this->pObj->rootElementLangParadigm === 'bound')) { $options = array(); $options[] = t3lib_div::inList($this->pObj->modTSconfig['properties']['disableDisplayMode'], 'default') ? '' : '<option value=""' . ($this->pObj->MOD_SETTINGS['langDisplayMode'] === '' ? ' selected="selected"' : '') . '>' . $LANG->sL('LLL:EXT:lang/locallang_general.xml:LGL.default_value') . '</option>'; $options[] = t3lib_div::inList($this->pObj->modTSconfig['properties']['disableDisplayMode'], 'selectedLanguage') ? '' : '<option value="selectedLanguage"' . ($this->pObj->MOD_SETTINGS['langDisplayMode'] === 'selectedLanguage' ? ' selected="selected"' : '') . '>' . $LANG->getLL('pageLocalizationDisplayMode_selectedLanguage') . '</option>'; $options[] = t3lib_div::inList($this->pObj->modTSconfig['properties']['disableDisplayMode'], 'onlyLocalized') ? '' : '<option value="onlyLocalized"' . ($this->pObj->MOD_SETTINGS['langDisplayMode'] === 'onlyLocalized' ? ' selected="selected"' : '') . '>' . $LANG->getLL('pageLocalizationDisplayMode_onlyLocalized') . '</option>'; $link = '\'index.php?' . $this->pObj->link_getParameters() . '&SET[langDisplayMode]=\'+this.options[this.selectedIndex].value'; if (count($options)) { $output .= ' <tr class="bgColor4"> <td width="20"> ' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'pagelocalizationdisplaymode', $this->doc->backPath) . ' </td><td width="200" style="vertical-align:middle;"> ' . $LANG->getLL('pageLocalizationDisplayMode', 1) . ': </td> <td style="vertical-align:middle;"> <select onchange="document.location=' . htmlspecialchars($link) . '"> ' . implode(chr(10), $options) . ' </select> </td> </tr> '; } } if ($this->pObj->rootElementLangMode !== 'disable') { $output .= ' <tr class="bgColor4"> <td width="20"> ' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'pagelocalizationmode', $this->doc->backPath) . ' </td><td width="200" style="vertical-align:middle;"> ' . $LANG->getLL('pageLocalizationMode', 1) . ': </td> <td style="vertical-align:middle;"><em>' . $LANG->getLL('pageLocalizationMode_' . $this->pObj->rootElementLangMode, 1) . ($this->pObj->rootElementLangParadigm != 'free' ? ' / ' . $LANG->getLL('pageLocalizationParadigm_' . $this->pObj->rootElementLangParadigm) : '') . '</em></td> </tr> '; } // enable/disable structure inheritance - see #7082 for details if ($BE_USER->isAdmin() && $this->pObj->rootElementLangMode == 'inheritance') { $link = '\'index.php?' . $this->pObj->link_getParameters() . '&SET[disablePageStructureInheritance]=' . ($this->pObj->MOD_SETTINGS['disablePageStructureInheritance'] == '1' ? '0' : '1') . '\''; $output .= ' <tr class="bgColor4"> <td width="20"> ' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'disablePageStructureInheritance', $this->doc->backPath) . ' </td><td width="200" style="vertical-align:middle;"> ' . $LANG->getLL('pageLocalizationMode_inheritance.disableInheritance', 1) . ': </td> <td style="vertical-align:middle;"> <input type="checkbox" onchange="document.location=' . $link . '" ' . ($this->pObj->MOD_SETTINGS['disablePageStructureInheritance'] == '1' ? ' checked="checked"' : '') . '/> </td> </tr> '; } $output .= ' <tr class="bgColor4"> <td width="20"> ' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'editlanguageversion', $this->doc->backPath) . ' </td><td width="200" style="vertical-align:middle;"> ' . $LANG->getLL('editlanguageversion', 1) . ': </td> <td style="vertical-align:middle;"> ' . $availableTranslationsFlags . ' </td> </tr> '; return $output; }
/** * Renders localized elements of a record * * @param array $contentTreeArr: Part of the contentTreeArr for the element * @param array $entries: Entries accumulated in this array (passed by reference) * @param integer $indentLevel: Indentation level * @return string HTML * @access protected * @see render_framework_singleSheet() */ function render_outline_localizations($contentTreeArr, &$entries, $indentLevel) { global $LANG, $BE_USER; if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) { // Traverse the available languages of the page (not default and [All]) foreach ($this->translatedLanguagesArr as $sys_language_uid => $sLInfo) { if ($sys_language_uid > 0 && $BE_USER->checkLanguageAccess($sys_language_uid)) { switch ((string) $contentTreeArr['localizationInfo'][$sys_language_uid]['mode']) { case 'exists': // Get localized record: $olrow = t3lib_BEfunc::getRecordWSOL('tt_content', $contentTreeArr['localizationInfo'][$sys_language_uid]['localization_uid']); // Put together the records icon including content sensitive menu link wrapped around it: $recordIcon_l10n = $this->getRecordStatHookValue('tt_content', $olrow['uid']) . t3lib_iconWorks::getSpriteIconForRecord('tt_content', $olrow); if (!$this->translatorMode) { $recordIcon_l10n = $this->doc->wrapClickMenuOnIcon($recordIcon_l10n, 'tt_content', $olrow['uid'], 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter'); } list($flagLink_begin, $flagLink_end) = explode('|*|', $this->link_edit('|*|', 'tt_content', $olrow['uid'], TRUE)); // Create entry for this element: $entries[] = array('indentLevel' => $indentLevel, 'icon' => $recordIcon_l10n, 'title' => t3lib_BEfunc::getRecordTitle('tt_content', $olrow), 'table' => 'tt_content', 'uid' => $olrow['uid'], 'flag' => $flagLink_begin . tx_templavoila_icons::getFlagIconForLanguage($sLInfo['flagIcon'], array('title' => $sLInfo['title'], 'alt' => $sLInfo['title'])) . $flagLink_end, 'isNewVersion' => $olrow['_ORIG_uid'] ? TRUE : FALSE); break; } } } } }
/** * Displays a list of local content elements on the page which were NOT used in the hierarchical structure of the page. * * @param $pObj: Reference to the parent object ($this) * @return string HTML output * @access protected */ function sidebar_renderNonUsedElements() { global $LANG, $TYPO3_DB, $BE_USER; $output = ''; $elementRows = array(); $usedUids = array_keys($this->pObj->global_tt_content_elementRegister); $usedUids[] = 0; $pid = $this->pObj->id; // If workspaces should evaluated non-used elements it must consider the id: For "element" and "branch" versions it should accept the incoming id, for "page" type versions it must be remapped (because content elements are then related to the id of the offline version) $res = $TYPO3_DB->exec_SELECTquery(t3lib_BEfunc::getCommonSelectFields('tt_content', '', array('uid', 'header', 'bodytext', 'sys_language_uid')), 'tt_content', 'pid=' . intval($pid) . ' ' . 'AND uid NOT IN (' . implode(',', $usedUids) . ') ' . 'AND ( t3ver_state NOT IN (1,3) OR (t3ver_wsid > 0 AND t3ver_wsid = ' . intval($GLOBALS['BE_USER']->workspace) . ') )' . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'uid'); $this->deleteUids = array(); // Used to collect all those tt_content uids with no references which can be deleted while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) { $elementPointerString = 'tt_content:' . $row['uid']; // Prepare the language icon: $languageLabel = htmlspecialchars($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['title']); if ($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon']) { $languageIcon = tx_templavoila_icons::getFlagIconForLanguage($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon'], array('title' => $languageLabel, 'alt' => $languageLabel)); } else { $languageIcon = $languageLabel && $row['sys_language_uid'] ? '[' . $languageLabel . ']' : ''; } // Prepare buttons: $cutButton = $this->element_getSelectButtons($elementPointerString, 'ref'); $recordIcon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row); $recordButton = $this->pObj->doc->wrapClickMenuOnIcon($recordIcon, 'tt_content', $row['uid'], 1, '&callingScriptId=' . rawurlencode($this->pObj->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete'); if ($GLOBALS['BE_USER']->workspace) { $wsRow = t3lib_BEfunc::getRecordWSOL('tt_content', $row['uid']); $isDeletedInWorkspace = $wsRow['t3ver_state'] == 2; } else { $isDeletedInWorkspace = FALSE; } if (!$isDeletedInWorkspace) { $elementRows[] = ' <tr id="' . $elementPointerString . '" class="tpm-nonused-element"> <td class="tpm-nonused-controls">' . $cutButton . $languageIcon . '</td> <td class="tpm-nonused-ref">' . $this->renderReferenceCount($row['uid']) . '</td> <td class="tpm-nonused-preview">' . $recordButton . htmlspecialchars(t3lib_BEfunc::getRecordTitle('tt_content', $row)) . '</td> </tr> '; } } if (count($elementRows)) { // Control for deleting all deleteable records: $deleteAll = ''; if (count($this->deleteUids)) { $params = ''; foreach ($this->deleteUids as $deleteUid) { $params .= '&cmd[tt_content][' . $deleteUid . '][delete]=1'; } $label = $LANG->getLL('rendernonusedelements_deleteall'); $deleteAll = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $this->doc->issueCommand($params, -1) . '\');') . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => htmlspecialchars($label))) . htmlspecialchars($label) . '</a>'; } // Create table and header cell: $output = ' <table class="tpm-nonused-elements lrPadding" border="0" cellpadding="0" cellspacing="1" width="100%"> <tr class="bgColor4-20"> <td colspan="3">' . $LANG->getLL('inititemno_elementsNotBeingUsed', '1') . ':</td> </tr> ' . implode('', $elementRows) . ' <tr class="bgColor4"> <td colspan="3" class="tpm-nonused-deleteall">' . $deleteAll . '</td> </tr> </table> '; } return $output; }