[jboss-svn-commits] JBL Code SVN: r11203 - in labs/jbosslabs/trunk/portal-extensions: forge-mapper/src/java/org/jboss/labs/mapper/url and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Apr 22 12:46:32 EDT 2007


Author: adamw
Date: 2007-04-22 12:46:31 -0400 (Sun, 22 Apr 2007)
New Revision: 11203

Modified:
   labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/FacesTools.java
   labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/url/LabsMainUrlFactory.java
   labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/freezone/Freezone.java
   labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml
Log:
Freezone edit fix

Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/FacesTools.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/FacesTools.java	2007-04-21 23:21:21 UTC (rev 11202)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/FacesTools.java	2007-04-22 16:46:31 UTC (rev 11203)
@@ -32,8 +32,7 @@
 import javax.portlet.PortletRequest;
 
 import org.jboss.forge.common.projects.ProjectsHelper;
-import org.jboss.forge.common.projects.permissions.ActionRequestPermissionsChecker;
-import org.jboss.forge.common.projects.permissions.RenderRequestPermissionsChecker;
+import org.jboss.forge.common.projects.permissions.PermissionsCheckerFactory;
 import org.jboss.portal.api.node.PortalNodeURL;
 import org.jboss.portlet.JBossActionRequest;
 import org.jboss.portlet.JBossActionResponse;
@@ -235,21 +234,13 @@
     		String projectId = getSelectedProjectId();
     	
     		Object request = getExternalContext().getRequest();
-        
-    		if (request instanceof JBossActionRequest) {
-    			
-        		return ProjectsHelper.getProjects().editPermissionAllowed(
-    				new ActionRequestPermissionsChecker((JBossActionRequest) request),
-    				projectId);    
+
+        if (request instanceof PortletRequest) {
+            return ProjectsHelper.getProjects().editPermissionAllowed(
+                    PermissionsCheckerFactory.getPermissionsChecker((PortletRequest) request),
+                    projectId);
         }
         
-        if (request instanceof JBossRenderRequest) {
-        	
-        			return ProjectsHelper.getProjects().editPermissionAllowed(
-    				new RenderRequestPermissionsChecker((JBossRenderRequest) request),
-    				projectId);	
-        }
-        
         return false;
 	}
 }

Modified: labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/url/LabsMainUrlFactory.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/url/LabsMainUrlFactory.java	2007-04-21 23:21:21 UTC (rev 11202)
+++ labs/jbosslabs/trunk/portal-extensions/forge-mapper/src/java/org/jboss/labs/mapper/url/LabsMainUrlFactory.java	2007-04-22 16:46:31 UTC (rev 11203)
@@ -3,7 +3,6 @@
 import org.jboss.portal.core.controller.command.mapper.AbstractURLFactory;
 import org.jboss.portal.core.controller.ControllerCommand;
 import org.jboss.portal.core.model.portal.command.*;
-import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
 import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
 import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
 import org.jboss.portal.core.model.portal.command.action.ImportPageToDashboardCommand;
@@ -96,23 +95,26 @@
                 addToPath(sb, poc.getTargetId(), true);
 
                 return convertToURL(sb);
