Flex form configuration in controller - typo3 - typo3

I have a typo3 extension.I need to save the basic configuration using flex forms.So that i wrote a flex form.But can't access these values in controller.
My code is given below
ext_tables.php
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$frontendpluginName = 'userform'; //Your Front-end Plugin Name
$pluginSignature = strtolower($extensionName) . '_'.strtolower($frontendpluginName);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/user_flexform.xml');
user_flexform.xml
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Data Table Config</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<switchableControllerActions>
<TCEforms>
<label>Phone Number Format</label>
<config>
<type >select</type>
<items name="settings.phone" type="array">
<numIndex index="0" type="array">
<numIndex index="0">US</numIndex>
<numIndex index="1">(678) 567-1234</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">India</numIndex>
<numIndex index="1">+91 6789765434</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</switchableControllerActions>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
user_controller.php
$config = $this->settings;

The switchableControllerActions is used to select an action. This is not a regular setting. Those are defined a bit different
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Data Table Config</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<switchableControllerActions>
<TCEforms>
<label>LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<items>
<numIndex index="1">
<numIndex index="0">Company</numIndex>
<numIndex index="1">Company->list;Company->show</numIndex>
</numIndex>
<numIndex index="2">
<numIndex index="0">Product</numIndex>
<numIndex index="1">Product->list;Product->show</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</switchableControllerActions>
<settings.phone>
<TCEforms>
<label>Phone Number Format</label>
<config>
<type >select</type>
<items>
<numIndex index="0" type="array">
<numIndex index="0">US</numIndex>
<numIndex index="1">(678) 567-1234</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">India</numIndex>
<numIndex index="1">+91 6789765434</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.phone>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
If you don't need the switchableControllerActions, then just remove it.
Be aware that once saving flexform with those can create side effects as those are still persisted even though you removed them in your flexforms. Therefore best is to remove the plugin and create a new one!

Related

Typo3 & gridelements & flexform: Flexform-Elements side by side

when I code a gridelement with a flexform for backend-layout, the elements are always top-down.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<meta type="array">
<langDisable>1</langDisable>
</meta>
<ROOT type="array">
<type>array</type>
<el type="array">
<title type="array">
<TCEforms type="array">
<label>Titel</label>
<config type="array">
<type>input</type>
<size>30</size>
<eval>trim,required</eval>
</config>
</TCEforms>
</title>
<description type="array">
<TCEforms type="array">
<label>Beschreibung</label>
<config type="array">
<type>input</type>
<size>60</size>
<eval>trim,required</eval>
</config>
</TCEforms>
</description>
</el>
</ROOT>
</T3DataStructure>
How is it possible to show them side by side?
Is this possible only with a flexform configuration?

Logging options for Slick

I'm createing a Play 2.1 app, in which I have decided to use Slick for database interaction.
However I can't find documentation about how to configure/enable logging for Slick.
Anyone knows this?
Slick doesn't do much of any logging above DEBUG level. In application.conf if you add the line:
logger.scala.slick=DEBUG
you're going to get deluged with information from the query compiler.
You're probably just interested in the session information (Connection pool management, query strings, etc). In which case, just add
logger.scala.slick.session=DEBUG
to your Play application's application.conf
For PlayFramework 2.5.0 without Slick
Add to all your database configurations
db.default.logSql=true
Add to your logback.xml file:
<logger name="logger.org.jdbcdslog.StatementLogger" level="INFO" />
All the statements will be logged.
Reference:
https://www.playframework.com/documentation/2.5.x/ScalaDatabase#How-to-configure-SQL-log-statement
For play with Slick 3.0, just use
<logger name="slick.jdbc.JdbcBackend.statement" level="DEBUG" />
To print only select statements, in play-2.2.1 with slick 2.0.0, in application.conf have:
logger.scala.slick.jdbc.JdbcBackend.statement=DEBUG
I'm not using Play at the moment, but configure it as you would use logback. This is a nice description for setting up Play logging.
One option is to add
logger.scala.slick=INFO
to application.conf, as per Play manual. The other, if you have a custom logback.xml, is to add there the following line:
<logger name="scala.slick" level="INFO" />
Slick seems to use slf4j for its logging. So you might want to add a dependency on something like slf4j-simple to your project and set the desired log level for the Slick classes.
I've tried to integrate the logback.xml with the Slick logger but it doesn't work.
Modifing logger.xml (get it the latest version from GitHub based on your version) and adding the slick logger, instead, works.
<configuration>
<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${application.home}/logs/application.log</file>
<encoder>
<pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%coloredLevel %logger{15} - %message%n%xException{5}</pattern>
</encoder>
</appender>
<logger name="play" level="INFO" />
<logger name="application" level="DEBUG" />
<!-- Off these ones as they are annoying, and anyway we manage configuration ourself -->
<logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" />
<logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF" />
<logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF" />
<logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF" />
<logger name="scala.slick" level="SQL" />
<root level="ERROR">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
For slick 3.1.0, paste this in logback.xml in your resources directory:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="application" level="DEBUG"/>
<logger name="com.zaxxer.hikari" level="INFO"/>
<logger name="slick" level="INFO"/>
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
In my case I had to add <logger name="slick" level="INFO"/> to my log4j2.xml file. I'm using Slick 3.0.3 with Spray 1.3.3 and Log4j 2.1

