cancel
Showing results for 
Search instead for 
Did you mean: 

Interchanging FileName and Title in documentLibrary

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi,

I have a requirement to interchange the way the Document Name and Title is shown in document library. Basically, the Title needs to be shown first and then the file name. The end user does not care for the actual file name rather title makes more sense to him. This needs to changed in document-library, details, search pages etc.

I took a glance at the document-list.js component and it seems to be complicated.

Has anyone done this before? Any thoughts on how to achieve this?

Thanks
4 REPLIES 4

arnoldschrijve1
Champ on-the-rise
Champ on-the-rise
Given your requirement it probably involves augmenting (YAHOO.lang.augmentObject) the client-side js components involved and selectively overriding only those functions where name/title are displayed (e.g. column rendering function in documentlist.js). There may also be a number of freemarker html templates that need to be changed.
The changes to the code itself should be minor (just swapping the fields), but given the number of changes it is still a significant amount of work.

The best way to package your exension in my opinion would be to package as an amp, and use the Surf extension mechanisms to define your own module(s) and hook up your extensions. It has been much improved of late, allowing you to extend the functionality without too much code duplication.

Another option would be to physically swap the data of Name and Title fields upon creation of a document node. You can do this by hooking up a form filter (class that derives from AbstractFilter<ItemType, PersistType>) and implementing the beforePersist() method where you can do the switch.
This solution is probably undesirable because it would also change the filename of the document when downloading (though you could write code to handle this). Also if you don't append the filename extension, a generic document icon is shown.

Hope this helps.

sharifu
Confirmed Champ
Confirmed Champ
if some one has completed his can you write down some steps please on what to do exactly

unknown-user
Champ on-the-rise
Champ on-the-rise
I had to interchange the fileName and title in Document List, Document Details and Search pages. Following are the methods/files I extended.

a) For Document List page - Overridden fnRenderCellDescription() of components\documentlibrary\documentlist.js
b) For Document Details Page - Since the title and name are rendered in org\alfresco\components\node-details\node-header.get.html.ftl, I had to extend this FTL file using Alfresco's extension mechanism.
c) For Search - Overridden _setupDataTable() method in components\search\search.js

I also updated the respective *.get.head.ftl files to include my custom JS files containing the overridden methods.

Hope this helps.

sharifu
Confirmed Champ
Confirmed Champ
I had to interchange the fileName and title in Document List, Document Details and Search pages. Following are the methods/files I extended.

a) For Document List page - Overridden fnRenderCellDescription() of components\documentlibrary\documentlist.js
b) For Document Details Page - Since the title and name are rendered in org\alfresco\components\node-details\node-header.get.html.ftl, I had to extend this FTL file using Alfresco's extension mechanism.
c) For Search - Overridden _setupDataTable() method in components\search\search.js

I also updated the respective *.get.head.ftl files to include my custom JS files containing the overridden methods.

Hope this helps.

i am a noob. is it possible you can show me the script files?