Feature #16935 » 4911_translation_shortcut_url__v2.diff

Administrator Admin, 2009-02-03 14:16

View differences:

t3lib/config_default.php (working copy)
300 300
		'get_url_id_token' => '#get_URL_ID_TOK#',	// This is the token, which is substituted in the output code in order to keep a GET-based session going. Normally the GET-session-id is 5 chars ('&ftu=') + hash_length (norm. 10)
301 301
		'content_doktypes' => '1,2,5,7',			// List of pages.doktype values which can contain content (so shortcut pages and external url pages are excluded, but all pages below doktype 199 should be included. doktype=6 is not either (backend users only...). For doktypes going into menus see class.tslib_menu.php, line 494 (search for 'doktype'))
302 302
		'enable_mount_pids' => 1,					// If set to "1", the mount_pid feature allowing 'symlinks' in the page tree (for frontend operation) is allowed.
303
		'pageOverlayFields' => 'uid,title,subtitle,nav_title,media,keywords,description,abstract,author,author_email',				// List of fields from the table "pages_language_overlay" which should be overlaid on page records. See t3lib_page::getPageOverlay()
303
		'pageOverlayFields' => 'uid,title,subtitle,nav_title,media,keywords,description,abstract,author,author_email,url,urltype,shortcut,shortcut_mode',				// List of fields from the table "pages_language_overlay" which should be overlaid on page records. See t3lib_page::getPageOverlay()
304 304
		'hidePagesIfNotTranslatedByDefault' => FALSE,	// If TRUE, pages that has no translation will be hidden by default. Basically this will inverse the effect of the page localization setting "Hide page if no translation for current language exists" to "Show page even if no translation exists"
305 305
		'eID_include' => array(),				// Array of key/value pairs where key is "tx_[ext]_[optional suffix]" and value is relative filename of class to include. Key is used as "?eID=" for index_ts.php to include the code file which renders the page from that point. (Useful for functionality that requires a low initialization footprint, eg. frontend ajax applications)
306 306
		'disableNoCacheParameter' => false,				// Boolean. If set, the no_cache request parameter will become ineffective. This is currently still an experimental feature and will require a website only with plugins that don't use this parameter. However, using "&no_cache=1" should be avoided anyway because there are better ways to disable caching for a certain part of the website (see COA_INT/USER_INT documentation in TSref).
