Fórum

Change Portlet Background

Ketan Patel, modificado 11 Anos atrás.

Change Portlet Background

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Hi!

I want change the background image of specific portlet, How can I do that?
I also want to change the background position of Image.

I would appreciate any help.

Thanks,
Ketan Patel.
thumbnail
Ajeykumar HB, modificado 11 Anos atrás.

RE: Change Portlet Background

Junior Member Postagens: 72 Data de Entrada: 13/03/12 Postagens Recentes
Hi patel We can do it by following steps (in CE6.1)

1. In UI goto options of that particular portlet
2. select look and feel
3. select advanced styling
4. In that click on "Add a CSS rule for just this portlet"
5. add following code "background-image:url("/images/sampleimage.jpg");"
6.here you have to paste the sampleimage.jpg in folder by name images which is the folder you have to create inside webapps folder of server.
Ketan Patel, modificado 11 Anos atrás.

RE: Change Portlet Background

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Thanks Ajay for quick reply!

In my case background image would be added by admin of the portlet.
so my first concern is where I have to store that selected image? In database or any where else? if in database than in which table?

Thanks,
Ketan
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Change Portlet Background

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Just upload your image to Document and Media library and use the url of the uploaded file.
thumbnail
Priyanka Dhingra, modificado 11 Anos atrás.

RE: Change Portlet Background

Liferay Master Postagens: 501 Data de Entrada: 20/12/11 Postagens Recentes
Hi Ketan,

You can try this also
http://www.liferay.com/community/forums/-/message_boards/message/13189540
Ketan Patel, modificado 11 Anos atrás.

RE: Change Portlet Background

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Thanks Priyanka!

In my case admin will add/choose image through browse [uploader/file chooser]. so, I have created one hook for that. and admin will upload the image and applied it.
so, you have any better idea for the same.

Thanks,
Ketan Patel
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Change Portlet Background

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
I have created one hook for that. and admin will upload the image and applied it.


Why not just use the Document and Media portlet? There's no need to create a plugin. Liferay already supports this feature.
Ketan Patel, modificado 11 Anos atrás.

RE: Change Portlet Background

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Hi Hitoshi!

Thanks for reply.
As per customer requirements, I have to upload image from my custom hook. so, Is there any better solution for uploading image and save it to database and display it to on portlet?

Thanks,
Ketan Patel
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Change Portlet Background

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
You're mixing different questions in one thread and it is very confusing and discouraged in forum policy. Please create a new thread for file upload question. You're question is also confusing. If you are required to create a hook and you've created it already, what is your question? You haven't specified how your hook is uploading images and saving it to a database, how are we to know whether there is a "better way" when you haven't told us what you've done. Anyways, please create a new thread on this issue because it's not related to your first question on changing portlet's background.
Ketan Patel, modificado 11 Anos atrás.

RE: Change Portlet Background

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Hi Hitoshi!

Sorry if you are not getting my question correctly.
Let me clear my question from scratch.

I have created one hook and the jsp file for my hook is under
/html/portlet/portlet_css/view.jsp
. I have added file upload tag under
<aui:fieldset id="background-styles">
tag in view.jsp file.

now, my concerns is that, How I will save the Image in database? and in which table? please check the view.jsp file and please help me!

FYI my view.jsp page code:

<aui:fieldset id="background-styles">
					<aui:layout>
						<aui:column columnwidth="30" first="<%=true%>">
							<aui:input label="background-color" name="lfr-bg-color" />
						</aui:column>
						<aui:column columnwidth="40" second="<%=true%>">
							<aui:input label="background-image" type="file" size="30" name="lfr-bg-color" />
						</aui:column>
						<aui:column columnwidth="30" last="<%=true%>">
							<aui:input label="background-repeat" name="lfr-bg-color" />
						</aui:column>
					</aui:layout>
				</aui:fieldset>


Thanks,
Ketan