Author: sohil.shah(a)jboss.com
Date: 2007-12-02 10:21:40 -0500 (Sun, 02 Dec 2007)
New Revision: 9240
Added:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/Util.java
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublish.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1699 - Better CMS workflow approval
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublish.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublish.java 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublish.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -51,6 +51,16 @@
* @param approved true if approved, false if rejected
*/
public void processManagerResponse(long processId, String manager, boolean approved)
throws WorkflowException;
+
+ /**
+ * Called when a manager either approves the publishing of a specific content to go
live, but at the same time
+ * adds his/her own modifications to the original content
+ *
+ * @param processId
+ * @param manager userId of the manager
+ * @param approved true if approved, false if rejected
+ */
+ public void processManagerResponse(long processId, String manager, String
modifiedContent) throws WorkflowException;
/**
* Retrieves a queue of unapproved content associated with the specified file in the
CMS
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -436,7 +436,80 @@
IOTools.safeClose(jbpmContext);
}
}
+
+ /**
+ * Called when a manager either approves the publishing of a specific content to go
live, but at the same time
+ * adds his/her own modifications to the original content
+ *
+ * @param processId
+ * @param manager userId of the manager
+ * @param approved true if approved, false if rejected
+ */
+ public void processManagerResponse(long processId, String manager, String
modifiedContent) throws WorkflowException
+ {
+ JbpmContext jbpmContext = null;
+ ProcessInstance processInstance = null;
+ boolean isManager = false;
+ try
+ {
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ //Now, we search for all process instances of this process definition.
+ processInstance = jbpmContext.loadProcessInstance(processId);
+
+ if (processInstance.hasEnded())
+ {
+ log.debug("This process has already ended...");
+ return;
+ }
+
+ processInstance.getContextInstance().setVariable("approved", new
Boolean(true));
+ processInstance.getContextInstance().setVariable("modifiedContent",
modifiedContent);
+
+ Collection allTasks = processInstance.getTaskMgmtInstance().getTaskInstances();
+ if (allTasks != null)
+ {
+ for (Iterator itr = allTasks.iterator(); itr.hasNext();)
+ {
+ TaskInstance cour = (TaskInstance)itr.next();
+ if (this.isManager(manager, cour.getActorId()))
+ {
+ isManager = true;
+ log.debug("Manager=" + cour.getActorId() + "(" +
processId + ")");
+
+ //check and make sure this task instance is not marked for deletion
+ if (cour.getVariable(processInstance.getId() + ":" +
cour.getId()) != null)
+ {
+ continue;
+ }
+
+ cour.start();
+ cour.end("approval");
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WorkflowException(e);
+ }
+ finally
+ {
+ if (processInstance != null)
+ {
+ jbpmContext.save(processInstance);
+ }
+
+ if (!isManager)
+ {
+ WorkflowException we = new WorkflowException("You are not authorized to
Approve/Deny content publish requests");
+ throw we;
+ }
+ IOTools.safeClose(jbpmContext);
+ }
+ }
+
/**
* Retrieves a queue of unapproved content associated with the specified file in the
CMS
*
Added:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.workflow;
+
+import java.util.List;
+import java.util.Locale;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.impl.interceptors.ACLInterceptor;
+
+/**
+ * @author Sohil Shah - sshah(a)redhat.com
+ */
+public class CMSWorkflowUtil
+{
+ /**
+ *
+ * @return
+ */
+ public static Content getPendingContent(long processId, String contentPath)
+ {
+ Content content = null;
+
+ int lastIndex = contentPath.lastIndexOf('/');
+ String path = contentPath.substring(0, lastIndex);
+ String language = contentPath.substring(lastIndex + 1);
+
+ ACLInterceptor.turnOff();
+
+ CMS cms = CMSWorkflowUtil.getCMSService();
+ Command command =
cms.getCommandFactory().createContentGetVersionsCommand(contentPath);
+ List versions = (List)cms.execute(command);
+
+ content = CMSWorkflowUtil.findProcessContent(processId, versions);
+ if(content != null)
+ {
+ //fetch the content
+ command = cms.getCommandFactory().createFileGetCommand(path,
content.getVersionNumber(), new Locale(language));
+ File file = (File)cms.execute(command);
+
+ content = file.getContent();
+ }
+
+
+ ACLInterceptor.turnOn();
+
+ return content;
+ }
+
+ /**
+ * @param processId
+ * @param versions
+ * @return
+ */
+ private static Content findProcessContent(long processId, List versions)
+ {
+ Content content = null;
+
+ if (versions != null)
+ {
+ for (int i = 0; i < versions.size(); i++)
+ {
+ Content cour = (org.jboss.portal.cms.model.Content)versions.get(i);
+ if (cour.isWaitingForPublishApproval())
+ {
+ if (cour.getApprovalProcessId() != null &&
+ cour.getApprovalProcessId().trim().equals(String.valueOf(processId)))
+ {
+ //not if found...the content of this version should be published to go
live
+ return cour;
+ }
+ }
+ }
+ }
+
+ return content;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private static CMS getCMSService()
+ {
+ try
+ {
+ return (CMS)new InitialContext().lookup("java:/portal/CMS");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -54,6 +54,7 @@
{
Content content =
(Content)executionContext.getContextInstance().getVariable("content");
boolean approved =
((Boolean)executionContext.getContextInstance().getVariable("approved")).booleanValue();
+ String modifiedContent =
(String)executionContext.getContextInstance().getVariable("modifiedContent");
long processId = executionContext.getProcessInstance().getId();
CMS cms = this.getCMSService();
@@ -82,6 +83,11 @@
command = cms.getCommandFactory().createFileGetCommand(path,
processContent.getVersionNumber(),
new Locale(language));
File file = (File)cms.execute(command);
+
+ if(modifiedContent != null && modifiedContent.trim().length()>0)
+ {
+ file.getContent().setBytes(modifiedContent.getBytes());
+ }
//now publish this
file.getContent().setApprovalProcessId(null);
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -389,5 +389,4 @@
return controllerContext.renderURL(cmd, URLContext.newInstance(false, false),
RELATIVE_SERVLET_ENCODED_URL_FORMAT);
}
}
-
}
Added:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/Util.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/Util.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/Util.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.cms.ui;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.jboss.portal.cms.util.FileUtil;
+import org.jboss.portal.core.cms.content.InternalCMSContentProvider;
+import org.jboss.portal.core.cms.ui.CMSPortlet.GlobalURLFactory;
+import org.jboss.portal.core.cms.ui.CMSPortlet.LocalURLFactory;
+import org.jboss.portal.core.cms.ui.CMSPortlet.URLFactory;
+import org.jboss.portlet.JBossRenderRequest;
+
+/**
+ * @author Sohil Shah - sshah(a)redhat.com
+ */
+public class Util
+{
+ /**
+ * It's easier and more robust to follow the standards. See
http://www.ietf.org/rfc/rfc2396.txt of which, Section
+ * 3.1 on the "Scheme Component" is partially excerpted here:
+ * <p/>
+ * Just as there are many different methods of access to resources, there are a
variety of schemes for identifying
+ * such resources...
+ * <p/>
+ * Scheme names consist of a sequence of characters beginning with a lower case letter
and followed by any
+ * combination of lower case letters, digits, plus ("+"), period
("."), or hyphen ("-"). For resiliency, programs
+ * interpreting URI should treat upper case letters as equivalent to lower case in
scheme names (e.g., allow "HTTP"
+ * as well as "http").
+ * <p/>
+ * scheme = alpha *( alpha | digit | "+" | "-" | "." )
+ */
+ private static final String URI_schemeRegex = "[a-z][-+.0-9a-z]*:";
+
+ /**
+ * For our purposes, ignore URIs that start with a scheme idicator, a slash
(indicating an absolute path), or a hash
+ * sign (# = ASCII hex 23).
+ */
+ private static final String URI_ignoreRegex = "" + URI_schemeRegex +
"|/|\\x23";
+
+ private static final String
+ regex = "((?:href|src)\\s*=\\s*) # Capture preliminaries in $1.
\n"
+ + "(?: # First look for URL in quotes.
\n"
+ + " ([\"\']) # Capture open quote in $2.
\n"
+ + " (?!" + URI_ignoreRegex + ") # If it isn't
absolute... \n"
+ + " /?(.+?) # ...capture URL in $3
\n"
+ + " \\2 # Match the closing quote
\n"
+ + " | # Look for non-quoted URL.
\n"
+ + " (?![\"\']|" + URI_ignoreRegex + ") # If it isn't
absolute... \n"
+ + " /?([^\\s>]+) # ...capture URL in $4
\n"
+ + ")";
+
+ /** Removes header content, and leaves content between body tags. */
+ private static final String HTMLStripperRegex =
"(.*<body[^>]*>(.+)</body>.*)";
+
+ /** . */
+ private static final Pattern RELATIVE_URI_PATTERN = Pattern.compile(regex,
Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.COMMENTS);
+
+ /** . */
+ private static final Pattern STRIP_TAGS_PATTERN = Pattern.compile(HTMLStripperRegex,
Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
+
+ /**
+ *
+ * @param cmsContent
+ * @return
+ */
+ public static String getViewableContent(RenderRequest req, RenderResponse resp,String
cmsContent)
+ {
+ String viewableContent = "";
+
+ //
+ URLFactory textURLFactory = null;
+ if (InternalCMSContentProvider.useGlobalURL())
+ {
+ textURLFactory = new
GlobalURLFactory(((JBossRenderRequest)req).getControllerContext());
+ }
+ if (textURLFactory == null)
+ {
+ textURLFactory = new LocalURLFactory(resp.createRenderURL());
+ }
+
+ //
+ URLFactory resourceURLFactory = new
GlobalURLFactory(((JBossRenderRequest)req).getControllerContext());
+
+ //clean html and body tags
+ viewableContent = Util.cleanupContent(cmsContent);
+
+ // begin modifying links
+ StringBuffer buffer = new StringBuffer();
+ Matcher m = RELATIVE_URI_PATTERN.matcher(viewableContent);
+ while (m.find())
+ {
+ String relURI = m.group(3) != null ? m.group(3) : m.group(4);
+ URLFactory urlFactory = resourceURLFactory;
+ if (relURI.endsWith(".html"))
+ {
+ urlFactory = textURLFactory;
+ }
+ String absoluteURI = urlFactory.createURL("/" + relURI);
+ m.appendReplacement(buffer, "$1$2" +
FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
+ }
+ m.appendTail(buffer);
+ viewableContent = buffer.toString();
+
+ return viewableContent;
+ }
+
+ /**
+ *
+ */
+ private static String cleanupContent(String content)
+ {
+ //including content only between the <body> and </body>
+ if (content.toLowerCase().indexOf("<body") != -1)
+ {
+ Matcher h = STRIP_TAGS_PATTERN.matcher(content);
+ while (h.find())
+ {
+ content = h.group(2);
+ }
+ }
+
+ return content;
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -107,4 +107,8 @@
public static final String OP_VIEWSEARCHRESULTS = "view_search_results";
public static final String OP_CREATEFILE_VALIDATION_ERROR =
"create_file_validation_error";
+
+ public static final String OP_VIEWPENDINGPREVIEW = "view_pending_preview";
+
+ public static final String OP_MODIFYANDAPPROVE = "modify_and_approve";
}
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-12-02
15:21:40 UTC (rev 9240)
@@ -43,6 +43,8 @@
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.portal.cms.util.NodeUtil;
import org.jboss.portal.cms.workflow.ApprovePublish;
+import org.jboss.portal.cms.workflow.CMSWorkflowUtil;
+import org.jboss.portal.core.cms.ui.Util;
import org.jboss.portal.core.cms.command.StreamContentCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.identity.AnonymousRole;
@@ -617,10 +619,51 @@
rRes.setContentType("text/html");
rReq.setAttribute("currpath", sPath);
-
+
javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/pending_items.jsp");
prd.include(rReq, rRes);
}
+ else if (CMSAdminConstants.OP_VIEWPENDINGPREVIEW.equals(op))
+ {
+ String processId = rReq.getParameter("pid");
+ String path = rReq.getParameter("path");
+ String contentPath = rReq.getParameter("contentPath");
+
+ if (this.getApprovePublish() != null)
+ {
+ try
+ {
+ Collection pendingQueue =
this.getApprovePublish().getAllPendingInQueue();
+ rReq.setAttribute("pendingQueue", pendingQueue);
+ }
+ catch (WorkflowException we)
+ {
+ rReq.setAttribute("pendingQueue", null);
+ }
+ }
+
+ Content pendingContent =
CMSWorkflowUtil.getPendingContent(Long.parseLong(processId), contentPath);
+ String viewableContent = Util.getViewableContent(rReq, rRes,
pendingContent.getContentAsString());
+
+ rReq.setAttribute("pendingPreviewContent", viewableContent);
+
+ StringBuffer sbUrl = new StringBuffer();
+ sbUrl.append(rReq.getScheme());
+ sbUrl.append("://");
+ sbUrl.append(rReq.getServerName());
+ if (rReq.getScheme().equals("http") && rReq.getServerPort() !=
80 ||
+ rReq.getScheme().equals("https") && rReq.getServerPort() !=
443)
+ {
+ sbUrl.append(':');
+ sbUrl.append(rReq.getServerPort());
+ }
+ rRes.setContentType("text/html");
+ rReq.setAttribute("currpath", path);
+ rReq.setAttribute("document_base_url", sbUrl.toString() +
this.buildURL(rReq, "/"));
+
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/pending_items.jsp");
+ prd.include(rReq, rRes);
+ }
}
public void processAction(final JBossActionRequest aReq, final JBossActionResponse
aRes) throws PortletException
@@ -1239,6 +1282,38 @@
aRes.setRenderParameter("path",
aReq.getParameter("path"));
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
}
+ else if(CMSAdminConstants.OP_MODIFYANDAPPROVE.equals(op))
+ {
+ String modifiedContent = aReq.getParameter("elm1");
+ String processId = aReq.getParameter("pid");
+ String path = aReq.getParameter("path");
+ String sManager = aReq.getUser().getUserName();
+
+ try
+ {
+ //Apply this modifiedContent instead of the one published by the original
author
+ this.getApprovePublish().processManagerResponse(Long.parseLong(processId),
sManager, modifiedContent);
+ }
+ catch (Exception e)
+ {
+ //show an error message on the pending item screen
+ aRes.setRenderParameter("path",
aReq.getParameter("path"));
+ aRes.setRenderParameter("exception", e.getMessage());
+
+ String from = aReq.getParameter("from");
+ if (from == null || from.trim().length() == 0)
+ {
+ aRes.setRenderParameter("op",
CMSAdminConstants.OP_VIEWPENDING);
+ }
+ else
+ {
+ aRes.setRenderParameter("op", from);
+ }
+ return;
+ }
+ aRes.setRenderParameter("path", path);
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
+ }
else if (CMSAdminConstants.OP_MAKELIVE.equals(op))
{
String path = aReq.getParameter("path");
@@ -1251,7 +1326,7 @@
aRes.setRenderParameter("path", path);
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
- }
+ }
}
else
{
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2007-12-02
15:21:40 UTC (rev 9240)
@@ -62,6 +62,7 @@
CMS_TRANSFER=Import/Export
CMS_EXPORTARCHIVE=Export Folder
CMS_SECURE=Secure
+CMS_PREVIEW=Preview
CMS_CREATEFILEINDIR=Creating File in Directory
CMS_FILENAME=FileName
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp 2007-12-02
15:21:40 UTC (rev 9240)
@@ -18,16 +18,13 @@
<div class=" cms-tab-container">
<%
String sCurrPath = (String)request.getAttribute("currpath");
- Collection pendingQueue = (Collection)request.getAttribute("pendingQueue");
+ Collection pendingQueue = (Collection)request.getAttribute("pendingQueue");
String exception = request.getParameter("exception");
String rowClass = "portlet-section-body";
%>
-
-
-
<!-- Currently browsing -->
<ul class="objectpath">
<li class="pathItem"><a href="<portlet:renderURL>
@@ -92,6 +89,96 @@
<!-- the table listing the pending queue items -->
<div align="center"><font
class="portlet-font-dim"><b>Pending Approval
Queue</b></font></div>
<br/>
+
+
+<!-- Preview of Content being approved -->
+<%
+ String pendingPreviewContent =
(String)request.getAttribute("pendingPreviewContent");
+ String contentBeingPreviewed = "-1";
+%>
+<%if(pendingPreviewContent != null && pendingPreviewContent.trim().length()
>0){%>
+<%
+ String pid = request.getParameter("pid");
+ String path = request.getParameter("path");
+ String sDocBase = (String)request.getAttribute("document_base_url");
+ String sCSSURL = (String)request.getAttribute("css_url");
+ contentBeingPreviewed = pid;
+%>
+<!-- tinyMCE -->
+<script language="javascript" type="text/javascript"
+ src="<%= renderRequest.getContextPath() +
CMSAdminConstants.DEFAULT_IMAGES_PATH
%>/tiny_mce/tiny_mce_src.js"></script>
+<script language="javascript" type="text/javascript">
+ tinyMCE.init({
+ mode : "textareas",
+ theme : "advanced",
+ theme_advanced_disable : "styleselect",
+ plugins :
"advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash",
+ theme_advanced_buttons1_add : "fontselect,fontsizeselect,forecolor",
+ theme_advanced_buttons2_add_before: "cut,copy,paste,separator",
+ theme_advanced_buttons2_add :
"separator,insertdate,inserttime,preview,zoom",
+ theme_advanced_buttons3_add : "iespell,flash,advhr",
+ content_css : "<%= sCSSURL %>",
+ plugin_insertdate_dateFormat : "%Y-%m-%d",
+ plugin_insertdate_timeFormat : "%H:%M:%S",
+ relative_urls : "false",
+ document_base_url : "<%= sDocBase %>",
+ extended_valid_elements :
+
"style[type],a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],font[face|size|color],hr[class|width|size|noshade]"
+ });
+
+ var status = true;
+ function toggleEditor()
+ {
+ if(status)
+ {
+ tinyMCE.execCommand("mceRemoveControl", false, "elm1");
+ status = false;
+ }
+ else
+ {
+ tinyMCE.execCommand("mceAddControl", false, "elm1");
+ status = true;
+ }
+ }
+</script>
+<!-- /tinyMCE -->
+<div align="center">
+ <form method="post"
+ action="<portlet:actionURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_MODIFYANDAPPROVE %>"/>
+ <portlet:param name="pid" value="<%= pid %>"/>
+ <portlet:param name="path" value="<%= path %>"/>
+ </portlet:actionURL>"
+ >
+ <table>
+ <tr>
+ <!--
+ <td style="border: 1px solid
#000000;"><%=pendingPreviewContent%></td>
+ -->
+ <form>
+ <textarea id="elm1" name="elm1" rows="20"
cols="80" style="width: 100%" class="textarea">
+ <%=pendingPreviewContent%>
+ </textarea>
+ </form>
+ </tr>
+ <tr>
+ <td> </td>
+ </tr>
+ <tr align="center">
+ <td>
+ <input class="portlet-form-button" type="submit"
value="${n:i18n("CMS_MODIFY")}/${n:i18n("CMS_APPROVE")}"/>
+ <input class="portlet-form-button" type="reset"
name="reset" value="Reset"/>
+ <input class="portlet-form-button" type="button"
value="${n:i18n("CMS_CANCEL")}" name="cancel"
+
onclick="window.location='<portlet:renderURL><portlet:param
name="op" value="<%= CMSAdminConstants.OP_VIEWPENDING
%>"/><portlet:param name="path" value="<%= path
%>"/></portlet:renderURL>'">
+ </td>
+ </tr>
+ </table>
+ </form>
+</div>
+<br/></br>
+<%}%>
+
+
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td
class="portlet-table-text"><b>${n:i18n("CMS_PATH")}</b></td>
@@ -140,6 +227,15 @@
<td><%= cour.getUserName() %>
</td>
<td>
+ <a href="<portlet:renderURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_VIEWPENDINGPREVIEW %>"/>
+ <portlet:param name="pid"
value="<%=cour.getProcessId()%>"/>
+ <portlet:param name="path"
value="<%=linkPath%>"/>
+ <portlet:param name="contentPath"
value="<%=cour.getPath()%>"/>
+ </portlet:renderURL>"
+
<%if(contentBeingPreviewed.equals(cour.getProcessId())){%>style="color:
red;"<%}%>
+ >${n:i18n("CMS_PREVIEW")}</a>
+
<a href="<portlet:actionURL>
<portlet:param name="op" value="<%=
CMSAdminConstants.OP_APPROVE %>"/>
<portlet:param name="pid"
value="<%=cour.getProcessId()%>"/>
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-12-01
11:48:45 UTC (rev 9239)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-12-02
15:21:40 UTC (rev 9240)
@@ -402,6 +402,13 @@
{
%>
<td>
+ <a href="<portlet:renderURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_VIEWPENDINGPREVIEW %>"/>
+ <portlet:param name="pid"
value="<%=cour.getProcessId()%>"/>
+ <portlet:param name="path"
value="<%=sCurrPath%>"/>
+ <portlet:param name="contentPath"
value="<%=cour.getPath()%>"/>
+
</portlet:renderURL>">${n:i18n("CMS_PREVIEW")}</a>
+
<a href="<portlet:actionURL>
<portlet:param name="op"
value="<%=CMSAdminConstants.OP_APPROVE%>"/>
<portlet:param name="pid"
value="<%=cour.getProcessId()%>"/>