typo3/sysext/cms/ext_tables.php (working copy)
753 753
// ******************************************************************
754 754
$TCA['pages_language_overlay'] = array (
755 755
	'ctrl' => array (
756
		'label' => 'title',
757
		'tstamp' => 'tstamp',
758
		'title' => 'LLL:EXT:cms/locallang_tca.xml:pages_language_overlay',
759
		'versioningWS' => true,
760
		'versioning_followPages' => true,
761
		'origUid' => 't3_origuid',
762
		'crdate' => 'crdate',
763
		'cruser_id' => 'cruser_id',
764
		'delete' => 'deleted',
765
		'enablecolumns' => array (
766
			'disabled' => 'hidden',
756
		'label'                           => 'title',
757
		'tstamp'                          => 'tstamp',
758
		'title'                           => 'LLL:EXT:cms/locallang_tca.xml:pages_language_overlay',
759
		'versioningWS'                    => true,
760
		'versioning_followPages'          => true,
761
		'origUid'                         => 't3_origuid',
762
		'crdate'                          => 'crdate',
763
		'cruser_id'                       => 'cruser_id',
764
		'delete'                          => 'deleted',
765
		'enablecolumns'                   => array (
766
			'disabled'  => 'hidden',
767 767
			'starttime' => 'starttime',
768
			'endtime' => 'endtime'
768
			'endtime'   => 'endtime'
769 769
		),
770
		'transOrigPointerField' => 'pid',
771
		'transOrigPointerTable' => 'pages',
772
		'transOrigDiffSourceField' => 'l18n_diffsource',
770
		'transOrigPointerField'           => 'pid',
771
		'transOrigPointerTable'           => 'pages',
772
		'transOrigDiffSourceField'        => 'l18n_diffsource',
773 773
		'shadowColumnsForNewPlaceholders' => 'title',
774
		'languageField' => 'sys_language_uid',
775
		'mainpalette' => 1,
776
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php'
774
		'languageField'                   => 'sys_language_uid',
775
		'mainpalette'                     => 1,
776
		'dynamicConfigFile'               => t3lib_extMgm::extPath($_EXTKEY) . 'tbl_cms.php',
777
		'type'                            => 'doktype',
778
		'dividers2tabs'                   => true
777 779
	)
778 780
);
779 781

  
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
223 223
	var $rootLine='';					// The rootLine (all the way to tree root, not only the current site!) (array)
224 224
	var $page='';						// The pagerecord (array)
225 225
	var $contentPid=0;					// This will normally point to the same value as id, but can be changed to point to another page from which content will then be displayed instead.
226
	public $originalShortcutPage = null;	// only set when we took a shortcut, used to determine the correct shortcut in case a translation changes the shortcut target
226 227

  
227 228
	/**
228 229
	 * sys_page-object, pagefunctions
......
1087 1088
			// Is the ID a link to another page??
1088 1089
		if ($this->page['doktype']==4)	{
1089 1090
			$this->MP = '';		// We need to clear MP if the page is a shortcut. Reason is if the short cut goes to another page, then we LEAVE the rootline which the MP expects.
1091

  
1092
				// saving the page so that we can check later - when we know
1093
				// about languages - whether we took the correct shortcut or
1094
				// whether a translation of the page overwrote the shortcut
1095
				// and we need to set a new target
1096
			$this->originalShortcutPage = $this->page;
1097

  
1090 1098
			$this->page = $this->getPageShortcut($this->page['shortcut'],$this->page['shortcut_mode'],$this->page['uid']);
1091 1099
			$this->id = $this->page['uid'];
1092 1100
		}
......
2256 2264

  
2257 2265
			// If sys_language_uid is set to another language than default:
2258 2266
		if ($this->sys_language_uid>0)	{
2267

  
2268
				// check whether a shortcut is overwritten by a translated page
2269
				// we can only do this now, as this is the place where we get
2270
				// to know about translations
2271
			$this->checkTranslatedShortcut();
2272

  
2259 2273
				// Request the overlay record for the sys_language_uid:
2260 2274
			$olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
2261 2275
			if (!count($olRec))	{
......
2374 2388
	}
2375 2389

  
2376 2390
	/**
2391
	 * checks whether a translated shortcut page has a different shortcut
2392
	 * target than the original language page.
2393
	 * If that is the case, things get corrected to follow that alternative
2394
	 * shortcut
2395
	 *
2396
	 * @return	void
2397
	 * @author	Ingo Renner <ingo@typo3.org>
2398
	 */
2399
	protected function checkTranslatedShortcut() {
2400

  
2401
		if (!is_null($this->originalShortcutPage)) {
2402
			$originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage['uid'], $this->sys_language_uid);
2403

  
2404
			if (!empty($originalShortcutPageOverlay['shortcut']) && $originalShortcutPageOverlay['shortcut'] != $this->id) {
2405
					// the translation of the original shortcut page has a different shortcut target!
2406
					// set the correct page and id
2407

  
2408
				$shortcut = $this->getPageShortcut(
2409
					$originalShortcutPageOverlay['shortcut'],
2410
					$originalShortcutPageOverlay['shortcut_mode'],
2411
					$originalShortcutPageOverlay['uid']
2412
				);
2413

  
2414
				$this->id   = $this->contentPid = $shortcut['uid'];
2415
				$this->page = $this->sys_page->getPage($this->id);
2416

  
2417
					// fix various effects on things like menus f.e.
2418
				$this->fetch_the_id();
2419
				$this->tmpl->rootLine = array_reverse($this->rootLine);
2420
			}
2421
		}
2422
	}
