Sulu Pagebuilder: Add Multiple Types in a Collection - sulu

In Sulu cmf demo there is a sctionb where i can add multiple blocks.
I'd like to use this as "Pagebuilder".
I thought this block in my pages/default.xml will do the trick (and I think it is).
Do I need to clear any cache for this to work, or what am I missing?
<section name="content">
<meta>
<title lang="de">Inhalt</title>
<title lang="en">Content</title>
<info_text lang="de">Bereich für den Inhalt</info_text>
<info_text lang="en">Content Section</info_text>
</meta>
<properties>
<property name="article" type="text_editor" mandatory="true">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
<block name="block"
default-type="editor"
minOccurs="2"
maxOccurs="10"
mandatory="true">
<meta>
<title lang="de">Block</title>
<title lang="en">Block</title>
</meta>
<types>
<type name="editor">
<meta>
<title lang="de">Texteditor</title>
<title lang="en">Text editor</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
<property name="article" type="text_editor" mandatory="true">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
</properties>
</type>
<type name="textarea">
<meta>
<title lang="de">Texteingabe</title>
<title lang="en">Text area</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
<property name="article" type="text_area" mandatory="true">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
</properties>
</type>
<type name="title_only">
<meta>
<title lang="de">Nur Titel</title>
<title lang="en">Title Only</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
</types>
</block>
<property name="name" type="text_line" mandatory="false" minOccurs="2" maxOccurs="5">
<meta>
<title lang="de">Name</title>
<title lang="en">Name</title>
</meta>
</property>
</properties>
</section>
<property name="links" type="internal_links">
<meta>
<title lang="de">Verknüpfungen</title>
<title lang="en">Internal links</title>
</meta>
</property>
</properties>

If you do changes in a template file you need to clear the cache with the default symfony command:
app/console cache:clear
EDIT
Did test it Daniel Rotter is right on dev you don't need to clear the cache. Just refresh the page and it should show your changes.

Okay, after i logged off and signed in again, it works like expected.

Related

Stop log4net (or services) using a file when errors are not being placed in it

I have the following log4net config
<?xml version="1.0" encoding="utf-8" ?>
<log4net xmlns="urn:log4net">
<appender name ="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="C:\temp\Generator.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maximumFileSize value="500KB" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{DATE} %level %thread %logger - %message%newline" />
</layout>
</appender>
<appender name ="GenerationErrors" type="log4net.Appender.FileAppender">
<file type="log4net.Util.PatternString" value="c:\temp\GenerationErrors.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{DATE} %level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<appender-ref ref="RollingFile" />
<level value="INFO" />
</root>
<logger name ="GPA.Module.Generate">
<level value="INFO" />
<appender-ref ref="GenerationErrors" />
</logger>
<logger name="PmuManagement">
<level value="INFO" />
<appender-ref ref="GenerationErrors" />
</logger>
</log4net>
The first appender logs all errors for all of my processes and the second only logs a certain group of errors, as required.
I need to be able to delete the contents of the second log file on the fly however this isn't currently possible as the programme needs constant access to it to run (if you try and make any changes you get the "this file is in use by another programme" error.
Is there a way for log4net to only need access to the file when errors need to be written to it?
Or is there a more generic way to stop services/programmes needing access to file temporarily and allowing access again shortly after?
Thanks
I found this question here Intermittent log4net RollingFileAppender locked file issue and the answer is what I needed. I simply added <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> to my second appender.

finding target worksheet for action in twb (xml) file

