cancel
Showing results for 
Search instead for 
Did you mean: 

Make an association link clickable like a html link

drisschelouati
Champ on-the-rise
Champ on-the-rise
Hi,

i wrote an aspect containing a simple association property targeting cm:content types:

1- Model:


<aspects>
        <aspect name="ad:mailattachements">
            <title>contenu joint</title>
            <associations>
                <association name="ad:customattachements">
      <title>pieces jointes</title>
                <source>
                <mandatory>false</mandatory>
                <many>true</many>
                </source>
           <target>
           <class>cm:content</class>
            <mandatory>false</mandatory>
           <many>true</many>
            </target>
            </association>
         </associations>
        </aspect>
     </aspects>


2- configuration of the aspect for share:


<config evaluator="aspect" condition="ad:mailattachements">
    <forms>
        <form>
            <field-visibility>
                <show id="ad:customattachements" />
            </field-visibility>
            <appearance>                   
                <field id="ad:customattachements" label-id="prop.ad_customattachements" />
                    <control template="/org/alfresco/components/form/controls/association.ftl">
                    <control-param name="compactMode">true</control-param>
                  <control-param name="showTargetLink">true</control-param>
                    </control>
            </appearance>
        </form>
    </forms>
</config>



Like you can see in the attached file, the aspect works fine. In the properties, the last element "pieces jointes" (attachements in french) shows the associated documents. I would like to make those links clickable, so they can redirect the user to the associated document.
Can someone give me some advice on how i can do that? Thanks!
5 REPLIES 5

mitpatoliya
Star Collaborator
Star Collaborator
Well if you just put following control parameter then it should work for you

<control-param name="showTargetLink">true</control-param>

But somehow it is not working in your case. You could to define same in config of the content type where you are adding this aspect.

I Will try to add the config elements to the forms i wish to work with and i will let you know about the result! Anyway, thanks for your advice!

dsmith
Champ on-the-rise
Champ on-the-rise
I believe you want to have your < control > element within the < field > element.  And your < control-param > elements within < control >.  So something like:


<field id="ad:customattachements" label-id="prop.ad_customattachements" >
    <control template="/org/alfresco/components/form/controls/association.ftl">
        <control-param name="compactMode">true</control-param>
        <control-param name="showTargetLink">true</control-param>
    </control>
</field>

You are definitly right dsmith, it works just fine now ! Thank you

phamhieptam
Champ in-the-making
Champ in-the-making

help me!

There was a problem importing the file. Try removing the existing model before importing another. The custom model doesn't support the 'associations' element.