2423

  
2424
	/**
2377 2425
	 * Checks if any email-submissions or submission via the fe_tce
2378 2426
	 *
2379 2427
	 * @return	string		"email" if a formmail has been sent, "fe_tce" if front-end data submission (like forums, guestbooks) is sent. "" if none.
typo3/sysext/cms/ext_tables.sql (working copy)
179 179
CREATE TABLE pages_language_overlay (
180 180
  uid int(11) NOT NULL auto_increment,
181 181
  pid int(11) DEFAULT '0' NOT NULL,
182
  doktype tinyint(3) unsigned DEFAULT '0' NOT NULL,
182 183
  t3ver_oid int(11) DEFAULT '0' NOT NULL,
183 184
  t3ver_id int(11) DEFAULT '0' NOT NULL,
184 185
  t3ver_wsid int(11) DEFAULT '0' NOT NULL,
......
207 208
  author_email varchar(80) DEFAULT '' NOT NULL,
208 209
  tx_impexp_origuid int(11) DEFAULT '0' NOT NULL,
209 210
  l18n_diffsource mediumblob,
211
  url varchar(255) DEFAULT '' NOT NULL,
212
  urltype tinyint(4) unsigned DEFAULT '0' NOT NULL,
213
  shortcut int(10) unsigned DEFAULT '0' NOT NULL,
214
  shortcut_mode int(10) unsigned DEFAULT '0' NOT NULL,
210 215

  
211 216
  PRIMARY KEY (uid),
212 217
  KEY t3ver_oid (t3ver_oid,t3ver_wsid),
typo3/sysext/cms/layout/class.tx_cms_layout.php (working copy)
2005 2005

  
2006 2006
				// If any languages are left, make selector:
2007 2007
			if (count($langSelItems)>1)		{
2008
				$onChangeContent = 'window.location.href=\''.$this->backPath.'alt_doc.php?&edit[pages_language_overlay]['.$id.']=new&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value+\'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'\'';
2008
				$onChangeContent = 'window.location.href=\''.$this->backPath.'alt_doc.php?&edit[pages_language_overlay]['.$id.']=new&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRecord['doktype'] . '&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value+\'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'\'';
2009 2009
				return $GLOBALS['LANG']->getLL('new_language',1).': <select name="createNewLanguage" onchange="'.htmlspecialchars($onChangeContent).'">
2010 2010
						'.implode('',$langSelItems).'
2011 2011
					</select><br /><br />';
typo3/sysext/cms/tbl_cms.php (working copy)
475 475
		'showRecordFieldList' => 'title,hidden,starttime,endtime,keywords,description,abstract'
476 476
	),
477 477
	'columns' => array(
478
		'doktype' => $TCA['pages']['columns']['doktype'],
478 479
		'hidden' => array(
479 480
			'exclude' => 1,
480
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.hidden',
481
			'label' => 'LLL:EXT:cms/locallang_tca.xml:pages.hidden',
481 482
			'config' => array(
482 483
				'type' => 'check',
483 484
				'default' => '0'
......
606 607
				'minitems' => '0'
607 608
			)
608 609
		),
610
		'url' => array(
611
			'exclude' => 1,
612
			'label' => 'LLL:EXT:cms/locallang_tca.php:pages.url',
613
			'config' => array(
614
				'type' => 'input',
615
				'size' => '25',
616
				'max' => '255',
617
				'eval' => 'trim'
618
			)
619
		),
620
		'urltype' => array(
621
			'exclude' => 1,
622
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.type',
623
			'config' => array(
624
				'type' => 'select',
625
				'items' => $TCA['pages']['columns']['urltype']['config']['items'],
626
				'default' => '1'
627
			)
628
		),
629
		'shortcut' => array (
630
			'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.shortcut_page',
631
			'config' => array (
632
				'type' => 'group',
633
				'internal_type' => 'db',
634
				'allowed' => 'pages',
635
				'size' => '3',
636
				'maxitems' => '1',
637
				'minitems' => '0',
638
				'show_thumbs' => '1'
639
			)
640
		),
641
		'shortcut_mode' => array (
642
			'exclude' => 1,
643
			'label' => 'LLL:EXT:cms/locallang_tca.xml:pages.shortcut_mode',
644
			'config' => array (
645
				'type' => 'select',
646
				'items' => $TCA['pages']['columns']['shortcut_mode']['config']['items'],
647
				'default' => '0'
648
			)
649
		),
609 650
		'sys_language_uid' => array(
610 651
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language',
611 652
			'config' => array(
......
629 670
		),
630 671
	),
631 672
	'types' => array(
632
		'0' => array('showitem' => 'hidden;;;;1-1-1, sys_language_uid, title;;;;2-2-2, subtitle, nav_title, --div--, abstract;;5;;3-3-3, keywords, description, media;;;;4-4-4')
673
			// Standard
674
		'1'   => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2, subtitle, nav_title,                                                                                              --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.metadata, --palette--;LLL:EXT:lang/locallang_general.xml:LGL.author;5;;3-3-3, abstract, keywords, description, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.files, media;;;;4-4-4, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime'),
675

  
676
			// External URL - URL and URL type can be different for the translated page
677
		'3'   => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2, subtitle,            --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.url, url;;;;3-3-3, urltype,                                                                                                                                                                                 --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.files, media;;;;4-4-4, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime'),
678

  
679
			// Shortcut - shortcut and shortcut mode can be different for the translated page
680
		'4'   => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2, subtitle,            --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.shortcut, shortcut;;;;3-3-3, shortcut_mode,                                                                                                                                                                 --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.files, media;;;;4-4-4, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime'),
681

  
682
			// Mount Point - mount point options can _NOT_ be different for the translated page
683
		'7'   => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2, subtitle, nav_title,                                                                                                                                                                                                                                                              --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.files, media;;;;4-4-4, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime'),
684

  
685
			// Separator
686
		'199' => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2'),
687

  
688
			// Sysfolder
689
		'254' => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;LLL:EXT:lang/locallang_general.xml:LGL.title;;;2-2-2'),
690

  
691
			// Recycler
692
		'255' => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2')
633 693
	),
634 694
	'palettes' => array(
635
		'1' => array('showitem' => 'starttime,endtime'),
636
		'5' => array('showitem' => 'author,author_email')
695
		'5' => array('showitem' => 'author,author_email', 'canNotCollapse' => true)
637 696
	)
638 697
);
639 698

  
(4-4/7)