1
|
Index: Z:/svnworkspace/TYPO3_4-1/t3lib/class.t3lib_page.php
|
2
|
===================================================================
|
3
|
--- Z:/svnworkspace/TYPO3_4-1/t3lib/class.t3lib_page.php (revision 2438)
|
4
|
+++ Z:/svnworkspace/TYPO3_4-1/t3lib/class.t3lib_page.php (working copy)
|
5
|
@@ -239,7 +239,35 @@
|
6
|
}
|
7
|
return 0;
|
8
|
}
|
9
|
-
|
10
|
+ /**
|
11
|
+ * function that checks which page record overlay language should be used, according to the given fallbackorder
|
12
|
+ *
|
13
|
+ * @param integer pid which is checked for translations
|
14
|
+ * @param string comma seperated list of language uids (integer). the languageUid to whith the fallback order
|
15
|
+ * @return integer id of the first found languageuid in the fallbackorder where a translation for $pid exists.
|
16
|
+ **/
|
17
|
+ function getLanguageOverlayUidForPage($page_id,$fallBackOrder) {
|
18
|
+ $lUids = t3lib_div::intExplode(',', $fallBackOrder);
|
19
|
+ foreach($lUids as $lUid) {
|
20
|
+ // Selecting overlay record:
|
21
|
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
22
|
+ '*',
|
23
|
+ 'pages_language_overlay',
|
24
|
+ 'pid='.intval($page_id).'
|
25
|
+ AND sys_language_uid='.intval($lUid).
|
26
|
+ $this->enableFields('pages_language_overlay'),
|
27
|
+ '',
|
28
|
+ '',
|
29
|
+ '1'
|
30
|
+ );
|
31
|
+ $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
32
|
+ $this->versionOL('pages_language_overlay',$row);
|
33
|
+ if (is_array($row)) {
|
34
|
+ return $lUid;
|
35
|
+ }
|
36
|
+ }
|
37
|
+ return 0;
|
38
|
+ }
|
39
|
/**
|
40
|
* Returns the relevant page overlay record fields
|
41
|
*
|
42
|
@@ -248,20 +276,28 @@
|
43
|
* @return array Page row which is overlayed with language_overlay record (or the overlay record alone)
|
44
|
*/
|
45
|
function getPageOverlay($pageInput,$lUid=-1) {
|
46
|
-
|
47
|
- // Initialize:
|
48
|
- if ($lUid<0) $lUid = $this->sys_language_uid;
|
49
|
+ //get page_id
|
50
|
+ if (is_array($pageInput)) {
|
51
|
+ $page_id = $pageInput['uid']; // Was the whole record
|
52
|
+ }
|
53
|
+ else {
|
54
|
+ $page_id = $pageInput; // Was the id
|
55
|
+ }
|
56
|
+ // Initialize:
|
57
|
+ if ($lUid<0) {
|
58
|
+ $lUid = $this->sys_language_uid;
|
59
|
+ //if with sys_language_overlayCheckOrder, check for other Overlay language which should be used instead
|
60
|
+ if ($page_id && $lUid && is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->sys_language_overlayCheckOrder) {
|
61
|
+ $lUid=$this->getLanguageOverlayUidForPage($page_id,$GLOBALS['TSFE']->sys_language_overlayCheckOrder);
|
62
|
+ }
|
63
|
+ }
|
64
|
$row = NULL;
|
65
|
-
|
66
|
// If language UID is different from zero, do overlay:
|
67
|
if ($lUid) {
|
68
|
$fieldArr = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields']);
|
69
|
- if (is_array($pageInput)) {
|
70
|
- $page_id = $pageInput['uid']; // Was the whole record
|
71
|
+ if (is_array($pageInput)) {
|
72
|
$fieldArr = array_intersect($fieldArr,array_keys($pageInput)); // Make sure that only fields which exist in the incoming record are overlaid!
|
73
|
- } else {
|
74
|
- $page_id = $pageInput; // Was the id
|
75
|
- }
|
76
|
+ }
|
77
|
|
78
|
if (count($fieldArr)) {
|
79
|
/*
|
80
|
@@ -286,7 +322,7 @@
|
81
|
|
82
|
if (is_array($row)) {
|
83
|
$row['_PAGES_OVERLAY'] = TRUE;
|
84
|
-
|
85
|
+ $row['_PAGES_OVERLAY_LUID'] = $lUid;
|
86
|
// Unset vital fields that are NOT allowed to be overlaid:
|
87
|
unset($row['uid']);
|
88
|
unset($row['pid']);
|