Skip to content

Commit

Permalink
Merge pull request #1 from NamelessCoder/4.7
Browse files Browse the repository at this point in the history
4.7.12
  • Loading branch information
Claus Due committed Nov 24, 2012
2 parents ad9b0e8 + 95c0120 commit 545a7a1
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Classes/Backend/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public function renderPreview(&$headerContent, &$itemContent, array &$row) {
if (file_exists($templatePathAndFilename)) {
$typoScript = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$extension = str_replace('_', '', $provider->getExtensionKey($row));
$providerTemplatePaths = $provider->getTemplatePaths($row);
if ($providerTemplatePaths === NULL) {
continue;
}
if ($provider->getTemplatePaths($row)) {
$paths = $provider->getTemplatePaths($row);
} else if (t3lib_extMgm::isLoaded($provider->getExtensionKey($row))) {
Expand Down
24 changes: 23 additions & 1 deletion Classes/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class Tx_Flux_Core {
*/
private static $providers = array();

/**
* Contains ConfigurationProviders which have been unregistered
* @var array
*/
private static $unregisteredProviders = array();

/**
* Registers a class implementing one of the Flux ConfigurationProvider
* interfaces.
Expand All @@ -56,7 +62,9 @@ public static function registerConfigurationProvider($classNameOrInstance) {
if (in_array('Tx_Flux_Provider_ConfigurationProviderInterface', class_implements($classNameOrInstance)) === FALSE) {
throw new Exception(is_object($classNameOrInstance) ? get_class($classNameOrInstance) : $classNameOrInstance . ' must implement one of the Provider interfaces from Flux/Provider', 1327173536);
}
array_push(self::$providers, $classNameOrInstance);
if (in_array($classNameOrInstance, self::$unregisteredProviders) === FALSE) {
array_push(self::$providers, $classNameOrInstance);
}
}

/**
Expand Down Expand Up @@ -145,6 +153,20 @@ public static function registerFluidFlexFormTable($table, $fieldName, $templateF
self::registerConfigurationProvider($provider);
}

/**
* @param string $providerClassName
* @return void
*/
public static function unregisterConfigurationProvider($providerClassName) {
if (in_array($providerClassName, self::$providers) === TRUE) {
$index = array_search($providerClassName, self::$providers);
unset(self::$providers[$index]);
}
if (in_array($providerClassName, self::$unregisteredProviders) === FALSE) {
array_push(self::$unregisteredProviders, $providerClassName);
}
}

/**
* Gets the defined FlexForms configuration providers based on parameters
* @return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ public function preProcessRecord(array &$row, $id, t3lib_TCEmain $reference) {
if ($slice[0] === 'top') {
$row['tx_flux_parent'] = $slice[1];
$row['tx_flux_column'] = $slice[2];
#$row['colPos'] = -42;
} elseif ($slice[1] === 'after') {
$row['pid'] = 0 - $slice[2];
$row['colPos'] = -42;
} elseif ($slice[0] === 'after') {
$row['pid'] = 0 - $slice[1];
$row['tx_flux_column'] = $slice[2];
} else {
$row['tx_flux_parent'] = $row['tx_flux_column'] = '';
}
break;
}
}
}
#\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($retrievedArgument);
#return;
}
if ($row['pid'] < 0) {
// inserting a new element after another element. Check column position of that element.
Expand All @@ -125,7 +126,6 @@ public function preProcessRecord(array &$row, $id, t3lib_TCEmain $reference) {
$row['tx_flux_parent'] = $relativeToRecord['tx_flux_parent'];
$row['tx_flux_column'] = $relativeToRecord['tx_flux_column'];
}
#\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($id);
unset($id, $reference);
}

Expand Down
112 changes: 112 additions & 0 deletions Classes/Service/Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2012 Claus Due <claus@wildside.dk>, Wildside A/S
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

/**
* Configuration Service
*
* Service to interact with site configuration
*
* @package Flux
* @subpackage Service
*/
class Tx_Flux_Service_Configuration implements t3lib_Singleton {

/**
* @var Tx_Extbase_Configuration_ConfigurationManagerInterface
*/
protected $configurationManager;

/**
* @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
* @return void
*/
public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
$this->configurationManager = $configurationManager;
}

/**
* Gets an array of TypoScript configuration from below plugin.tx_fed -
* if $extensionName is set in parameters it is used to indicate which sub-
* section of the result to return.
*
* @param string $extensionName
* @param string $memberName
* @param array $dontTranslateMembers Array of members not to be translated by path
* @return array
*/
public function getTypoScriptSubConfiguration($extensionName, $memberName, $dontTranslateMembers = array()) {
$config = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$config = $config['plugin.']['tx_fed.'][$memberName . '.'];
if (is_array($config) === FALSE) {
return array();
}
if ($this->checkDependenciesForConfiguration($config) === FALSE) {
return array();
}
$config = Tx_Flux_Utility_Array::convertTypoScriptArrayToPlainArray($config);
if ($extensionName) {
$config = $config[$extensionName];
}
if (is_array($config) === FALSE) {
return array();
}
foreach ($config as $k => $v) {
if ($extensionName) {
if (in_array($k, $dontTranslateMembers) === FALSE) {
$config[$k] = Tx_Flux_Utility_Path::translatePath($v);
}
} else {
foreach ($v as $subkey=>$paths) {
if (in_array($subkey, $dontTranslateMembers) === FALSE) {
$config[$k][$subkey] = Tx_Flux_Utility_Path::translatePath($paths);
}
}
}
}
return $config;
}

/**
* @param array $configuration
* @return boolean
*/
public function checkDependenciesForConfiguration($configuration) {
if (isset($configuration['dependencies']) === TRUE) {
$dependencies = t3lib_div::trimExplode(',', $configuration['dependencies']);
foreach ($dependencies as $dependency) {
if (!t3lib_extMgm::isLoaded($dependency)) {
$messageText = 'The Fluid configuration set named ' .
$configuration['label'] . ' depends on extension ' . $dependency . ' (all dependencies: ' .
implode(',', $dependencies) . ') but ' . $dependency . ' was not loaded';
$flashMessage = new \TYPO3\CMS\Core\Messaging\FlashMessage($messageText, 'Fluid configuration missing', t3lib_FlashMessage::WARNING);
t3lib_FlashMessageQueue::addMessage($flashMessage);
return FALSE;
}
}
}
return TRUE;
}

}
20 changes: 18 additions & 2 deletions Classes/Utility/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,24 @@ public static function assertHasFixedFlexFormFieldNamePassing() {
$isRecent4x5 = ($version[0] == 4 && $version[1] == 5 && $version[2] >= 23);
$isRecent4x6 = ($version[0] == 4 && $version[1] == 6 && $version[2] >= 16);
$isRecent4x7 = ($version[0] == 4 && $version[1] == 7 && $version[2] >= 8);
$isAbove4 = ($version[0] > 4);
return ($isAbove4 || $isRecent4x5 || $isRecent4x6 || $isRecent4x7);
$isRecent6x0 = self::assertCoreVersionIsAtLeastSixPointZero();
return (!$isRecent6x0 || $isRecent4x5 || $isRecent4x6 || $isRecent4x7);
}

/**
* @return boolean
*/
public static function assertCoreVersionIsBelowSixPointZero() {
$version = explode('.', TYPO3_version);
return ($version[0] < 6);
}

/**
* @return boolean
*/
public static function assertCoreVersionIsAtLeastSixPointZero() {
$version = explode('.', TYPO3_version);
return ($version[0] >= 6);
}

}
3 changes: 3 additions & 0 deletions Classes/ViewHelpers/Widget/Controller/GridController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@ public function setRow($row) {
public function indexAction() {
$this->view->assign('grid', $this->grid);
$this->view->assign('row', $this->row);
if (Tx_Flux_Utility_Version::assertCoreVersionIsBelowSixPointZero() === TRUE) {
return $this->view->render('legacy');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
<div class="fce-container">
<div class="t3-page-ce">
<div class="t3-page-ce-dropzone" id="colpos-{row.colPos}-page-1-{fed:data.func(func: 'md5', arguments: {0: area.name})}-top-{row.uid}-{area.name}" style="height: 16px;">
<div class="t3-page-ce-dropzone" id="colpos-{row.colPos}-page-{row.pid}-{fed:data.func(func: 'md5', arguments: {0: area.name})}-top-{row.uid}-{area.name}" style="height: 16px;">
<div class="t3-page-ce-wrapper-new-ce">
<flux:be.link.content.new row="{row}" area="{area.name}" />
</div>
Expand All @@ -36,7 +36,8 @@
<flux:be.contentElement row="{record}" dblist="{dblist}" />
<fed:comment comment="This next DIV closing tag is NOT a mistake! It is a bug in tt_content list rendering internals of TYPO3" />
</div>
<div class="t3-page-ce-dropzone" id="colpos-{record.colPos}-page-1-{fed:data.func(func: 'md5', arguments: {0: record.uid})}-after-{row.uid}-{area.name}" style="height: 16px;">
</div>
<div class="t3-page-ce-dropzone" id="colpos-{record.colPos}-page-{record.pid}-{fed:data.func(func: 'md5', arguments: {0: record.uid})}-after-{row.uid}" style="height: 16px;">
<div class="t3-page-ce-wrapper-new-ce">
<flux:be.link.content.new row="{row}" area="{area.name}" />
</div>
Expand Down
72 changes: 72 additions & 0 deletions Resources/Private/Templates/ViewHelpers/Widget/Grid/Legacy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{namespace fed=Tx_Fed_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}

<style type="text/css">
.fce-header { background-color: #5B5B5B; background-image: -moz-linear-gradient(center top , #7F7F7F 10%, #5B5B5B 100%); padding: 4px; margin-top: 8px; color: white; font-weight: bold; }
.fce-header span { position: absolute; }
.fce-header div { text-align: center; }

.fce-container .t3-page-ce-body { margin-bottom: 8px; }
td.spacer { width: 8px; height: 8px; }
</style>

<table style="width: 100%; margin-top: 8px;" cellspacing="0" cellpadding="0">
<tbody>
<f:for each="{grid}" as="gridrow" iteration="rowIteration">
<fed:data.var name="totalColumnCount" type="integer" value="0" />
<tr>
<f:for each="{gridrow}" as="gridcolumn" iteration="columnIteration">
<td colspan="{gridcolumn.colspan}" rowspan="{gridcolumn.rowspan}" style="{gridcolumn.style}">
<f:for each="{gridcolumn.areas}" as="area">
<flux:be.contentArea area="{area.name}" row="{row}">
<div class="fce-header t3-page-colHeader">
<flux:be.link.content.new row="{row}" area="{area.name}" />
<div><f:translate key="{area.label}" default="{area.label}" /></div>
</div>
<div class="fce-container">
<f:for each="{records}" as="record">
<div class="t3-page-ce">
<flux:be.contentElement row="{record}" dblist="{dblist}" />
<fed:comment comment="This next DIV closing tag is NOT a mistake! It is a bug in tt_content list rendering internals of TYPO3" />
</div>
</div>
</f:for>
</div>
</flux:be.contentArea>
</f:for>

<fed:data.var name="totalColumnCount" type="integer">
<fed:math>
<fed:data.var name="totalColumnCount"/> + 1 + ({gridcolumn.colspan} - 1)
</fed:math>
</fed:data.var>

</td>
<f:if condition="{columnIteration.isLast} < 1">

<fed:data.var name="totalColumnCount" type="integer">
<fed:math>
<fed:data.var name="totalColumnCount"/> + 1
</fed:math>
</fed:data.var>

<td class="spacer">&nbsp;</td>
</f:if>
</f:for>
</tr>
<!--
<f:if condition="{rowIteration.isLast} < 1">
<tr>
<td><fed:data.var name="totalColumnCount"/></td>
<td class="spacer">&nbsp;</td>
</tr>
</f:if>
-->
<tr>
<fed:loop count="{totalColumnCount}">
<td class='spacer'>&nbsp;</td>
</fed:loop>
</tr>
</f:for>
</tbody>
</table>

0 comments on commit 545a7a1

Please sign in to comment.