cancel
Showing results for 
Search instead for 
Did you mean: 

Change name/title displayment for custom nodes in th doclist

webdesigner
Champ in-the-making
Champ in-the-making
Hello,

I need to do a very simple modification for my custom content types.

In the DocumentLibrary (simple/detailed) view all content and space nodes are displayed using following format:

1. LINE: <cm:name>(<cm:title>)
2. LINE <cm:description>
etc….


For nodes having my custom aspect I need to display instead of cm:name (cm:title) another properties (from my custom model) .

Something like:
1. LINE: <fooSmiley Tonguerop1>(<fooSmiley Tonguerop2>)
etc….

I've tried to use metadata-templates, but it's used only for the lines below of the name/title (beginning with line 2 in my example).

I've found the propertyDecorator approach, but it doesn't work for cm:name for some reason:
Here my bean definition (see customNamePropertyDecorator below):
<bean id="applicationScriptUtils" parent="baseJavaScriptExtension" class="org.alfresco.repo.jscript.ApplicationScriptUtils">
        <property name="extensionName">
            <value>appUtils</value>
        </property>
        <property name="serviceRegistry">
            <ref bean="ServiceRegistry"/>
        </property>
        <property name="decoratedProperties">
            <map>
                <entry key="cm:creator">
                    <ref bean="usernamePropertyDecorator"/>
                </entry>
                <entry key="cm:modifier">
                    <ref bean="usernamePropertyDecorator"/>
                </entry>
                <entry key="cm:workingCopyOwner">
                    <ref bean="usernamePropertyDecorator"/>
                </entry>
                <entry key="cm:lockOwner">
                    <ref bean="usernamePropertyDecorator"/>
                </entry>
                <entry key="cmSmiley Surprisedwner">
                    <ref bean="usernamePropertyDecorator"/>
                </entry>
                <entry key="cm:taggable">
                   <ref bean="tagPropertyDecorator"/>
                </entry>
                <entry key="cm:categories">
                   <ref bean="categoryPropertyDecorator"/>
                </entry>
                <!– Own decorators –>
                <entry key="cm:name">
                   <ref bean="customNamePropertyDecorator"/>
                </entry>
          …..


Can you please point me how to do it using Standard Extension points?

Best regards and thanks in advance
Vitali
11 REPLIES 11

mikeh
Star Contributor
Star Contributor
This won't help you right now, but the next release of Community will allow the first line to be overridden as part of a metadata template using a new <title> config element.

I haven't had time recently, but will write a blog post detailing the new fields soon.

Thanks,
Mike

webdesigner
Champ in-the-making
Champ in-the-making
Hi Mike,

thanks for your reply. Unfortunately I can't wait until next release.

Do I have a chance to modify it on another way?

Best regards
Vitali

mikeh
Star Contributor
Star Contributor
Although I haven't tried it, the cm:name decorator method should have worked - did you check the JSON output from the Repository to see if your code was being run?

The only other way would be to make some of the code changes required to override the title. Take a look at r33845 in our SVN; in particular the changes to surf-doclist.lib.js and documentlibrary.js

Thanks,
Mike

webdesigner
Champ in-the-making
Champ in-the-making
Hi Mike,

thanks for helping me.

Do you mean to extend this code in surf-doclist.lib.js:
var fnProcessItem = function processItem(item)

         item.fileName = node.properties[DocList.PROP_NAME];
         if (node.isLink)
         {
            item.displayName = node.properties[DocList.PROP_TITLE];
         }
         else
         {
            item.displayName = node.properties[DocList.PROP_NAME];
            if (item.workingCopy)
            {
               item.displayName = item.displayName.replace(workingCopyLabel, "");
            }
         }


Is it only way to override the whole JS-file with my custom code? Or is there any better alternative (using extension point of Share 4.0)?

I'm developing Share extension that is deployed as an AMP and if it's been installed in the Alfresco that already has customizations in surf-doclist.lib.js, it will overwrite them all.

Thanks in advance
Best regards
Vitali

mikeh
Star Contributor
Star Contributor
Due to the extent of the changes required, yes you will have to overwrite some of the core Share files.

Thanks,
Mike

sharifu
Confirmed Champ
Confirmed Champ
has this been implemented in 4.2.a. How do i make cm:title appear instead of cm:name in the share

sharifu
Confirmed Champ
Confirmed Champ
Is there an update to this?

afaust
Legendary Innovator
Legendary Innovator
Hello,

you can provide a <title> element in your metadata template, which can be used much like any other metadata line configuration, e.g. use {cm_title} for the link. Alternatively, you might want to use a custom renderer which can interpolate between cm:title and cm:name based on the value state - e.g. if cm:title is set, use this otherwise revert to cm:name.

I have used a custom renderer on a customer project with Alfresco 4.0.2.9 and 4.1.1 which replaces the document link of MS Office files with a link to the "Edit Online" action as the customer wanted a quick-access action in this use case.

Regards
Axel

sharifu
Confirmed Champ
Confirmed Champ
@Axel

I do not understand your answer. What template are you talking about?

Do I have to make this custom renderer if so how or where do i get from?