Author: taylor
Date: Mon Feb 12 14:38:44 2007
New Revision: 506718
URL: http://svn.apache.org/viewvc?view=rev&rev=506718
Log:
https://issues.apache.org/jira/browse/JS2-306
Portal Site Manager improvements
* move and copy of nodes in the site tree implemented
* optional User Tree implemented (without search (ahem....))
contribution from Vivek Kumar
Added:
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/getfolders.vm
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetFoldersListAction.java
Modified:
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/site/site-view.vm
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/desktop/impl/DesktopValveImpl.java
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/Constants.java
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/UpdateFolderAction.java
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/UpdateLinkAction.java
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/UpdatePageAction.java
portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
Modified:
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java?view=diff&rev=506718&r1=506717&r2=506718
==============================================================================
---
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
(original)
+++
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
Mon Feb 12 14:38:44 2007
@@ -1,189 +1,195 @@
-/*
- * Copyright 2000-2001,2004 The Apache Software Foundation.
- *
- * Licensed 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.site;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletPreferences;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.CommonPortletServices;
-import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.components.portletregistry.PortletRegistry;
-import org.apache.jetspeed.decoration.DecorationFactory;
-import org.apache.jetspeed.headerresource.HeaderResource;
-import org.apache.jetspeed.om.folder.Folder;
-import org.apache.jetspeed.page.PageManager;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
-import org.apache.velocity.context.Context;
-
-/**
- * Manage the Portal Site
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
- * @version $Id: $
- */
-public class PortalSiteManager extends AbstractDojoVelocityPortlet
-{
- protected final Log log = LogFactory.getLog(this.getClass());
-
- // components
- protected PageManager pageManager;
- protected PortletRegistry registry;
- protected DecorationFactory decorationFactory;
-
- // session
- protected final static String SESSION_FOLDERS =
"jetspeed.site.manager.folders";
- protected final static String SESSION_ROOT = "jetspeed.site.manager.root";
-
- // context
- public final static String FOLDERS = "folders";
- public final static String JSROOT = "jsroot";
- public static final String ALL_SECURITY_REFS = "allSecurityRefs";
-
-
- public void init(PortletConfig config)
- throws PortletException
- {
- super.init(config);
- pageManager = (PageManager)
getPortletContext().getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
- if (null == pageManager)
- {
- PortletException pe = new PortletException("Failed to find the
Page Manager on SiteViewController initialization");
- throw new RuntimeException(pe);
- }
- registry = (PortletRegistry)
getPortletContext().getAttribute(CommonPortletServices.CPS_REGISTRY_COMPONENT);
- if (null == registry)
- {
- PortletException pe = new PortletException("Failed to find the
Portlet Registry on SiteViewController initialization");
- throw new RuntimeException(pe);
- }
- decorationFactory = (DecorationFactory)
getPortletContext().getAttribute(CommonPortletServices.CPS_DECORATION_FACTORY);
- if (null == decorationFactory)
- {
- PortletException pe = new PortletException("Failed to find the
Decoration Factory on SiteViewController initialization");
- throw new RuntimeException(pe);
- }
-
- }
-
- public void doView(RenderRequest request, RenderResponse response)
- throws PortletException, IOException
- {
- try
- {
- String jsroot = determineRootFolder(request);
- RequestContext requestContext =
- (RequestContext)
request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
- this.getContext(request).put("page-decorations",
decorationFactory.getPageDecorations(requestContext));
- this.getContext(request).put("portlet-decorations",
decorationFactory.getPortletDecorations(requestContext));
- this.getContext(request).put("themes",
decorationFactory.getDesktopThemes(requestContext));
- this.getContext(request).put("defaultLayout",
request.getPreferences().getValue("defaultLayout",
"jetspeed-layouts::VelocityTwoColumns"));
- this.getContext(request).put(FOLDERS, retrieveFolders(request,
jsroot));
- this.getContext(request).put(ALL_SECURITY_REFS,
pageManager.getPageSecurity().getSecurityConstraintsDefs());
- }
- catch (Exception e)
- {
- throw new PortletException("Failed to get root folder");
- }
-
- super.doView(request, response);
- }
-
- protected String determineRootFolder(RenderRequest request)
- {
- String jsroot = request.getParameter(JSROOT);
- if (jsroot == null || jsroot.equals(""))
- {
- jsroot = request.getPreferences().getValue("root", "/_user/" +
request.getRemoteUser() + "/");
- }
- this.getContext(request).put(JSROOT, jsroot);
- return jsroot;
- }
-
- public Folder retrieveFolders(RenderRequest request, String root)
- throws PortletException
- {
- try
- {
- Folder folder = pageManager.getFolder(root);
- return folder;
- }
- catch (Exception e)
- {
- log.error("Failed to retrieve folders ", e);
- throw new PortletException("Failed to get root folder");
- }
- }
-
- protected void includeHeaderContent(HeaderResource headerResource)
- {
- headerResource.dojoAddCoreLibraryRequire("dojo.lang.*");
- //headerResource.dojoAddCoreLibraryRequire("dojo.dnd.*");
- headerResource.dojoAddCoreLibraryRequire("dojo.dnd.HtmlDragManager");
- headerResource.dojoAddCoreLibraryRequire("dojo.dnd.DragAndDrop");
- headerResource.dojoAddCoreLibraryRequire("dojo.dnd.HtmlDragAndDrop");
-
- headerResource.dojoAddCoreLibraryRequire("dojo.event.*");
- headerResource.dojoAddCoreLibraryRequire("dojo.io");
-
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.ContentPane");
-
headerResource.dojoAddCoreLibraryRequire("dojo.widget.LayoutContainer");
-
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.Tree");
-
headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeRPCController");
- //
headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeLoadingControllerV3");
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeSelector");
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeNode");
-
headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeContextMenu");
-
-
headerResource.dojoAddCoreLibraryRequire("dojo.widget.ValidationTextbox");
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.ComboBox");
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.Checkbox");
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.Dialog");
- headerResource.dojoAddCoreLibraryRequire("dojo.widget.Button");
-
- headerResource.dojoAddModuleLibraryRequire( "jetspeed.desktop.core" );
- headerResource.dojoAddModuleLibraryRequire(
"jetspeed.widget.EditorTable" );
- }
-
- public void doEdit(RenderRequest request, RenderResponse response)
- throws PortletException, IOException
- {
- response.setContentType("text/html");
- doPreferencesEdit(request, response);
- }
-
- public void processAction(ActionRequest request, ActionResponse
actionResponse) throws PortletException, java.io.IOException
- {
- String add = request.getParameter("Save");
- if (add != null)
- {
- processPreferencesAction(request, actionResponse);
- }
- }
-}
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.site;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.CommonPortletServices;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.decoration.DecorationFactory;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
+import org.apache.velocity.context.Context;
+
+/**
+ * Manage the Portal Site
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class PortalSiteManager extends AbstractDojoVelocityPortlet
+{
+ protected final Log log = LogFactory.getLog(this.getClass());
+
+ // components
+ protected PageManager pageManager;
+ protected PortletRegistry registry;
+ protected DecorationFactory decorationFactory;
+
+ // session
+ protected final static String SESSION_FOLDERS =
"jetspeed.site.manager.folders";
+ protected final static String SESSION_ROOT = "jetspeed.site.manager.root";
+
+ // context
+ public final static String FOLDERS = "folders";
+ public final static String JSROOT = "jsroot";
+ public static final String ALL_SECURITY_REFS = "allSecurityRefs";
+
+
+ public void init(PortletConfig config)
+ throws PortletException
+ {
+ super.init(config);
+ pageManager = (PageManager)
getPortletContext().getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
+ if (null == pageManager)
+ {
+ PortletException pe = new PortletException("Failed to find the
Page Manager on SiteViewController initialization");
+ throw new RuntimeException(pe);
+ }
+ registry = (PortletRegistry)
getPortletContext().getAttribute(CommonPortletServices.CPS_REGISTRY_COMPONENT);
+ if (null == registry)
+ {
+ PortletException pe = new PortletException("Failed to find the
Portlet Registry on SiteViewController initialization");
+ throw new RuntimeException(pe);
+ }
+ decorationFactory = (DecorationFactory)
getPortletContext().getAttribute(CommonPortletServices.CPS_DECORATION_FACTORY);
+ if (null == decorationFactory)
+ {
+ PortletException pe = new PortletException("Failed to find the
Decoration Factory on SiteViewController initialization");
+ throw new RuntimeException(pe);
+ }
+
+ }
+
+ public void doView(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+ try
+ {
+ String jsroot = determineRootFolder(request);
+ RequestContext requestContext =
+ (RequestContext)
request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+ this.getContext(request).put("page-decorations",
decorationFactory.getPageDecorations(requestContext));
+ this.getContext(request).put("portlet-decorations",
decorationFactory.getPortletDecorations(requestContext));
+ this.getContext(request).put("themes",
decorationFactory.getDesktopThemes(requestContext));
+ this.getContext(request).put("userTree",
determineuserTree(request));
+ this.getContext(request).put("defaultLayout",
request.getPreferences().getValue("defaultLayout",
"jetspeed-layouts::VelocityTwoColumns"));
+ this.getContext(request).put(FOLDERS, retrieveFolders(request,
jsroot));
+ this.getContext(request).put(ALL_SECURITY_REFS,
pageManager.getPageSecurity().getSecurityConstraintsDefs());
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Failed to get root folder");
+ }
+
+ super.doView(request, response);
+ }
+
+ protected String determineRootFolder(RenderRequest request)
+ {
+ String jsroot = request.getParameter(JSROOT);
+ if (jsroot == null || jsroot.equals(""))
+ {
+ jsroot = request.getPreferences().getValue("root", "/_user/" +
request.getRemoteUser() + "/");
+ }
+ this.getContext(request).put(JSROOT, jsroot);
+ return jsroot;
+ }
+ protected String determineuserTree(RenderRequest request)
+ {
+ String userTree;
+ userTree = request.getPreferences().getValue("displayUserTree","false");
+ return userTree;
+ }
+ public Folder retrieveFolders(RenderRequest request, String root)
+ throws PortletException
+ {
+ try
+ {
+ Folder folder = pageManager.getFolder(root);
+ return folder;
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to retrieve folders ", e);
+ throw new PortletException("Failed to get root folder");
+ }
+ }
+
+ protected void includeHeaderContent(HeaderResource headerResource)
+ {
+ headerResource.dojoAddCoreLibraryRequire("dojo.lang.*");
+ //headerResource.dojoAddCoreLibraryRequire("dojo.dnd.*");
+ headerResource.dojoAddCoreLibraryRequire("dojo.dnd.HtmlDragManager");
+ headerResource.dojoAddCoreLibraryRequire("dojo.dnd.DragAndDrop");
+ headerResource.dojoAddCoreLibraryRequire("dojo.dnd.HtmlDragAndDrop");
+
+ headerResource.dojoAddCoreLibraryRequire("dojo.event.*");
+ headerResource.dojoAddCoreLibraryRequire("dojo.io");
+
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.ContentPane");
+
headerResource.dojoAddCoreLibraryRequire("dojo.widget.LayoutContainer");
+
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.Tree");
+
headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeRPCController");
+ //
headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeLoadingControllerV3");
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeSelector");
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeNode");
+
headerResource.dojoAddCoreLibraryRequire("dojo.widget.TreeContextMenu");
+
+
headerResource.dojoAddCoreLibraryRequire("dojo.widget.ValidationTextbox");
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.ComboBox");
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.Checkbox");
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.Dialog");
+ headerResource.dojoAddCoreLibraryRequire("dojo.widget.Button");
+
+ headerResource.dojoAddModuleLibraryRequire( "jetspeed.desktop.core" );
+ headerResource.dojoAddModuleLibraryRequire(
"jetspeed.widget.EditorTable" );
+ }
+
+ public void doEdit(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ doPreferencesEdit(request, response);
+ }
+
+ public void processAction(ActionRequest request, ActionResponse
actionResponse) throws PortletException, java.io.IOException
+ {
+ String add = request.getParameter("Save");
+ if (add != null)
+ {
+ processPreferencesAction(request, actionResponse);
+ }
+ }
+}
Modified:
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml?view=diff&rev=506718&r1=506717&r2=506718
==============================================================================
---
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
(original)
+++
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
Mon Feb 12 14:38:44 2007
@@ -1074,12 +1074,12 @@
<description>Provides users with the ability register as a new user with
the portal.</description>
<description
xml:lang="ja">ã¦ã¼ã¶ã¼ã«ãã¼ã¿ã«ã®æ°è¦ç»é²ããæ©è½ãæä¾ãã¾ãã</description>
<description xml:lang="zh">注åä¸ä¸ªæ°ç鍿·ç¨æ·</description>
- <description xml:lang="zh-TW">註åä¸åæ°çéæ¶ç¨æ¶</description>
- <portlet-name>UserRegistrationPortlet</portlet-name>
- <display-name>User Registration Portlet</display-name>
- <display-name
xml:lang="ja">ã¦ã¼ã¶ã¼ç»é²ãã¼ãã¬ãã</display-name>
- <display-name xml:lang="zh">ç¨æ·æ³¨å</display-name>
- <display-name xml:lang="zh-TW">ç¨æ¶è¨»å</display-name>
+ <description xml:lang="zh-TW">註åä¸åæ°çéæ¶ç¨æ¶</description>
+ <portlet-name>UserRegistrationPortlet</portlet-name>
+ <display-name>User Registration Portlet</display-name>
+ <display-name
xml:lang="ja">ã¦ã¼ã¶ã¼ç»é²ãã¼ãã¬ãã</display-name>
+ <display-name xml:lang="zh">ç¨æ·æ³¨å</display-name>
+ <display-name xml:lang="zh-TW">ç¨æ¶è¨»å</display-name>
<portlet-class>org.apache.jetspeed.portlets.registration.UserRegistrationPortlet</portlet-class>
<init-param>
<description>This parameter sets the template used in view
mode.</description>
@@ -1127,20 +1127,20 @@
<init-param>
<name>portlet-icon</name>
<value>start-here.png</value>
- </init-param>
- <expiration-cache>-1</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <supported-locale>en</supported-locale>
+ </init-param>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
<supported-locale>ja</supported-locale>
-
<resource-bundle>org.apache.jetspeed.portlets.registration.resources.UserRegistrationResources</resource-bundle>
- <portlet-info>
- <title>User Registration </title>
- <short-title>User Registration</short-title>
- <keywords>admin,password,register,signup,user</keywords>
- </portlet-info>
+
<resource-bundle>org.apache.jetspeed.portlets.registration.resources.UserRegistrationResources</resource-bundle>
+ <portlet-info>
+ <title>User Registration </title>
+ <short-title>User Registration</short-title>
+ <keywords>admin,password,register,signup,user</keywords>
+ </portlet-info>
</portlet>
<portlet id="PortalLoginPortlet">
@@ -1422,6 +1422,10 @@
<name>defaultLayout</name>
<value>jetspeed-layouts::VelocityTwoColumns</value>
</preference>
+ <preference>
+ <name>displayUserTree</name>
+ <value>false</value>
+ </preference>
<preference>
<name>root</name>
<value>/</value>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]