Home

Alfresco share, which provides collaborative platform on top of Alfresco, and can also be used as an interface for Alfresco repository. The main building block for Alfresco share is the form. There is a form-service in the back end which handles the form rendition. As Alfresco share heavily relies on forms during customization, we always come across requirements where we need to create many Alfresco share forms. As far as normal forms, we want to design it very easily but sometimes we need to show those forms in popups after clicking.

The main steps involved in creating popup forms are as follows:

Step 1:

Configure action config in share-config-custom.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<action id="document-customaction" type="javascript" icon="customicon"
 label="actions.document.customaction">
      <!—param which indicate form needs to be open in popup   -->            
            <param name="function">onActionFormDialog</param>
     <!-- Additional parameters for onFormDialog function  -->
            <param name="itemKind">action</param>
            <param name="itemId">doc-tagging</param>
            <param name="mode">create</param>
            <param name="destination">{node.nodeRef}</param>
      <!--  params associated with the success and failure message of action   -->
            <param name="successMessage">message.customaction.success</param>
            <param name="failureMessage">message.customaction.failure</param>
 </action>

Step 2:

Add messages in property file custom.properties

1
2
3
4
5
6
7
8
9
10
11
actions.document.customaction =Custom Action
actions.mycompany.goToGoogle=Google Search
message.customaction.success=Custom action executed successfully.
message.customaction.failure=Couldn't complete custom action.
document-customaction.field.name=Name
document-customaction.field.address=address

Place it under <tomcat>/shared/classes/alfresco/messages

Step 3:

Register message related property file though custom-application-context.xml file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<beans>
   <!-- Add application extension messages -->
   <bean id="mycompany.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>alfresco.messages.custom</value>
         </list>
      </property>
   </bean>
 </beans>

Place it under <tomcat>/shared/classes/alfresco/web-extension

Step 4:

Configure form in alfresco share which needs to be open in popup on click of action created in step1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
&lt;config evaluator="string-compare" condition="<span style="color: #666666;">doc-tagging</span>"&gt;
        &lt;forms&gt;
            &lt;form&gt;
                &lt;field-visibility&gt;
                    &lt;show id="name"/&gt;
                    &lt;show id="address"/&gt;
                &lt;/field-visibility&gt;
                &lt;appearance&gt;
                    &lt;field id="name" label-id="document-customaction.field.name"&gt;
&lt;field id="address" label-id="document-customaction.field.address"&gt;
                     &lt;control template="/org/alfresco/components/form/controls/textarea.ftl" /&gt;                  
                    &lt;/field&gt;              
                &lt;/appearance&gt;
            &lt;/form&gt;
        &lt;/forms&gt;
    &lt;/config&gt;

Step 5:

Associate form created in step 2 with action created in step1

Form and actions are linked though action id i.e. document-customaction in this case. We just need to make sure form config has same condition attribute value as action id.

That’s it you are good to go restart your server. Login to alfresco share and click on your custom action you will be able to see popup with two fields called name and address.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Publicités

Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s