cancel
Showing results for 
Search instead for 
Did you mean: 

Colour vs tags

momau67
Champ in-the-making
Champ in-the-making
Dear all

i'm looking for a way to associate a specific colour or icon on a document depending on an associated tag
For example I could have documents related to cars that would have cars as tag and a car picture as icon

Any help is welcome

Alain
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
Not sure how many different tags you might want to handle this way, but one idea would be to use "indicators". For example, in Alfresco 4 (maybe it was available in 3.4 as well, I can't remember) you can set an indicator to appear in the document library list based on arbitrary criteria.

For example, here is a snippet from share-config-custom.xml from one of my examples:
<!– Document Library config section –>
    <config evaluator="string-compare" condition="DocumentLibrary">
        <!–
         Used by the "Manage Aspects" action

         For custom aspects, remember to also add the relevant i18n string(s)
            cm_myaspect=My Aspect
        –>
        <aspects>
            <!– Aspects that a user can see –>
            <visible>
                <aspect name="sc:webable" />
                <aspect name="sc:productRelated" />
                <aspect name="cm:replaceable" />
            </visible>

            <!– Aspects that a user can add. Same as "visible" if left empty –>
            <addable>
            </addable>

            <!– Aspects that a user can remove. Same as "visible" if left empty –>
            <removeable>
            </removeable>
        </aspects>

      <!–
         Used by the "Change Type" action

         Define valid subtypes using the following example:
            <type name="cm:content">
               <subtype name="cm:mysubtype" />
            </type>

         Remember to also add the relevant i18n string(s):
            cm_mysubtype=My SubType
      –>
        <types>
            <type name="cm:content">
                <subtype name="sc:doc" />
                <subtype name="sc:whitepaper" />
            </type>
            <type name="sc:doc">
                <subtype name="sc:whitepaper" />
            </type>
        </types>
       
        <!– Custom Indicators –>
        <indicators>
            <indicator id="someco-website" index="10">
                <evaluator>someco.evaluator.doclib.action.isActive</evaluator>
            </indicator>
        </indicators>
    </config>

Note the "indicators" section. It points to an evaluator called someco.evaluator.doclib.action.isActive. That's a bean ID. The bean looks like this:
<bean id="someco.evaluator.doclib.action.isActive" parent="evaluator.doclib.action.value">
        <property name="accessor" value="node.properties.sc:isActive" />
        <property name="comparator">
            <bean class="org.alfresco.web.evaluator.StringEqualsComparator">
                <property name="value" value="true" />
            </bean>
        </property>
   </bean>

Here, I'm using an out-of-the-box comparator to check the custom "isActive" property. If it is true, the evaluator resolves to true and a custom icon is displayed.

You could do something similar but check for the presence of a specific tag rather than the value of a property. I don't know if there's an out-of-the-box comparator that looks at tags. If not, and you don't feel like writing it yourself, you could write a rule that would set a property based on the presence of a tag, then use an out-of-the-box comparator to look at that property value to decide which indicator to set.

Hope this makes sense and gives you an idea of how you might tackle it. There are probably several other ways to do it.

Jeff