Wednesday, August 1, 2012

Creating Bookmarks/Links with Alfresco

A link to a file (bookmark) is of type "app:filelink" (which extends the base 'cm:link' type). The object has a single NodeRef value property called "cm:destination" which you set to the object you wish to link to -that's it.

Creating a link to a folder is very similar expect you create a node of type "app:folderlink" and set the same property.

Application-model.xml
FILE BOOKMARK
<type name="app:filelink">
<title>File Link Object</title>
<parent>cm:link</parent>
</type>
FOLDER BOOKMARK
<type name="app:folderlink">
<title>Folder Link Object</title>
<parent>cm:link</parent>
</type>

Content-model.xml
<type name="cm:link">
<title>Link Object</title>
<parent>cm:cmobject</parent>
<properties>
<property name="cm:destination">
<title>Link Destination</title>
<type>d:noderef</type>
<mandatory>true</mandatory>
</property>
</properties>
</type


It will show up in share like another document in the document library.  Clicking on the link will open the referenced document or folder in the details view.

4 comments:

  1. Hello Josh,

    How to display the links in alfresco share ?

    does it create additional scripts or configure share-config file ?

    Thank

    ReplyDelete
  2. Hello Sibe,

    The links will show up in share without any changes to share.

    You could create an action with a picker to let you pick the destination of the bookmark.

    I have created actions that file the bookmarks based on metadata.

    Hope this helps.

    -Josh

    ReplyDelete
    Replies
    1. Hello Josh, i tried with Alfresco 4.2 Community Edition and i didn't find a way to create a link to a document. Is there a way to do this like in Alfresco Explorer? I tried also to create a custom action but i don't exactly how to do. Can you help me?
      Mike

      Delete
  3. Josh, do you have any idea how to make the folderlink go to the actual folder in de doclibrary and not to the node of the folder?
    looking at the contentmodel the link always refers to the node, So I'm afraid there is no such option... any thoughts?

    King regards,
    Tom

    ReplyDelete