Index: t3lib/class.t3lib_tstemplate.php
===================================================================
--- t3lib/class.t3lib_tstemplate.php (Revision 6918)
+++ t3lib/class.t3lib_tstemplate.php (Arbeitskopie)
@@ -548,7 +548,8 @@
}
// Include static records (static_template) or files (from extensions) (#1/2)
- if (!$row['includeStaticAfterBasedOn']) { // NORMAL inclusion, The EXACT same code is found below the basedOn inclusion!!!
+ // NORMAL inclusion, The EXACT same code is found below the basedOn inclusion!!!
+ if (!$row['includeStaticAfterBasedOn']) {
$this->includeStaticTypoScriptSources($idList,$templateID,$pid,$row);
}
@@ -637,7 +638,7 @@
}
/**
- * Includes static template records (from static_template table) and static template files (from extensions) for the input template record row.
+ * Includes static template records (from static_template table, loaded through a hook) and static template files (from extensions) for the input template record row.
*
* @param string A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion.
* @param string The id of the current template. Same syntax as $idList ids, eg. "sys_123"
@@ -648,17 +649,16 @@
*/
function includeStaticTypoScriptSources($idList,$templateID,$pid,$row) {
// Static Template Records (static_template): include_static is a list of static templates to include
- if (trim($row['include_static'])) {
- $include_staticArr = t3lib_div::intExplode(',', $row['include_static']);
- foreach ($include_staticArr as $id) { // traversing list
- if (!t3lib_div::inList($idList,'static_'.$id)) { // if $id is not allready included ...
- $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_template', 'uid='.intval($id));
- if ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // there was a template, then we fetch that
- $subrow = $this->prependStaticExtra($subrow);
- $this->processTemplate($subrow,$idList.',static_'.$id,$pid,'static_'.$id,$templateID);
- }
- $GLOBALS['TYPO3_DB']->sql_free_result($res);
- }
+ // Call function for link rendering:
+ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['includeStaticTypoScriptSources'])) {
+ $_params = array(
+ 'idList' => &$idList,
+ 'templateId' => &$templateID,
+ 'pid' => &$pid,
+ 'row' => &$row
+ );
+ foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['includeStaticTypoScriptSources'] as $_funcRef) {
+ t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
Index: typo3/sysext/cms/ext_tables.php
===================================================================
--- typo3/sysext/cms/ext_tables.php (Revision 6918)
+++ typo3/sysext/cms/ext_tables.php (Arbeitskopie)
@@ -833,23 +833,5 @@
)
);
-// ******************************************************************
-// static_template
-// ******************************************************************
-$TCA['static_template'] = array (
- 'ctrl' => array (
- 'label' => 'title',
- 'tstamp' => 'tstamp',
- 'title' => 'LLL:EXT:cms/locallang_tca.xml:static_template',
- 'readOnly' => 1, // This should always be true, as it prevents the static templates from being altered
- 'adminOnly' => 1, // Only admin, if any
- 'rootLevel' => 1,
- 'is_static' => 1,
- 'default_sortby' => 'ORDER BY title',
- 'crdate' => 'crdate',
- 'iconfile' => 'template_standard.gif',
- 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_cms.php'
- )
-);
-?>
+?>
\ No newline at end of file
Index: typo3/sysext/cms/locallang_tca.xml
===================================================================
--- typo3/sysext/cms/locallang_tca.xml (Revision 6918)
+++ typo3/sysext/cms/locallang_tca.xml (Arbeitskopie)
@@ -112,7 +112,6 @@
-
@@ -129,7 +128,6 @@
-
Index: typo3/sysext/cms/ext_tables.sql
===================================================================
--- typo3/sysext/cms/ext_tables.sql (Revision 6918)
+++ typo3/sysext/cms/ext_tables.sql (Arbeitskopie)
@@ -280,25 +280,6 @@
#
-# Table structure for table 'static_template'
-#
-CREATE TABLE static_template (
- uid int(11) unsigned NOT NULL auto_increment,
- pid int(11) unsigned DEFAULT '0' NOT NULL,
- tstamp int(11) unsigned DEFAULT '0' NOT NULL,
- crdate int(11) unsigned DEFAULT '0' NOT NULL,
- title varchar(255) DEFAULT '' NOT NULL,
- include_static tinytext,
- constants text,
- config text,
- editorcfg text,
- description text,
- PRIMARY KEY (uid),
- KEY parent (pid)
-);
-
-
-#
# Table structure for table 'sys_domain'
#
CREATE TABLE sys_domain (
@@ -347,7 +328,6 @@
endtime int(11) unsigned DEFAULT '0' NOT NULL,
root tinyint(4) unsigned DEFAULT '0' NOT NULL,
clear tinyint(4) unsigned DEFAULT '0' NOT NULL,
- include_static tinytext,
include_static_file text,
constants text,
config text,
Index: typo3/sysext/cms/tbl_cms.php
===================================================================
--- typo3/sysext/cms/tbl_cms.php (Revision 6918)
+++ typo3/sysext/cms/tbl_cms.php (Arbeitskopie)
@@ -750,7 +750,7 @@
$TCA['sys_template'] = array(
'ctrl' => $TCA['sys_template']['ctrl'],
'interface' => array(
- 'showRecordFieldList' => 'title,clear,root,include_static,basedOn,nextLevel,resources,sitetitle,description,hidden,starttime,endtime'
+ 'showRecordFieldList' => 'title,clear,root,basedOn,nextLevel,resources,sitetitle,description,hidden,starttime,endtime'
),
'columns' => array(
'title' => array(
@@ -865,17 +865,6 @@
),
)
),
- 'include_static' => array(
- 'label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.include_static',
- 'config' => array(
- 'type' => 'select',
- 'foreign_table' => 'static_template',
- 'foreign_table_where' => 'ORDER BY static_template.title DESC',
- 'size' => 10,
- 'maxitems' => 20,
- 'default' => '',
- ),
- ),
'include_static_file' => array(
'label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.include_static_file',
'config' => array(
@@ -1000,7 +989,7 @@
'1' => array('showitem' => '
hidden,title;;1;;2-2-2, sitetitle, constants;;;;3-3-3, config, description;;;;4-4-4,
--div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.options, clear, root, nextLevel, editorcfg;;;;5-5-5,
- --div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.include, include_static,includeStaticAfterBasedOn,6-6-6, include_static_file, basedOn, static_file_mode,
+ --div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.include, includeStaticAfterBasedOn,6-6-6, include_static_file, basedOn, static_file_mode,
--div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.files, resources,
--div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.access, starttime, endtime'
)
@@ -1008,82 +997,4 @@
);
-
-
-
-// ******************************************************************
-// static_template
-// ******************************************************************
-$TCA['static_template'] = array(
- 'ctrl' => $TCA['static_template']['ctrl'],
- 'interface' => array(
- 'showRecordFieldList' => 'title,include_static,description'
- ),
- 'columns' => array(
- 'title' => array(
- 'label' => 'Template title:',
- 'config' => array(
- 'type' => 'input',
- 'size' => '25',
- 'max' => '256',
- 'eval' => 'required'
- )
- ),
- 'constants' => array(
- 'label' => 'Constants:',
- 'config' => array(
- 'type' => 'text',
- 'cols' => '48',
- 'rows' => '10',
- 'wrap' => 'OFF'
- ),
- 'defaultExtras' => 'fixed-font : enable-tab',
- ),
- 'include_static' => array(
- 'label' => 'Include static:',
- 'config' => array(
- 'type' => 'select',
- 'foreign_table' => 'static_template',
- 'foreign_table_where' => 'ORDER BY static_template.title',
- 'size' => 10,
- 'maxitems' => 20,
- 'default' => ''
- )
- ),
- 'config' => array(
- 'label' => 'Setup:',
- 'config' => array(
- 'type' => 'text',
- 'rows' => 10,
- 'cols' => 48,
- 'wrap' => 'OFF'
- ),
- 'defaultExtras' => 'fixed-font : enable-tab',
- ),
- 'editorcfg' => array(
- 'label' => 'Backend Editor Configuration:',
- 'config' => array(
- 'type' => 'text',
- 'rows' => 4,
- 'cols' => 48,
- 'wrap' => 'OFF'
- ),
- 'defaultExtras' => 'fixed-font : enable-tab',
- ),
- 'description' => array(
- 'label' => 'Description:',
- 'config' => array(
- 'type' => 'text',
- 'rows' => 10,
- 'cols' => 48
- )
- )
- ),
- 'types' => array(
- '1' => array('showitem' => 'title;;;;2-2-2, constants;;;;3-3-3, config, include_static;;;;5-5-5, description;;;;5-5-5, editorcfg')
- )
-);
-
-
-
?>
\ No newline at end of file
Index: typo3/sysext/tstemplate/ts/index.php
===================================================================
--- typo3/sysext/tstemplate/ts/index.php (Revision 6918)
+++ typo3/sysext/tstemplate/ts/index.php (Arbeitskopie)
@@ -358,18 +358,24 @@
// New standard?
if ($newStandardTemplate) {
- $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title,uid', 'static_template', '', '', 'title');
- $opt = '';
- while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
- if (substr(trim($row['title']), 0, 8) == 'template') {
- $opt .= '';
- }
- }
- $selector = '';
+ if (t3lib_extMgm::isLoaded('statictemplates')) { // check wether statictemplates are supported
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title,uid', 'static_template', '', '', 'title');
+ $opt = '';
+ while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+ if (substr(trim($row['title']), 0, 8) == 'template') {
+ $opt .= '';
+ }
+ }
+ $selector = '';
+ $staticsText = ', optionally based on one of the standard templates';
+ } else {
+ $selector = '';
+ $staticsText = '';
+ }
// Extension?
$theOutput .= $this->doc->spacer(10);
- $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('newWebsite'), $GLOBALS['LANG']->getLL('newWebsiteDescription') . '
+ $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('newWebsite') . $staticsText, $GLOBALS['LANG']->getLL('newWebsiteDescription') . '
' .
$selector . '
Index: typo3/sysext/install/mod/class.tx_install.php
===================================================================
--- typo3/sysext/install/mod/class.tx_install.php (Revision 6918)
+++ typo3/sysext/install/mod/class.tx_install.php (Arbeitskopie)
@@ -155,6 +155,7 @@
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_installversioning.php');
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_installnewsysexts.php');
require_once(t3lib_extMgm::extPath('install') . 'mod/class.tx_install_session.php');
+require_once(t3lib_extMgm::extPath('install') . 'updates/class.tx_coreupdates_statictemplates.php');
/**
* Install Tool module
Index: typo3/sysext/install/updates/class.tx_coreupdates_statictemplates.php
===================================================================
--- typo3/sysext/install/updates/class.tx_coreupdates_statictemplates.php (Revision 0)
+++ typo3/sysext/install/updates/class.tx_coreupdates_statictemplates.php (Revision 0)
@@ -0,0 +1,103 @@
+
+ * @author Benjamin Mack
+ */
+class tx_coreupdates_statictemplates {
+ public $versionNumber; // version number coming from t3lib_div::int_from_ver()
+ public $pObj; // parent object (tx_install)
+ public $userInput; // user input
+
+
+ /**
+ * Checks if there are any references to static_templates and an update is needed.
+ *
+ * @param string &$description: The description for the update
+ * @return boolean whether an update is needed (true) or not (false)
+ */
+ public function checkForUpdate(&$description) {
+ $description = 'Check dependencies / references to old TypoScript templates in table static_template.
+ This updater checks if you are using the old TypoScript static templates. These are extracted into its own extension "statictemplates". If you need them, this updater will install this extension.
';
+ if ($this->versionNumber >= 4004000 && !t3lib_extMgm::isLoaded('statictemplates')) {
+ $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
+ '*',
+ 'sys_refindex',
+ 'ref_table = "static_template" AND tablename != "static_template" AND deleted=0'
+ );
+ if ($count) {
+ $description .= 'Dependencies found! You MUST install the extenion "statictemplates"!';
+ return TRUE;
+ }
+ else {
+ $description .= 'No Dependencies found! You may use the COMPARE - Tool to delete the static_template table.';
+ }
+ }
+ return FALSE;
+ }
+
+ /**
+ * second step: get user info
+ *
+ * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
+ * @return string HTML output
+ */
+ public function getUserInput($inputPrefix) {
+ $content = 'Install the system extension You are about to install the extension "statictemplates". Make sure it is available in the TYPO3 source.';
+
+ return $content;
+ }
+
+ /**
+ * performs the action of the UpdateManager
+ *
+ * @param array &$dbQueries: queries done in this update
+ * @param mixed &$customMessages: custom messages
+ * @return bool whether everything went smoothly or not
+ */
+ public function performUpdate(array &$dbQueries, &$customMessages) {
+ if ($this->versionNumber >= 4004000 && !t3lib_extMgm::isLoaded('statictemplates')) {
+ // check wether the table can be truncated or if sysext with tca has to be installed
+ if ($this->checkForUpdate($customMessages[])) {
+ $localconf = $this->pObj->writeToLocalconf_control();
+ $this->pObj->setValueInLocalconfFile($localconf, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] . ',statictemplates');
+ $message = $this->pObj->writeToLocalconf_control($localconf);
+ if ($message == 'continue') {
+ $customMessages[] = 'System Extension "statictemplates" was succesfully loaded, static templates are now supported.';
+ return TRUE;
+ } else {
+ return FALSE; // something went wrong
+ }
+ }
+ return TRUE;
+ }
+ }
+}
+?>
Index: typo3/sysext/install/ext_localconf.php
===================================================================
--- typo3/sysext/install/ext_localconf.php (Revision 6918)
+++ typo3/sysext/install/ext_localconf.php (Arbeitskopie)
@@ -29,4 +29,8 @@
// install versioning since TYPO3 4.3
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['installVersioning'] = 'tx_coreupdates_installversioning';
+ // add static_template if needed (since TYPO3 4.3 this table is not standard)
+ // if needed, sysext statictables is loaded, which gives back functionality
+$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['checkForStaticTypoScriptTemplates'] = 'tx_coreupdates_statictemplates';
+
?>