Problème d'ajout de nouveaux types de documents

cancel
Showing results for 
Search instead for 
Did you mean: 
mfcp
Member II

Re: Problème d'ajout de nouveaux types de documents

Voici mon message précédent:

Il y a quelques erreurs, notamment pour le chemin des dossiers:
Je te propose d'essayer ce code. Dis toi que tu peux avoir un seul fichier avec le suffixe -context.xml et un seul: web-client-config-custom.xml
mais autant de model que tu veux dépendant du nombre de type de document que tu as.

models-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/model/scModel.xml</value>
         </list>
      </property>
   </bean>
</beans>

scModel.xml (à placer dans le dossier model):


<?xml version="1.0" encoding="UTF-8"?>
<!–Definition of new Model –>
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!–Optional metadata about the model –>
<description>Someco Model</description>
<author>Moi</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.someco.com/model/content/1.0" prefix="sc" />
</namespaces>

<types>
<!–Enterprisewide generic document type –>

   <type name="sc:doc">
      <title>Someco Document</title>
      <parent>cm:content</parent>
      <associations>
         <association name="sc:relatedDocuments">
            <title>Related Documents</title>
            <source>
               <mandatory>false</mandatory>
               <many>true</many>
            </source>
            <target>
               <class>sc:doc</class>
               <mandatory>false</mandatory>
               <many>true</many>
            </target>
         </association>
      </associations>
      <mandatory-aspects>
         <aspect>cm:generalclassifiable</aspect>
      </mandatory-aspects>
   </type>
  
   <type name="sc:whitepaper">
      <title>Someco Whitepaper</title>
      <parent>sc:doc</parent>
   </type>
</types>

<aspects>
   <aspect name="sc:webable">
      <title>Someco Webable</title>
      <properties>
         <property name="sc:published">
            <type>d:date</type>
         </property>
         <property name="sc:isActive">
            <type>d:boolean</type>
            <default>false</default>
         </property>
      </properties>
   </aspect>
      <aspect name="sc:productRelated">
      <title>Someco Product Metadata</title>
      <properties>
         <property name="sc:product">
            <type>d:text</type>
            <mandatory>true</mandatory>
         </property>
         <property name="sc:version">
            <type>d:text</type>
            <mandatory>true</mandatory>
         </property>
      </properties>
   </aspect>
</aspects>
</model>

webclient-config-custom.xml:

Il faut placer le code ci-dessous entre les balises <alfresco-config> et </alfresco-config>:



<config evaluator="string-compare" condition="Content Wizards">
   <content-types>
      <type name="sc:doc" />
      <type name="sc:whitepaper" />
   </content-types>
</config>

<!–add webable aspect properties to property sheet –>

<config evaluator="aspect-name" condition="sc:webable">
   <property-sheet>
      <show-property name="sc:published" display-label-id="published"/>
      <show-property name="sc:isActive" display-label-id="isActive" read-only="true" />
      <show-association name="sc:relatedDocuments" />
   </property-sheet>
</config>

<config evaluator="aspect-name" condition="sc:productRelated">
   <property-sheet>
      <show-property name="sc:product" display-label-id="product"/>
      <show-property name="sc:version" display-label-id="version" readonly="true" />
      <show-association name="sc:relatedDocuments" />
   </property-sheet>
</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 –>
   <aspects>
      <aspect name="sc:webable"/>
      <aspect name="sc:productRelated"/>
   </aspects>
<!–The list of types shown in the issubtype condition –>
   <subtypes>
      <type name="sc:doc" />
      <type name="sc:whitepaper" />
   </subtypes>
<!–The list of content and/or folder types shown in the specialisetype action –>
   <specialise-types>
      <type name="sc:doc" />
      <type name="sc:whitepaper" />
   </specialise-types>
</config>

<config evaluator="string-compare" condition="Advanced Search">
   <advanced-search>
      <content-types>
         <type name="sc:doc" />
         <type name="sc:whitepaper" />
      </content-types>
      <custom-properties>
         <meta-data aspect="sc:webable" property="sc:published" display-label-id="published" />
         <meta-data aspect="sc:webable" property="sc:isActive" display-label-id="isActive" />
         <meta-data aspect="sc:productRelated" property="sc:product" display-label-id="product" />
         <meta-data aspect="sc:productRelated" property="sc:version" display-label-id="version" />
      </custom-properties>
   </advanced-search>
</config>
lodacom
Member II

Re: Problème d'ajout de nouveaux types de documents

Euh pour le dernier je remplace ce qu'il y a ou je rajoute entre les balises?….
lodacom
Member II

Re: Problème d'ajout de nouveaux types de documents

