随笔-10  评论-23  文章-32  trackbacks-0

    首先到web space 安装目录下,找到web space server 的自定义配置文件,应该在:<root-dir>/webspace-for-gfv2/var/webspace/war-workspace/customs/webspace/WEB-INF/classes 下。

    很多同类产品可以直接修改默认的配置文件,不管需不需要的配置信息都会出现在默认配置文件里,一眼看去让人畏惧,而web space server允许用户不需要进入默认配置文件,使用自定义配置文件(porttal-ext.properties)配置参数。这样可以有一个简洁明了的自定义配置文件,只包含我们自己的配置。这样的配置方式使配置web space server非常便捷。

    实际上,真正的web space server 默认配置文件是存储在portal-impl.jar中的portal.properties文件。portal-impl.jar包存在与<GlassFishhome>/domains/domain1/application/j2ee-modules/webspace/WEB-INF/lib下。研究这些配置最好的方法是复制此jar包到某个文件夹,解压之后研究根目录下的portal.properties文件,里面对每个配置参数都有详细说明.

    最常用到的是在portlet中加入自己的js和css,这里有一段重要的代码在:D:\worksoft\webspace-gfv2\var\webspace\war-workspace\sources\webspace\html\common\themes\top_head.jsp

<%-- Portal JavaScript References --%>
<%@ include file="/html/common/themes/top_js.jspf" %>
<%@ include file="/html/common/themes/top_js-ext.jspf" %>
<%-- Portlet JavaScript References --%>
<c:if test="<%= portlets != null %>">
	<%
	Set<String> headerPortalJavaScriptPaths = new LinkedHashSet<String>();
	for (Portlet portlet : portlets) {
		List<String> headerPortalJavaScriptList = portlet.getHeaderPortalJavaScript();
		for (String headerPortalJavaScript : headerPortalJavaScriptList) {
			String headerPortalJavaScriptPath = request.getContextPath() + headerPortalJavaScript;
			if (!headerPortalJavaScriptPaths.contains(headerPortalJavaScriptPath) && !themeDisplay.isIncludedJs(headerPortalJavaScriptPath)) {
				headerPortalJavaScriptPaths.add(headerPortalJavaScriptPath);
				headerPortalJavaScriptPath = HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, headerPortalJavaScriptPath, portlet.getTimestamp()));
	%>
				<script src="<%= headerPortalJavaScriptPath %>" type="text/javascript"></script>
	<%
			}
		}
	}
	Set<String> headerPortletJavaScriptPaths = new LinkedHashSet<String>();
	for (Portlet portlet : portlets) {
		List<String> headerPortletJavaScriptList = portlet.getHeaderPortletJavaScript();
		for (String headerPortletJavaScript : headerPortletJavaScriptList) {
			String headerPortletJavaScriptPath = portlet.getContextPath() + headerPortletJavaScript;
			if (!headerPortletJavaScriptPaths.contains(headerPortletJavaScriptPath)) {
				headerPortletJavaScriptPaths.add(headerPortletJavaScriptPath);
				headerPortletJavaScriptPath = HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, headerPortletJavaScriptPath, portlet.getTimestamp()));
	%>
				<script src="<%= headerPortletJavaScriptPath %>" type="text/javascript"></script>
	<%
			}
		}
	}
	%>
</c:if>
<%-- Raw Text --%>
<%
List<String> markupHeaders = (List<String>)request.getAttribute(MimeResponse.MARKUP_HEAD_ELEMENT);
if (markupHeaders != null) {
	for (String markupHeader : markupHeaders) {
%>
		<%= markupHeader %>
<%
	}
}
StringBuilder pageTopSB = (StringBuilder)request.getAttribute(WebKeys.PAGE_TOP);
%>
<c:if test="<%= pageTopSB != null %>">
	<%= pageTopSB.toString() %>
</c:if>
<%-- Theme CSS --%>
<link href="<%= HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, themeDisplay.getPathThemeCss() + "/main.css")) %>" rel="stylesheet" type="text/css" />
<style type="text/css">
	/* <![CDATA[ */
		<c:if test="<%= !themeDisplay.getCompanyLogo().equals(StringPool.BLANK) %>">
			#banner .logo a {
				background: url(<%= HtmlUtil.escape(themeDisplay.getCompanyLogo()) %>) no-repeat;
				display: block;
				font-size: 0;
				height: <%= themeDisplay.getCompanyLogoHeight() %>px;
				text-indent: -9999em;
				width: <%= themeDisplay.getCompanyLogoWidth() %>px;
			}
		</c:if>
		<c:if test="<%= BrowserSnifferUtil.isIe(request) && (BrowserSnifferUtil.getMajorVersion(request) < 7) %>">
			img, .png {
				position: relative;
				behavior: expression(
					(this.runtimeStyle.behavior = "none") &&
					(
						this.pngSet || (this.src && this.src.toLowerCase().indexOf('spacer.png') > -1) ?
							this.pngSet = true :
								(
									this.nodeName == "IMG" &&
									(
										(this.src.toLowerCase().indexOf('.png') > -1) ||
										(this.className && ([''].concat(this.className.split(' ')).concat(['']).join('|').indexOf('|png|')) > -1)
									) ?
										(
											this.runtimeStyle.backgroundImage = "none",
											this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
											this.src = "<%= themeDisplay.getPathThemeImages() %>/spacer.png"
										) :
											(
											   (
													(this.currentStyle.backgroundImage.toLowerCase().indexOf('.png') > -1) ||
													(this.className && ([''].concat(this.className.split(' ')).concat(['']).join('|').indexOf('|png|')) > -1)
												) ?
													(
															this.origBg = this.origBg ?
																this.origBg :
																this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
																this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
																this.runtimeStyle.backgroundImage = "none"
													) :
														''
											)
								),
								this.pngSet = true
					)
				);
			}
		</c:if>
	/* ]]> */
</style>
<%-- User Inputted Layout CSS --%>
<c:if test="<%= (layout != null) && Validator.isNotNull(layout.getCssText()) %>">
	<style type="text/css">
		<%= layout.getCssText() %>
	</style>
</c:if>
<%-- User Inputted Portlet CSS --%>
<c:if test="<%= portlets != null %>">
	<style type="text/css">
		<%
		for (Portlet portlet : portlets) {
			PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portlet.getPortletId());
			String portletSetupCss = portletSetup.getValue("portlet-setup-css", StringPool.BLANK);
		%>
			<c:if test="<%= Validator.isNotNull(portletSetupCss) %>">
				<%
				try {
				%>
					<%@ include file="/html/common/themes/portlet_css.jspf" %>
				<%
				}
				catch (Exception e) {
					if (_log.isWarnEnabled()) {
						_log.warn(e.getMessage());
					}
				}
				%>
			</c:if>
		<%
		}
		%>
	</style>
</c:if>
posted on 2010-04-16 18:30 liuyimx 阅读(591) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: