Fóruns

Início » Liferay Portal » English » 6. Portal Framework

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Shantanu Puranik
Custom field display in Document Library
9 de Janeiro de 2012 23:02
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

I'm working on customizing Document Library portlet in Liferay 6.0.6.
I've added a custom field as 'Document Status' on 'Document Library Document' which is a selection list with three values.
It's displaying correctly and desired value can be selected when document is in edit mode.

I have following questions.
1. Is it possible to set default value ( Let's say first value from selection list ) when document is added for first time? If yes, How?
2. How to display this custom field in the document list besides the document name column?

Thank you.
Shantanu Puranik
RE: Custom field display in Document Library
10 de Janeiro de 2012 20:59
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

After going through many posts in this forum, wiki articles and few blogs on Liferay, I could display it via hook.
Default value can now be seen in document list besides the name when the document is added first time.
Still, on document details page only customFieldKey is displayed but not it's default value.

Following are the steps followed:
1. Append <customFieldColumnName> to String defaultFileEntryColumns in init.jsp
2. In file_entry_columns.jspf add following code block at appropriate location (refer column sequence in init.jsp)
 1<c:when test='<%= fileEntryColumn.equals("customFieldColumnName") %>'>
 2        <%
 3            Object customFieldValues = fileEntry.getFileVersion().getExpandoBridge().getAttribute("customFieldKey");            
 4            String [] cfValues = (String[]) customFieldValues ;
 5            String selectedValue = (cfValues .length > 0 ? cfValues [0] : "");
 6       
 7        %>
 8            <liferay-ui:search-container-column-text
 9                href="<%= rowHREF %>"
10                index="<%= j %>"
11                name="<%= fileEntryColumn %>"
12                value="<%= selectedValue %>"
13            />
14            
15        </c:when>
Michael Haddad
RE: Custom field display in Document Library
11 de Janeiro de 2012 06:56
Resposta

Michael Haddad

Ranking: New Member

Mensagens: 6

Data de entrada: 1 de Fevereiro de 2011

Mensagens recentes

Hi
I have a different problem. I don't want the star ratings or rating comments to appear in either the doc library or doc viewer. But regardless of the checking or unchecking the 'Enable ratings comment' check box at pottom of configuration dialogue, they still appear for each file.
Does anyone have any advice on how to get rid of these star ratings?
Thanks
Using Liferay CE 6.0.6
Shantanu Puranik
RE: Custom field display in Document Library
12 de Janeiro de 2012 01:12
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

You can modify this behavior using hook plugin.
Just comment out the part of code in corresponding jsp to stop it from displaying.

e.g. it's also displayed after search is performed.
For this you need to comment out two line in search.jsp
headerNames.add("score"); //line no. 76
row.addScore(results.score(i)); // line no. 148

Hope this helps.
Michael Haddad
RE: Custom field display in Document Library
12 de Janeiro de 2012 02:48
Resposta

Michael Haddad

Ranking: New Member

Mensagens: 6

Data de entrada: 1 de Fevereiro de 2011

Mensagens recentes

Thanks shantanu. I'll try it later.
Michael
Krishan Kumar
RE: Custom field display in Document Library
9 de Março de 2012 23:23
Resposta

Krishan Kumar

Ranking: New Member

Mensagens: 16

Data de entrada: 18 de Janeiro de 2012

Mensagens recentes

Hi Shantanu Puranik,

I need a little help on Docuemnt Lib. custom Fields. If you can help me out, it wud be great.

I want to search document on custom Fields value. That is, I added a custom field - say Package - in DL file and added a value - say 1234- to it.

Now when is search the Liferay portal through open search portlet, it should give me this document. Currently Open search is searching on Custom fileds in User but not on Custom Fields in Document Library.

If you can suggest any solution, plz give it step by step as im Preety new to Liferay.

I am using Liferay 6.0.6 + tomcat 6.0.29 + MySQL 5.5.

Thanx in advance...

Krishan Kumar
Shantanu Puranik
RE: Custom field display in Document Library
12 de Março de 2012 10:08
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

Hi Krishan Kumar,

Problem that you faced is already listed and resolved Jira issue LPS-12514 but for 6.1
If you go through it, you can make it out.
Krishan Kumar
RE: Custom field display in Document Library
13 de Março de 2012 02:10
Resposta

Krishan Kumar

Ranking: New Member

Mensagens: 16

Data de entrada: 18 de Janeiro de 2012

Mensagens recentes

Thanx for the reply Shantanu,

I did tried using LR6.1 but there are many new features in it ... also, my almost all the development is finished in 6.0.5. So, i think if i can add these changes in 6.0.5, that wud be great.

Plz help.
Shantanu Puranik
RE: Custom field display in Document Library
19 de Março de 2012 02:05
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

ahhh. What I actually mean is go through the jira issue and implement solution suggested by Sergio Gonzalez via hooks plug-in.
There is enough documentation available on web to create hooks-plugin.
Do it with Liferay IDE. This is definitely simplest way to create a hook. Select version that suits your Liferay environment.
Hope this helps.
Amit Shukla
RE: Custom field display in Document Library
25 de Julho de 2012 23:11
Resposta

Amit Shukla

Ranking: Junior Member

Mensagens: 90

Data de entrada: 7 de Junho de 2012

Mensagens recentes

Hi Shantanu,

I want to add some custom field in document library documents and need to get values from these attribute from database table.I followed the same step as mentioned above But i am not getting these values.
1- append -->defaultEntryColumns String in Init.jsp
2-do changes in file_entry_columns.jspf

fileEntryColumn.equalsIgnoreCase(customfieldname)
// Object customFieldValues = fileEntry.getFileVersion().getExpandoBridge().getAttribute("customFieldKey");
String [] cfValues=new String[]{"test1","test2","test3"};
String selectedValue = (cfValues .length > 0 ? cfValues [0] : "");


%>
<liferay-ui:search-container-column-text
href="<%= rowHREF %>"
index="<%= j %>"
name="<%= fileEntryColumn %>"
value="<%= selectedValue %>"
/>

Please guide me where I am wrong???

Thanks
Amit
Shantanu Puranik
RE: Custom field display in Document Library
6 de Agosto de 2012 06:36
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

Well it was few months back I did those changes for exploration purpose. Don't know the changes by heart.

What do you mean by "not getting values" ? Is there an error or nothing is displayed?
In case of error, need to see what exactly it is. But, if it is showing empty string...
Please ensure that your (column name) custom string are appended as comma separated values and without a space. (This is important as I remember)
1String defaultFileEntryColumns = "name,size,Status,customString1,customString2";


Also check that you are using exactly the same string for 'customFieldKey' which you have used to define the custom field.
btw, I also had few default values set since the requirement was for dropdown/ selection list.
Please also check permissions on custom field for you liferay user.
Hope this helps.
Abhi Ed
RE: Custom field display in Document Library
14 de Agosto de 2012 05:17
Resposta

Abhi Ed

Ranking: Regular Member

Mensagens: 114

Data de entrada: 4 de Junho de 2012

Mensagens recentes

Shantanu Puranik:
You can modify this behavior using hook plugin.
Just comment out the part of code in corresponding jsp to stop it from displaying.

e.g. it's also displayed after search is performed.
For this you need to comment out two line in search.jsp
headerNames.add("score"); //line no. 76
row.addScore(results.score(i)); // line no. 148

Hope this helps.



Can you explain how have you created hook for document library?
Or if you can refer me to any supporting study material, that will be great help.I have created hook project for terms of use web content earlier, but for creating hook for document library, I am not getting any clue.Which jsp or other file to keep?and which location to refer?

Thanks
Abhi
Shantanu Puranik
RE: Custom field display in Document Library
21 de Agosto de 2012 06:14
Resposta

Shantanu Puranik

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Janeiro de 2011

Mensagens recentes

Abhi,
Hook in general is documented on this site and many blogs as well but not for document library.
It's hardship, there is no documentation to know what page/ code to edit. Neither do I maintaned it.
You need to search with google, posts in this forum and also look into some issues/ tickets related to Document Library and gain knowldge.
All the jsp files for document library are present at "liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\html\portlet\document_library"