cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect property sheet when linking to association

babbage
Champ in-the-making
Champ in-the-making
I am trying to create a new document type that has a few sub-documents associated with it.  I added the association to the model and created a custom template that had links to the associated documents using the url property of the node.  This links directly the the document itself.  I want to get to the detail view for these documents.  The result template is as follows.


<#list document.assocs["msu:attach"] as child>
      <#if child.isDocument>
         <tr>
            <td><a href="/alfresco${child.url}" target="new"><img src="/alfresco${child.icon16}" border=0></a></td>
            <td><a href=/alfresco/navigate/showDocDetails/workspace/SpacesStore/${child.id}>${child.properties.name}</a>  
             
</td>
            <td>${(child.size / 1000)?string("0.##")} KB</td>
            <td> <#if child.isLocked>Yes</#if></td>
         </tr>
      </#if>
   </#list>

This seems to work ok.  It does indeed link to the detail view of the associated document.  The problem is that it seems to try to render this page with the  property sheet of the parent document.  It displays "$$error_association$$" even though the current document is of a type that has no associations.
4 REPLIES 4

gavinc
Champ in-the-making
Champ in-the-making
There is indeed a bug in that $$error_association$$ is shown rather than a proper error message.

However, the reason the error is triggered is because there is a property sheet configured for the type of node being shown that specifies a <show-association> or <show-child-association> element when the node does not have this assoication.

Try and find the offending bit of config and remove the rogue associations and then the page should display propertly at which point you can check whether the property sheet is rendering the correct node, from the template you have posted we can't see any reason why the parent document should be rendered instead of the child.

babbage
Champ in-the-making
Champ in-the-making
I don't believe there is a property sheet problem.  The parent document is of type msu:contract and the associated document is a msu:guideline_content_ops.

The model file

<type name="msu:guideline_content_ops">
     <title>Operations Guideline</title>
       <parent>cm:content</parent>
     <properties>
          <property name="msu:opsGroup">
                        <title>Group</title>
                        <type>d:text</type>
                        <constraints>
                         <constraint ref="msu:opsGroup" />
                        </constraints>
                </property>
     </properties>
       </type>
     
     <type name="msu:contract">
        <title>Contracts and Grants</title>
        <parent>cm:content</parent>
    <properties>
          <property name="msu:test">
                        <title>Test</title>
                        <type>d:text</type>
                </property>
     </properties>
       <associations>
            <association name="msu:attach">
               <target>
                  <class>msu:guideline_content_ops</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
      </associations>
   </type>

web-client-config-custom

   <config evaluator="node-type" condition="msu:guideline_content_ops">
      <property-sheet>
         <show-property name="msu:opsGroup" />
      </property-sheet>
   </config>
   <config evaluator="node-type" condition="msu:contract">
      <property-sheet>
              <show-property name="msu:test" />
         <show-association name="msu:attach" />
      </property-sheet>
   </config>

When I view the associated document by clicking through the previously listed template, I get the error.  When I view this document by clicking view details, it shows up fine. 

Is there something I am missing?  The client tries to use the property sheet for the msu:contract when it is looking at a msu:guideline_content_ops

Also, I am not sure what the difference is between standard associations and child associations.  I have tried it both ways, and get the same error.

Thank you for the reply.

/jon

hbf
Champ on-the-rise
Champ on-the-rise
I can confirm this and have added an JIRA issue with a little more information.

alarocca
Champ in-the-making
Champ in-the-making
Any workaround for this issue?

Regards,
Alessandro