liferay中自定义字段及部分路由说明

来源:互联网 发布:深圳华夏软件学校招生 编辑:程序博客网 时间:2024/04/30 13:53

参考平行线的凝聚,网址:http://www.tuicool.com/articles/raQzA3,http://supercharles888.blog.51cto.com/609344/1288618

在liferay站点->站点设置->自定义字段,中,对于这个存储,首先,我们可以查看form提交的action,

form中acion连接为:http://localhost:8082/group/control_panel/manage?
p_auth=heAqArRv&p_p_auth=6Z5Wds7k&p_p_id=165&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&
doAsGroupId=21413&refererPlid=20184&controlPanelCategory=sites&_165_struts_action=%2Fsite_settings%2Fedit_site

p_p_id=165为portlet的id为165。

参数165_struts_action=%2Fsite_settings%2Fedit_site,说明action为edit_site


在portal-web    WEB-INF   struts-config.xml   中

<action path="/admin_server/edit_site" type="com.liferay.portlet.sites.action.EditGroupAction">
            <forward name="portlet.sites_admin.edit_site" path="portlet.sites_admin.edit_site" />
            <forward name="portlet.sites_admin.error" path="portlet.sites_admin.error" />
 </action>


liferay-portlet.xml中

<portlet>
        <portlet-name>165</portlet-name>
        <icon>/html/icons/site_settings.png</icon>
        <struts-path>site_settings</struts-path>
        <parent-struts-path>sites_admin</parent-struts-path>
        <portlet-url-class>com.liferay.portal.struts.StrutsActionPortletURL</portlet-url-class>
        <control-panel-entry-category>site_administration.configuration</control-panel-entry-category>
        <control-panel-entry-weight>1.0</control-panel-entry-weight>
        <control-panel-entry-class>com.liferay.portlet.sitesadmin.SiteSettingsControlPanelEntry</control-panel-entry-class>
        <preferences-owned-by-group>true</preferences-owned-by-group>
        <use-default-template>false</use-default-template>
        <private-request-attributes>false</private-request-attributes>
        <private-session-attributes>false</private-session-attributes>
        <render-weight>50</render-weight>
        <header-portlet-css>/html/portlet/sites_admin/css/main.css</header-portlet-css>
        <css-class-wrapper>portlet-site-settings</css-class-wrapper>
        <add-default-resource>true</add-default-resource>
        <system>true</system>
    </portlet>

之后在tiles-defs.xml中查找portlet.sites_admin.edit_site,找到

    <definition name="portlet.sites_admin.edit_site" extends="portlet.sites_admin">
        <put name="portlet_content" value="/portlet/sites_admin/edit_site.jsp" />
    </definition>

接着在edit_site.jsp界面查看所需的界面。

对于该界面,自定义字段的查找,一般为:


boolean showPrototypes = ParamUtil.getBoolean(request, "showPrototypes", true);

String[] mainSections = PropsValues.SITES_FORM_ADD_MAIN;  //所需的jsp页面的组合,在下面中有所体现

String[] seoSections = PropsValues.SITES_FORM_ADD_SEO;
String[] advancedSections = PropsValues.SITES_FORM_ADD_ADVANCED;
String[] miscellaneousSections = PropsValues.SITES_FORM_ADD_MISCELLANEOUS;


。。。。

。。。。

    <liferay-ui:form-navigator
        backURL="<%= backURL %>"       
        categoryNames="<%= _CATEGORY_NAMES %>"
        categorySections="<%= categorySections %>"        //展示mainSections中的内容信息
        jspPath="/html/portlet/sites_admin/site/"
        showButtons="<%= true %>"
    />
</aui:form>

在liferay-ui.tld中

<tag>
        <name>form-navigator</name>
        <tag-class>com.liferay.taglib.ui.FormNavigatorTag</tag-class>
        <body-content>JSP</body-content>
        <attribute>
            <name>backURL</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>categoryNames</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>categorySections</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>displayStyle</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>formName</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>htmlBottom</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>htmlTop</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>jspPath</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>showButtons</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>

com.liferay.taglib.ui.FormNavigatorTag类中跳转页面为:

    private static final String _PAGE =
        "/html/taglib/ui/form_navigator/page.jsp";


在portal.properties中查看


    sites.form.add.main=details,categorization   //为details.jsp和categorization .jsp ,为
    sites.form.add.seo=

    sites.form.add.advanced=
    sites.form.add.miscellaneous=

之后页面进行组合即可。




1 0
原创粉丝点击