cancel
Showing results for 
Search instead for 
Did you mean: 

Custom aspect not working

onno182
Champ in-the-making
Champ in-the-making
I am having trouble getting a custom aspect to work with Alfresco.

The custom aspect is displayed in the 'Manage Aspects' window, and I can add it.  However, after it is added, and I go to the 'Edit Properties' window, nothing is displayed from the aspect.

What am I doing wrong?.

marmavastgoed-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="someco.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/model/MVProjectModel.xml</value>
            </list>
        </property>
    </bean>
</beans>


extension/model/MVProjectModel.xml:


<model name="mv:projectmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
  <description>Marma Vastgoed Project Model</description>
  <author>Onno van der Heijden</author>
  <version>1.0</version>

  <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="http://www.marma.nl/model/MWProjectModel/1.0" prefix="mv" />
  </namespaces>

  <aspects>
    <aspect name="mv:project">
      <title>Project</title>

      <properties>
        <property name="mv:name">
          <title>Project Name</title>
          <type>d:text</type>
        </property>

        <property name="mv:start">
          <title>Project Start Date</title>
          <type>d:date</type>
        </property>

        <property name="mv:end">
          <title>Project End Date</title>
          <type>d:date</type>
        </property>
      </properties>

    </aspect>
  </aspects>
</model>


alfresco/web-extension/share-config-custom.xml:

I have added
<aspect name="mv:project" />
to the aspects element within
<config evaluator="string-compare" condition="DocumentLibrary" replace="true">
as so:


      <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="cm:geographic" />
            <aspect name="exif:exif" />
            <aspect name="audio:audio" />
            <aspect name="cm:indexControl" />
            <aspect name="dp:restrictable" />
            <aspect name="mv:project" />
         </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>



And within the same config patent, the following in the forms tags:


      <forms>
         <!– Default form configuration used on the document details and edit metadata pages –>
         <form>
            <field-visibility>
               <show id="mv:name"  />
            </field-visibility>
            <appearance>
               <field id="mv:name" label-id="prop.mv_name" />
            </appearance>
         </form>

         <!– Document Library pop-up Edit Metadata form –>
         <form id="doclib-simple-metadata">
            <field-visibility>
               <show id="mv:name" />
            </field-visibility>
            <appearance>
               <field id="mv:name" label-id="prop.mv_name" />
            </appearance>
         </form>

         <!– Document Library Inline Edit form –>
         <form id="doclib-inline-edit">
            <field-visibility>
               <show id="mv:name" />
            </field-visibility>
            <appearance>
               <field id="mv:name" label-id="prop.mv_name" />
            </appearance>
         </form>
      </forms>


1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
Looks like you've got your form definitions in the wrong spot. You need to use a different evaluator. To define forms for existing nodes for a given type use:

<config evaluator="node-type" condition="sc:whitepaper">

To define forms for new nodes of a given type use:

<config evaluator="model-type" condition="sc:whitepaper">


And to define forms for a specific aspect regardless of type use:


<config evaluator="aspect" condition="sc:webable">

Jeff