AnsweredAssumed Answered

Création de contenus personnalisés

Question asked by mymemorial on Aug 10, 2010
Latest reply on Aug 11, 2010 by jayjayecl
Bonjour, je suis nouveau sur le forum tout comme avec Alfresco 3.2 =)

J'aurais besoin de votre aide concernant la création de contenu personnalisé, je m'explique :

Je voudrais que, en saisissant 'Créer un contenu', dans Propriétés générales > Type, je puisse sélectionner parmis plusieurs types de contenus.
[img]http://img830.imageshack.us/img830/8706/captureds.jpg[/img]
Je voudrais par exemple avoir le choix entre Contenu, Compte rendu d'une Réunion et Compte rendu d'une Réalisation.
compteRendu-model-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>
    <!– Registration of new models –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/compteRenduModel.xml</value>
            </list>
        </property>
    </bean>
</beans>
compteRenduModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="cr:gemadecmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Gemadec Model</description>
   <author>ehtp</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="http://www.gemadec.com/model/content/1.0" prefix="cr" />
   </namespaces>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="cr:doc1">
         <title>Compte rendu de Reunion</title>
         <parent>cm:content</parent>
         <properties>
            <property name="cr:NumReunion">
               <type>d:int</type>
               <mandatory>true</mandatory>
            </property>   
            <property name="cr:dateReunion">
               <type>d:datetime</type>
               <mandatory>true</mandatory>
            </property>      
            <property name="cr:lieuReunion">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>            
            <property name="cr:titreProjet">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cr:objetReunion">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cr:presentClient">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="cr:presentSociete">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cr:absents">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>            
         </properties>         
      </type>
   </types>
</model>
Comme vous pouvez le voir, le premier marche et s'affiche.
Tous ces fichiers se trouvent dans C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension
Maintenant, je voudrais creer un autre type de contenu:
CRR2-model-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>
    <!– Registration of new models –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/CRR2Model.xml</value>
            </list>
        </property>
    </bean>
</beans>
CRR2Model.xml
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="cr:gemadecmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Gemadec Model</description>
   <author>ehtp</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="http://www.gemadec.com/model/content/1.0" prefix="cr" />
   </namespaces>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="cr:doc2">
         <title>Compte rendu d'une Realisation</title>
         <parent>cm:content</parent>
         <properties>
            <property name="cr:NumReunion">
               <type>d:int</type>
               <mandatory>true</mandatory>
            </property>   
            <property name="cr:dateReunion">
               <type>d:datetime</type>
               <mandatory>true</mandatory>
            </property>      
            <property name="cr:lieuReunion">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cr:absents">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>            
         </properties>         
      </type>      
   </types>
</model>
Et voici enfin web-client-config-custom.xml :
<alfresco-config>



<config evaluator="string-compare" condition="Languages">
      <languages>
         <language locale="fr_FR">French</language>
      </languages>
   </config>



