在 IBM WebSphere Portal 6.1 Portlet 上使用 Multibox (mootools)

发布于 2024-12-17 09:24:23 字数 544 浏览 6 评论 0原文

我正在尝试在 IBM WebSphere Portal 6.1 中部署一个 portlet,它具有 MultiBox(Lightbox 的扩展版本,它不仅允许显示图片,还允许显示其他类型的组件,在我的例子中是 HTML 反馈表单)。

我正在使用 multiBox - 用于 MooTools 1.2,如 http://www.liamsmart.co 中所述.uk/Downloads/multiBox/

当我将下载的 zip 文件解压到我的机器上时,它工作正常,因为它是纯 HTML;但是当我将所有文件包含在 Portlet 项目中时(我使用 RAD 8.0 创建一个符合 JSR-286 的基本 Portlet,使用 Java 1.5 和目标为 WebSphere Portal 7.0 存根的运行时,所有这些都遵循新建 Portlet 项目向导

)这周都在搜索有关此类部署的信息,但我没有找到任何信息。有谁知道我在哪里可以找到我需要的帮助?

提前致谢。

I'm trying to deploy a portlet in IBM WebSphere Portal 6.1, that features a MultiBox (an extended version of a Lightbox, which not only allows to display pictures, but also other kind of components, in my case an HTML feedback form).

I'm using multiBox - for MooTools 1.2, as featured in http://www.liamsmart.co.uk/Downloads/multiBox/

When i extract the downloaded zip file to my machine, it works fine, because it's pure HTML; but when I include all files in a Portlet Project (I use RAD 8.0 to create a JSR-286 compliant basic portlet, using Java 1.5 and runtime targeted as WebSphere Portal 7.0 stub, all of this following the New Portlet Project wizard)

I have been searching for info regarding this kind of deployment all this week, but I haven't found anything. Does anyone know where could I find the help I need?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

子栖 2024-12-24 09:24:23

好吧,我终于能够询问以前从事过此类事情的人,他给了我一些指导方针,以便完成我的开发。

我最终执行的操作如下:

首先,我在 Portlet 的 doView 方法中执行此操作(在本示例中为 /Feedback/src/com/ibm/feedback/FeedbackPortlet.java):

public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType(request.getResponseContentType());

    String targetJsp = "/_Feedback/jsp/html/FeedbackPortletView.jsp";
    String nextTask = request.getParameter("nextTask");
    if ("verFormulario".equalsIgnoreCase(nextTask)) {
        targetJsp = "/_Feedback/multibox/files/feedbackform.jsp";
    }

    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(targetJsp);
    rd.include(request, response);
}

然后,在 Portlet 的 JSP 中执行此操作视图(在此示例中为 /Feedback/WebContent/_Feedback/jsp/html/FeedbackPortletView.jsp),内容如下:

<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1" import="java.util.*,javax.portlet.*,com.ibm.feedback.*"%>
<%@page import="com.ibm.wps.l2.urlspihelper.portletrequest.PortletURLHelper"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="javax.servlet.jsp.jstl.core.LoopTagStatus"%>
<%@page import="java.util.HashMap"%>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" prefix="portlet-client-model"%>

<portlet:defineObjects/>
<portlet-client-model:init>
    <portlet-client-model:require module="ibm.portal.xml.*"/>
    <portlet-client-model:require module="ibm.portal.portlet.*"/>   
</portlet-client-model:init> 
<head> 

<%
    PortletURL url = renderResponse.createRenderURL();
    url.setParameter("keepSession", "true");
    url.setParameter("saveMap", "true");

    StringBuffer sb = new StringBuffer();

    HashMap params = new HashMap();
    params.put("nextTask", new String[] { "verFormulario" });
%>

<!-- Copy code below -->
<link type="text/css" rel="stylesheet" href="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/css/multibox.css"/> 

<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/mootools-1.2.4-core-yc.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/mootools-1.2.4.4-more-yc.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/overlay.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/multibox.js"></script> 
<script type="text/javascript">
    window.addEvent('domready', function(){
        //call multiBox
        var initMultiBox = new multiBox({
            mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
            container: $(document.body),//where to inject multiBox
            descClassName: 'multiBoxDesc',//the class name of the description divs
            path: './_Feedback/multibox/files/',//path to mp3 and flv players
            useOverlay: true,//use a semi-transparent background. default: false;
            maxSize: {w:600, h:400},//max dimensions (width,height) - set to null to disable resizing
            addDownload: false,//do you want the files to be downloadable?
            pathToDownloadScript: './_Feedback/multibox/js/forceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
            addRollover: true,//add rollover fade to each multibox link
            addOverlayIcon: true,//adds overlay icons to images within multibox links
            addChain: true,//cycle through all images fading them out then in
            recalcTop: true,//subtract the height of controls panel from top position
            addTips: true,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
            autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc)
        });
    });
</script>
<!-- Copy code above -->

<!-- Styles -->
<style type="text/css">
    body{
        font-family:Arial;
    }
</style>
<!-- Styles -->
</head>
<body style="width:800px; margin:30px auto 0 auto; color:#555;">
<div style="clear:both; height:0; line-height:0; overflow:hidden"></div>

