Hybris Cockpit - Populate a Drop-down list with model data items - zk

How to populate a Drop-Down list created in a custom wizard in the Hybris cockpit with the model data items?
The wizard is designed with ZK framework components (in a .zul extension file).

To get a drop-down list in Hybris Cockpit Wizards, you need to call the Hybris native editor bean named shortListEditor in the MyItem xml configuration file. To go more further in the solution you need to :
Locat the wizard xml configuration file, often named wizardConfig_MyItem.xml.
Add attribute (the myAttribute should be a List or Enum) to MyItem structure.
Add xml configuration for your attribute :
If myAttribute a List add : <property qualifier='MyItem.myAttribute' editorCode='shortListEditor'>
If myAttribute an Enum add : <property qualifier='MyItem.myAttribute' editorCode='shortListEditor'>

Related

Populate AEM forms dropdown field using data from a JSON file

I have a JSON file - options.json which looks like this -
{
"option1" : "abc",
"option2" : "xyz"
}
I have saved this file in AEM's DAM.
I want AEM form's dropdown list to be populated using the values from this file.
How do I achieve this?
Please note - entering path of this file in the Items Load Path field doesnt work.
Based on the information you provided I assume that you want to do this in the Adobe product called AEM Forms.
Solution outline:
Create a REST service (could be a simple Servlet) that exposes the contents of the file as Json.
Create a new AEM Forms DataSource and configure your REST service.
Create a Form Data Model.
Configure Form Data Model to use DataSource.
Use Form Data Model in your Form component.
You can find the documentation for this here:
https://helpx.adobe.com/experience-manager/kt/forms/using/creating-datasource-feature-video-use.html
https://helpx.adobe.com/experience-manager/6-3/forms/using/data-integration.html
Google will give you more links and examples.

How to activate Fluid (TYPO3) autocompletion in Netbeans?

I did what it said here: Extbase and Fluid Autocompletion
In NetBeans right-click your Extension project and choose Properties
in the opened context menu to edit the project properties. Select the
category PHP Include Path and use Add Folder... to add the directories
of Extbase and Fluid.
So I added the Fluid and Extbase Folders which I previously copied onto my computer from the Server at /var/www/typo3_src/typo3_src-6.2.25/typo3/sysext:
but it didn't work - here's my Project:
And here is fluid stuff that the editor still doesn't recognize:
What am I doing or thinking wrong?
Found info here, works for me:
It's an old topic but I have a trick so that you can add Auto-complete
function for fluid, vhs, flux.
First of all, download the XSD schema files from here :
https://fluidtypo3.org/viewhelpers/fluid/master.html put them
somewhere locally.
Next step, in Netbeans, go to menu Tools > DTD and XML Schemas, add
your 3 DTD in user catalog :
Flux : Public ID = http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers URI
= path to your flux XDS file
Fluid : Public ID = http://typo3.org/ns/TYPO3/Fluid/ViewHelpers URI =
path to your fluid XDS file
Vhs : Public ID = http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers URI =
path to your flux VHS file
Next, in project properties, go to 'testing' menu and add the folder
where you stored your DTD.
Now, in your Project > Test Files, add a new XML Document and choose
"XML Schema-Constrained Document" on next step, click the button
'Browse' and By File > Your Project > Test Files and select import for
all the xsd schema files.
Then, change the prefix f for fluid, flux for flux and vhs for vhs
choose fluid as primary and finish.
A file is created with this content :
And into the section <f:alias>, you have the auto-completion for
fluid, vhs and flux.
<f:alias
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:f='http://typo3.org/ns/TYPO3/Fluid/ViewHelpers'
xmlns:vhs='http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers'
xmlns:flux='http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers'
xsi:schemaLocation='http://typo3.org/ns/TYPO3/Fluid/ViewHelpers file:/home/florian/Documents/Docs/Netbeans/Autocomplete%20Fluid/Schemas/Fluid.xsd
http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers file:/home/florian/Documents/Docs/Netbeans/Autocomplete%20Fluid/Schemas/Vhs.xsd
http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers file:/home/florian/Documents/Docs/Netbeans/Autocomplete%20Fluid/Schemas/Flux.xsd'>
Auto-completion here
</f:alias>
http://netbeans-org.1045718.n5.nabble.com/Schemas-for-code-completion-with-xsd-tt5752294.html#none
take files from https://fluidtypo3.org/schemas/
Some more info Use Netbeans to Create Sample XML from XSD
From a project that contains the .xsd:
Click New File on the tool bar or File > New File from the menu
Choose XML > XML Document
Name your file, click next
Choose XML Schema-Constrained Document, click next
Click the Browse button and use By File to navigate to the .xsd
Click the Import check box beside the file name, click next
Review the options available and click Finish to generate
You can use more than one .xsd file to generate the .xml. In this case it will use whichever .xsd file you choose as Primary to resolve any conflicts.

