cancel
Showing results for 
Search instead for 
Did you mean: 

Custom forms in share

jnjp28
Champ in-the-making
Champ in-the-making
Hi,

i'm trying to develop a custom form in a Share AMP.

I have some problems with my AMP's structure.

I took Dod AMP Share project as an AMP example. I think my custom context is not recognized by spring :

I put "custom-slingshot-crc-context.xml" in "config/alfresco/web-extension/custom-slingshot-crc-context.xml" in my AMP.

This is the code of my custom context :


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>     
   <bean id="crc.custom.config" class="org.springframework.extensions.config.ConfigBootstrap" init-method="register">
      <property name="configService" ref="web.config" />
      <property name="configs">
         <list>
             <value>classpath:alfresco/crc-form-config.xml</value>            
         </list>
      </property>
   </bean>  
</beans>

I put "crc-form-config.xml" file in "config/alfresco/crc-form-config.xml" in my AMP

Then this is the code of my crc-form-config.xml file :


<alfresco-config>
<config evaluator="node-type" condition="crc:content">
        <forms>
            <form>
                <field-visibility>
                   <show id="cm:typeDoc" force="true"/>                   
                    <show id="cm:directionDeleguee" force="true"/>
                    <show id="cm:author" force="true" />
                    <show id="crc:organization" />
                    <show id="cm:name" />
                    <show id="cm:title" />
                    <show id="cm:description" force="true" />
                    <show id="crc:dateOfEvent" />
                    <show id="cm:eventNature" force="true"/>                   
                    <show id="cm:created" for-mode="view" />
                    <show id="cm:modified" for-mode="view" />
                    <show id="crc:state" />
                    <show id="crc:sendAlert" for-mode="edit" force="true"/>
                </field-visibility>
                <appearance>
                    <field id="cm:typeDoc" label-id="form.field.crc.typeDoc" mandatory="true">
                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">
                            <control-param name="remoteOptions">listeDocTypes</control-param>
                        </control>
                    </field>
                   
                    <field id="cm:directionDeleguee" label-id="form.field.crc.dgd" mandatory="true">
                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">
                            <control-param name="remoteOptions">listeDirectionsDelegueesPiloteNiveau2</control-param>
                        </control>
                    </field>
                    <field id="cm:author" mandatory="true" />
                    <field id="cm:title" mandatory="true">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>
                    <field id="crc:dateOfEvent" label-id="form.field.crc.dateOfEvent">
                        <control template="/org/alfresco/components/form/controls/date.ftl">
                            <control-param name="showTime">false</control-param>
                        </control>
                    </field>
                    <field id="cm:eventNature" label-id="form.field.crc.eventNature">
                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">
                            <control-param name="remoteOptions">listeNatureEvenement</control-param>
                        </control>
                    </field>
<!–                    <field id="crc:state" label-id="form.field.crc.state">–>
<!–                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">–>
<!–                            <control-param name="remoteOptions">listeDocStates</control-param>–>
<!–                        </control>–>
<!–                    </field>–>
                    <field id="crc:state" label-id="form.field.crc.state">
                        <control template="/org/alfresco/components/form/controls/displayViewHiddenEdit.ftl"/>
                    </field>

                    <field id="crc:sendAlert" label-id="form.field.crc.sendAlert" />
                   
                    <field id="crc:organization" label-id="form.field.crc.organization" />
                </appearance>
            </form>
           
            <form id="doclib-inline-edit">
                <field-visibility>
                   <show id="cm:typeDoc" force="true"/>
                    <show id="cm:directionDeleguee" force="true"/>
                    <show id="cm:author" force="true" />
                    <show id="crc:organization" />
                    <show id="cm:name" />
                    <show id="cm:title" />
                    <show id="cm:description" force="true" />
                    <show id="crc:dateOfEvent" />
                    <show id="cm:eventNature" force="true"/>
                    <show id="cm:content" force="true" />
                    <show id="cm:created" for-mode="view" />
                    <show id="cm:modified" for-mode="view" />
                    <show id="crc:state" for-mode="view"/>
                    <show id="crc:sendAlert" for-mode="edit" force="true"/>
                </field-visibility>
                <appearance>
                    <field id="cm:content">
                        <control>
                            <control-param name="editorAppearance">explorer</control-param>
                            <control-param name="forceEditor">true</control-param>
                        </control>
                    </field>
                    <field id="cm:typeDoc" label-id="form.field.crc.typeDoc" read-only="true">
                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">
                            <control-param name="remoteOptions">listeDocTypes</control-param>
                        </control>
                    </field>
                    <field id="cm:directionDeleguee" label-id="form.field.crc.dgd">
                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">
                            <control-param name="remoteOptions">listeDirectionsDelegueesPiloteNiveau2</control-param>
                        </control>
                    </field>
                    <field id="cm:author" mandatory="true" />
                    <field id="cm:title" mandatory="true">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>
                    <field id="crc:dateOfEvent" label-id="form.field.crc.dateOfEvent">
                        <control template="/org/alfresco/components/form/controls/date.ftl">
                            <control-param name="showTime">false</control-param>
                        </control>
                    </field>
                    <field id="cm:eventNature" label-id="form.field.crc.eventNature">
                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">
                            <control-param name="remoteOptions">listeNatureEvenement</control-param>
                        </control>
                    </field>
<!–                    <field id="crc:state" label-id="form.field.crc.state">–>
<!–                        <control template="/org/alfresco/components/form/controls/selectoneremote.ftl">–>
<!–                            <control-param name="remoteOptions">listeDocStates</control-param>–>
<!–                        </control>–>
<!–                    </field>–>
                    <field id="crc:state" label-id="form.field.crc.state">
                        <control template="/org/alfresco/components/form/controls/displayViewHiddenEdit.ftl"/>
                    </field>
                    <field id="crc:sendAlert" label-id="form.field.crc.sendAlert" />
                   
                    <field id="crc:organization" label-id="form.field.crc.organization" />
                </appearance>
            </form>
        </forms>
    </config>
</alfresco-config>

Thanks for your repplies
1 REPLY 1

jnjp28
Champ in-the-making
Champ in-the-making
I renamed my custom context. "custom-web-framework-application-context.xml" and it's ok Smiley Wink

Share load now my context  Smiley Very Happy  Smiley Very Happy