cancel
Showing results for 
Search instead for 
Did you mean: 

How setup spring surf form with dinamic variables from a properties file

4535992
Star Collaborator
Star Collaborator

Hi i have a spring surf form extensions , in the specific a dropdown where i want to put the value on a dynamic way reading the value from alfresco or a properties file here the myaction-share-amp-actions-extension-modules:

<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>

or in alternative

<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">${valueX}</control-param>

                                 <!-- where valueX= "value1,value2,value3" -->

                                      </control>
 </field>

....................

                            </appearance>
                        </form>
                    </forms>
                </config> 

...........................................

</extension>

And the properties file is set on the share-config.xml file:

<bean id="configurazioniBeanCompletoLocale" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath*:it/test/properties/alfresco.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="true" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
        <property name="searchSystemEnvironment" value="false"/>           
        <property name="propertiesPersister">
            <bean class="org.alfresco.config.AlfrescoPropertiesPersister" />
        </property>
    </bean>

And the file alfresco.properties contains:

value1=hello

value2=hi

value3=goodbye

valueX=hello,hi,goodbye

in alternative i can accept to use property of a specific file on alfresco if anyone know how to do foe eaxmple :

Reapository/Data Dicitopnary/configuration.txt with properties of a aspect "Configurator" with properties:

value1=hello

value2=hi

value3=goodbye

valueX=hello,hi,goodbye

 

There is a way to do one of this ?

1 ACCEPTED ANSWER

4535992
Star Collaborator
Star Collaborator

The only solution i find it's to build your own ftl template and use the javascript with remote call to alfresco for customize your form with specific data.

View answer in original post

1 REPLY 1

4535992
Star Collaborator
Star Collaborator

The only solution i find it's to build your own ftl template and use the javascript with remote call to alfresco for customize your form with specific data.