<!– Envoyer tache______________________________________________________________________ workflow tasks –>
  
  
    <config evaluator="node-type" condition="pwf:envoyerTache" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" display-label-id="pwf_adhoc_priority" />
         <show-property name="bpm:workflowDueDate" display-label-id="pwf_adhoc_due_date" />
       <show-property name="pwf:notifyAssignee" />
         <show-property name="pwf:notifyMe" />
       <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
      <show-association name="bpm:assignee" />
        
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="pwf:tacheAssignee" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true" />
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="pwf:tacheComplete" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true" />
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
        
      </property-sheet>
   </config>
  
  
  
  
  
    <!– Review and Approve workflow tasks –>

   <config evaluator="node-type" condition="pwf:submitReviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" display-label-id="pwf_review_priority" />
         <show-property name="bpm:workflowDueDate" display-label-id="pwf_review_due_date" />
        <show-property name="pwf:notifyAssignee1" />
       <show-property name="pwf:notifyMe1" />
      
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:assignee" display-label-id="pwf_reviewer" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="pwf:reviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="pwf:rejectedTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:assignee" display-label-id="pwf_reviewer" read-only="true" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="pwf:approvedTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:assignee" display-label-id="pwf_reviewer" read-only="true" />
      </property-sheet>
   </config>
  
   <!–  add webable aspect  ******************************************************************************************************************************properties to property sheet –>
   

   <!–  add product related aspect properties to property sheet –>
   

   <!– show related documents association on doc property sheet –>
   
   
   <config evaluator="node-type" condition="cr:doc1">
      <property-sheet>
         <separator name="sep2" display-label-id="detailCr" component-generator="HeaderSeparatorGenerator" />
         <show-property name="cr:NumReunion" display-label-id="NumReunion" />
         <show-property name="cr:dateReunion" display-label-id="dateReunion" />
         <show-property name="cr:lieuReunion" display-label-id="lieuReunion" />
         <show-property name="cr:titreProjet" display-label-id="titreProjet" />
         <show-property name="cr:objetReunion" component-generator="TextAreaGenerator" display-label-id="objetReunion" />
         <show-property name="cr:presentClient"  component-generator="TextAreaGenerator" display-label-id="presentClient" />
         <show-property name="cr:presentSociete" component-generator="TextAreaGenerator" display-label-id="presentSociete" />
         <show-property name="cr:absents" component-generator="TextAreaGenerator" display-label-id="absents" />
         
      </property-sheet>
   </config>

   <!– show related documents association on whitepaper property sheet –>
   
      
   <!–  add someco types to add content list –>
   <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="cr:doc1" />
         <type name="cr:doc2" />
      </content-types>
   </config>

   <config evaluator="string-compare" condition="Action Wizards">
       <!– The list of aspects to show in the add/remove features action –>
       <!– and the has-aspect condition –>   
      
      <!– The list of types shown in the is-subtype condition –>
      <subtypes>
         <type name="cr:doc1" />
         <type name="cr:doc2" />
      </subtypes>      

   <config evaluator="string-compare" condition="Action Wizards">
       <!– The list of aspects to show in the add/remove features action –>
       <!– and the has-aspect condition –>   
      
      <!– The list of types shown in the is-subtype condition –>
      <subtypes>
         <type name="cr:doc1" />
                        <type name="cr:doc2" />
      </subtypes>      

      <!– The list of content and/or folder types shown in the specialise-type action –>
      <specialise-types>
         <type name="cr:doc1" />
         <type name="cr:doc2" />
      </specialise-types>      
   </config>   
   
   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
            <type name="cr:doc1" />
            <type name="cr:doc2" />
         </content-types>
      </advanced-search>
   </config>
</alfresco-config>
Je suis conscient que le fait de debuter avec alfresco n'est pas une excuse pour faire d'aussi grosses gaffes (car je sais qu'il y'en a pas mal, surtout a la fin quand j'ai double les <type name> pour doc2), mais si quelqu'un pourrait me donner un petit coup de pouce, ce serait vraiment super!

Quelqu'un serait ce qu'il faudrait modifier dans tout ca pour avoir dans la liste deroulante les deux rapports ainsi que 'Contenu' ?
Merci d'avance pour toute aide!  :D

PS : j'ai aussi change dans un certain someco-model-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>
    <!– Registration of new models –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
            <value>alfresco/extension/compteRenduModel.xml</value>
            <value>alfresco/extension/CRR2Model.xml</value>               
            
            </list>
        </property>
    </bean>
</beans>
Merci d'avance pour toute aide!


EDIT: J'ai cru comprendre qu'il faut créer un autre web-client-config-custom.xml pour le second type de contenu.
(J'enleverais donc ce que j'ai ajouter par rapport a doc2)
Ma question est : Ou faut-il mettre les fichiers du nouveau type de contenu ? Et que faut-il changer d'autre ?

Outcomes