留言板

How can i get the image gallery select button in JSP Page.

Nagiy reddyy Yedulay,修改在15 年前。

How can i get the image gallery select button in JSP Page.

Junior Member 帖子: 96 加入日期: 08-12-3 最近的帖子
Hai. i got a requirement like i need to show a portlet.Content of Portlet will be

1). Text field with select button.

2).When click on select button it has to show the images in the image gallery.

3).once i click the any one of the image,image pathe has to store on the text box.

How can achieve the above content in JSP portlet.

if any body has the any idea,please let me know.

your ideas are greatly appreciated.


Thanks
Nagireddy Y
Rahul Parashar,修改在13 年前。

RE: How can i get the image gallery select button in JSP Page.

New Member 帖子: 7 加入日期: 11-3-21 最近的帖子
Well thats how i did it.. looking to improve on it..

view.jsp

//On load its shows the default blank image
<img id="displayimage" src="/image/image_gallery?uuid=4115bc88-1dcb-44fa-a60e-4170c835f4df&groupId=18&t=1303323974453"/><br/>
<a href="#" onclick="openWindow();" >Choose an Image</a>

// On click of the link you just have to open the image gallery, i cudnt find a better way so i have to hard code the entire image gallery url
function openWindow()
{

win = window.open("http://localhost:8080/group/control_panel/manage?p_p_id=15&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&doAsGroupId=18&refererPlid=10146&_15_struts_action=%2fjournal%2fselect_image_gallery&_15_groupId=18","mywindow","scroll=1,status=1,menubar=1,resizable=1,width=750,height=850");

}

If you check the code in select_image_gallery.jsp, when you choose a image from image gallery, it calls the opener selectImageGallery() method and passes the image url to it.. So i just created this method in my view.jsp (the opener in my case)..

// Had to hard code the namespace, dint find any other way
function _15_selectImageGallery(url) {

document.getElementById('displayimage').src = url;
document.getElementById('image').value = url;
alert(document.getElementById('image').value);
}

I have url to the input hidden field, you can very well use a input text field and give this url value to it..

Hope this helps..
Andy Harb,修改在12 年前。

RE: How can i get the image gallery select button in JSP Page.

Junior Member 帖子: 66 加入日期: 09-10-22 最近的帖子
Thanks Rahul,

This is a great way to handle this. The only thing you may want to add is a

		if(win != null)
			win.close();


Into the _15_selectImageGalary(url) function. That way after they select an image it closes the window.


One question i have is what permission does a user have in order to select an image? I tried giving the user view into the Image Gallery and a few other things but for some reason if they are not admins they get a "You do not have the required permissions to access this application" message when the window popups up.

Any pointers would be greatly appreciated.

Thanks
Andy
liferay liferay,修改在11 年前。

RE: How can i get the image gallery select button in JSP Page.

New Member 帖子: 3 加入日期: 12-7-4 最近的帖子
Is it possible at Liferay 6.1 GA? How can I do that?

Thxs
thumbnail
Nishikant sapkal,修改在11 年前。

RE: How can i get the image gallery select button in JSP Page.

Junior Member 帖子: 80 加入日期: 10-2-16 最近的帖子
liferay liferay:
Is it possible at Liferay 6.1 GA? How can I do that?

Thxs


Yes you can easily do that using LR 6 as well...
Just check the following code which is similar to what LR is using for selecting images.

function openImageSelector(imgId,imgSrc) {

var test='<portlet:renderURL windowState="<%= LiferayWindowState.POP_UP.toString() %>"><portlet:param name="jspPage" value="/select_image.jsp" /><portlet:param name="imageSrc" value='imageSource' /><portlet:param name="imageId" value='imgId'/></portlet:renderURL>';

var imageWindow = window.open(test, 'structure', 'directories=no,height=640,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=680');
imageWindow.focus();
}

now select_image.jsp is the jsp page which will load all images from image gallery you can copy the jsp from image gallery as well.
liferay liferay,修改在11 年前。

RE: How can i get the image gallery select button in JSP Page.

New Member 帖子: 3 加入日期: 12-7-4 最近的帖子
easily? It's a joke, ok.

select_image.jsp, imgId, imgSrc? Thanks for help me, but I want to open a image (document and media at LR 6.1) gallery selector, check one and get the url or id or something similar.

In LR 6.0 was easily, I only used a url (/group/control_panel/manage?p_p_id=15...) and a one javascript method. Are there any url to open this gallery selector like in LR 6.0?

Thanks
liferay liferay,修改在11 年前。

RE: How can i get the image gallery select button in JSP Page.

New Member 帖子: 3 加入日期: 12-7-4 最近的帖子
Ok, for LR 6.1 the code is this:

function openWindow()
{
win = window.open("<%=themeDisplay.getPathContext()%>/group/control_panel/manage?p_p_id=15&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&doAsGroupId=<%=idGroup%>&refererPlid=10711&_15_struts_action=%2fjournal%2fselect_document_library&_15_groupId=<%=idGroup%>","mywindow","scroll=1,status=1,menubar=1,resizable=1,width=750,height=850");
}

function _15_selectDocumentLibrary(url, hash, name, version)
{
document.getElementById('displayimage').src = url;
document.getElementById('image').value = url;
}
thumbnail
Jitendra Rajput,修改在11 年前。

RE: How can i get the image gallery select button in JSP Page.

Liferay Master 帖子: 875 加入日期: 11-1-7 最近的帖子
liferay liferay:
Ok, for LR 6.1 the code is this:


If i am not wrong then your code will display both Documents and Images in popup ?
How can you display only images from document and media ?
thumbnail
Sachin Aware,修改在11 年前。

RE: How can i get the image gallery select button in JSP Page.

New Member 帖子: 23 加入日期: 12-7-19 最近的帖子
Jitendra Rajput:
liferay liferay:
Ok, for LR 6.1 the code is this:


If i am not wrong then your code will display both Documents and Images in popup ?
How can you display only images from document and media ?


To display images from image gallery use select_image_gallery instead of select_document_library.


onclick=" _15_imageGalleryInput = 'url';
_15_imageGalleryInputImage = 'img';
_15_imageGalleryType = 'stroller';
_15_imageGalleryMethod = '';
var imageGalleryWindow = window.open(
'<%=themeDisplay.getPathContext()%>/group/control_panel/manage?p_p_id=15&amp;p_p_lifecycle=0&amp;p_p_state=pop_up&amp;p_p_mode=view&amp;_15_struts_action=%2Fjournal%2Fselect_image_gallery&amp;_15_groupId=livegroupid', 'imageGallery', 'directories=no,height=640,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=680');
void('');
imageGalleryWindow.focus();"

Please replace livegroupid with your group id.


I hope this will help you.

Thanks & Regards,
Sachin Aware
Robert Lee,修改在10 年前。

RE: How can i get the image gallery select button in JSP Page.

New Member 发布: 1 加入日期: 13-4-29 最近的帖子
liferay liferay:


function _15_selectDocumentLibrary(url, hash, name, version)
{
document.getElementById('displayimage').src = url;
document.getElementById('image').value = url;
}


Is there more information available somewhere on using _15_selectDocumentLibrary?
How did you know are available parameters? and what is inside the hash?

Thanks!