留言板
How to create customField for DDM Structure?
d ll,修改在10 年前。
How to create customField for DDM Structure?
Regular Member 帖子: 158 加入日期: 11-12-12 最近的帖子
lfr 6.2.
Hook:
1. edit dynamic_data_mapping/js/main.js
add
result:
2. edit dynamic_data_mapping/custom_fields.jspf
add FormBuilderTypes['ddm-customfield'] = DDMNumberFieldCustom;
AND
3. edit dynamic_data_lists/js/main.js
AND
4. ROOT/dtd/liferay-ddm-structure_6_2_0.xsd
What I have missed?
Error: Please enter a valid XML schema definition.
Hook:
1. edit dynamic_data_mapping/js/main.js
add
{
hiddenAttributes: MAP_HIDDEN_FIELD_ATTRS.DEFAULT,
iconClass: 'icon-fb-text-box',
label: Liferay.Language.get('customfield'),
type: 'ddm-customfield'
}
result:
2. edit dynamic_data_mapping/custom_fields.jspf
add FormBuilderTypes['ddm-customfield'] = DDMNumberFieldCustom;
AND
var DDMNumberFieldCustom = A.Component.create(
{
ATTRS: {
dataType: {
value: 'number'
},
fieldNamespace: {
value: 'ddm'
}
},
EXTENDS: A.FormBuilderTextField,
NAME: 'ddm-customfield'
}
);
3. edit dynamic_data_lists/js/main.js
TYPE_EDITOR: {
'checkbox': A.CheckboxCellEditor,
'ddm-date': A.DateCellEditor,
'ddm-decimal': A.TextCellEditor,
'ddm-integer': A.TextCellEditor,
'ddm-number': A.TextCellEditor,
'ddm-customfield': A.TextCellEditor,
'radio': A.RadioCellEditor,
'select': A.DropDownCellEditor,
'text': A.TextCellEditor,
'textarea': A.TextAreaCellEditor
}
AND
else if ((type === 'ddm-decimal') || (type === 'ddm-integer') || (type === 'ddm-number') || (type === 'ddm-customfield')) {
config.outputFormatter = function(value) {
var number = A.DataType.Number.parse(value);
var numberValue = STR_EMPTY;
if (Lang.isNumber(number)) {
numberValue = number;
}
return numberValue;
};
4. ROOT/dtd/liferay-ddm-structure_6_2_0.xsd
<xs:simpletype name="type">
<xs:restriction base="xs:string">
<xs:enumeration value="checkbox" />
<xs:enumeration value="ddm-date" />
<xs:enumeration value="ddm-decimal" />
<xs:enumeration value="ddm-documentlibrary" />
<xs:enumeration value="ddm-integer" />
<xs:enumeration value="ddm-link-to-page" />
<xs:enumeration value="ddm-number" />
<xs:enumeration value="ddm-customfield" />
<xs:enumeration value="ddm-paragraph" />
<xs:enumeration value="ddm-separator" />
<xs:enumeration value="ddm-text-html" />
<xs:enumeration value="fieldset" />
<xs:enumeration value="option" />
<xs:enumeration value="radio" />
<xs:enumeration value="select" />
<xs:enumeration value="text" />
<xs:enumeration value="textarea" />
<xs:enumeration value="wcm-image" />
</xs:restriction>
</xs:simpletype>
What I have missed?
Error: Please enter a valid XML schema definition.
Fabio De Pra,修改在10 年前。
RE: How to create customField for DDM Structure?
New Member 帖子: 24 加入日期: 13-11-4 最近的帖子
Hi,
I had the same issue.
The validator load the DTD from http://www.liferay.com/dtd/liferay-ddm-structure_6_2_0.xsd.
If you want to load yuour custom DTD you have to override this bean definition
in util-spring.xml.
Create an ext-plugin, create docroot/WEB-INF/ext-impl/src/META-INF/ext-spring.xml and add the following code:
I had the same issue.
The validator load the DTD from http://www.liferay.com/dtd/liferay-ddm-structure_6_2_0.xsd.
If you want to load yuour custom DTD you have to override this bean definition
<bean id="com.liferay.portlet.dynamicdatamapping.util.DDMXML" class="com.liferay.portlet.dynamicdatamapping.util.DDMXMLImpl">
<property name="XMLSchema">
<bean class="com.liferay.portal.xml.XMLSchemaImpl">
<property name="schemaLanguage" value="http://www.w3.org/2001/XMLSchema" />
<property name="systemId" value="http://www.liferay.com/dtd/liferay-ddm-structure_6_2_0.xsd" />
</bean>
</property>
</bean>
in util-spring.xml.
Create an ext-plugin, create docroot/WEB-INF/ext-impl/src/META-INF/ext-spring.xml and add the following code:
<!--?xml version="1.0"?-->
<beans default-destroy-method="destroy" default-init-method="afterPropertiesSet" xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<bean id="com.liferay.portlet.dynamicdatamapping.util.DDMXML" class="com.liferay.portlet.dynamicdatamapping.util.DDMXMLImpl">
<property name="XMLSchema">
<bean class="com.liferay.portal.xml.XMLSchemaImpl">
<property name="schemaLanguage" value="http://www.w3.org/2001/XMLSchema" />
<property name="systemId" value="http://localhost:8080/dtd/liferay-ddm-structure_6_2_0.xsd" />
</bean>
</property>
</bean>
</beans>
d ll,修改在10 年前。
RE: How to create customField for DDM Structure?
Regular Member 帖子: 158 加入日期: 11-12-12 最近的帖子
Thank you very much!
The next question:
How to change handler "image"?
Currently returns '<img alt="adress" src="${ad3336.getData()}" />'
I want to change to '<img alt="adress" src="${ad3336.getData()}" data-data1="qqqqqqqqqqq" data-data2="wwwwwwwww" data-data3="eeeeeeeeeeee" />'
The next question:
var WCMImageField = A.Component.create(
{
ATTRS: {
dataType: {
value: 'image'
},
How to change handler "image"?
Currently returns '<img alt="adress" src="${ad3336.getData()}" />'
I want to change to '<img alt="adress" src="${ad3336.getData()}" data-data1="qqqqqqqqqqq" data-data2="wwwwwwwww" data-data3="eeeeeeeeeeee" />'
d ll,修改在10 年前。
RE: How to create customField for DDM Structure?
Regular Member 帖子: 158 加入日期: 11-12-12 最近的帖子
On this side, I'm in a dead end:
and on this side too (/dynamic_data_mapping/edit_template_display.jspf):
until the trail leads to com.liferay.portal.template.TemplateContextHelper.java
Where is the damn processor wcm-image?
P.S. for field SELECT data are taken from /html/js/aui/aui-form-builder-field-multiple-choice/aui-form-builder-field-multiple-choice-min.js
var WCMImageField = A.Component.create(
{
ATTRS: {
dataType: {
value: 'image'
},
fieldNamespace: {
value: 'wcm'
}
},
EXTENDS: A.FormBuilderField,
NAME: 'wcm-image',
prototype: {
getHTML: function() {
return TPL_WCM_IMAGE;
}
}
}
);
FormBuilderTypes['adress'] = WCMImageField;
and on this side too (/dynamic_data_mapping/edit_template_display.jspf):
<%
long templateHandlerClassNameId = ddmDisplay.getTemplateHandlerClassNameId(template, classNameId);
Map<string, templatevariablegroup> templateVariableGroups = TemplateContextHelper.getTemplateVariableGroups(templateHandlerClassNameId, classPK, language, locale);
for (TemplateVariableGroup templateVariableGroup : templateVariableGroups.values()) {
for (TemplateVariableDefinition templateVariableDefinition : templateVariableGroup.getTemplateVariableDefinitions()) {
String[] dataContentArray = _getDataContentArray(templateVariableDefinition, language);
%>
data-content1="<%= HtmlUtil.escapeAttribute(dataContentArray[0]) %>"
</string,>
until the trail leads to com.liferay.portal.template.TemplateContextHelper.java
Where is the damn processor wcm-image?
P.S. for field SELECT data are taken from /html/js/aui/aui-form-builder-field-multiple-choice/aui-form-builder-field-multiple-choice-min.js
Prasanta Bhuyan,修改在10 年前。
RE: How to create customField for DDM Structure?
New Member 发布: 1 加入日期: 12-5-3 最近的帖子
Instead of modifying the schema and hosting it somewhere you could take a shortcut like this. But you have to understand the obvious risk in here.
#
# Set this property to false to disable XML validation in the portal. XML
# validation should only be disabled if validation cannot be performed
# because the servers hosting the external DTD or XSD files are not
# available.
#
# Disabled in order to add custom fields(length validation) to content structures
#
xml.validation.enabled=false
#
# Set this property to false to disable XML validation in the portal. XML
# validation should only be disabled if validation cannot be performed
# because the servers hosting the external DTD or XSD files are not
# available.
#
# Disabled in order to add custom fields(length validation) to content structures
#
xml.validation.enabled=false
Michal Sima,修改在9 年前。
RE: How to create customField for DDM Structure?
New Member 帖子: 24 加入日期: 13-2-27 最近的帖子
How should liferahook.xml look like?
I have the following structure of folders:
webapp/ROOT/dtd/liferay-ddm-structure_6_2_0.xsd
webapp/WEB-INF/ext-impl/src/META-INF/ext-spring.xml
webapp/custom_jsps/html/portlet/dynamic_data_mapping/js/main.js
webapp/custom_jsps/html/portlet/dynamic_data_mapping/custom_fields.jspf
But can't make new property works, I get "XML scheme incorrect" error.
I guess .dtd is not overwritten as in liferay-hook.xml I have only:
<hook>
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
</hook>
Cheers!
I have the following structure of folders:
webapp/ROOT/dtd/liferay-ddm-structure_6_2_0.xsd
webapp/WEB-INF/ext-impl/src/META-INF/ext-spring.xml
webapp/custom_jsps/html/portlet/dynamic_data_mapping/js/main.js
webapp/custom_jsps/html/portlet/dynamic_data_mapping/custom_fields.jspf
But can't make new property works, I get "XML scheme incorrect" error.
I guess .dtd is not overwritten as in liferay-hook.xml I have only:
<hook>
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
</hook>
Cheers!
Tushar Patel,修改在8 年前。
RE: How to create customField for DDM Structure?
New Member 帖子: 12 加入日期: 14-8-26 最近的帖子
Hi
I want to create custom field Date and Time. Can you guide me how to do that?
I want to create custom field Date and Time. Can you guide me how to do that?
Tushar Patel,修改在8 年前。
RE: How to create customField for DDM Structure?
New Member 帖子: 12 加入日期: 14-8-26 最近的帖子
Hi,
I want to create custom field date and time in DDM structure. Can you help me?
I want to create custom field date and time in DDM structure. Can you help me?