Project

General

Profile

Feature #16935 » 4911_translation_shortcut_url__v4.diff

Administrator Admin, 2009-02-04 10:56

View differences:

t3lib/config_default.php (working copy)
'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)
'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'))
'enable_mount_pids' => 1, // If set to "1", the mount_pid feature allowing 'symlinks' in the page tree (for frontend operation) is allowed.
'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()
'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()
'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"
'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)
'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/db_new.php (working copy)
</tr>
';
}
// New pages AFTER this pages
if ($this->newPagesAfter
&& $this->isTableAllowedForThisPage($this->pidInfo,'pages')
......
// Create link to new page after
$t = 'pages';
$v = $TCA[$t];
$rowContent = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join.gif','width="18" height="16"').' alt="" />'.
$rowContent = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join.gif','width="18" height="16"').' alt="" />'.
$this->linkWrap(
t3lib_iconWorks::getIconImage($t,array(),$BACK_PATH,'').
$LANG->sL($v['ctrl']['title'],1).' ('.$LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after',1).')',
......
);
// Half-line added:
$rowContent.= '<br /><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/ol/halfline.gif','width="18" height="8"').' alt="" />';
// Compile table row:
$tRows[] = '
<tr>
......
}
}
// Compile table row:
$tRows[]='
<tr>
......
<td></td>
</tr>
';
// Make table:
$this->code.='
......
/**
* Links the string $code to a create-new form for a record in $table created on page $pid
*
* @param string Link string
* @param string Link text
* @param string Table name (in which to create new record)
* @param integer PID value for the "&edit['.$table.']['.$pid.']=new" command (positive/negative)
* @param boolean If $addContentTable is set, then a new contentTable record is created together with pages
* @return string The link.
*/
function linkWrap($code,$table,$pid,$addContentTable=0) {
$params = '&edit['.$table.']['.$pid.']=new'.
($table=='pages'
&& $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']
&& isset($GLOBALS['TCA'][$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']])
&& $addContentTable ?
'&edit['.$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'].'][prev]=new&returnNewPageId=1' :
''
);
$onClick = t3lib_BEfunc::editOnClick($params,'',$this->returnUrl);
return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$code.'</a>';
function linkWrap($linkText, $table, $pid, $addContentTable = false) {
$parameters = '&edit[' . $table . '][' . $pid . ']=new';
if ($table == 'pages'
&& $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']
&& isset($GLOBALS['TCA'][$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']])
&& $addContentTable) {
$parameters .= '&edit['.$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'].'][prev]=new&returnNewPageId=1';
} elseif ($table == 'pages_language_overlay') {
$parameters .= '&overrideVals[pages_language_overlay][doktype]='
. (int) $this->pageinfo['doktype'];
}
$onClick = t3lib_BEfunc::editOnClick($parameters, '', $this->returnUrl);
return '<a href="#" onclick="'.htmlspecialchars($onClick).'">' . $linkText . '</a>';
}
/**
typo3/sysext/cms/ext_tables.php (working copy)
// ******************************************************************
$TCA['pages_language_overlay'] = array (
'ctrl' => array (
'label' => 'title',
'tstamp' => 'tstamp',
'title' => 'LLL:EXT:cms/locallang_tca.xml:pages_language_overlay',
'versioningWS' => true,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'enablecolumns' => array (
'disabled' => 'hidden',
'label' => 'title',
'tstamp' => 'tstamp',
'title' => 'LLL:EXT:cms/locallang_tca.xml:pages_language_overlay',
'versioningWS' => true,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'enablecolumns' => array (
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime'
'endtime' => 'endtime'
),
'transOrigPointerField' => 'pid',
'transOrigPointerTable' => 'pages',
'transOrigDiffSourceField' => 'l18n_diffsource',
'transOrigPointerField' => 'pid',
'transOrigPointerTable' => 'pages',
'transOrigDiffSourceField' => 'l18n_diffsource',
'shadowColumnsForNewPlaceholders' => 'title',
'languageField' => 'sys_language_uid',
'mainpalette' => 1,
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php'
'languageField' => 'sys_language_uid',
'mainpalette' => 1,
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'tbl_cms.php',
'type' => 'doktype',
'dividers2tabs' => true
)
);
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
var $rootLine=''; // The rootLine (all the way to tree root, not only the current site!) (array)
var $page=''; // The pagerecord (array)
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.
protected $originalShortcutPage = null; // gets set when we are processing a page of type shortcut in the early stages opf init.php when we do not know about languages yet, used later in init.php to determine the correct shortcut in case a translation changes the shortcut target (array)
/**
* sys_page-object, pagefunctions
......
// Is the ID a link to another page??
if ($this->page['doktype']==4) {
$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.
// saving the page so that we can check later - when we know
// about languages - whether we took the correct shortcut or
// whether a translation of the page overwrites the shortcut
// target and we need to follow the new target
$this->originalShortcutPage = $this->page;
$this->page = $this->getPageShortcut($this->page['shortcut'],$this->page['shortcut_mode'],$this->page['uid']);
$this->id = $this->page['uid'];
}
......
// If sys_language_uid is set to another language than default:
if ($this->sys_language_uid>0) {
// check whether a shortcut is overwritten by a translated page
// we can only do this now, as this is the place where we get
// to know about translations
$this->checkTranslatedShortcut();
// Request the overlay record for the sys_language_uid:
$olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
if (!count($olRec)) {
......
}
/**
* checks whether a translated shortcut page has a different shortcut
* target than the original language page.
* If that is the case, things get corrected to follow that alternative
* shortcut
*
* @return void
* @author Ingo Renner <ingo@typo3.org>
*/
protected function checkTranslatedShortcut() {
if (!is_null($this->originalShortcutPage)) {
$originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage['uid'], $this->sys_language_uid);
if (!empty($originalShortcutPageOverlay['shortcut']) && $originalShortcutPageOverlay['shortcut'] != $this->id) {
// the translation of the original shortcut page has a different shortcut target!
// set the correct page and id
$shortcut = $this->getPageShortcut(
$originalShortcutPageOverlay['shortcut'],
$originalShortcutPageOverlay['shortcut_mode'],
$originalShortcutPageOverlay['uid']
);
$this->id = $this->contentPid = $shortcut['uid'];
$this->page = $this->sys_page->getPage($this->id);
// fix various effects on things like menus f.e.
$this->fetch_the_id();
$this->tmpl->rootLine = array_reverse($this->rootLine);
}
}
}
/**
* Checks if any email-submissions or submission via the fe_tce
*
* @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)
CREATE TABLE pages_language_overlay (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
doktype tinyint(3) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
......
author_email varchar(80) DEFAULT '' NOT NULL,
tx_impexp_origuid int(11) DEFAULT '0' NOT NULL,
l18n_diffsource mediumblob,
url varchar(255) DEFAULT '' NOT NULL,
urltype tinyint(4) unsigned DEFAULT '0' NOT NULL,
shortcut int(10) unsigned DEFAULT '0' NOT NULL,
shortcut_mode int(10) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
typo3/sysext/cms/layout/class.tx_cms_layout.php (working copy)
// If any languages are left, make selector:
if (count($langSelItems)>1) {
$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')).'\'';
$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')).'\'';
return $GLOBALS['LANG']->getLL('new_language',1).': <select name="createNewLanguage" onchange="'.htmlspecialchars($onChangeContent).'">
'.implode('',$langSelItems).'
</select><br /><br />';
typo3/sysext/cms/tbl_cms.php (working copy)
'showRecordFieldList' => 'title,hidden,starttime,endtime,keywords,description,abstract'
),
'columns' => array(
'doktype' => $TCA['pages']['columns']['doktype'],
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.hidden',
'label' => 'LLL:EXT:cms/locallang_tca.xml:pages.hidden',
'config' => array(
'type' => 'check',
'default' => '0'
......
'minitems' => '0'
)
),
'url' => array(
'exclude' => 1,
'label' => 'LLL:EXT:cms/locallang_tca.php:pages.url',
'config' => array(
'type' => 'input',
'size' => '25',
'max' => '255',
'eval' => 'trim'
)
),
'urltype' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.type',
'config' => array(
'type' => 'select',
'items' => $TCA['pages']['columns']['urltype']['config']['items'],
'default' => '1'
)
),
'shortcut' => array (
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.shortcut_page',
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => '3',
'maxitems' => '1',
'minitems' => '0',
'show_thumbs' => '1'
)
),
'shortcut_mode' => array (
'exclude' => 1,
'label' => 'LLL:EXT:cms/locallang_tca.xml:pages.shortcut_mode',
'config' => array (
'type' => 'select',
'items' => $TCA['pages']['columns']['shortcut_mode']['config']['items'],
'default' => '0'
)
),
'sys_language_uid' => array(
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language',
'config' => array(
......
),
),
'types' => array(
'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')
// Standard
'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'),
// External URL - URL and URL type can be different for the translated page
'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'),
// Shortcut - shortcut and shortcut mode can be different for the translated page
'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'),
// Mount Point - mount point options can _NOT_ be different for the translated page
'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'),
// Separator
'199' => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2'),
// Sysfolder
'254' => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;LLL:EXT:lang/locallang_general.xml:LGL.title;;;2-2-2'),
// Recycler
'255' => array('showitem' => 'doktype;;;;1-1-1, hidden, sys_language_uid, title;;;;2-2-2')
),
'palettes' => array(
'1' => array('showitem' => 'starttime,endtime'),
'5' => array('showitem' => 'author,author_email')
'5' => array('showitem' => 'author,author_email', 'canNotCollapse' => true)
)
);
typo3/class.db_list_extra.inc (working copy)
} else {
$params = '&edit['.$table.']['.$this->id.']=new';
if ($table == 'pages_language_overlay') {
$params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype'];
}
$icon = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
'</a>';
(6-6/7)