cancel
Showing results for 
Search instead for 
Did you mean: 

show links of related documents as links in metadata

kay_be_
Champ in-the-making
Champ in-the-making
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.  😎

regards,
Kris
7 REPLIES 7

mitpatoliya
Star Collaborator
Star Collaborator
You can have your custom properties which will show the links which leads to the associated documents.
There is one URL associated with each document called as Details page URL which is nothing but the link of that document.
You can create that URL and set those properties along with setting association in your script.

kay_be_
Champ in-the-making
Champ in-the-making
I figured out I can override the default generators methods (createComponent and generate) and then make modifications in the generate method to use my own renderer. Problem is I don't have a clue what generator I have to override. If someone knows which generator is called for the selection of related documents, I'll appreciate it if you would share this.
It is the generator that renders the docs list as seen in the image below and has a select function while in edit properties mode.
[img]http://i279.photobucket.com/albums/kk127/_Naoko_/alfresco/capture4.jpg[/img]

Thanks a lot.
Kris

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
You can make it as link in share.

Have a look at this page: http://wiki.alfresco.com/wiki/Forms#association.ftl,  pay special attention to the showTargetLink property.

You just need to configure it for share

kay_be_
Champ in-the-making
Champ in-the-making
Thanks, that's just what I need!

etoropov
Champ in-the-making
Champ in-the-making
Hi!

>I have a script running on the files entering a folder:
how do you make it to the script worked when file is placed?

thx a lot

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Hi,

You need to create an inbound rule that triggers that script.

The script should be placed in Data Dictionary/Scripts, and set the rule manually in the folder.

Regards,
Adei

etoropov
Champ in-the-making
Champ in-the-making
Many thanks, Adei