cancel
Showing results for 
Search instead for 
Did you mean: 

cannot customize share with share-config-custom.xml

jackjm
Champ in-the-making
Champ in-the-making
Hello all

i wanted to customize the metadata displayed for an articles in the library to show the name of the author instead of the 'modified by' field. Here is what I put into share-config-custom.xml


<config evaluator="string-compare" condition="DocumentLibrary">
        <metadata-templates>
            <template id="customTemplate">
                <line index="10" id="author">{author}</line>
            </template>
        </metadata-templates>
</config>

But share doesn't respect this and default meta-data is rendered. However, if I were to edit the main config file: share-documentlibrary-config.xml; then the author's name is displayed. Obviously, I don't want to be editing the core files; so I would really appreciate any feedback on what the mistake in my code is?

Also, here are some more n00b questions Smiley Tongue

1) If I were to add some text to indicate the field, say: Author: ${author}, then it is displayed in the reverse order as- 'XYZName Author: ' Suggestions on why this is happenning.

2) say I wanted this line to be not displayed at all if the author name is blank; how would I go about doing it? From MikeH's blog post, I realize I might need to write a custom evaluator to make this happen; but my knowledge ends there; are there any working sequence of steps that I can first try and build upon

3) Is it possible to have different meta-data displayed for spaces and content? If possible, any guidance will be greatly appreciated.

Thanks a lot for your time

p.s: I will put it out there that this is a result of this post. I have created a new post since had I general questions about customizing share. If you think this should be merged; please let me know and I shall merge this post with the earlier one.
2 REPLIES 2

jordiv
Champ on-the-rise
Champ on-the-rise
Hi,

I'm also a newbie with this, and I'm learning how to do this things at the moment, so maybe my response is not very accurate.


1) If I were to add some text to indicate the field, say: Author: ${author}, then it is displayed in the reverse order as- 'XYZName Author: ' Suggestions on why this is happenning.
The syntax for doing that is:
<line index="10" id="author">{my:author label.my_author}</line>

2) say I wanted this line to be not displayed at all if the author name is blank; how would I go about doing it? From MikeH's blog post, I realize I might need to write a custom evaluator to make this happen; but my knowledge ends there; are there any working sequence of steps that I can first try and build upon
You are right, you need a custom evaluator for that. So your code would look like:
<line index="10" id="author" evaluator="evaluator.doclib.metadata.hasAuthor">
    {my:author label.my_author}
</line>
If I'm not mistaken, you define your custom evaluators in custom-slingshot-application-context.xml located at tomcat/shared/classes/alfresco/web-extension/. There are some predefined evaluators you can use as parent for your custom evaluator. In your case you could use the evaluator.doclib.action.propertyNotNull evaluator.
So your custom evaluator would be something similar to:

    <bean id="evaluator.doclib.metadata.hasAuthor" parent="evaluator.doclib.action.propertyNotNull">
        <property name="property">
            <value>my:author</value>
        </property>
    </bean>

3) Is it possible to have different meta-data displayed for spaces and content? If possible, any guidance will be greatly appreciated.
I think that is possible using evaluators. For example you have the evaluator.doclib.action.nodeType evaluator that will display the metadata only if the node matches a certain node type.


Cheers,
Jordi

jackjm
Champ in-the-making
Champ in-the-making
Fantastic, thank you for the help again Jordi!