Advanced Search Custom Attributes

cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Search Custom Attributes

resplin
Intermediate
0 0 8,598

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Web Client CustomizationSearchAlfresco Explorer


Introduction


The Advanced Search screen in the web-client can be extended to add additional custom types and attributes to search against.


Adding Custom Content Types


Any type that inherits from cm:content or cm:folder can be configured to search against.

Find the following section in web-client-config-custom.xml (refer to the examples section below for details):

<advanced-search>
   <content-types>
   ...
   </content-types>
   <folder-types>
   ...
   </folder-types>
</advanced-search>

Types can then be added by adding <type> child elements, for example:

<type name='my:sop' />

The label used in the drop down list is retrieved by looking up the type title from the data dictionary.


Adding Properties


Any valid property in the model (on either a type or an aspect) can be added via the web-client configuration.

Find the following section in the web-client-config-custom.xml file:

<custom-properties>
</custom-properties>

Properties can then be added by adding child elements to the <custom-properties> section, for example:

<meta-data type='cm:dictionaryModel' property='cm:modelAuthor' />

Each <meta-data> element adds a single property to the Advanced Search screen. They are added in the order as defined in the config file.

The <type> attribute is the model type containing the property and the <property> attribute specifies the property to use. The display label for the property will also be taken from the repository model definiton.

Instead of <type> it is also possible to specify an aspect containing the property instead, for example:

<meta-data aspect='app:simpleworkflow' property='app:approveStep' />

The UI will render the appropriate control for the type of the property as defined in the Data Dictionary. The following property types with associated rendered components are currently supported:


  • d:text - Text field

  • d:boolean - Checkbox

  • d:noderef - Space Selector

  • d:category - Category Selector

  • d:datetime - Date Time range selectors

  • d:date - Date range selectors

  • d:int - Text field

  • d:long - Text field

  • d:double - Text field

  • d:float - Text field

The UI will also render the appropriate label from the data-dictionary. A display-label-id attribute is also available, this can be used to set an I18N message Id to use instead of the data-dictionary label.

In Alfresco 2.1 list-of-values constraint bound properties are supported and will display as a drop-down list of values for selection.


Examples


Alfresco ships with an example web client configuration file which contains a section showing how to enable the SOP type defined in the Data Dictionary Guide for searching. This file is called web-client-config-custom.xml.sample and can be found in /tomcat/shared/classes/alfresco/extension if you are using the Tomcat bundle or /jboss/server/default/conf/alfresco/extension if you are using the JBoss bundle.

If the example model is enabled rename the sample web client config file to web-client-config-custom.xml and uncomment the following section.

<config evaluator='string-compare' condition='Advanced Search'>
   <advanced-search>
      <content-types>
         <type name='my:sop' />
      </content-types>
      <folder-types>
      </folder-types>
      <custom-properties>
         <meta-data type='my:sop' property='my:authorisedBy' />
         <meta-data aspect='my:imageClassification' property='my:resolution' />
      </custom-properties>
   </advanced-search>
</config>

Existing properties from Alfresco types and aspects can also be added as the XML and screenshot below show.

<custom-properties>
  <meta-data type='cm:dictionaryModel' property='cm:modelAuthor' />
  <meta-data aspect='app:simpleworkflow' property='app:approveStep' />
  <meta-data aspect='app:inlineeditable' property='app:editInline' />
  <meta-data aspect='app:simpleworkflow' property='app:approveFolder' />
  <meta-data type='cm:dictionaryModel' property='cm:modelPublishedDate' />
</custom-properties>



CustomSearchAttrs.png