You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2009/04/17 13:17:37 UTC
svn commit: r765946 - in /portals/jetspeed-2/applications/j2-admin/trunk/src:
main/java/org/apache/jetspeed/portlets/dojo/
main/java/org/apache/jetspeed/portlets/security/permissions/
main/java/org/apache/jetspeed/portlets/selector/ webapp/WEB-INF/ web...
Author: woonsan
Date: Fri Apr 17 11:17:37 2009
New Revision: 765946
URL: http://svn.apache.org/viewvc?rev=765946&view=rev
Log:
APA-8: Overriding doHeaders() because j2-admin portlets can access jetspeed-api.
Also, changes the header page to use standard head contribution apis.
Added:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java (with props)
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java?rev=765946&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java Fri Apr 17 11:17:37 2009
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.dojo;
+
+import java.io.IOException;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
+import org.apache.portals.gems.dojo.DojoPortletHelper;
+
+/**
+ * Extending AbstractDojoVelocityPortlet because admin portlets can use jetspeed-api
+ * to detect the portal webapp context path.
+ *
+ * @version $Id$
+ */
+public abstract class AbstractAdminDojoVelocityPortlet extends AbstractDojoVelocityPortlet
+{
+
+ protected static final String DOJO_JS_RELATIVE_URL_INIT_PARAM = "dojo.js.relative.url";
+
+ protected String dojoJsRelativeUrl;
+
+ /*
+ * Portlet constructor.
+ */
+ public AbstractAdminDojoVelocityPortlet()
+ {
+ super();
+ }
+
+ @Override
+ public void init(PortletConfig config) throws PortletException
+ {
+ super.init(config);
+ this.dojoJsRelativeUrl = getInitParameter(DOJO_JS_RELATIVE_URL_INIT_PARAM);
+ }
+
+ @Override
+ protected void doHeaders(RenderRequest request, RenderResponse response)
+ {
+ if (this.dojoJsRelativeUrl != null)
+ {
+ RequestContext requestContext = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
+ String portalContextPath = requestContext.getRequest().getContextPath();
+ DojoPortletHelper.enableDojo(response, portalContextPath + this.dojoJsRelativeUrl);
+ }
+ else
+ {
+ DojoPortletHelper.enableDojo(response, this.dojoJsUrl);
+ }
+
+ if (this.headerPage != null)
+ {
+ try
+ {
+ this.getPortletContext().getRequestDispatcher(this.headerPage).include(request, response);
+ }
+ catch (PortletException e)
+ {
+ throw new RuntimeException("Failed to include header page.", e);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Failed to include header page.", e);
+ }
+ }
+
+ if (this.dojoRequiresCoreList != null)
+ {
+ DojoPortletHelper.contributeDojoRequires(response, this.dojoRequiresCoreList);
+ }
+
+ if (this.dojoRequiresAddOnList != null)
+ {
+ DojoPortletHelper.contributeDojoRequires(response, this.dojoRequiresAddOnList);
+ }
+ }
+
+}
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/dojo/AbstractAdminDojoVelocityPortlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java?rev=765946&r1=765945&r2=765946&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java Fri Apr 17 11:17:37 2009
@@ -34,6 +34,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.CommonPortletServices;
import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.portlets.dojo.AbstractAdminDojoVelocityPortlet;
import org.apache.jetspeed.security.JetspeedPermission;
import org.apache.jetspeed.security.JetspeedPrincipal;
import org.apache.jetspeed.security.JetspeedPrincipalType;
@@ -41,7 +42,6 @@
import org.apache.jetspeed.security.PermissionManager;
import org.apache.jetspeed.security.Role;
import org.apache.jetspeed.security.RoleManager;
-import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
import org.apache.velocity.context.Context;
/**
@@ -50,7 +50,7 @@
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id: $
*/
-public class SecurityPermissionsPortlet extends AbstractDojoVelocityPortlet
+public class SecurityPermissionsPortlet extends AbstractAdminDojoVelocityPortlet
{
protected final Log logger = LogFactory.getLog(this.getClass());
protected PermissionManager pm = null;
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java?rev=765946&r1=765945&r2=765946&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java Fri Apr 17 11:17:37 2009
@@ -57,12 +57,12 @@
import org.apache.jetspeed.page.PageManager;
import org.apache.jetspeed.portlets.CategoryInfo;
import org.apache.jetspeed.portlets.PortletInfo;
+import org.apache.jetspeed.portlets.dojo.AbstractAdminDojoVelocityPortlet;
import org.apache.jetspeed.profiler.Profiler;
import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.search.ParsedObject;
import org.apache.jetspeed.search.SearchEngine;
import org.apache.jetspeed.security.SecurityAccessController;
-import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
import org.apache.velocity.context.Context;
/**
@@ -71,7 +71,7 @@
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id: $
*/
-public class CategoryPortletSelector extends AbstractDojoVelocityPortlet implements Comparator
+public class CategoryPortletSelector extends AbstractAdminDojoVelocityPortlet implements Comparator
{
public final String[] DEFAULT_IMAGES = new String[]
{
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml?rev=765946&r1=765945&r2=765946&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml Fri Apr 17 11:17:37 2009
@@ -1335,6 +1335,10 @@
<display-name xml:lang="ja">ã»ãã¥ãªãã£ãã¼ããã·ã§ã³ããªã·ã¼</display-name>
<portlet-class>org.apache.jetspeed.portlets.security.permissions.SecurityPermissionsPortlet</portlet-class>
<init-param>
+ <name>dojo.js.relative.url</name>
+ <value>/javascript/dojo/dojo.js</value>
+ </init-param>
+ <init-param>
<name>ViewPage</name>
<value>/WEB-INF/security/permissions/view.vm</value>
</init-param>
@@ -1427,6 +1431,10 @@
<display-name xml:lang="ja">ãã¼ãã¬ããé¸æ</display-name>
<portlet-class>org.apache.jetspeed.portlets.selector.CategoryPortletSelector</portlet-class>
<init-param>
+ <name>dojo.js.relative.url</name>
+ <value>/javascript/dojo/dojo.js</value>
+ </init-param>
+ <init-param>
<name>ViewPage</name>
<value>/WEB-INF/view/selectors/category-portlet-selector.vm</value>
</init-param>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm?rev=765946&r1=765945&r2=765946&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/selectors/category-portlet-header.vm Fri Apr 17 11:17:37 2009
@@ -14,124 +14,129 @@
See the License for the specific language governing permissions and
limitations under the License.
*#
-<style>
-.portlet-selector-title
-{
- font-size: 9pt;
- color: blue;
-}
-.portlet-selector-text
-{
- font-size: 8pt;
- color: green;
-}
-.dojoDialog {
- background : #eee;
- border : 1px solid #999;
- -moz-border-radius : 5px;
- padding : 4px;
- width: 420px;
-}
-
-.buttonbox {
- display: block;
- text-align: center;
-}
-.buttonbox .dojoButton {
- float: left;
- margin-right: 10px;
- margin-bottom: 6px;
-}
-
-.buttonboxright {
- display: block;
- text-align: center;
-}
-.buttonboxright .dojoButton {
- float: right;
- margin-left: 10px;
- margin-bottom: 6px;
-}
-
-.constraints {
- font-family:Lucida Grande, Verdana;
- font-size:0.8em;
- width:100%;
- border:1px solid #ccc;
- cursor:default;
-}
-
-#mainTabContainer {
- width: 100%;
- height: 304px;
-}
-
-* html div.tableContainer { /* IE only hack */
- width: 95%;
- border: 1px solid #ccc;
- height: 285px;
- overflow-x: hidden;
- overflow-y: auto;
-}
-
-.constraints td,
-.constraints th{
- border-right: 1px solid #999;
- padding: 2px;
- font-weight: normal;
- font-size: small;
-}
-
-.constraints thead td, .constraints thead th {
- background-image:url(/j2-admin/images/st-head.gif);
- background-repeat:no-repeat;
- background-position:top right;
- font-size: small;
- font-weight: bold;
- text-align: left;
-}
-.constraints thead td.selectedUp, .constraints thead th.selectedUp {
- background-image:url(/j2-admin/images/st-headup.gif);
-}
-.constraints thead td.selectedDown, .constraints thead th.selectedDown {
- background-image:url(/j2-admin/images/st-headdown.gif);
-}
-
-* html div.tableContainer table thead tr td,
-* html div.tableContainer table thead tr th{
- /* IE Only hacks */
- position:relative;
- top:expression(dojo.html.getFirstAncestorByTag(this,'table').parentNode.scrollTop-2);
-}
-
-
-html>body tbody.scrollContent {
- height: 262px;
- overflow-x: hidden;
- overflow-y: auto;
-}
-
-tbody.scrollContent td, tbody.scrollContent tr td {
- background: #FFF;
- padding: 2px;
-}
-
-tbody.scrollContent tr.alternateRow td {
- background: #e3edfa;
- padding: 2px;
-}
-
-tbody.scrollContent tr.selected td {
- background: yellow;
- padding: 2px;
-}
-tbody.scrollContent tr:hover td {
- background: #a6c2e7;
- padding: 2px;
-}
-tbody.scrollContent tr.selected:hover td {
- background: #ff3;
- padding: 2px;
-}
-
-</style>
+#set($styleTextContent =
+ ".portlet-selector-title "
++ "{ "
++ " font-size: 9pt; "
++ " color: blue; "
++ "} "
++ ".portlet-selector-text "
++ "{ "
++ " font-size: 8pt; "
++ " color: green; "
++ "} "
++ ".dojoDialog { "
++ " background : #eee; "
++ " border : 1px solid #999; "
++ " -moz-border-radius : 5px; "
++ " padding : 4px; "
++ " width: 420px; "
++ "} "
++ " "
++ ".buttonbox { "
++ " display: block; "
++ " text-align: center; "
++ "} "
++ ".buttonbox .dojoButton { "
++ " float: left; "
++ " margin-right: 10px; "
++ " margin-bottom: 6px; "
++ "} "
++ " "
++ ".buttonboxright { "
++ " display: block; "
++ " text-align: center; "
++ "} "
++ ".buttonboxright .dojoButton { "
++ " float: right; "
++ " margin-left: 10px; "
++ " margin-bottom: 6px; "
++ "} "
++ " "
++ ".constraints { "
++ " font-family:Lucida Grande, Verdana; "
++ " font-size:0.8em; "
++ " width:100%; "
++ " border:1px solid #ccc; "
++ " cursor:default; "
++ "} "
++ " "
++ "#mainTabContainer { "
++ " width: 100%; "
++ " height: 304px; "
++ "} "
++ " "
++ "* html div.tableContainer { /* IE only hack */ "
++ " width: 95%; "
++ " border: 1px solid #ccc; "
++ " height: 285px; "
++ " overflow-x: hidden; "
++ " overflow-y: auto; "
++ "} "
++ " "
++ ".constraints td, "
++ ".constraints th{ "
++ " border-right: 1px solid #999; "
++ " padding: 2px; "
++ " font-weight: normal; "
++ " font-size: small; "
++ "} "
++ " "
++ ".constraints thead td, .constraints thead th { "
++ " background-image:url(/j2-admin/images/st-head.gif); "
++ " background-repeat:no-repeat; "
++ " background-position:top right; "
++ " font-size: small; "
++ " font-weight: bold; "
++ " text-align: left; "
++ "} "
++ ".constraints thead td.selectedUp, .constraints thead th.selectedUp { "
++ " background-image:url(/j2-admin/images/st-headup.gif); "
++ "} "
++ ".constraints thead td.selectedDown, .constraints thead th.selectedDown { "
++ " background-image:url(/j2-admin/images/st-headdown.gif); "
++ "} "
++ " "
++ "* html div.tableContainer table thead tr td, "
++ "* html div.tableContainer table thead tr th{ "
++ " /* IE Only hacks */ "
++ " position:relative; "
++ " top:expression(dojo.html.getFirstAncestorByTag(this,'table').parentNode.scrollTop-2); "
++ "} "
++ " "
++ " "
++ "html>body tbody.scrollContent { "
++ " height: 262px; "
++ " overflow-x: hidden; "
++ " overflow-y: auto; "
++ "} "
++ " "
++ "tbody.scrollContent td, tbody.scrollContent tr td { "
++ " background: #FFF; "
++ " padding: 2px; "
++ "} "
++ " "
++ "tbody.scrollContent tr.alternateRow td { "
++ " background: #e3edfa; "
++ " padding: 2px; "
++ "} "
++ " "
++ "tbody.scrollContent tr.selected td { "
++ " background: yellow; "
++ " padding: 2px; "
++ "} "
++ "tbody.scrollContent tr:hover td { "
++ " background: #a6c2e7; "
++ " padding: 2px; "
++ "} "
++ "tbody.scrollContent tr.selected:hover td { "
++ " background: #ff3; "
++ " padding: 2px; "
++ "}"
+)
+#set($headElem = $renderResponse.createElement("style"))
+#set($headElemDoc = $headElem.ownerDocument)
+#set($styleTextNode = $headElemDoc.createTextNode($styleTextContent))
+#set($result = $headElem.appendChild($styleTextNode))
+#set($result = $headElem.setAttribute("id", "category-portlet-header.vm"))
+#set($result = $renderResponse.addProperty("javax.portlet.markup.head.element", $headElem))
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org