AnsweredAssumed Answered

Cannot add more then 1 Custom Content Type

Question asked by ctraversa on May 28, 2007
Latest reply on May 30, 2007 by gavinc
Hi all.
I'd like to extend the content model with 2 additional Custom Content Type
To do this, according to the wiki documentation, I do as following:


1. I Create, in the extension folder, the file cct-context.xml
<?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="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
      <list>
        <value>alfresco/extension/cctModel1.xml</value>
        <value>alfresco/extension/cctModel2.xml</value>
      </list>
    </property>
  </bean>
</beans>


2. I create, in the extension folder, the file cctModel1.xml for Custom Content Type Model 1
<?xml version="1.0" encoding="UTF-8"?>
<model name="cct1:mycctmodel1" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <namespace uri="my.cct.model1" prefix="cct1"/>
   </namespaces>
   <types>
      <type name="cct1:custconttyp1">
      <title>Custom Content 1</title>
      <parent>cm:content</parent>
      <properties>
         <property name="cct1:cctfield1">
         <title>Custom Content Field 1</title>
         <type>d:text</type>
         </property>
      </properties>
      </type>
   </types>
</model>


3. Create, in the extension folder, the file cctModel2.xml for Custom Content Type Model 2
<?xml version="1.0" encoding="UTF-8"?>
<model name="cct2:mycctmodel2" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <namespace uri="my.cct.model2" prefix="cct2"/>
   </namespaces>
   <types>
      <type name="cct2:custconttyp2">
      <title>Custom Content 2</title>
      <parent>cm:content</parent>
      <properties>
         <property name="cct2:cctfield2">
         <title>Custom Content Field 2</title>
         <type>d:text</type>
         </property>
      </properties>
      </type>
   </types>
</model>


4. In the extension folder, in the file web-client-config-custom.xml I configure the web client for the Custom Content Type Models
<alfresco-config>
   <config evaluator="node-type" condition="cct1:custconttyp1">
      <property-sheet>
         <show-property name="mimetype" display-label-id="mimetype"
                        converter="org.alfresco.faces.MimeTypeConverter"
                        show-in-edit-mode="false" />
         <show-property name="size" display-label-id="size"
                        converter="org.alfresco.faces.ByteSizeConverter"
                        show-in-edit-mode="false" />         
         <show-property name="cct1:cctfield1" />
      </property-sheet>
   </config>   
   <config evaluator="node-type" condition="cct2:custconttyp2">
      <property-sheet>
         <show-property name="mimetype" display-label-id="mimetype"
                        converter="org.alfresco.faces.MimeTypeConverter"
                        show-in-edit-mode="false" />
         <show-property name="size" display-label-id="size"
                        converter="org.alfresco.faces.ByteSizeConverter"
                        show-in-edit-mode="false" />         
         <show-property name="cct2:cctfield2" />
      </property-sheet>
   </config>
   <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="cct1:custconttyp1" />
         <type name="cct2:custconttyp2" />        
      </content-types>
   </config>
   <config evaluator="string-compare" condition="Action Wizards">
      <subtypes>
         <type name="cct1:custconttyp1"/>
         <type name="cct2:custconttyp2"/>
      </subtypes>
   </config>
</alfresco-config>

Now, when I click on the button "Add Content" (in any space), I choose the content to upload, I upload it and my expectation is to see in the Add Content Dialog page, in the "Type" drop down list:
- Content
- Custom Content 1
- Custom Content 2
and if i.e. I choose Custom Content 1, my expectation is to be able to add the Custom Content Field 1 while if I choose Custom Content 2, my expectation is to be able to add the Custom Content Field 2 but it doesn't work. I can see only the Custom Content 1.
Can somebody help me to understand why?
Does anybody have any idea about which is my mistake?
Of course if I use only 1 custom content type it works fine.
Thanks in advance,
Carlo Traversa.

Outcomes