如何在“控制面板”部分中添加自定义portlet

时间:2012-12-28 08:23:08

标签: liferay liferay-6 control-panel

如何将自定义portlet添加到“控制面板”的Portal部分,如下图所示:

enter image description here

2 个答案:

答案 0 :(得分:13)

以下是如何操作:

  1. 在您的portlet中liferay-portlet.xml(您可以查看此xml的DTD以获取有关其他标记的更多信息)在<portlet>标记中包含两个标记,如下所示:

    <portlet>
        <portlet-name>MyCustomPortlet</portlet-name>
        <icon>/mycustom.png</icon>
        <!--
            These are the two entries which are required for the portlet
            to appear in the control panel
        -->
        <!--
            Set the control-panel-entry-category value to "my", "content",
            "portal" or "server" to make this portlet available in the
            Control Panel under that category.
        -->
        <control-panel-entry-category>portal</control-panel-entry-category>
    
        <!--
           Set the control-panel-entry-weight value to a double number
           to control the position of the entry within its Control Panel
           category. Higher values mean that the entry will appear lower
           in the Control Panel menu.
        -->
        <control-panel-entry-weight>100</control-panel-entry-weight>
    
        <instanceable>false</instanceable>
        <header-portlet-css>/css/main.css</header-portlet-css>
        <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
        <css-class-wrapper>mycustomportlet-portlet</css-class-wrapper>
    </portlet>
    
  2. 此外,如果您不希望自己的portlet显示在Add Menu中,以便它不会放在其他网页上,那么您可以在liferay-display.xml中添加:

    <display>
        <category name="category.hidden">
            <!--
               Adding your portlet to the hidden category would not display
               the portlet in the ADD Menu on the top-left-hand corner
            -->
            <portlet id="MyCustomPortlet"></portlet>
        </category>
    </display>
    
  3. 构建和部署您的portlet,你很高兴。

答案 1 :(得分:0)

除了Prakash K的答案之外,ajaxable和instanciable应该是假的。