-            } else if (poc instanceof InvokeWindowCommand) {
-                InvokeWindowCommand wndCmd = (InvokeWindowCommand) poc;
-                InvokePortletWindowActionCommand actionCmd = null;
-                InvokePortletWindowRenderCommand renderCmd = null;
-                boolean freezone = false;
+            } else if (poc instanceof InvokePortletWindowActionCommand) {
+                InvokePortletWindowActionCommand actionCmd = (InvokePortletWindowActionCommand) poc;
 
-                StateString navigationalState = null;
+                addToPath(sb, poc.getTargetId(), true);
 
-                if (poc instanceof InvokePortletWindowActionCommand) {
-                    actionCmd = (InvokePortletWindowActionCommand) poc;
-                    navigationalState = actionCmd.getNavigationalState();
-                } else if (poc instanceof InvokePortletWindowRenderCommand) {
-                    renderCmd = (InvokePortletWindowRenderCommand) poc;
-                    navigationalState = renderCmd.getNavigationalState();
-                }
+                ServerURL url = convertToURL(sb);
+                PortletRequestEncoder encoder = new PortletRequestEncoder(url.getParameterMap());
 
-                if (wndCmd.getTargetId().toString().contains(FREEZONE_WINDOW_COMPONENT)) {
+                encoder.encodeAction(actionCmd.getNavigationalState(),
+                        actionCmd.getInteractionState(), actionCmd.getMode(),
+                        actionCmd.getWindowState());
+
+                return url;
+            } else if (poc instanceof InvokePortletWindowRenderCommand) {
+                InvokePortletWindowRenderCommand renderCmd = (InvokePortletWindowRenderCommand) poc;
+                boolean freezone = false;
+
+                StateString navigationalState = renderCmd.getNavigationalState();
+
+                if (renderCmd.getTargetId().toString().contains(FREEZONE_WINDOW_COMPONENT)) {
                     // A freezone window request; adding the resource path to
                     // the buffer.
                     freezone = true;
@@ -125,7 +127,7 @@
                         path = getFreezonePathFromStateString((StateString)
                                 serverInvocation.getContext().getAttributeResolver(
                                         ServerInvocation.NAVIGATIONAL_STATE_SCOPE).getAttribute(
-                                        wndCmd.getTargetId()));
+                                        renderCmd.getTargetId()));
                     }
 
                     addToPath(sb, poc.getTargetId(), false);
@@ -139,14 +141,8 @@
                 ServerURL url = convertToURL(sb);
                 PortletRequestEncoder encoder = new PortletRequestEncoder(url.getParameterMap());
 
