Start page / Template development / Forms / Input components / FS_LIST: Migration Guide / FS_LIST, Type INLINE → FS_CATALOG
FS_LIST, INLINE type → FS_CATALOG
Contents |
Please observe the following when converting FS_LIST to FS_CATALOG.
If data has been saved using FS_CATALOG and it becomes necessary to revert to FS_LIST at a later date (due to a different data format), FS_LIST will no longer be able to read and interpret this data.
Actions and Rules
In FS_LIST components, the editing options (such as “New”, “Edit”, and “Delete”) that must be provided are defined via the <ACTIONS>/<ACTION> tag on the Form tab. In FS_CATALOG, they are defined via the Rules tab.
Here, it should be noted that the display logic of the available ACTIONS is reversed. If one of the ACTIONS has been defined for FS_LIST, nothing needs to be done for FS_CATALOG. If an ACTION is missing in FS_LIST, this must be deliberately hidden for the FS_CATALOG input component.
The following ACTIONS for FS_LIST are automatically available in the FS_CATALOG input component. However, they can be deliberately hidden:
ADD / NEW / REMOVE / EDIT / DELETE
The following ACTIONS are automatically available and cannot be deactivated:
VIEW / UP / DOWN
The following ACTIONS are not supported by FS_CATALOG:
COPY / GOTO
Sample form
Form definition for the FS_LIST input component:
<FS_LIST name="IDENTIFIER" hFill="yes" rows="10">
<DATASOURCE type="inline" useLanguages="no" maxEntries="1">
<ACTIONS>
<ACTION name="ADD"/>
<ACTION name="REMOVE"/>
<ACTION name="UP"/>
<ACTION name="DOWN"/>
<ACTION name="EDIT"/>
</ACTIONS>
<COLUMNS>
<COLUMN show="no">#identifier</COLUMN>
</COLUMNS>
<LAYOUT>
<ADD component="toolbar" constraint="top"/>
<ADD component="overview" constraint="center"/>
<ADD component="singleview" constraint="bottom"/>
</LAYOUT>
<TEMPLATES source="sectiontemplates">
<TEMPLATE uid="mysections"/>
</TEMPLATES>
</DATASOURCE>
<LANGINFOS>
<LANGINFO lang="*" label="Edit sections"/>
</LANGINFOS>
</FS_LIST>
In this example, all buttons are allowed for FS_LIST except for “NEW”. This means that the “NEW” button must be hidden using a rule in the case of FS_CATALOG.
Form definition for the FS_CATALOG input component:
<FS_CATALOG name="IDENTIFIER" useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Dataset selection"/>
</LANGINFOS>
<TEMPLATES type="section">
<TEMPLATE uid="mysections"/>
</TEMPLATES>
</FS_CATALOG>
Rule definition for the FS_CATALOG input component:
<RULES>
<RULE when="ONLOCK">
<WITH>
<FALSE/>
</WITH>
<DO>
<PROPERTY name="NEW" source="IDENTIFIER"/>
</DO>
</RULE>
</RULES>
Labels
The labeling of inputs in an FS_LIST input component is modeled using the #item.IDENTIFIER inside the LABELS/LABEL tag. Inputs in an FS_CATALOG input component are not labeled inside the form definition; instead, they are labeled via a corresponding snippet definition. The snippet definition of the selected section/link templates is used for this purpose.
Height of the input component
In FS_LIST components, the height parameter relates to the height in pixels; in FS_CATALOG, it relates to the number of rows.
Number of entries
In FS_LIST components, the maxEntries parameter is used to determine how many entries are allowed to be added. In FS_CATALOG, this is done via a rule with the SIZE property.
Output
If entries are output using $CMS_FOR(...)$, the .getItem (or .item in Bean syntax) method call must be added in the case of FS_CATALOG:
FS_LIST
$CMS_FOR(VARIABLE, LISTNAME)$
$CMS_VALUE(VARIABLE.ELEMENT)$
$CMS_END_FOR$
In this example, LISTNAME is the identifier for the FS_LIST component and ELEMENT is the variable name for the required input component in the selected section or link template.
FS_CATALOG
$CMS_FOR(VARIABLE, LISTNAME)$
$CMS_VALUE(VARIABLE.item.ELEMENT)$
$CMS_END_FOR$
Example scripts
Script: Reading out FS_CATALOG
final FormData myFormData = section.getFormData();
final FormField myFsCatalogFormField = myFormData.get(lang, "st_myFsCatalog");
final Catalog myFsCatalog = (Catalog) myFsCatalogFormField.get();
final Iterator<Catalog.Card> cardIterator = myFsCatalog.iterator();
while (cardIterator.hasNext()){
final Catalog.Card card = cardIterator.next();
final Template sectionOrLinkTemplate = card.getTemplate();
final FormData formData = card.getItem();
Integer myNumber = (Integer) formData.get(lang, "st_number").get();
}
Script: Emptying FS_CATALOG
//Clear Catalog of all cards
myFsCatalog.clear();
Script: Generating a new CatalogCard
//Create new card
final FormsAgent formsAgent = context.requireSpecialist(FormsAgent.TYPE);
final Form form = formsAgent.getForm(sectionTemplate.getGomSource());
final FormData formData = form.createFormData();
final Catalog.Card newCard = myFsCatalog.create(sectionTemplate, formData);
myFsCatalog.add(newCard);
Use of system objects
The #sectionList system object is only used for the FS_LIST input component, INLINE type.
In the event of a migration from FS_LIST to FS_CATALOG, the #sectionList system object may also need to be migrated to #fs_catalog.
FS_LIST
Numbered output in the section template (HTML template set):
<CMS_HEADER />
$CMS_IF(!#index.isNull && !#sectionList.size.isNull)$
$CMS_VALUE(#index + 1)$/$CMS_VALUE(#sectionList.size)$:
$CMS_END_IF$
$CMS_VALUE(st_text)$
<br>
FS_CATALOG
Numbered output in the section template (HTML template set):
<CMS_HEADER />
$CMS_IF(!#index.isNull && !#fs_catalog.size.isNull)$
$CMS_VALUE(#index + 1)$/$CMS_VALUE(#fs_catalog.size)$:
$CMS_END_IF$
$CMS_VALUE(st_text)$
<br>