



Product
This sample is for web content such as Product profile or Product description. It consists of fields such as Title, Description, Categories, SKU and Product Pictures with optional Thumbnails. It reuses the web script we used for getting a dynamic list of categories based on the web form type.
One new feature which is available after Alfresco Enterprise 2.2 and Alfresco Lab 3 is that the File Picker widget can be optionally restricted in two additional ways:
For this example, we configure two additional appearance options for the file picker widget. In the first folder_restricted_sample_image_picker option, we set the relative path as content/product/pictures to limit the product image selection to path like ‘
For the second additional appearance option search_restricted_sample_file_picker, we will limit thumbnail file picker contents to the results of the pre-configured public search sample-search. We should also note that the search is Lucene based and it will only query content of the staging sandbox. The public saved search is actually stored as an XML document in Alfresco DM repository. Therefore we can modify it with any Luncene query that is supported by Alfresco WCM search.
<widget xforms-type="xf:upload" appearance="search_restricted_sample_file_picker" javascript-class-name="alfresco.xforms.FilePicker"> <param name="config_search_name">sample-search</param> </widget> <widget xforms-type="xf:upload" appearance="folder_restricted_sample_image_picker" javascript-class-name="alfresco.xforms.FilePicker"> <param name="selectable_types">wcm:avmcontent,wcm:avmfolder</param> <param name="folder_restriction">content/product/pictures</param> </widget>
(Custom Configurations for File Picker )
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://www.alfresco.org/alfresco/product"
targetNamespace="http://www.alfresco.org/alfresco/product"
xmlns:alf="http://www.alfresco.org"
elementFormDefault="qualified">
<!-- Imports -->
<xs:include schemaLocation="webscript://demo/wcm/schema/catgory?
ticket=${ticket}%26storeid=${storeid}%26form=product" />
<!-- Limited Size String Type -->
<xs:simpleType name="LimitedSizeNormalizedStringType">
<xs:restriction base="xs:normalizedString">
<xs:minLength value="5"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
<!-- Common Properties Type -->
<xs:complexType abstract="true" name="CommonPropertiesType">
<xs:sequence>
<xs:element name="Name" type="p:LimitedSizeNormalizedStringType"
nillable="false" minOccurs="1"
maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:label>${name}</alf:label>
<alf:alert>
Length of Title should be between 5 and 50.
</alf:alert>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Description" type="xs:string" nillable="false"
minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:label>${description}</alf:label>
<alf:appearance>compact</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="SKU" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:label>${sku}</alf:label>
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:normalizedString">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Category" type="p:catgory-list"
nillable="false" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ImageType">
<xs:sequence>
<xs:element name="File" type="xs:anyURI">
<xs:annotation>
<xs:appinfo>
<alf:label>${file}</alf:label>
<alf:appearance>
folder_restricted_sample_image_picker
</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Thumbnail" type="xs:anyURI"
minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<alf:label>${thumbnail}</alf:label>
<alf:appearance>
search_restricted_sample_file_picker
</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductType">
<xs:complexContent>
<xs:extension base="p:CommonPropertiesType">
<xs:sequence>
<xs:element name="ImageFile" type="p:ImageType"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Root Element for product -->
<xs:element name="Product" type="p:ProductType"/>
</xs:schema>
(Schema for Product)
————————————————————





































