如何安装春天冲浪形式Alfresco与属性文件中的动态变量共享
嗨,我已经写了一个软件alfresco的春天冲浪形式扩展,在具体的下拉列表中,我想把值的动态读取值从alfresco
或属性文件在这里myaction-share-amp-actions-extension-modules
:如何安装春天冲浪形式Alfresco与属性文件中的动态变量共享
<extension>
.................................................................
<config evaluator="string-compare" condition="signed">
<forms>
<form>
<field-visibility>
............................................
<show id="my_form_sign_firma.tipo"/>
...................................
</field-visibility>
<appearance>
.....................
<field id="my_form_sign_firma.tipo" label-id="property.form.sign.my_form_sign_firma.tipo">
<control template="/org/alfresco/components/form/controls/selectone.ftl">
<control-param name="options">${value1},${value2},${value3}</control-param>
</control>
</field>
....................
或替代
....................
<field id="my_form_sign_firma.tipo" label-id="property.form.sign.my_form_sign_firma.tipo">
<control-param name="options">${valueX}</control-param>
<!-- where valueX= "value1,value2,value3" -->
</control>
</field>
....................
</appearance>
</form>
</forms>
</config>
...........................................
</extension>
而对于负载bean的属性被设置在share-config.xml
文件:
<bean id="configurazioniBeanCompletoLocale" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:it/test/properties/myalfresco.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="propertiesPersister">
<bean class="org.alfresco.config.AlfrescoPropertiesPersister" />
</property>
</bean>
而且属性文件被设置在share-config.xml
文件:
classpath*:it/test/properties/myalfresco.properties
和文件myalfresco.properties
包含:
value1=hello
value2=hi
value3=goodbye
valueX=hello,hi,goodbye
在替代我可以接受使用特定文件的属性在户外如果有人知道如何做例如:
Repository/Data Dictionary/configuration.txt
一个方面,“配置”具有属性的属性:
value1=hello
value2=hi
value3=goodbye
valueX=hello,hi,goodbye
有办法做到这些吗?
UPDATE:
现在我会尽量写在纸上的这个环节上完整的解决方案: https://community.alfresco.com/thread/233246-how-setup-spring-surf-form-with-dinamic-variables-from-a-properties-file
在这里,你可以找到类似这样的情况下,另外一个例子:https://community.alfresco.com/thread/209460-dynamic-selectone-in-alfresco-share
至于说通过Vikash,我建议你创建自定义表单控件(把它放在src/main/amp/config/alfresco/web-extension/site-webscripts/org /alfresco /components/form/controls/mycontrol.ftl
文件夹)。
在里面,你会调用你创建的一个自定义webscript(它会得到你的文件的值)。这是微不足道的部分,我不觉得有必要向你展示一个例子。
你可以看一下这个(简体),例如为FTL部分:
...
<select id="${fieldHtmlId}" name="${field.name}" tabindex="0"
<#if field.description??>title="${field.description}"</#if>
</select>
...
<script type="text/javascript">//<![CDATA[
YAHOO.util.Event.onContentReady("${fieldHtmlId}", function()
{
Alfresco.util.Ajax.jsonGet({
url: encodeURI(Alfresco.constants.PROXY_URI + '/myserviceuri'),
successCallback:
{
fn: function loadWebscript_successCallback(response, config)
{
var obj = eval('(' + response.serverResponse.responseText + ')');
if (obj)
{
for (i = 0; i < obj.length; i++) {
var newOption = document.createElement('option');
newOption.value = obj[i].id;
newOption.text = obj[i].name;
YAHOO.util.Dom.get("${fieldHtmlId}").options.add(newOption);
}
}
}
}
});
}, this);
//]]></script>
然后,您可以使用这种方式:
<field id="my_form_sign_firma.tipo" label-id="property.form.sign.my_form_sign_firma.tipo">
<control template="/org/alfresco/components/form/controls/mycontrol.ftl">
</control>
</field>
你可以使用您的自定义ftl文件作为窗体控件
以共享的形式给您的自定义ftl文件提供模板路径
<form>
<appearance>
<field id="cm:name">
<control template="/my-textfield.ftl" />
</field>
</appearance>
</form>
请参阅本Documentation
是的,我已经试过了,但我可以检索.ftl文件中的属性文件?我的意思是我没有找到一个工作的JavaScript代码来检索从我的template.ftl文件属性,如果你能告诉我一个例子,可以是完美的解决方案。 – 4535992