WIX - Unable to patch an installation after it has been patched

need a little help here...
The Error : The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch.
I have done the following...
Created an MSI version 1.0 (GUID automatically created), ProductId="*"
Created a Patch (MSP) against the against the 1.0.wixpdb, version 1.1 (Update Code has been set), ProductId="{GUID1}", pyro gave a warning about changing the product code.
Created another Patch (MSP) against the 1.1.wixpdb, version 1.2 (Kept the same Update code). ProductId="{GUID1}", cannot install.
Scenario...
Install MSI v1.0 -> Install MSP 1.1 = Works fine.
Install MSI v1.0 -> Install MSP 1.1 -> Install MSP 1.2 = FAIL, windows cannot find the application.
Install MSI v1.1 -> Install MSP 1.2 = Works fine.
To me this means that when the first patch (1.1) went down something was potentially not update, or that in creating patch 1.2 i need to take 1.0 and 1.1 into account. I have tried various options, ranging from using to within the ...
Any ideas?
Update/Patch Code...
Product.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="WiX Patch Example Product"
Language="1033"
Version="1.0.0"
Manufacturer="Dynamo Corporation"
UpgradeCode="48C49ACE-90CF-4161-9C6E-9162115A54DD">
<Package Description="Installs a file that will be patched."
Comments="This Product does not install any executables"
InstallerVersion="200"
Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<FeatureRef Id="SampleProductFeature"/>
</Product>
<Fragment>
<Feature Id="SampleProductFeature" Title="Sample Product Feature" Level="1">
<ComponentRef Id="File_1.txt" />
<ComponentRef Id="File_2.txt" />
<ComponentRef Id="File_3.txt" />
</Feature>
</Fragment>
<Fragment>
<DirectoryRef Id="SampleProductFolder">
<Component Id="File_1.txt" Guid="{d738b2a9-0dbc-4381-9efd-5801723b1569}" DiskId="1">
<File Id="File_1.txt" Name="File 1.txt" Source=".\$(var.Version)\File 1.txt" />
</Component>
<Component Id="File_2.txt" Guid="{b9b267a3-5648-4e32-9ab1-f3032980f6c2}" DiskId="1">
<File Id="File_2.txt" Name="File 2.txt" Source=".\$(var.Version)\File 2.txt" />
</Component>
<Component Id="File_3.txt" Guid="{1df728ae-333d-47c5-9558-c0923f958a8d}" DiskId="1">
<File Id="File_3.txt" Name="File 3.txt" Source=".\$(var.Version)\File 3.txt" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="SampleProductFolder" Name="Patch Sample Directory">
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
Product 1.1.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="48C49ACE-90CF-4161-9C6E-9162115A54DD"
Name="WiX Patch Example Product"
Language="1033"
Version="1.1.0"
Manufacturer="Dynamo Corporation"
UpgradeCode="48C49ACE-90CF-4161-9C6E-9162115A54DD">
<Package Description="Installs a file that will be patched."
Comments="This Product does not install any executables"
InstallerVersion="200"
Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<FeatureRef Id="SampleProductFeature"/>
</Product>
<Fragment>
<Feature Id="SampleProductFeature" Title="Sample Product Feature" Level="1">
<ComponentRef Id="File_1.txt" />
<ComponentRef Id="File_2.txt" />
<ComponentRef Id="File_3.txt" />
<ComponentRef Id="File_4.txt" />
</Feature>
</Fragment>
<Fragment>
<DirectoryRef Id="SampleProductFolder">
<Component Id="File_1.txt" Guid="{d738b2a9-0dbc-4381-9efd-5801723b1569}" DiskId="1">
<File Id="File_1.txt" Name="File 1.txt" Source=".\$(var.Version)\File 1.txt" />
</Component>
<Component Id="File_2.txt" Guid="{b9b267a3-5648-4e32-9ab1-f3032980f6c2}" DiskId="1">
<File Id="File_2.txt" Name="File 2.txt" Source=".\$(var.Version)\File 2.txt" />
</Component>
<Component Id="File_3.txt" Guid="{1df728ae-333d-47c5-9558-c0923f958a8d}" DiskId="1">
<File Id="File_3.txt" Name="File 3.txt" Source=".\$(var.Version)\File 3.txt" />
</Component>
<Component Id="File_4.txt" Guid="{f728f62d-91f4-4c78-b2fe-65a9f0f6043c}" DiskId="1">
<File Id="File_4.txt" Name="File 4.txt" Source=".\$(var.Version)\File 4.txt" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="SampleProductFolder" Name="Patch Sample Directory">
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
Product 1.2.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="48C49ACE-90CF-4161-9C6E-9162115A54DD"
Name="WiX Patch Example Product"
Language="1033"
Version="1.2.0"
Manufacturer="Dynamo Corporation"
UpgradeCode="48C49ACE-90CF-4161-9C6E-9162115A54DD">
<Package Description="Installs a file that will be patched."
Comments="This Product does not install any executables"
InstallerVersion="200"
Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<FeatureRef Id="SampleProductFeature"/>
</Product>
<Fragment>
<Feature Id="SampleProductFeature" Title="Sample Product Feature" Level="1">
<ComponentRef Id="File_1.txt" />
<ComponentRef Id="File_2.txt" />
<ComponentRef Id="File_3.txt" />
<ComponentRef Id="File_4.txt" />
</Feature>
</Fragment>
<Fragment>
<DirectoryRef Id="SampleProductFolder">
<Component Id="File_1.txt" Guid="{d738b2a9-0dbc-4381-9efd-5801723b1569}" DiskId="1">
<File Id="File_1.txt" Name="File 1.txt" Source=".\$(var.Version)\File 1.txt" />
</Component>
<Component Id="File_2.txt" Guid="{b9b267a3-5648-4e32-9ab1-f3032980f6c2}" DiskId="1">
<File Id="File_2.txt" Name="File 2.txt" Source=".\$(var.Version)\File 2.txt" />
</Component>
<Component Id="File_3.txt" Guid="{1df728ae-333d-47c5-9558-c0923f958a8d}" DiskId="1">
<File Id="File_3.txt" Name="File 3.txt" Source=".\$(var.Version)\File 3.txt" />
</Component>
<Component Id="File_4.txt" Guid="{f728f62d-91f4-4c78-b2fe-65a9f0f6043c}" DiskId="1">
<File Id="File_4.txt" Name="File 4.txt" Source=".\$(var.Version)\File 4.txt" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="SampleProductFolder" Name="Patch Sample Directory">
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
Patch 1.1
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Patch
AllowRemoval="yes"
Manufacturer="Dynamo Corp"
MoreInfoURL="http://www.dynamocorp.com/"
DisplayName="Sample Patch"
Description="Small Update Patch"
Classification="Update"
OptimizedInstallMode="yes">
<Media Id="8000" Cabinet="RTM.cab" CompressionLevel="none">
<PatchBaseline Id="RTM">
</PatchBaseline>
</Media>
<PatchFamilyRef Id="SamplePatchFamily"/>
</Patch>
<Fragment>
<PatchFamily Id='SamplePatchFamily' Version='1.1.0' Supersede='no'>
</PatchFamily>
</Fragment>
</Wix>
Patch 1.2
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Patch
AllowRemoval="yes"
Manufacturer="Dynamo Corp"
MoreInfoURL="http://www.dynamocorp.com/"
DisplayName="Sample Patch"
Description="Small Update Patch"
Classification="Update"
OptimizedInstallMode="yes">
<Media Id="8000" Cabinet="RTM.cab" CompressionLevel="none">
<PatchBaseline Id="RTM">
</PatchBaseline>
</Media>
<PatchFamilyRef Id="SamplePatchFamily"/>
</Patch>
<Fragment>
<PatchFamily Id='SamplePatchFamily' Version='1.2.0' Supersede='no'>
</PatchFamily>
</Fragment>
</Wix>
Making your ProductId static will help with the patching scenario, every next patch will work.
But bare in mind that running a .msi e.g. version 1.5 after your version 1.3 patch (or even version 1.0 msi) will fail with: "Another version of the product is installed..." message. So while you're sticking with the same product id only provide the patches (.msp created from .msi), and when you wish to provide a new .msi make sure you change the product id.
I'm certainly too late with this answer, but I just wasted a whole work day on this issue, and decided to put it up so others won't have to.
I guess the two rules of MSI+MSP updates are:
Never make patches from MSIs with different product IDs, they will fail to find the product and will not run
Never provide different MSIs with same product IDs, they will fail with "another version installed" and will not run
It would have been much simpler if a different MSI just overwrote the previous one with the same product ID, but there must be a good reason for the way it is...
You need a static product id across the board. You can use Orca to go in and find the product id from your 1.0 msi. Use that guid in your 1.1 and 1.2 product.wxs ProductId.

