0
votes

I wanted to customize the metadata displayed for documents to show the name of the author instead of the 'modified by' information. 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

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 happening.

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; is there a 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

2
Could you please provide the version of Alfresco you're using and the link to the article you mention? - skuro
I am using Alfresco 4.0.d community and here is the link to the article. Thanks a lot. - codewrangler
I got a response to the questions 1-3 on the Alfresco community forums here. I have put up a possible reason for share not using the configuration under Tahir's answer below. Thanks a lot. - codewrangler

2 Answers

1
votes

According to the Blog of Mike Hatfield You need to put the changes in share-documentlibrary-config.xml. Can't you create this file in the web-extension folder? I guess it should be picked up.

If not, try to package it in a *.jar file, it might be picked up then.

If that still doesn't work, locate the -context file, I guess it's slingshot-documentlibrary-context.xml. Here it should load the above config file. Add an override, like the share-config-custom.xml and name it share-documentlibrary-config-custom.xml which looks in the web-extension folder.

0
votes

According to your "if I were to edit the main config file: share-documentlibrary-config.xml; then the author's name is displayed.", then you can write these code in share-config-custom.xml by adding replace="true" in config tag like this. You should copy all text within config to your share-config-custom.xml and modifying your own.

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

    </config>