-                if (actionCmd != null) {
-                    encoder.encodeAction(actionCmd.getNavigationalState(),
-                            actionCmd.getInteractionState(), actionCmd.getMode(),
-                            actionCmd.getWindowState());
-                } else if (renderCmd != null) {
-                    encoder.encodeRender(navigationalState,
-                            renderCmd.getMode(), renderCmd.getWindowState());
-                }
+                encoder.encodeRender(navigationalState,
+                        renderCmd.getMode(), renderCmd.getWindowState());
 
                 if (freezone) {
                     // If the target object is the freezone window, and the

Modified: labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/freezone/Freezone.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/freezone/Freezone.java	2007-04-21 23:21:21 UTC (rev 11202)
+++ labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/freezone/Freezone.java	2007-04-22 16:46:31 UTC (rev 11203)
@@ -30,16 +30,12 @@
 import javax.portlet.PortletMode;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletResponse;
-
 import org.jboss.forge.common.Constants;
 import org.jboss.forge.common.ForgeHelper;
 import org.jboss.forge.common.portlet.JBossLabsPortlet;
 import org.jboss.forge.common.projects.ProjectsHelper;
 import org.jboss.forge.common.projects.permissions.PermissionsCheckerFactory;
-import org.jboss.forge.common.projects.permissions.RenderRequestPermissionsChecker;
 import org.jboss.forge.projects.exceptions.NotExistsException;
-import org.jboss.logging.Logger;
 import org.jboss.portlet.JBossRenderRequest;
 import org.jboss.portlet.JBossRenderResponse;
 import org.jboss.shotoku.ContentManager;
@@ -52,293 +48,262 @@
 
 /**
  * A portlet for a project freezone.
- * 
+ *
  * @author Adam Warski (adamw at aster.pl)
  * @author Tomasz Szymanski
  * @author Ryszard Kozmik
  */
 public class Freezone extends JBossLabsPortlet {
-	@Inject
-	private ContentManager cm;
+    @Inject
+    private ContentManager cm;
 
-	@CacheItem
-	private FreezoneConfWatcher conf;
+    @CacheItem
+    private FreezoneConfWatcher conf;
 
-	private final static String ERROR_404_MSG = "404 - Not found.";
+    private final static String ERROR_404_MSG = "404 - Not found.";
 
-	private final static String TAGME_JSP = "freezone/tagme.jsp";
+    private final static String TAGME_JSP = "freezone/tagme.jsp";
 
-	private final static Logger log = Logger.getLogger(Freezone.class);
+    private void sendResponseNotFound(JBossRenderResponse response)
+            throws IOException {
+        response.setContentType(Constants.PAGES_MIME_TYPE);
+        response.getWriter().println(ERROR_404_MSG);
+    }
 
-	private void sendResponseNotFound(JBossRenderResponse response)
-			throws IOException {
-		response.setContentType(Constants.PAGES_MIME_TYPE);
-		response.getWriter().println(ERROR_404_MSG);
-	}
+    private String getRelativeRequestedPath(PortletRequest request) throws NotExistsException {
+        // Getting the path from render parameters.
+        String requestedRelPath = request
+                .getParameter(Constants.FREEZONE_PATH_PARAM);
 
-	private String getRequestedPath(PortletRequest request,
-			PortletResponse response) throws NotExistsException {
-		/*
-		 * Checking if the user has access to the selected project (this isn't
-		 * checked in the url mapper).
-		 */
-		String projectId = ProjectsHelper.getSelectedProjectId(request);
+        if ("".equals(requestedRelPath)) {
+            requestedRelPath = null;
+        }
 
-		if ((projectId != null)
-				&& (!"default".equals(projectId))
-				&& (!ProjectsHelper.getProjects(Constants.LABS_PORTAL)
-						.projectExists(
-								PermissionsCheckerFactory
-										.getPermissionsChecker(request),
-								projectId))) {
-			throw new NotExistsException("Not allowed to see");
-		}
+        // It is used if an instance has defined preference in instance
+        // descriptor.
+        Object requestedPathFromPref = request.getPreferences().getValue(
+                "page", null);
 
-		if (projectId == null) {
-			projectId = "default";
-		}
+        if ((requestedRelPath == null)
+                && (!Tools.isEmpty((String) requestedPathFromPref))) {
+            requestedRelPath = requestedPathFromPref.toString();
+        }
 
-		// Getting the path from render parameters.
-		String requestedRelPath = request
-				.getParameter(Constants.FREEZONE_PATH_PARAM);
+        return requestedRelPath;
+    }
 
-		if ("".equals(requestedRelPath)) {
-			requestedRelPath = null;
-		}
+    private String getAbsoluteRequestedPath(String requestedRelPath, PortletRequest request) throws NotExistsException {
+        /*
+		 * Checking if the user has access to the selected project (this isn't
+		 * checked in the url mapper).
+		 */
+        String projectId = ProjectsHelper.getSelectedProjectId(request);
 
-		// It is used if an instance has defined preference in instance
-		// descriptor.
-		Object requestedPathFromPref = request.getPreferences().getValue(
-				"page", null);
+        if ((projectId != null)
+                && (!"default".equals(projectId))
+                && (!ProjectsHelper.getProjects(Constants.LABS_PORTAL)
+                .projectExists(
+                        PermissionsCheckerFactory
+                                .getPermissionsChecker(request),
+                        projectId))) {
+            throw new NotExistsException("Not allowed to see");
+        }
 
-		if ((requestedRelPath == null)
-				&& (!Tools.isEmpty((String) requestedPathFromPref))) {
-			requestedRelPath = requestedPathFromPref.toString();
-		}
+        if (projectId == null) {
+            projectId = "default";
+        }
 
-		return ProjectsHelper.createAbsoluteFreezonePath(projectId,
-				requestedRelPath);
-	}
+        return ProjectsHelper.createAbsoluteFreezonePath(projectId,
+                requestedRelPath);
+    }
 
-	public void labsDoView(JBossRenderRequest request,
-			JBossRenderResponse response) throws IOException, PortletException {
+    private String getAbsoluteRequestedPath(PortletRequest request) throws NotExistsException {
+        return getAbsoluteRequestedPath(getRelativeRequestedPath(request), request);
+    }
 
-		// Getting the path requested by the user.
-		String requestedPath;
-		try {
-			requestedPath = getRequestedPath(request, response);
-		} catch (NotExistsException e1) {
-			sendResponseNotFound(response);
-			return;
-		}
+    public void labsDoView(JBossRenderRequest request,
+                           JBossRenderResponse response) throws IOException, PortletException {
 
-		Node requestedNode;
-		try {
-			requestedNode = cm.getNode(requestedPath);
-		} catch (ResourceDoesNotExist e) {
-			// Even if the resource doesn't exist, writing an edit link, to
-			// (possibly) create a new page.ru
-			if (isAllowedToEdit(request, response)) {
-				response.setContentType(Constants.PAGES_MIME_TYPE);
-				writeTagmeButton(request, response, requestedPath);
-				writeEditLink(request, response);
-				// writeEditLink(requestedPath, request, response);
-				response.getWriter().println(ERROR_404_MSG);
-			} else {
-				sendResponseNotFound(response);
-			}
+        // Getting the path requested by the user.
+        String requestedPath;
+        try {
+            requestedPath = getAbsoluteRequestedPath(request);
+        } catch (NotExistsException e1) {
+            sendResponseNotFound(response);
+            return;
+        }
 
-			return;
-		}
+        Node requestedNode;
+        try {
+            requestedNode = cm.getNode(requestedPath);
+        } catch (ResourceDoesNotExist e) {
+            // Even if the resource doesn't exist, writing an edit link, to
+            // (possibly) create a new page.
+            if (isAllowedToEdit(request, response)) {
+                response.setContentType(Constants.PAGES_MIME_TYPE);
+                writeTagmeButton(request, response, requestedPath);
+                writeEditLink(request, response);
+                response.getWriter().println(ERROR_404_MSG);
+            } else {
+                sendResponseNotFound(response);
+            }
 
-		response.setContentType(Constants.PAGES_MIME_TYPE);
-		writeTagmeButton(request, response, requestedPath);
-		if (isAllowedToEdit(request, response)) {
-			writeEditLink(request, response);
-		}
-		
-		if (isAllowedToEdit(request, response)) {
-			// writeEditLink(requestedPath, request, response);
-			Tools.transfer(requestedNode.getContentInputStream(), response
-					.getWriter());
-		} else {
-			Tools.transfer(requestedNode.getContentInputStream(), response
-					.getWriter());
-		}
-	}
+            return;
+        }
 
-	private void writeTagmeButton(JBossRenderRequest request,
-			JBossRenderResponse response, String requestedPath)
-			throws PortletException, IOException {
-		if (request.getUser() != null) {
-			request.setAttribute("TAGME_PATH", requestedPath);
-			request.setAttribute("TAGME_USER", request.getUser().getUserName());
+        response.setContentType(Constants.PAGES_MIME_TYPE);
+        writeTagmeButton(request, response, requestedPath);
+        if (isAllowedToEdit(request, response)) {
+            writeEditLink(request, response);
+        }
 
-			PortletRequestDispatcher rd = getPortletContext()
-					.getRequestDispatcher(
-							ForgeHelper.createRepoAccessPath(TAGME_JSP));
+        Tools.transfer(requestedNode.getContentInputStream(), response.getWriter());
+    }
 
-			rd.include(request, response);
-		}
-	}
+    private void writeTagmeButton(JBossRenderRequest request,
+                                  JBossRenderResponse response, String requestedPath)
+            throws PortletException, IOException {
+        if (request.getUser() != null) {
+            request.setAttribute("TAGME_PATH", requestedPath);
+            request.setAttribute("TAGME_USER", request.getUser().getUserName());
 
-	@SuppressWarnings("unchecked")
-	@Override
-	protected boolean isAllowed(JBossRenderRequest request,
-			JBossRenderResponse response) {
-		String cmsPath = null;
-		try {
-			cmsPath = getRequestedPath(request, response);
-		} catch (NotExistsException e) {
-			// should not happen
-		}
+            PortletRequestDispatcher rd = getPortletContext()
+                    .getRequestDispatcher(
+                            ForgeHelper.createRepoAccessPath(TAGME_JSP));
 
-		List<String> loggedInOnly = conf
-				.get(ForgeHelper.getPortalName(request));
+            rd.include(request, response);
+        }
+    }
 
-		return (request.getUser() != null)
-				|| (loggedInOnly != null && !loggedInOnly.contains(cmsPath));
-	}
+    @SuppressWarnings("unchecked")
+    @Override
+    protected boolean isAllowed(JBossRenderRequest request,
+                                JBossRenderResponse response) {
+        String cmsPath = null;
+        try {
+            cmsPath = getAbsoluteRequestedPath(request);
+        } catch (NotExistsException e) {
+            // should not happen
+        }
 
-	/*
-	 * EDITING PART
-	 */
+        List<String> loggedInOnly = conf
+                .get(ForgeHelper.getPortalName(request));
 
-	private final static String LOG_MSG = "Freezone save";
+        return (request.getUser() != null)
+                || (loggedInOnly != null && !loggedInOnly.contains(cmsPath));
+    }
 
-	private final static String ERROR_403_MSG = "403 not authorized";
+    /*
+      * EDITING PART
+      */
 
-	private final static String EDIT_LINK_JSP = "freezone/edit_link.jsp";
+    private final static String ERROR_403_MSG = "403 not authorized";
+    
+    private final static String CONTENT = "content";
 
-	private final static String EDIT_JSP = "freezone/edit.jsp";
+    protected boolean isAllowedToEdit(JBossRenderRequest request,
+                                      JBossRenderResponse response) {
+        return ProjectsHelper.getProjects().editPermissionAllowed(
+                PermissionsCheckerFactory.getPermissionsChecker(request),
+                ProjectsHelper.getSelectedProjectId(request, true));
+    }
 
-	private final static String PARAM_MESSAGE = "message";
+    protected void writeEditLink(JBossRenderRequest request,
+                                 JBossRenderResponse response) throws IOException, PortletException {
+        PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+                ForgeHelper.createRepoAccessPath("freezone/edit_link.jsp"));
 
-	private final static String MESSAGE_SAVE_ERROR = "There was an error while saving; please try again or contact the "
-			+ "administrator. Error: ";
+        rd.include(request, response);
+    }
 
-	private final static String ACTION_SAVE = "save";
+    private Node getNodeForPath(String path) throws PortletException {
+        try {
+            return cm.getNode(path);
+        } catch (ResourceDoesNotExist resourceDoesNotExist) {
+            try {
+                return cm.getRootDirectory().newNode(path);
+            } catch (Exception e) {
+                throw new PortletException(e);
+            }
+        }
+    }
 
-	private final static String ACTION_CANCEL = "cancel";
+    protected void doEdit(JBossRenderRequest request,
+                          JBossRenderResponse response) throws PortletException, IOException {
+        // We'll be sending text/html for sure.
+        response.setContentType(Constants.PAGES_MIME_TYPE);
 
-	private final static String ACTION_PREVIEW = "preview";
+        // First checking if a user is allowed to edit the page.
+        if (!isAllowedToEdit(request, response)) {
+            response.getWriter().write(ERROR_403_MSG);
+            return;
+        }
 
-	private final static String CONTENT = "content";
+        // Setting the content attribute.
+        String reqRelPath, reqAbsPath;
+        try {
+            reqRelPath = getRelativeRequestedPath(request);
+            reqAbsPath = getAbsoluteRequestedPath(reqRelPath, request);
+        } catch (NotExistsException e) {
+            response.getWriter().println(ERROR_404_MSG);
+            return;
+        }
 
-	protected boolean isAllowedToEdit(JBossRenderRequest request,
-			JBossRenderResponse response) {
-		return ProjectsHelper.getProjects().editPermissionAllowed(
-				new RenderRequestPermissionsChecker(request),
-				ProjectsHelper.getSelectedProjectId(request, true));
-	}
+        String content = getNodeForPath(reqAbsPath).getContent();
 
-	protected void writeEditLink(JBossRenderRequest request,
-			JBossRenderResponse response) throws IOException, PortletException {
-		PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
-				ForgeHelper.createRepoAccessPath(EDIT_LINK_JSP));
+        if (content == null) {
+            content = getNodeForPath(
+                    request.getParameter(Constants.FREEZONE_PATH_PARAM))
+                    .getContent();
+        }
 
-		rd.include(request, response);
-	}
+        request.setAttribute(CONTENT, content);
+        request.setAttribute(Constants.FREEZONE_PATH_PARAM, reqRelPath);
+        // Showing the edit page.
+        PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+                ForgeHelper.createRepoAccessPath("freezone/edit.jsp"));
 