My intention is to find target worksheet for actions in tableau workbook. where should I search for that target worksheet correspond to some particular action in twb(xml) file?
For example:
<actions>
<action caption='Filter 1 (generated)' name='[Action1]'>
<activation auto-clear='true' type='on-select' />
<source dashboard='Figure 8-60 thought 8-65' type='sheet' worksheet='Heat Map' />
<command command='tsc:tsl-filter'>
<param name='special-fields' value='all' />
<param name='target' value='Figure 8-60 thought 8-65' />
</command>
</action>
<action caption='Filter 2 (generated)' name='[Action2]'>
<activation auto-clear='true' type='on-select' />
<source dashboard='Figure 8-59' type='sheet' worksheet='Poor Filter Design' />
<command command='tsc:tsl-filter'>
<param name='special-fields' value='all' />
<param name='target' value='Figure 8-59' />
</command>
</action>
<action caption='Filter 3 (generated)' name='[Action3]'>
<activation auto-clear='true' type='on-select' />
<source dashboard='Figure 8-59' type='sheet' worksheet='Good Filter Design' />
<command command='tsc:tsl-filter'>
<param name='special-fields' value='all' />
<param name='target' value='Figure 8-59' />
</command>
</action>
</actions>
As you can see above code filter1 action got a param tag inside that target attribute is present, but the value present there is a dashoard name. What i want is target woksheet corresponded to the action filter.
Tried to play a bit with .twb file and got this for dashboard actions:
<actions>
<action caption='Filter 1 (generated)' name='[Action1]'>
<activation auto-clear='true' type='on-select' />
<source dashboard='Dashboard 1' type='sheet' worksheet='Sheet 3' />
<command command='tsc:tsl-filter'>
<param name='special-fields' value='all' />
<param name='target' value='Dashboard 1' />
</command>
</action>
<action caption='Filter 2 (generated)' name='[Action2]'>
<activation auto-clear='true' type='on-select' />
<source dashboard='Dashboard 2' type='sheet' worksheet='Sheet 2' />
<command command='tsc:tsl-filter'>
<param name='special-fields' value='all' />
<param name='target' value='Dashboard 2' />
</command>
</action>
<action caption='Filter 3 (generated)' name='[Action3]'>
<activation auto-clear='true' type='on-select' />
<source dashboard='Dashboard 2' type='sheet' worksheet='Sheet 3' />
<command command='tsc:tsl-filter'>
<param name='special-fields' value='all' />
<param name='target' value='Dashboard 2' />
</command>
</action>
</actions>
Honestly I couldn't find any direct link to the target sheet while source sheet is always available in actions, This can be observed in Actions window.
But I was able to see the actions that were mapped to target sheets if we go to the individual sheet actions instead of dashboard actions where we can see target as dashboard.
See below data where I have created a dummy dashboard to check actions.
These are the actions that created in report:
<group caption='Action (Product Category)' hidden='true' name='[Action (Product Category)]' name-style='unqualified' user:auto-column='sheet_link'>
<groupfilter function='crossjoin'>
<groupfilter function='level-members' level='[Product Category]' />
</groupfilter>
</group>
<group caption='Action (Product Sub-Category)' hidden='true' name='[Action (Product Sub-Category)]' name-style='unqualified' user:auto-column='sheet_link'>
<groupfilter function='crossjoin'>
<groupfilter function='level-members' level='[Product Sub-Category]' />
</groupfilter>
</group>
Along with this if we go to individual sheets then we can see the actions mapped first one is for Sheet 2 and other is for Sheet 3:
<filter class='categorical' column='[federated.0idnrl40bk56fg130xiy30dnljux].[Action (Product Category)]'>
<groupfilter function='level-members' level='[Product Category]' user:ui-enumeration='all' user:ui-marker='enumerate' />
</filter>
<slices>
<column>[federated.0idnrl40bk56fg130xiy30dnljux].[Action (Product Category)]</column>
</slices>
<filter class='categorical' column='[federated.0idnrl40bk56fg130xiy30dnljux].[Action (Product Sub-Category)]'>
<groupfilter function='level-members' level='[Product Sub-Category]' user:ui-enumeration='all' user:ui-marker='enumerate' />
</filter>
<slices>
<column>[federated.0idnrl40bk56fg130xiy30dnljux].[Action (Product Sub-Category)]</column>
</slices>
If we keep track of actions that were created in dashboards then we can easily tell what all sheets are joined in a dashboard using the name of the actions.
Would like to know your thoughts and observations aswell.
Changing the names of the actions
Going into the .twb XML and changing the order of the <> blocks.
Going into the .twb XML and changing the internal Action1, Action2, etc. names. Doing this I'm able to change which of Dashboard 2 and Dashboard 3 is opened.
adding a Web Page object to Dashboard 1 and then a URL action using about:blank as the target, on the idea that maybe URL actions take precedence over filter actions.

CXF wadl2java generate code from grammar

