Step 1 : Create new file testCustomFields-model.xml in /alfresco/tomcat/shared/classes/alfresco/extension folder with following content.
<?xml version="1.0" encoding="UTF-8"?>
<model name="test:knowledgebase" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>test Base Model</description>
<author>Sourabh Aggarwal</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="test.model" prefix="yamaha"/>
</namespaces>
<aspects>
<!-- Definition of new Content Aspect: Knowledge Base Document -->
<aspect name="test:cutomfieldsdata">
<title>Knowledge Base Referencable</title>
<properties>
<property name="test:metadata_serial_number">
<type>d:text</type>
</property>
<property name="test:metadata_status">
<type>d:text</type>
</property>
<property name="test:metadata_owner">
<type>d:text</type>
</property>
<property name="test:metadata_name_of_agreement">
<type>d:text</type>
</property>
<property name="test:metadata_type_of_agreement">
<type>d:text</type>
</property>
<property name="test:metadata_title_of_agreement">
<type>d:text</type>
</property>
<property name="test:metadata_renewal">
<type>d:text</type>
</property>
<property name="test:metadata_area_of_agreement">
<type>d:text</type>
</property>
<property name="test:metadata_nature_of_agreement">
<type>d:text</type>
</property>
<property name="test:metadata_parties">
<type>d:text</type>
</property>
<property name="test:metadata_department">
<type>d:text</type>
</property>
<property name="test:metadata_department_created_by">
<type>d:text</type>
</property>
<property name="test:metadata_agreement_linked_agreements">
<type>d:text</type>
</property>
<property name="test:metadata_type_of_document">
<type>d:text</type>
</property>
</properties>
</aspect>
</aspects>
</model>
Step 2 : create new file with name testCustomFields-model-context.xml in /alfresco/tomcat/shared/classes/alfresco/extension folder with following content.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.kb.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/testCustomFields-model.xml</value>
</list>
</property>
</bean>
<bean id="extension.kb.resourceBundle" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.testCustomFields</value>
</list>
</property>
</bean>
</beans>
Step 3 : create new file web-client-config-custom.xml in /alfresco/tomcat/shared/classes/alfresco/extension folder with following content.
<alfresco-config>
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<folder-types>
</folder-types>
<custom-properties>
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_serial_number" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_status" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_owner" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_name_of_agreement" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_title_of_agreement" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_type_of_agreement" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_renewal" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_area_of_agreement" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_nature_of_agreement" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_parties" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_agreement_linked_agreements" />
<meta-data aspect="test:cutomfieldsdata" property="test:metadata_type_of_document" />
</custom-properties>
</advanced-search>
</config>
</alfresco-config>
Step 4 : create new file testCustomFields.properties in alfresco/tomcat/shared/classes/alfresco/messages with following content.
# Custom test messages
test_knowledgebase.property.test_metadata_serial_number.title=Serial Number
test_knowledgebase.property.test_metadata_status.title=Status For Agreement
test_knowledgebase.property.test_metadata_owner.title=Owner
test_knowledgebase.property.test_metadata_name_of_agreement.title=Name Of Agreement
test_knowledgebase.property.test_metadata_title_of_agreement.title=Title Of Agreement
test_knowledgebase.property.test_metadata_type_of_agreement.title=Type Of Agreement
test_knowledgebase.property.test_metadata_renewal.title=Renewal
test_knowledgebase.property.test_metadata_area_of_agreement.title=Area Of Agreement
test_knowledgebase.property.test_metadata_nature_of_agreement.title=Nature Of Agreement
test_knowledgebase.property.test_metadata_parties.title=Parties
test_knowledgebase.property.test_metadata_agreement_linked_agreements.title=Linked Agreements
test_knowledgebase.property.test_metadata_type_of_document.title=Type Of Document
Step 5 : edit file share-config-custom.xml in alfresco/tomcat/shared/classes/alfresco/web-extension and add following content.
<!-- cm:content type (existing nodes) -->
<config evaluator="node-type" condition="cm:content">
<forms>
<form>
<field-visibility>
<show id="test:metadata_serial_number" />
<show id="test:metadata_status" />
<show id="test:metadata_owner" />
<show id="test:metadata_name_of_agreement" />
<show id="test:metadata_title_of_agreement" />
<show id="test:metadata_type_of_agreement" />
<show id="test:metadata_renewal" />
<show id="test:metadata_area_of_agreement" />
<show id="test:metadata_nature_of_agreement" />
<show id="test:metadata_department" />
<show id="test:metadata_department_created_by" />
<show id="test:metadata_type_of_service" />
<show id="test:metadata_parties" />
<show id="test:metadata_agreement_linked_agreements" />
<show id="test:metadata_type_of_document" />
</field-visibility>
</form>
<!-- Document Library pop-up Edit Metadata form -->
<form id="doclib-simple-metadata">
<field-visibility>
<show id="test:metadata_serial_number" />
<show id="test:metadata_status" />
<show id="test:metadata_owner" />
<show id="test:metadata_name_of_agreement" />
<show id="test:metadata_title_of_agreement" />
<show id="test:metadata_type_of_agreement" />
<show id="test:metadata_renewal" />
<show id="test:metadata_area_of_agreement" />
<show id="test:metadata_nature_of_agreement" />
<show id="test:metadata_department" />
<show id="test:metadata_department_created_by" />
<show id="test:metadata_type_of_service" />
<show id="test:metadata_parties" />
<show id="test:metadata_agreement_linked_agreements" />
<show id="test:metadata_type_of_document" />
</field-visibility>
<edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
</form>
<!-- Document Library Inline Edit form -->
<form id="doclib-inline-edit">
<field-visibility>
<show id="test:metadata_serial_number" />
<show id="test:metadata_status" />
<show id="test:metadata_owner" />
<show id="test:metadata_name_of_agreement" />
<show id="test:metadata_title_of_agreement" />
<show id="test:metadata_type_of_agreement" />
<show id="test:metadata_renewal" />
<show id="test:metadata_area_of_agreement" />
<show id="test:metadata_nature_of_agreement" />
<show id="test:metadata_department" />
<show id="test:metadata_department_created_by" />
<show id="test:metadata_type_of_service" />
<show id="test:metadata_parties" />
<show id="test:metadata_agreement_linked_agreements" />
<show id="test:metadata_type_of_document" />
</field-visibility>
</form>
</forms>
</config>
Step 6 : Optional if want this model as the aspect then we have to add following in the same share-config-custom.xml file.
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<!--
Used by the "Manage Aspects" action
For custom aspects, remember to also add the relevant i18n string(s)
cm_myaspect=My Aspect
-->
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="cm:generalclassifiable" />
<aspect name="cm:complianceable" />
<aspect name="cm:dublincore" />
<aspect name="cm:effectivity" />
<aspect name="cm:summarizable" />
<aspect name="cm:versionable" />
<aspect name="cm:templatable" />
<aspect name="cm:emailed" />
<aspect name="emailserver:aliasable" />
<aspect name="cm:taggable" />
<aspect name="app:inlineeditable" />
<aspect name="test:cutomfieldsdata" />
</visible>
<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>
<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>
</config>
Step 7 : In file custom-slingshot-application-context.xml l in alfresco/tomcat/shared/classes/alfresco/web-extension and add following content between <beans></beans>.
<!-- Add test messages -->
<bean id="webscripts.kb.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.testCustomFields</value>
</list>
</property>
</bean>
step 8 : restart.
No comments:
Post a Comment