How to print hidden files/folders list using NAnt script?

Current I try as below but that will skip all hidden files/folders. I want to see them.
Please help if you know the trick! Thank you.
<foreach item="Folder" property="folderName">
<in>
<items>
<include name=".\**" />
</items>
</in>
<do>
<echo message="${folderName}" />
</do>
</foreach>
Are you sure they are skipped because they're hidden? I'm more inclined that the files not listed are in default excludes. You should try disabling these excludes and see if that helps:
<foreach item="Folder" property="folderName">
<in>
<items defaultexcludes="false">
<include name=".\**" />
</items>
</in>
<do>
<echo message="${folderName}" />
</do>
</foreach>

nant exclude folder

I am looping though my folders and need to exclude the svn folders. I thought I could simply add the exclude element, though that doesnt seem to work.
<foreach item="Folder" property="foldername">
<in>
<items>
<include name="YOUR_FOLDER\**" />
<exlcude name="YOUR_FOLDER\**/_svn" />
</items>
</in>
<do>
<foreach item="File" property="filename" in="${foldername}">
<do>
<echo message="${filename}" />
</do>
</foreach>
</do>
</foreach>
Can somebody help?
It works when adding simply:
<exclude name="YOUR_FOLDER\**_svn**" />
You'll want to include the .svn directories and everything in them as well, otherwise the exclude mask will only hit the .svn directories, but not .svn/prop-base, .svn/props, .svn/text-base and so on.
<foreach item="Folder" property="foldername">
<in>
<items>
<include name="YOUR_FOLDER/**" />
<exclude name="YOUR_FOLDER/**/.svn/**" />
<exclude name="YOUR_FOLDER/**/_svn/**" />
</items>
</in>
<do>
<foreach item="File" property="filename" in="${foldername}">
<do>
<echo message="${filename}" />
</do>
</foreach>
</do>
</foreach>
Also, are you really using the alternative _svn naming scheme for Subversion's data directories?
<copy failonerror="true" overwrite="true" todir="${BusinessServicesTarget}">
<fileset basedir="${BusinessServicesPath}">
<exclude name="*.*" />
<include name="/**/*.as?x" />
<exclude name="/**/**_SVN**" />
You need to use it in copy function not in foreach.