-	private Node getNodeForPath(String path) throws PortletException {
-		try {
-			return cm.getNode(path);
-		} catch (ResourceDoesNotExist resourceDoesNotExist) {
-			try {
-				return cm.getRootDirectory().newNode(path);
-			} catch (Exception e) {
-				throw new PortletException(e);
-			}
-		}
-	}
+        rd.include(request, response);
+    }
 
-	protected void doEdit(JBossRenderRequest request,
-			JBossRenderResponse response) throws PortletException, IOException {
-		String portalName = ForgeHelper.getPortalName(request);
+    public void processAction(ActionRequest request, ActionResponse response)
+            throws PortletException, IOException {
 
-		log.info("doEdit FREEZONE PARAM: "
-				+ request.getParameter(Constants.FREEZONE_PATH_PARAM)
-				+ " CONTENT: " + request.getParameter(CONTENT));
+        // Passing necessary parameters.
+        String requestPathParam;
+        try {
+            requestPathParam = getAbsoluteRequestedPath(request);
+        } catch (NotExistsException e1) {
+            return;
+        }
 
-		// We'll be sending text/html for sure.
-		response.setContentType(Constants.PAGES_MIME_TYPE);
+        if (request.getParameter("save") != null) {
+            // Save.
+            Node n = getNodeForPath(requestPathParam);
+            n.setContent(request.getParameter(CONTENT));
 
-		// First checking if a user is allowed to edit the page.
-		if (!isAllowedToEdit(request, response)) {
-			response.getWriter().write(ERROR_403_MSG);
-			return;
-		}
+            try {
+                n.save("Freezone save");
+            } catch (SaveException e) {
+                response.setRenderParameter(CONTENT, request
+                        .getParameter(CONTENT));
+                response.setRenderParameter("message",
+                        "There was an error while saving; please try again or contact the "
+                                + "administrator. Error: " + e.toString());
 
-		// Setting the content attribute.
-		String reqPath = null;
-		try {
-			reqPath = getRequestedPath(request, response);
-		} catch (NotExistsException e) {
-			// will not happen
-		}
+                return;
+            }
 
-		String content = getNodeForPath(reqPath).getContent();
+            // Save successfull, returning to the normal view.
+            response.setPortletMode(PortletMode.VIEW);
 
-		if (content == null) {
-			content = getNodeForPath(
-					request.getParameter(Constants.FREEZONE_PATH_PARAM))
-					.getContent();
-		}
+            return;
+        }
 
-		request.setAttribute(CONTENT, content);
-		request.setAttribute(Constants.FREEZONE_PATH_PARAM, reqPath);
-		// Showing the edit page.
-		PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
-				ForgeHelper.createRepoAccessPath(portalName, EDIT_JSP));
+        if (request.getParameter("cancel") != null) {
+            // Canceling the edit - returning to normal view.
 
-		rd.include(request, response);
-	}
-
-	public void processAction(ActionRequest request, ActionResponse response)
-			throws PortletException, IOException {
-
-		// Passing necessary parameters.
-		String requestPathParam;
-		try {
-			requestPathParam = getRequestedPath(request, response);
-		} catch (NotExistsException e1) {
-			log.error("Can't get project informations", e1);
-			return;
-		}
-
-		if (request.getParameter(ACTION_PREVIEW) != null) {
-			// Preview.
-			response.setRenderParameter(CONTENT, request.getParameter(CONTENT));
-
-			return;
-		}
-
-		if (request.getParameter(ACTION_SAVE) != null) {
-			// Save.
-			Node n = getNodeForPath(requestPathParam);
-			n.setContent(request.getParameter(CONTENT));
-
-			try {
-				n.save(LOG_MSG);
-			} catch (SaveException e) {
-				response.setRenderParameter(CONTENT, request
-						.getParameter(CONTENT));
-				response.setRenderParameter(PARAM_MESSAGE, MESSAGE_SAVE_ERROR
-						+ e.toString());
-
-				return;
-			}
-
-			// Save successfull, returning to the normal view.
-			response.setPortletMode(PortletMode.VIEW);
-
-			return;
-		}
-
-		if (request.getParameter(ACTION_CANCEL) != null) {
-			// Canceling the edit - returning to normal view.
-
-			response.setPortletMode(PortletMode.VIEW);
-		}
-	}
+            response.setPortletMode(PortletMode.VIEW);
+        }
+    }
 }

Modified: labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml	2007-04-21 23:21:21 UTC (rev 11202)
+++ labs/jbosslabs/trunk/portal-extensions/portal-default/src/web/WEB-INF/default-object.xml	2007-04-22 16:46:31 UTC (rev 11203)
@@ -56,7 +56,7 @@
 				<window-state>maximized</window-state>
 			</supported-window-states>
 
-			<page>
+            <page>
 				<page-name>default</page-name>
 				<properties>
 					<!-- Set a different layout for this page -->




More information about the jboss-svn-commits mailing list