Bon je vais essayer un remplacement du code pour voir ce que ça donne… Bon ben ça crach!! J'ai enlevé le fichier models-context.xml Tout fonctionne à nouveau normalement. A mon avis tout le problème repose sur ce fichier avec -context.xml Alfresco ne digère pas qu'on lui rajoute de type de fichier (enfin c'est ce que je remarque). T'as une explication?
mfcp
Member II

Re: Problème d'ajout de nouveaux types de documents

Il faut le rajouter entre les balises !
En fait, tu sais quoi, vide complétement le web-client-config-custom.xml, rajoute les 2 balises avec le code que je t'ai écrit à l'intérieur:
<alfresco-config>
<!– Ici le code –>
</alfresco-config>
lodacom
Member II

Re: Problème d'ajout de nouveaux types de documents

Bon ben on essaie… J'ai remis le fichier enlevé et j'ai rajouté comme tu m'as fis dans le fichier donné par Alfresco. Attente de restart.
mfcp
Member II

Re: Problème d'ajout de nouveaux types de documents

Tu peux me donner une liste des fichiers que tu as dans le dossier extension ?
lodacom
Member II

Re: Problème d'ajout de nouveaux types de documents

J'ai fais exactement comme tu m'as dis et ça plante zut. Bon patience est le maître mot… Pour la liste j'ai fais un screen je te l'envoi… Zut je peux pas envoyer d'image trop la flemme de faire la liste à la main j'ai essayé avec casimages y veut pas chui modit!!! :cry:
mfcp
Member II

Re: Problème d'ajout de nouveaux types de documents

Normalement, pour l'histoire du models-context.xml, ça ne devrait pas poser de problème à Alfresco.
Je pense à 2 soucis potentiels mais il y a très peu de chance que ce soit ça:
-tu as un autre fichier qui termine par -context.xml
-models-context.xml existe déja dans le core d'alfresco (models étant un nom assez commun) donc il faudrait changer le nom.

Du coup, par précaution, vérifie si tu n'as pas d'autre fichier -context.xml dans ton dossier extension. Il n'en faut qu'un seul pour tout les modèles.
Modifie le nom du dossier par ce nom: someco-model-context.xml
lodacom
Member II

Re: Problème d'ajout de nouveaux types de documents

J'ai ces fichiers se terminant par -context.xml dans extension:
wcm-bootstrap-context.xml
example-model-context.xml
Je fais quoi de ces fichiers?

Après sinon j'ai que des -context.xml.sample je suppose que ça compte pas.
lodacom
Member II

Re: Problème d'ajout de nouveaux types de documents

Attend je mets les codes qui sont dedans:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<!– This file enables Alfresco WCM.  It should be placed in shared/classes/extension –>

<beans>

    <!– 
        Patch in the WCM folders for the Authoring Environment
        Adds WCM Forms and WCM Projects
    –>
    <bean id="patch.wcmFolders" class="org.alfresco.repo.admin.patch.impl.WCMFoldersPatch" parent="basePatch" >
        <property name="id"><value>patch.wcmFolders</value></property>
        <property name="description"><value>patch.wcmFolders.description</value></property>
        <property name="fixesFromSchema"><value>0</value></property>
        <property name="fixesToSchema"><value>${version.schema}</value></property>
        <property name="targetSchema"><value>10000</value></property>
        <!– helper beans for execution –>
        <property name="messageSource">
            <ref bean="bootstrapSpacesMessageSource" />
        </property>
        <property name="importerBootstrap">
            <ref bean="spacesBootstrap" />
        </property>
    </bean>

    <!–  Bootstrap the WCM Deployment Receiver Subsystem –>
    <bean id="wcm_deployment_receiver"
        class="org.alfresco.repo.management.subsystems.ChildApplicationContextFactory"
        parent="abstractPropertyBackedBean">
      <property name="autoStart">
          <value>true</value>
        </property>
    </bean>
   
    <!–  Patch bean to add the "WCM Deployed" space to the company home folder –>
    <bean id="patch.wcmDeployed" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
        <property name="id"><value>patch.wcmDeployed</value></property>
        <property name="description"><value>patch.wcmDeployed.description</value></property>
        <property name="fixesFromSchema"><value>0</value></property>
        <property name="fixesToSchema"><value>${version.schema}</value></property>
        <property name="targetSchema"><value>10000</value></property>
        <!– bootstrap view –>
        <property name="importerBootstrap">
            <ref bean="spacesBootstrap" />
        </property>
        <property name="checkPath">
            <value>/${spaces.company_home.childname}/${spaces.wcm_deployed.childname}</value>
        </property>
        <property name="bootstrapView">
            <props>
                <prop key="path">/${spaces.company_home.childname}</prop>
                <prop key="location">alfresco/bootstrap/deployedSpace.xml</prop>
                <prop key="messages">alfresco/messages/bootstrap-spaces</prop>
            </props>
        </property>
    </bean>

</beans>


<?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/exampleModel.xml</value>
            </list>
        </property>
    </bean>
         
</beans>
Respectivement pour le premier et le deuxième.