Bug #23887 ยป patch_16188.diff
t3lib/class.t3lib_befunc.php (working copy) | ||
---|---|---|
* @return string
|
||
*/
|
||
public static function viewOnClick($id, $backPath = '', $rootLine = '', $anchor = '', $altUrl = '', $addGetVars = '', $switchFocus = TRUE) {
|
||
$viewScriptPreviewDisabled = '/' . TYPO3_mainDir . 'mod/user/ws/wsol_preview.php?id=';
|
||
$viewScriptPreviewEnabled = '/index.php?id=';
|
||
if ($altUrl) {
|
||
$viewScriptPreviewEnabled = $viewScriptPreviewDisabled = $altUrl;
|
||
}
|
||
$urlPreviewEnabled = $urlPreviewDisabled = $altUrl;
|
||
} else {
|
||
// Look if a fixed preview language should be added:
|
||
$viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
|
||
if (strlen($viewLanguageOrder)) {
|
||
$suffix = '';
|
||
$viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
|
||
if (strlen($viewLanguageOrder)) {
|
||
$suffix = '';
|
||
// Find allowed languages (if none, all are allowed!)
|
||
if (!$GLOBALS['BE_USER']->user['admin'] &&
|
||
strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
|
||
$allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
|
||
}
|
||
if (!$GLOBALS['BE_USER']->user['admin'] &&
|
||
strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
|
||
$allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
|
||
}
|
||
// Traverse the view order, match first occurence:
|
||
$lOrder = t3lib_div::intExplode(',', $viewLanguageOrder);
|
||
foreach($lOrder as $langUid) {
|
||
if (is_array($allowed_languages) && count($allowed_languages)) {
|
||
if (isset($allowed_languages[$langUid])) { // Choose if set.
|
||
$lOrder = t3lib_div::intExplode(',', $viewLanguageOrder);
|
||
foreach($lOrder as $langUid) {
|
||
if (is_array($allowed_languages) && count($allowed_languages)) {
|
||
if (isset($allowed_languages[$langUid])) { // Choose if set.
|
||
$suffix = '&L=' . $langUid;
|
||
break;
|
||
}
|
||
} else { // All allowed since no lang. are listed.
|
||
$suffix = '&L=' . $langUid;
|
||
break;
|
||
}
|
||
} else { // All allowed since no lang. are listed.
|
||
$suffix = '&L=' . $langUid;
|
||
break;
|
||
}
|
||
}
|
||
// Add it:
|
||
$addGetVars .= $suffix;
|
||
}
|
||
$addGetVars .= $suffix;
|
||
}
|
||
// check if we need to preview a mount point
|
||
$sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
|
||
$sys_page->init(FALSE);
|
||
$mountPointInfo = $sys_page->getMountPointInfo($id);
|
||
if ($mountPointInfo && $mountPointInfo['overlay']) {
|
||
$id = $mountPointInfo['mount_pid'];
|
||
$addGetVars .= '&MP=' . $mountPointInfo['MPvar'];
|
||
$sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
|
||
$sys_page->init(FALSE);
|
||
$mountPointInfo = $sys_page->getMountPointInfo($id);
|
||
if ($mountPointInfo && $mountPointInfo['overlay']) {
|
||
$id = $mountPointInfo['mount_pid'];
|
||
$addGetVars .= '&MP=' . $mountPointInfo['MPvar'];
|
||
}
|
||
$viewDomain = self::getViewDomain($id, $rootLine);
|
||
$urlPreviewEnabled = $viewDomain . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
|
||
$urlPreviewDisabled = $viewDomain . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
|
||
}
|
||
$viewDomain = self::getViewDomain($id, $rootLine);
|
||
$urlPreviewEnabled = $viewDomain . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
|
||
$urlPreviewDisabled = $viewDomain . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
|
||
return "var previewWin=window.open((top.TYPO3.configuration.inWorkspace === 0 || (top.TYPO3.configuration.inWorkspace !== 0 && top.TYPO3.configuration.workspaceFrontendPreviewEnabled)) ?'" .
|
||
$urlPreviewEnabled . "':'" . $urlPreviewDisabled .
|
||
"','newTYPO3frontendWindow');" . ( $switchFocus ? 'previewWin.focus();' : '');
|