Friday, March 25, 2011

How to customize Alfresco Share 3.4 Advanced Search Form

This post will guide you - how you can define your custom content type and custom properties in Share 3.4 advanced search form.

I am assuming, you know how to deploy custom content model and you have deployed CustomContentModel. Which contains doc:testContractType content type and some custom properties like doc:conName, doc:conNumber, doc:conStatus and doc:conType

Modify → \tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml

Add following configuration to include your custom content type in Advances Search option

<config evaluator="string-compare" condition="AdvancedSearch">
   <advanced-search>
       <forms>
           <form labelId="search.form.label.doc_testContractType"         descriptionId="search.form.desc.doc_testContractType">doc:testContractType</form>
      </forms>
  </advanced-search>
</config>

Add relavent i18 string in property file under test.properties
To add that property file, Go to tomcat\shared\classes\alfresco\web-extension
Modify – custom-slingshot-application-context.xml and add following code.


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Add Knowledge Base messages -->
    <bean id="webscripts.test.resources" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
          <property name="resourceBundles">
           <list>
               <value>alfresco.messages.test</value>
           </list>
        </property>
</bean>
</beans>

Create property file named test.properties under \tomcat\shared\classes\alfresco\messages
Add following i18 string

search.form.label.doc_testContractType=Test Custom Type
search.form.desc.doc_testContractType=Searches for all types of TestCustomType

To include custom fields for search, add following configuration in share-config-custom.xml under \tomcat\shared\classes\alfresco\web-extension\

<config evaluator="model-type" condition="doc:testContractType">
    <forms>
       <!-- Following fields will be visible during advanced search form -->
            <form id="search">
                 <field-visibility>
                        <show id="cm:title"/>
                        <show id="doc:conName" />
                        <show id="doc:conNumber" />
                        <show id="doc:conStatus" />
                       <show id="doc:conType" />
                 </field-visibility>
        </form>
</forms>
</config>



4 comments:

  1. Hello

    I am new to Alfresco Share Customization.

    We are 5 Developers Team which are going to work on Alfresco Share Customization.

    Please guide me how to Set Development Environment for working in Team for this customization Project.

    Please help.

    Thanks!
    -Nirvan

    ReplyDelete
  2. Hello Niketa,
    I have one query regarding Alfresco Share.I am not able to seen the .odt file in share preview.
    I am using Alfresco 3.4.d
    OS is Windows 7
    Thanks & Regards,
    Tapan

    ReplyDelete
  3. will you be able to point some free lancers for training on alfresco

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete