git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4899 709f56b5-9817-0410-a4d7...
authorKasper Skårhøj <kasper@typo3.org>
Sat, 31 Jan 2009 13:21:08 +0000 (13:21 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Sat, 31 Jan 2009 13:21:08 +0000 (13:21 +0000)
ChangeLog
t3lib/class.t3lib_befunc.php

index deb7412..05840dc 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-31     Kasper Sk\8crh¿j  <kasper@typo3.org>
+
+       * Added feature options.view.languageOrder which allows to specify which language parameter (&L=xx) is added to the view links of the backend for a user        
+       
 2009-01-30  Benjamin Mack  <benni@typo3.org>
 
        * Fixed bug #7123: Select wizard doesn't work in Safari (Thanks to Ismaël Bidau)
index bb3b81c..d1bd194 100755 (executable)
@@ -2544,7 +2544,36 @@ final class t3lib_BEfunc {
                                }
                        }
                        $preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
-
+                       
+                               // Look if a fixed preview language should be added:
+                       $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']));
+                               }
+                       
+                                       // 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.
+                                                       $suffix = '&L='.$langUid;
+                                                       break;
+                                               }
+                                       } else {        // All allowed since no lang. are listed.
+                                               $suffix = '&L='.$langUid;
+                                               break;
+                                       }
+                               }
+                       
+                                       // Add it:
+                               $addGetVars.= $suffix;
+                       }
+                       
                        $urlPreviewEnabled  = $preUrl . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
                        $urlPreviewDisabled = $preUrl . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
                }