The code generation with for the methods works fine, but it seems to me that the grammar part is omitted because no Pojo and JAXB annotations are generated. Do I have to specify some additional configuration? I used this command: wadl2java.bat -p packagename /path/to/wadl
Here is a snippet of the wadl.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammer>
<xsd:include href="file1.xsd"></xsd:include>
<xsd:include href="file2.xsd"></xsd:include>
<xsd:include href="file3.xsd"></xsd:include>
<xsd:include href="file14.xsd"></xsd:include>
</grammer>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>
....
I found my mistake. There was a typo in the wadl. Previously I used <grammer> but you have to use <grammars>
Now it works.
<application
xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.tns.de">
<grammars>
<include href="file1.xsd"></xsd:include>
<include href="file2.xsd"></xsd:include>
<include href="file3.xsd"></xsd:include>
<include href="file14.xsd"></xsd:include>
</grammars>
<resources base="http:localhost:8080/rest">
<resource path="status/{id}" id="statusId">
<param name="id" type="xsd:unsignedInt" required="true" default="" style="template"/>
<method name="GET" id="getById">
<request>
<representation mediaType="application/json" element="tns:type1"/>
</request>
<response>
<representation mediaType="application/json" element="tns:type2"/>
</response>
</method>

Default components in install4j

When my "installation components" screen runs (I'm in console mode, if it matters), I get the list of components to install, as expected. However, the "default" response is to accept 2 of the components, even though their "Initially Selected for installation" option is false.
I want the user to be able to NOT select any of the optional components, and this isn't possible when it's defaulting to have some of them "Selected".
As far as I can tell, there are no varfiles being loaded.
Snippet from my install4j file:
<component name="A" id="527" customizedId="a" displayDescription="false" hideHelpButton="false" selected="false" changeable="true" downloadable="false" hidden="false">
<description />
<include all="false">
<entry location=".i4j_external_314/a" fileType="regular" />
<entry location=".i4j_external_2366/a" fileType="regular" />
<entry location=".i4j_external_316/a" fileType="regular" />
<entry location=".i4j_external_8155/a" fileType="regular" />
<entry location=".i4j_external_318/a" fileType="regular" />
</include>
<dependencies />
</component>
<component name="B" id="528" customizedId="b" displayDescription="false" hideHelpButton="false" selected="false" changeable="true" downloadable="false" hidden="false">
<description />
<include all="false">
<entry location=".i4j_external_316/b" fileType="regular" />
<entry location=".i4j_external_8155/b" fileType="regular" />
<entry location=".i4j_external_318/b" fileType="regular" />
</include>
<dependencies />
</component>
<component name="C" id="69" customizedId="c" displayDescription="false" hideHelpButton="false" selected="false" changeable="true" downloadable="false" hidden="false">
<description />
<include all="false">
<entry location=".i4j_external_316/c" fileType="regular" />
<entry location=".i4j_external_8155/c" fileType="regular" />
<entry location=".i4j_external_318/c" fileType="regular" />
</include>
<dependencies />
Notice that in all 3 components, "selected" is false, and "changeable" is true.
When the installer runs, though, here is how it is presented:
Which components should be installed?
*: D
*: E
1: A
2: B
3: C
Please enter a comma-separated list of the selected values or [Enter] for the default selection:
[1,2]
(D and E are fine - they're set to "selected" and "not user changeable")
So, even though A and B are not "selected", they show up as a default. Also notice that "C" is configured the same way as "A" and "B", yet doesn't show up in the default.
This is problematic, because I have no way to select "none" of the optional components. I have to select at least 1 in order to not accept the default.
Thanks for any info - if you need more detail, I'd be happy to provide it.

Formatting XML files in eclipse

When i try to format a xml file in eclipse it puts each of the fields on a new line. instead i want each property to be on one line. for e.g. now when i press CTRL+SHFT+F, eclipse formats it like this.
<hibernate-mapping package="com.server.entities">
<class
name="Branch"
table="Branch"
>
<meta attribute="sync-DAO">false</meta>
<id name="Id"
type="java.lang.Long"
column="id"
>
<generator class="native"/>
</id>
<property
name="Created"
column="created"
type="timestamp"
not-null="false"
length="23"
/>
<property
name="LastUpdated"
column="lastUpdated"
type="timestamp"
not-null="false"
length="23"
/>
<property
name="CreatedBy"
column="createdBy"
type="java.lang.Long"
not-null="false"
length="19"
/>
but what i want is
<hibernate-mapping package="com.kaizen.report.server.entities">
<class name="Branch" table="Branch">
<meta attribute="sync-DAO">false</meta>
<id name="Id" type="java.lang.Long" column="id">
<generator class="native"/>
</id>
<property name="Created" column="created" type="timestamp" not-null="false" length="23"/>
If you're using the XML Editor from eclipse.org, go tot he XML Editor preference page and change the options to allow much longer lines and to not split multiple attributes each onto new lines.