How does my extension read bodytext fields from tt_content in TYPO3 CMS 7.6?

I'm writing a TYPO3 extension using TYPO3 CMS 7.6.x LTS and Extension Builder. One of my extension's tasks is to scan through the "header" and "bodytext" fields of TYPO3's tt_content table; match specific text patterns in "bodytext"; parse the found text; and put the resulting data into my extension's log table along with a label from the tt_content "header" field.
"Using Foreign Data Sources" in "Developing TYPO3 Extensions with Extbase and Fluid" at [ https://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/4-use-foreign-data-sources.html ] talks about putting data INTO tt_address using a TypoScript mapping. Instead, I'm reading data FROM tt_content, and would rather stay within PHP in the extension.
Using the graph in Foreign Key to TYPO3 Frontend User as an example, I added a second model to my extension's domain model in Extension Builder. I made a "TtContent" model, and used its "Domain object settings" to "map to existing table", its entry being "tt_content". I did NOT enter a value into the "extend using model class" field. I made a "relation" field in my Log model, and ran a wire connected from my Log:ttContent relation field to the title bar of my TtContent model. When I then clicked "Save", Extension Builder replied: "The configuration for table "tt_content" is not compatible with extbase. You have to configure it yourself if you want to map to this table (Error 606)". I don't understand this error message.
In Extension Builder, do I make a relation in my Log model to an existing external class? If so, which external class do I use? Or, do I make a model of tt_content in Extension Builder, and somehow get through that error 606? It shouldn't seem hard to do, because I want to read from an existing table already in TYPO3.
Solution: Create an Extbase model and a repository representing the existing tt_content table, then write a TypoScript property mapping.
In TYPO3 Extension Builder's domain modeller, add a model called "Content" or some name that reminds you of the tt_content table. In the "domain object settings" part of your Content model, put "tt_content" in the "map to existing table" box. Nevermind the "extend existing model class" box, because Extbase doesn't have such a class for tt_content.
Also in the domain object settings, set object type to "Entity", check the "is aggregate root" box, and uncheck the "add deleted field", "add hidden field", "add starttime/endtime fields", and "enable categorization" boxes. Setting the object type to "entity" and checking the "is aggregate root?" box causes Extension Builder to create a repository for your Content model.
Add properties to your Content model that represent the columns you want to access in the tt_content database table. In my Content model, I added only "header" and "bodytext" properties.
Note: You need not add TYPO3's uid or pid properties to the Content model. These properties have been extended from the parent \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject class.
Click "Save" in Extension Builder to save your new domain model. You will receive a message: "Warning! The configuration for table "tt_content" is not compatible with extbase. You have to configure it yourself if you want to map to this table (Error 606). Do you want to save anyway?" Yes, save anyway. Extension Builder will respond, "Success. The Extension was saved. Your Extension is not installed yet." Exit Extension Builder.
Note: If you go through several modelling iterations in Extension Builder, you may find artifacts in the extension's final code, left over from your earlier iterations. Extension Builder overwrites some of your extension areas, but leaves other areas alone. See the Extension Builder configuration reference at [ https://docs.typo3.org/typo3cms/extensions/extension_builder/Configuration/Index.html ].
Use Extbase table mapping to configure and thereby access content from the TYPO3 tt_content table. Do this configuration with TypoScript "config.tx_extbase.persistence.classes" mapping parameters in the "typo3conf/ext/yourextensionkey/ext_typoscript_setup.txt" file. Extension Builder created this file when you saved your domain model. This is the configuring mentioned in Error 606.
See the code example in "Using Foreign Data Sources" at [ https://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/4-use-foreign-data-sources.html ]. This TypoScript code example defines the mapping lines themselves. You may wish to use "config.tx_extbase" instead of "plugin.tx_myextension". The next page, "Modeling the Class Hierarchy" at [ https://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/5-modeling-the-class-hierarchy.html ], has a code example for "config.tx_extbase"; but it doesn't show the mapping lines themselves.
In my situation, I added TypoScript instructions in ext_typoscript_setup.txt to map the "header" and "bodytext" columns. I also deleted the recordType = Tx_Myextensionkey_Content line that Extension Builder wrote, because I want to read tt_content records that already exist, not records made by my extension.
config.tx_extbase{
persistence{
classes{
Mynamespace\Myextensionkey\Domain\Model\Content {
mapping {
tableName = tt_content
columns {
header.mapOnProperty = header
bodytext.mapOnProperty = bodytext
}
}
}
}
}
}
My TYPO3 extension can now read from tt_content.
Note: Giving a value to recordType in ext_typoscript_setup.txt causes the Extbase persistence layer to search for that one value in the underlying tt_content.CType column. Extbase does this through its \TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager getConfiguration() $frameworkConfiguration array, and its \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory buildDataMapInternal() function. As of this writing, you cannot use a wildcard character such as * or % in your recordType value; and you cannot give a value list such as text, textmedia.

How to make drop-down values to be easily authorable content in CQ

I was trying to understand how can we make drop-down values in dialog box easily authorable?
Select lists in dialogs can load their options dynamically from anywhere, so long as they are provided as an array of values in JSON format (from the docs):
[
{
value: "pink",
text: "Pink",
qtip: "Real Pink"
}
]
So one solution would be to:
Create a new template that would allow an editor to add/remove values from a list — make this editable for content authors as per any other content (e.g. using the page properties, or components that you can drag onto that template).
Create a Servlet that will parse those values & output them in the expected JSON.
Register that servlet, e.g. via a path (/bin/selectvalues).
Using the cqinclude xtype to load in your values:
i.e.
<select
type="select"
xtype="selection"
options="/bin/selectvalues"/>
If you are looking for a drop-in solution for this, take a look at http://adobe-consulting-services.github.io/acs-aem-commons/features/generic-lists.html. This supports easily authorable lists of name/value pairs which can be used (without writing additional code) in:
Classic UI Dialogs
Touch UI Dialogs
Touch UI Asset Metadata Editor

How to accomplish drop-down lists in KIE workbench?

I'm new to JBPM and am trying to wrap my head around a new project, and recently noticed that while trying to define some user task forms I couldn't find a form option for a drop-down list
At this point my knowledge of the technology is pretty small, and this seems like a strange limitation at first glance, which should have an easy work-around, but I'm having difficulty finding a quick and dirty solution.
Is this something I'd have to code in Eclipse, or something else?
The answer that #cego provides is correct for "hard-coded" values, if you want to load dynamic values (from a database for example) you can use the Select Box field type and configure it to use a SelectValuesProvider that calculates the combo values.
To create a SelectValuesProvider you should create a java project with a mvn dependency to:
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-form-modeler-api</artifactId>
</dependency>
Once you did that you can create your class that implements org.jbpm.formModeler.core.config.SelectValuesProvider. This interface provides two methods:
String getIdentifier(): should return a unique String that identifies this provider. This String will be shown on the Select Box configuration popup.
Map getSelectOptions(Field field, String value, FormRenderContext renderContext, Locale locale): This method have to return a Map containting the key, text that are going to be load on the Select box. The received parameters are:
Field field: the configuration of the field that is going to be evaluated.
String Value: the current value of the field
FormRenderContext renderContext: a class that contains all the information about the form that is rendered at that moment.
Locale locale: the locale in which is being rendered the form.
Once you've created this provider, you must compile your project and put the jar on the server classpath and restart it. After doing that you'll be able to create a form (or edit an existing one), add a Select Box field and choose your provider on the "Data provider" combo box.
Hope it helps, if you have any doubt please ask and I'll try to create an example.
Regards,
Pere
Ok, for old versions you can do it turning a textbox to a combobox using a RangeProvider. This is a very similar solution to the previous one.
First you should create java project with a mvn dependency to:
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-form-modeler-api</artifactId>
</dependency>
After that you have to create your RangeProvider class that implements org.jbpm.formModeler.api.model.RangeProvider and implement it's methods. As the SelectValuesProvider on the previous example this interface provides two methods:
- String getType(): A unique String to identify the provider
- Map getRangesMap(String namespace): This method have to return a Map containting the key, text that are going to be load on the combo box. It only receives a String parameter, it is an identifier that allows you to get all the information about the form that is being rendered.
Also you have to create a META-INF/beans.xml file to allow to lookup your provider via CDI (I missed this step on the previous example, sorry).
As the previous example, once you've created the provider you must compile your project and put the jar on the server classpath and restart it.
When the server is started you have to create a new form (or open an existing one), add a TextBox field, edit it's properties and write the string returned by your RangeProvider's getType method on the "Range value" property.
Save the field properties and if everything is fine the field would be rendered as a combobox showing the values returned by your provider.
To create a select element(drop-down list) look for "Setting a Range Formula" in this part of the documentation: http://docs.jboss.org/jbpm/v6.1/userguide/chap-formmodeler.html#sect-formmodeler-FormulasExpression