<%
    String strURL = PortletURLHelper.generateSinglePortletRenderURL(params, null, null, renderRequest, renderResponse);
%>
<a href='<%=strURL%>' id="mb11" class="mb" title="This is shown when hover the link and as a title for multibox dialog" rel="width:600,height:400">This is the link which opens multibox dialog</a>
<div class="multiBoxDesc mb11 mbHidden">This is shown as description (subtitle) for multibox dialog</div>
</body>

注释

  1. /Feedback/WebContent/_Feedback/multibox/files/feedbackform.jsp 只是基于 multibox 捆绑 HTML 页面(blank.htm 文件)的 JSP,它将显示在 multibox 对话框内。
  2. 这使用文章 Portal 6.1 和 7.0 高级 URL 生成助手类中附加的库(感谢@udo-held 提供的链接)。
  3. multibox zip 文件的内容被提取到 /Feedback/WebContent/_Feedback,保留文件结构。

OK, I finally was able to ask to the person who had worked on this kind of thing before and he gave me some guidelines in order to get my development done.

What I ended by doing is the following:

First, I did this in the doView method of the portlet (in this example, /Feedback/src/com/ibm/feedback/FeedbackPortlet.java):

public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType(request.getResponseContentType());

    String targetJsp = "/_Feedback/jsp/html/FeedbackPortletView.jsp";
    String nextTask = request.getParameter("nextTask");
    if ("verFormulario".equalsIgnoreCase(nextTask)) {
        targetJsp = "/_Feedback/multibox/files/feedbackform.jsp";
    }

    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(targetJsp);
    rd.include(request, response);
}

Then, in the JSP for the Portlet view (in this example /Feedback/WebContent/_Feedback/jsp/html/FeedbackPortletView.jsp), goes the following:

<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1" import="java.util.*,javax.portlet.*,com.ibm.feedback.*"%>
<%@page import="com.ibm.wps.l2.urlspihelper.portletrequest.PortletURLHelper"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="javax.servlet.jsp.jstl.core.LoopTagStatus"%>
<%@page import="java.util.HashMap"%>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" prefix="portlet-client-model"%>

<portlet:defineObjects/>
<portlet-client-model:init>
    <portlet-client-model:require module="ibm.portal.xml.*"/>
    <portlet-client-model:require module="ibm.portal.portlet.*"/>   
</portlet-client-model:init> 
<head> 

<%
    PortletURL url = renderResponse.createRenderURL();
    url.setParameter("keepSession", "true");
    url.setParameter("saveMap", "true");

    StringBuffer sb = new StringBuffer();

    HashMap params = new HashMap();
    params.put("nextTask", new String[] { "verFormulario" });
%>

<!-- Copy code below -->
<link type="text/css" rel="stylesheet" href="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/css/multibox.css"/> 

<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/mootools-1.2.4-core-yc.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/mootools-1.2.4.4-more-yc.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/overlay.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/multibox.js"></script> 
<script type="text/javascript">
    window.addEvent('domready', function(){
        //call multiBox
        var initMultiBox = new multiBox({
            mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
            container: $(document.body),//where to inject multiBox
            descClassName: 'multiBoxDesc',//the class name of the description divs
            path: './_Feedback/multibox/files/',//path to mp3 and flv players
            useOverlay: true,//use a semi-transparent background. default: false;
            maxSize: {w:600, h:400},//max dimensions (width,height) - set to null to disable resizing
            addDownload: false,//do you want the files to be downloadable?
            pathToDownloadScript: './_Feedback/multibox/js/forceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
            addRollover: true,//add rollover fade to each multibox link
            addOverlayIcon: true,//adds overlay icons to images within multibox links
            addChain: true,//cycle through all images fading them out then in
            recalcTop: true,//subtract the height of controls panel from top position
            addTips: true,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
            autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc)
        });
    });
</script>
<!-- Copy code above -->

<!-- Styles -->
<style type="text/css">
    body{
        font-family:Arial;
    }
</style>
<!-- Styles -->
</head>
<body style="width:800px; margin:30px auto 0 auto; color:#555;">
<div style="clear:both; height:0; line-height:0; overflow:hidden"></div>

<%
    String strURL = PortletURLHelper.generateSinglePortletRenderURL(params, null, null, renderRequest, renderResponse);
%>
<a href='<%=strURL%>' id="mb11" class="mb" title="This is shown when hover the link and as a title for multibox dialog" rel="width:600,height:400">This is the link which opens multibox dialog</a>
<div class="multiBoxDesc mb11 mbHidden">This is shown as description (subtitle) for multibox dialog</div>
</body>

Notes:

  1. /Feedback/WebContent/_Feedback/multibox/files/feedbackform.jsp is just the JSP based on multibox bundled HTML page (blank.htm file), that is going to be shown inside the multibox dialog.
  2. This uses the library attached in the article Portal 6.1 and 7.0 Advanced URL Generation Helper classes (thanks to @udo-held for the link).
  3. Contents of multibox zip file were extracted to /Feedback/WebContent/_Feedback, keeping file structure.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文