cancel
Showing results for 
Search instead for 
Did you mean: 

link a content type to an image

timv
Champ in-the-making
Champ in-the-making
Hi,
here's my plan:

I'm defining new content types, e.g. an event, a partner, … in the content model. Now, an event will have a title, description, location which are all text fields, but also a logo which will be an image. If I am correct I cannot have one content type Event that will have all these fields because Image is not a standard data type… Or is this possible? That was Q1.

So I created a content type Event that has some properties (title, description, location,…). I created an instance 'event1' of the Event type and I uploaded an image in Alfresco (event1.jpg).
What I now want to do, is in some way to tell Alfresco that event1.jpg is the image of event1. Q2: Can I link a content instance with an image? Can this be done with associations and how?

Regards,
Timv
4 REPLIES 4

gavinc
Champ in-the-making
Champ in-the-making
Yes it is possible.

What you could do is create a subtype of content called image (if you haven't already) and then define an association on your event type to the image.

If you do this and configure the association to appear on property sheets the association editor control will automatically query for all images in the repository and allow you to select one of them.

To set up the association do the following:


<associations>
   ….properties….
   <association name="your:event">
      <target>
         <class>your:image-type</class>
         <mandatory>true</mandatory>
         <many>false</many>
      </target>
   </association>
</associations>

Hope this helps.

alexeyg
Champ in-the-making
Champ in-the-making
Gavin,

This works wonderfully.  I created a child-association, it shows up as expected, and clicking search displays all "your:image-type" elements as expected.

The thing is, it displays all items of that type along with their full paths.  Is it possible to only display items from a specific space, and without necessarily displaying the full path? 

Currently the repository is searched from the root for all elements of matching <class>, as specified in <target>.  It seems ability to customise <show-association> and <show-child-association> elements to specify a search by xpath would be very helpful here…  Is only searching by <class> and from the root currenly supported?

Thank you.

gavinc
Champ in-the-making
Champ in-the-making
Yes, you answered your own question, a full repository search is currently performed for objects of <target> type.

There is a change in the forthcoming 1.4 release that allows you to restrict the number of results this returns but you can't restrict the search to a space.

The selector/picker components will hopefully be improved in the next release or two so this suggestion is something we'll definitely consider.

You could extend the UIAssociationEditor and/or UIChildAssociationEditor to get the behaviour you want for yout type, there is already some 'special' handling in these classes for cmSmiley Tongueerson, you could do a similar thing for your type.

mcalmendros
Champ in-the-making
Champ in-the-making
Hello,
I need he himself behavior that your. That the associations of contents are filtered by spaces.
You have obtained something?

Thank you very much