Skip to content

Commit

Permalink
* Add support for TYPO3 7 and 8
Browse files Browse the repository at this point in the history
* Remove support for TYPO3 before 7.6
  • Loading branch information
franzholz committed Sep 28, 2019
1 parent 495a998 commit 872f105
Show file tree
Hide file tree
Showing 24 changed files with 1,351 additions and 793 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

2019-09-28 Franz Holzinger <franz@ttproducts.de>
* Add support for TYPO3 7 and 8
* Remove support for TYPO3 before 7.6

2019-09-05 Franz Holzinger <franz@ttproducts.de>

Expand Down
66 changes: 66 additions & 0 deletions Classes/Controller/Plugin/WizardIcon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with TYPO3 source code.
*
* The TYPO3 project - inspiring people to share!
*/


namespace JambageCom\Jfmulticontent\Controller\Plugin;

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

/**
* Class that adds the wizard icon.
*
* @category Plugin
* @package TYPO3
* @subpackage jfmulticontent
* @author Franz Holzinger <franz@ttproducts.de>
* @license http://www.gnu.org/copyleft/gpl.html
*/
class WizardIcon
{
/**
* Processes the wizard items array.
*
* @param array $wizardItems The wizard items
* @return array Modified array with wizard items
*/
public function proc(array $wizardItems)
{
$wizardIcon = 'pi1/ce_wiz.gif';
$listType = JFMULTICONTENT_EXT . '_pi1';
$params = '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=' . $listType;

$wizardItem = array(
'title' => $GLOBALS['LANG']->sL('LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang.xml:pi1_title'),
'description' => $GLOBALS['LANG']->sL('LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang.xml:pi1_plus_wiz_description'),
'params' => $params
);

$iconIdentifier = 'extensions-jfmulticontent-wizard';
/** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
$iconIdentifier,
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
array(
'source' => 'EXT:' . JFMULTICONTENT_EXT . '/' . $wizardIcon,
)
);
$wizardItem['iconIdentifier'] = $iconIdentifier;

$wizardItems['plugins_tx_' . $listType] = $wizardItem;

return $wizardItems;
}
}
204 changes: 204 additions & 0 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?php
defined('TYPO3_MODE') || die('Access denied.');

$table = 'tt_content';

$listType = JFMULTICONTENT_EXT . '_pi1';

$GLOBALS['TCA'][$table]['types']['list']['subtypes_excludelist'][$listType] = 'layout,select_key,pages';
$GLOBALS['TCA'][$table]['types']['list']['subtypes_addlist'][$listType] = 'tx_jfmulticontent_view,tx_jfmulticontent_pages,tx_jfmulticontent_contents,tx_jfmulticontent_irre,pi_flexform';
// Add reload field to tt_content
$GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] .= ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] ? ',' : '') . 'tx_jfmulticontent_view';

$confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][JFMULTICONTENT_EXT]);

$colPosOfIrreContent = intval($confArr['colPosOfIrreContent']);

if (!isset($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'][$colPosOfIrreContent])) {
// Add the new colPos to the array, only if the ID does not exist...
$GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'][$colPosOfIrreContent] = [
'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.colPosOfIrreContent',
$colPosOfIrreContent
];
// $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['disableNoMatchingValueElement'] = 1; // neu FHO
}



$temporaryColumns = array(
'tx_jfmulticontent_view' => array(
'exclude' => 1,
'onChange' => 'reload',
'label' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.view',
'config' => array (
'type' => 'select',
'size' => 1,
'maxitems' => 1,
'default' => 'content',
'items' => array(
array('LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.view.I.0', 'content'),
array('LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.view.I.1', 'page'),
array('LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.view.I.2', 'irre'),
),
'itemsProcFunc' => 'EXT:' . JFMULTICONTENT_EXT . '/lib/class.tx_jfmulticontent_itemsProcFunc.php:&tx_jfmulticontent_itemsProcFunc->getViews',
)
),
'tx_jfmulticontent_pages' => array(
'exclude' => 1,
'displayCond' => 'FIELD:tx_jfmulticontent_view:IN:page',
'label' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.pages',
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => 12,
'minitems' => 0,
'maxitems' => 1000,
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
),
),
)
),
'tx_jfmulticontent_irre' => Array (
'exclude' => 1,
'displayCond' => 'FIELD:tx_jfmulticontent_view:IN:irre',
'label' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.irre',
'config' => array (
'type' => 'inline',
'foreign_table' => 'tt_content',
'foreign_field' => 'tx_jfmulticontent_irre_parentid',
'foreign_sortby' => 'sorting',
'foreign_label' => 'header',
'maxitems' => 1000,
'appearance' => array(
'showSynchronizationLink' => FALSE,
'showAllLocalizationLink' => FALSE,
'showPossibleLocalizationRecords' => FALSE,
'showRemovedLocalizationRecords' => FALSE,
'expandSingle' => TRUE,
'newRecordLinkAddTitle' => TRUE,
'useSortable' => TRUE,
),
'behaviour' => array(
'localizeChildrenAtParentLocalization' => 1,
'localizationMode' => 'select',
),
)
),
);


if ($confArr["useStoragePidOnly"]) {
$temporaryColumns['tx_jfmulticontent_contents'] = array(
'exclude' => 1,
'displayCond' => 'FIELD:tx_jfmulticontent_view:IN:,content',
'label' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.contents',
'config' => array (
'type' => 'select',
'foreign_table' => 'tt_content',
'foreign_table_where' => 'AND tt_content.pid=###STORAGE_PID### AND tt_content.hidden=0 AND tt_content.deleted=0 AND tt_content.sys_language_uid IN (0,-1) ORDER BY tt_content.uid',
'size' => 12,
'minitems' => 0,
'maxitems' => 1000,
'wizards' => array(
'_PADDING' => 2,
'_VERTICAL' => 1,
'add' => array(
'type' => 'script',
'title' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.contents_add',
'icon' => 'add.gif',
'script' => 'wizard_add.php',
'params' => array(
'table' => 'tt_content',
'pid' => '###STORAGE_PID###',
'setValue' => 'prepend'
),
),
'list' => array(
'type' => 'script',
'title' => 'List',
'icon' => 'list.gif',
'script' => 'wizard_list.php',
'params' => array(
'table' => 'tt_content',
'pid' => '###STORAGE_PID###',
),
),
'edit' => array(
'type' => 'popup',
'title' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.contents_edit',
'icon' => 'edit2.gif',
'script' => 'wizard_edit.php',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=600,width=800,status=0,menubar=0,scrollbars=1',
),
),
)
);
} else {
$temporaryColumns['tx_jfmulticontent_contents'] = array(
'exclude' => 1,
'displayCond' => 'FIELD:tx_jfmulticontent_view:IN:,content',
'label' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.contents',
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tt_content',
'size' => 12,
'minitems' => 0,
'maxitems' => 1000,
'wizards' => array(
'_PADDING' => 2,
'_VERTICAL' => 1,
'add' => array(
'type' => 'script',
'title' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.contents_add',
'icon' => 'add.gif',
'script' => 'wizard_add.php',
'params' => array(
'table' => 'tt_content',
'pid' => '###STORAGE_PID###',
'setValue' => 'prepend'
),
),
'list' => array(
'type' => 'script',
'title' => 'List',
'icon' => 'list.gif',
'script' => 'wizard_list.php',
'params' => array(
'table' => 'tt_content',
'pid' => '###STORAGE_PID###',
),
),
'edit' => array(
'type' => 'popup',
'title' => 'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.tx_jfmulticontent.contents_edit',
'icon' => 'edit2.gif',
'script' => 'wizard_edit.php',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=600,width=800,status=0,menubar=0,scrollbars=1',
),
),
)
);
}

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns($table, $temporaryColumns);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($listType, 'FILE:EXT:' . JFMULTICONTENT_EXT . '/flexform_ds.xml');

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
array(
'LLL:EXT:' . JFMULTICONTENT_EXT . '/locallang_db.xml:tt_content.list_type_pi1',
$listType,
'EXT:' . JFMULTICONTENT_EXT . '/ext_icon.gif'
),
'list_type',
JFMULTICONTENT_EXT
);



File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# TYPO3 extension jfmulticontent

I have started to develop the existing jfmulticontent extension for the TYPO3 version 8.7. If persons are interested, then I will continue the work for TYPO3 9 and future versions.
Any contributions are welcome. Just create an issue or write a pull request.

The extension t3jquery seems not to exist any more. Its support will therefore be dropped soon.



Any contributions are welcome. Just create an issue or write a pull request.
33 changes: 16 additions & 17 deletions class.ext_update.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use TYPO3\CMS\Core\Utility\GeneralUtility;


/**
* Class for updating jfmulticontent content elements
*
Expand Down Expand Up @@ -61,19 +64,15 @@ class ext_update
*/
public function main() {
$out = '';
if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) < 4003000) {
// add flashmessages styles
$cssPath = $GLOBALS['BACK_PATH'].t3lib_extMgm::extRelPath('jfmulticontent');
$out .= '<link rel="stylesheet" type="text/css" href="'.$cssPath.'compat/flashmessages.css" media="screen" />';
}
$this->flexObj = t3lib_div::makeInstance('t3lib_flexformtools');

$this->flexObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools::class);
// analyze
$this->contentElements = $this->getContentElements();
$this->wrongLanguage = $this->getWrongLanguage();
$this->wrongStyle = $this->getWrongStyle();
if (t3lib_div::_GP('do_update')) {
$out .= '<a href="'.t3lib_div::linkThisScript(array('do_update' => '', 'func' => '')).'">'.$GLOBALS['LANG']->sL($this->ll.'back').'</a><br/>';
$func = trim(t3lib_div::_GP('func'));
if (GeneralUtility::_GP('do_update')) {
$out .= '<a href="'.GeneralUtility::linkThisScript(array('do_update' => '', 'func' => '')).'">'.$GLOBALS['LANG']->sL($this->ll.'back').'</a><br/>';
$func = trim(GeneralUtility::_GP('func'));
if (method_exists($this, $func)) {
$out .= '
<div style="padding:15px 15px 20px 0;">
Expand All @@ -93,8 +92,8 @@ public function main() {
</div>';
}
} else {
$out .= '<a href="'.t3lib_div::linkThisScript(array('do_update' => '', 'func' => '')).'">'.$GLOBALS['LANG']->sL($this->ll.'reload').'
<img style="vertical-align:bottom;" '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="18" height="16"').'></a><br/>';
$out .= '<a href="'.GeneralUtility::linkThisScript(array('do_update' => '', 'func' => '')).'">'.$GLOBALS['LANG']->sL($this->ll.'reload').'
<img style="vertical-align:bottom;" '.\TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="18" height="16"').'></a><br/>';
$out .= $this->displayWarning();
$out .= '<h3>'.$GLOBALS['LANG']->sL($this->ll.'actions').'</h3>';
// Update all flexform
Expand All @@ -119,7 +118,7 @@ private function displayUpdateOption($k, $count, $func)
{
$msg = $GLOBALS['LANG']->sL($this->ll.'msg_'.$k).' ';
$msg .= '<br/><strong>'.str_replace('###COUNT###', $count, $GLOBALS['LANG']->sL($this->ll.'foundMsg_'.$k)).'</strong>';
$msg .= ' <img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/icon_'.($count == 0 ? 'ok' : 'warning2').'.gif', 'width="18" height="16"').'>';
$msg .= ' <img '.\TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/icon_'.($count == 0 ? 'ok' : 'warning2').'.gif', 'width="18" height="16"').'>';
if ($count) {
$msg .= '<p style="margin:5px 0;">'.$GLOBALS['LANG']->sL($this->ll.'question_'.$k).'<p>';
$msg .= '<p style="margin-bottom:10px;"><em>'.$GLOBALS['LANG']->sL($this->ll.'questionInfo_'.$k).'</em><p>';
Expand Down Expand Up @@ -180,7 +179,7 @@ private function wrapForm($content, $fsLabel)
private function getButton($func, $lbl = 'DO IT')
{
$params = array('do_update' => 1, 'func' => $func);
$onClick = "document.location='".t3lib_div::linkThisScript($params)."'; return false;";
$onClick = "document.location='".GeneralUtility::linkThisScript($params)."'; return false;";
$button = '<input type="submit" value="'.$lbl.'" onclick="'.htmlspecialchars($onClick).'">';
return $button;
}
Expand All @@ -202,7 +201,7 @@ private function getContentElements()
if ($res) {
$resultRows = array();
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
$ff_parsed = t3lib_div::xml2array($row['pi_flexform']);
$ff_parsed = GeneralUtility::xml2array($row['pi_flexform']);
// Check for old sheet values
if (is_array($ff_parsed['data'])) {
foreach ($ff_parsed['data'] as $key => $val) {
Expand Down Expand Up @@ -238,7 +237,7 @@ private function getWrongStyle()
if ($res) {
$resultRows = array();
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
$ff_parsed = t3lib_div::xml2array($row['pi_flexform']);
$ff_parsed = GeneralUtility::xml2array($row['pi_flexform']);
// Check for old sheet values
if (is_array($ff_parsed['data'])) {
foreach ($ff_parsed['data'] as $key => $val) {
Expand Down Expand Up @@ -279,7 +278,7 @@ private function getWrongLanguage()
$res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$select_fields,
$from_table,
'uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->fullQuoteArray(t3lib_div::trimExplode(',', $row['tx_jfmulticontent_contents'], TRUE), $from_table)).')
'uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->fullQuoteArray(GeneralUtility::trimExplode(',', $row['tx_jfmulticontent_contents'], TRUE), $from_table)).')
AND deleted=0'
);
while (($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2))) {
Expand Down Expand Up @@ -396,4 +395,4 @@ public function access($what = 'all')
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/jfmulticontent/class.ext_update.php']) {
include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/jfmulticontent/class.ext_update.php']);
}
?>
?>
Loading

0 comments on commit 872f105

Please sign in to comment.