Liferay 6.2 CE ga2 - AlloyUI打破了门户网站。有什么建议?

时间:2015-03-12 22:50:53

标签: liferay portlet

如何在Liferay 6.2中的portlet中使用AlloyUI 3.0.1该版本在门户网站的其余部分没有丢失功能。

无论我是否导入以下

,都会发生

<script src="http://cdn.alloyui.com/3.0.1/aui/aui-min.js"></script>
<link href="http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css" rel="stylesheet"></link>

这是我的代码......

的liferay-portlet.xml中

<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">

<liferay-portlet-app>
    <portlet>
        <portlet-name>example-input-alert</portlet-name>
        <icon>/icon.png</icon>
        <header-portlet-css>/css/main.css</header-portlet-css>
        <header-portlet-css>http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css</header-portlet-css>
        <header-portlet-javascript>http://cdn.alloyui.com/3.0.1/aui/aui-min.js</header-portlet-javascript>
        <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
        <css-class-wrapper>example-input-alert-portlet</css-class-wrapper>
    </portlet>
    <role-mapper>
        <role-name>administrator</role-name>
        <role-link>Administrator</role-link>
    </role-mapper>
    <role-mapper>
        <role-name>guest</role-name>
        <role-link>Guest</role-link>
    </role-mapper>
    <role-mapper>
        <role-name>power-user</role-name>
        <role-link>Power User</role-link>
    </role-mapper>
    <role-mapper>
        <role-name>user</role-name>
        <role-link>User</role-link>
    </role-mapper>
</liferay-portlet-app>


Resource "http://cdn.alloyui.com/3.0.1/aui/aui-min.js" not found.

view.jsp的

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />


<div id="myAlert"></div>

<script>
    YUI()
            .use(
                    'aui-alert',
                    function(Y) {
                        new Y.Alert(
                                {
                                    animated : true,
                                    bodyContent : 'Thank You Mario! But Our Princess Is In That Castle!',
                                    boundingBox : '#myAlert',
                                    closeable : true,
                                    cssClass : 'alert-warning',
                                    destroyOnHide : false,
                                    duration : 1,
                                    render : true
                                });
                    });
</script>

enter image description here

enter image description here

一些元素消失,门户网站和portlet失去了其他功能......

thx!

2 个答案:

答案 0 :(得分:1)

这是Liferay工作人员的回应......

enter image description here

答案 1 :(得分:0)

您需要在portlet中使用liferay-portlet.xml导入库:

<header-portlet-css>http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css</header-portlet-css>
<header-portlet-javascript>http://cdn.alloyui.com/3.0.1/aui/aui-min.js</header-portlet-javascript>

See the docs(在底部对此进行了解释)