AnsweredAssumed Answered

[Alfresco Share] Aspect personnalisé

Question asked by lamba on Mar 2, 2010
Latest reply on Mar 14, 2010 by cleseach
Salut tout le monde,

j'essaie l'exemple suivant http://blogs.alfresco.com/wp/wabson/2010/02/25/adding-custom-aspect-support-in-alfresco-share/ pour ajouter un aspect personnalisé dans Share:

J'ai créé les fichiers suivants:

kb-model.xml dans share\WEB-INF\classes\alfresco\extension
<?xml version="1.0" encoding="UTF-8"?>

<!– Definition of new Model –>

<!– The important part here is the name - Note: the use of the my: namespace
     which is defined further on in the document –>
<model name="kb:knowledgebase" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Knowledge Base Model</description>
   <author>Will Abson</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 –>
   <!– NOTE: The following namespace my.new.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="http://www.alfresco.com/model/knowledgebase/1.0" prefix="kb"/>
   </namespaces>

    <aspects>

      <!– Definition of new Content Aspect: Knowledge Base Document –>
      <aspect name="kb:referencable">
         <title>Knowledge Base Referencable</title>
         <properties>
            <property name="kb:documentRef">
               <type>d:text</type>
            </property>
         </properties>
      </aspect>

   </aspects>

</model>

kb-model-context.xml dans share\WEB-INF\classes\alfresco\extension

<?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/kb-model.xml</value>
            </list>
        </property>
    </bean>

</beans>

custom-slingshot-application-context.xml dans share\WEB-INF\classes\alfresco\web-extension

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

<beans>

   <!– Override WebScript Messages - add slingshot application messages –>
   <bean id="webscripts.resources" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.web-extension.messages.knowledgebase</value>
         </list>
      </property>
   </bean>

</beans>

share-config-custom.xml dans share\WEB-INF\classes\alfresco\web-extension

<alfresco-config>
<config evaluator="aspect" condition="kb:referencable">
    <forms>
       <form>
          <field-visibility>
             <!– inherited from cm:content –>
             <show id="cm:name" />
             <show id="cm:title" force="true" />
             <show id="cm:description" force="true" />
             <show id="mimetype" />
             <show id="cm:author" force="true" />
             <show id="size" for-mode="view" />
             <show id="cm:creator" for-mode="view" />
             <show id="cm:created" for-mode="view" />
             <show id="cm:modifier" for-mode="view" />
             <show id="cm:modified" for-mode="view" />
          
             <!–  aspect orb:referencable –>            
             <show id="kb:documentRef" />
           </field-visibility>
        
          <appearance>
             <field id="kb:documentRef" label-id="label.kb_documentRef" />
          </appearance>
       </form>
    </forms>
</config>
</alfresco-config>

knowledgebase.properties dans share\WEB-INF\classes\alfresco\messages

# Custom knowledge base messages
label.kb_documentRef=KB Reference
kb_referencable=Knowledge Base Referencable

et j'ai ajouté l'aspect dans le fichier aspects.get.config.xml pour qu'il apparait dans la fenêtre de dialogue "Manage Aspect". j'ai ajouté:

<aspect name="{http://www.alfresco.org/model/content/1.0}referencable" />

Le problème et que l'aspect ne peut pas être appliqué à un document, il me revoit le message "Could not update aspect".

est ce que j'ai manqué qc?


Merci.

Outcomes