AnsweredAssumed Answered

show links of related documents as links in metadata

Question asked by kay_be_ on Feb 6, 2012
Latest reply on May 15, 2012 by etoropov
I have a content model for documents with a qrcode property. I then have to make a script for retreiving documents with the same qrcode and have to list them in the metadata as a link. That way a user can look up the related document with the same qrcode.
I linked the documents by creating an association between the nodes.
My problem is that the related docs are listed with a path in alfresco explorer and as a title in Share but there are no links the user can click on…  :?

My model;

<?xml version="1.0" encoding="UTF-8"?>
<!– Custom Model –>
<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="herinnering:demomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Herinneringsbrief</description>
<author>Red Tree</author>
<version>0.1</version>

<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 custom.model should be changed to reflect your own namespace –>   <namespaces>      <namespace uri="com.ephesoftalfrescoherinnering.demo" prefix="herinnering"/>   </namespaces>
  <constraints>
   <constraint name="herinnering:talen" type="LIST">
      <parameter name="allowedValues">
         <list>
            <value>Fr</value>
            <value>Nl</value>
            <value>De</value>
            <value>En</value>
         </list>                                    
      </parameter>
   </constraint>   
  </constraints>
  <types>
      <type name="herinnering:document">
         <title>herinnering</title>
         <parent>cm:content</parent>
         <properties>
          <property name="herinnering:factuurnummer">
              <title>factuurnummer</title>
            <type>d:text</type>
         </property>
        
         <property name="herinnering:geadresseerde">
              <title>geadreseerde</title>
            <type>d:text</type>
         </property>
         <property name="herinnering:qrcode">
              <title>qrcode</title>
            <type>d:text</type>
            <index enabled="true">
               <atomic>true</atomic>
               <stored>true</stored>
               <tokenised>both</tokenised>
            </index>

         </property>
         <property name="herinnering:type">
              <title>Type document</title>
            <type>d:text</type>
         </property>
         <property name="herinnering:voorwerp">
              <title>voorwerp</title>
            <type>d:text</type>
         </property>        
         <property name="herinnering:dienst">
              <title>dienst</title>
            <type>d:text</type>
         </property>
         <property name="herinnering:aantalblz">
              <title>aantal blz</title>
            <type>d:text</type>
         </property>                 
       
         <property name="herinnering:datumopmaak">
              <title>datum opmaak</title>
            <type>d:text</type>
         </property>      
         <property name="herinnering:taal">
              <title>taal</title>
            <type>d:text</type>
            <constraints>
               <constraint ref="herinnering:talen"></constraint>           
            </constraints>
         </property>                   
      </properties>
    </type>
  </types>
  <aspects>
      <aspect name="herinnering:relatedDoc">
         <title>Gerelateerde documenten</title>
         <associations>
            <association name="herinnering:relatedDocList">
               <title>Gerelateerde documenten:</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>            
               <target>
                  <class>herinnering:document</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>      
            </association>
         </associations>      
      </aspect> 
  </aspects>
</model>

I have a script running on the files entering a folder:

var qrcode = document.properties["herinnering:qrcode"];
var query= "@herinnering\\:qrcode:" + qrcode;
var queryEncoded = search.ISO9075Encode(query);
document.properties["herinnering:dienst"] = query;
var results = search.luceneSearch(query);
for (var i = 0; i<results.length; i++){
    document.createAssociation(results[i], "herinnering:relatedDocList" );
}
document.save();

In web client config I make the related docs visible;

<config evaluator="aspect-name" condition="herinnering:relatedDoc">
   <property-sheet>
      <show-association name="herinnering:relatedDocList" />
   </property-sheet>
</config>   

The problem is: the related docs are no links.
In alfresco explorer the related documents look like this;
(note: 'Gerelateerde documenten' = related documents)
[img]http://i279.photobucket.com/albums/kk127/_Naoko_/alfresco/capture4.jpg[/img]

The title is shown in Share but again, no link to the original document.
(note: 'Gerelateerde documenten' = related documents)
[img]http://i279.photobucket.com/albums/kk127/_Naoko_/alfresco/Capture5.jpg[/img]

How can this be solved? Is there a better way to do this?
Any help appreciated.  8)

regards,
Kris

Outcomes