JBoss Portal SVN: r9246 - branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-12-03 09:20:08 -0500 (Mon, 03 Dec 2007)
New Revision: 9246
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
Log:
typo
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-12-03 13:48:23 UTC (rev 9245)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-12-03 14:20:08 UTC (rev 9246)
@@ -31,7 +31,7 @@
<table class="portlet-def-table datatable">
<thead class="portlet-section-header">
<tr>
- <th>Porlet name</th>
+ <th>Portlet name</th>
<th>Description</th>
<th>Remote</th>
<th>Remotable</th>
16 years, 5 months
JBoss Portal SVN: r9245 - in branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf: producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-03 08:48:23 -0500 (Mon, 03 Dec 2007)
New Revision: 9245
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml
Log:
- Hide unused WSRP tab
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml 2007-12-03 12:28:12 UTC (rev 9244)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml 2007-12-03 13:48:23 UTC (rev 9245)
@@ -9,7 +9,9 @@
<ul class="topnav">
<li id="currentTab">Consumers Configuration</li>
<li><h:commandLink value="Producer Configuration" action="producer"/></li>
+ <ui:remove>
<li><h:commandLink value="Producer Management" action="management"/></li>
+ </ui:remove>
</ul>
</h:form>
</ui:define>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml 2007-12-03 12:28:12 UTC (rev 9244)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml 2007-12-03 13:48:23 UTC (rev 9245)
@@ -9,7 +9,9 @@
<ul class="topnav">
<li><h:commandLink action="consumers" value="Consumers Configuration"/></li>
<li id="currentTab">Producer Configuration</li>
- <li><h:commandLink action="management" value="Producer Management"/></li>
+ <ui:remove>
+ <li><h:commandLink value="Producer Management" action="management"/></li>
+ </ui:remove>
</ul>
</h:form>
</ui:define>
16 years, 5 months
JBoss Portal SVN: r9244 - modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-03 07:28:12 -0500 (Mon, 03 Dec 2007)
New Revision: 9244
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
Log:
Fixing testsuite
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2007-12-03 12:27:41 UTC (rev 9243)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2007-12-03 12:28:12 UTC (rev 9244)
@@ -729,7 +729,7 @@
Role g1 = roleModule.createRole("role1", "role1");
Role g2 = roleModule.createRole("role2", "role2");
membershipModule.assignRoles(u1, Collections.singleton(g1));
- Set collection = Collections.unmodifiableSet((Set)CollectionBuilder.hashSet().add(g1).add(g2));
+ Set collection = Collections.unmodifiableSet((Set)CollectionBuilder.hashSet().add(g1).add(g2).get());
membershipModule.assignRoles(u2, collection);
membershipModule.assignRoles(admin, collection);
ctx.commit();
16 years, 5 months
JBoss Portal SVN: r9243 - modules/identity/tags/JBP_IDENTITY_1_0_1/identity/src/main/org/jboss/portal/test/identity.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-03 07:27:41 -0500 (Mon, 03 Dec 2007)
New Revision: 9243
Modified:
modules/identity/tags/JBP_IDENTITY_1_0_1/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
Log:
Fixing testsuite
Modified: modules/identity/tags/JBP_IDENTITY_1_0_1/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
===================================================================
--- modules/identity/tags/JBP_IDENTITY_1_0_1/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2007-12-03 10:53:51 UTC (rev 9242)
+++ modules/identity/tags/JBP_IDENTITY_1_0_1/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2007-12-03 12:27:41 UTC (rev 9243)
@@ -729,7 +729,7 @@
Role g1 = roleModule.createRole("role1", "role1");
Role g2 = roleModule.createRole("role2", "role2");
membershipModule.assignRoles(u1, Collections.singleton(g1));
- Set collection = Collections.unmodifiableSet((Set)CollectionBuilder.hashSet().add(g1).add(g2));
+ Set collection = Collections.unmodifiableSet((Set)CollectionBuilder.hashSet().add(g1).add(g2).get());
membershipModule.assignRoles(u2, collection);
membershipModule.assignRoles(admin, collection);
ctx.commit();
16 years, 5 months
JBoss Portal SVN: r9242 - modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/test/portlet/state.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-03 05:53:51 -0500 (Mon, 03 Dec 2007)
New Revision: 9242
Modified:
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
Log:
Fix testsuite
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2007-12-03 10:39:44 UTC (rev 9241)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2007-12-03 10:53:51 UTC (rev 9242)
@@ -606,7 +606,7 @@
ValueMapAssert.assertEquals(expectedProps, props);
//
- props = getProperties(popCtx, (Set)CollectionBuilder.linkedList().add("abc").add("mno").get());
+ props = getProperties(popCtx, (Set)CollectionBuilder.hashSet().add("abc").add("mno").get());
expectedProps = new SimplePropertyMap();
expectedProps.setProperty("abc", new StringValue("def"));
ValueMapAssert.assertEquals(expectedProps, props);
16 years, 5 months
JBoss Portal SVN: r9241 - modules/portlet/tags/JBP_PORTLET_1_0_1/portlet/src/main/org/jboss/portal/test/portlet/state.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-03 05:39:44 -0500 (Mon, 03 Dec 2007)
New Revision: 9241
Modified:
modules/portlet/tags/JBP_PORTLET_1_0_1/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
Log:
oups
Modified: modules/portlet/tags/JBP_PORTLET_1_0_1/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- modules/portlet/tags/JBP_PORTLET_1_0_1/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2007-12-02 15:21:40 UTC (rev 9240)
+++ modules/portlet/tags/JBP_PORTLET_1_0_1/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2007-12-03 10:39:44 UTC (rev 9241)
@@ -606,7 +606,7 @@
ValueMapAssert.assertEquals(expectedProps, props);
//
- props = getProperties(popCtx, (Set)CollectionBuilder.linkedList().add("abc").add("mno").get());
+ props = getProperties(popCtx, (Set)CollectionBuilder.hashSet().add("abc").add("mno").get());
expectedProps = new SimplePropertyMap();
expectedProps.setProperty("abc", new StringValue("def"));
ValueMapAssert.assertEquals(expectedProps, props);
16 years, 5 months
JBoss Portal SVN: r9240 - in branches/JBoss_Portal_Branch_2_6: core-cms/src/main/org/jboss/portal/core/cms/ui and 3 other directories.
by portal-commits@lists.jboss.org
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()%>"/>
16 years, 5 months
JBoss Portal SVN: r9239 - modules/web/tags/JBP_WEB_1_1_0/web.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-01 06:48:45 -0500 (Sat, 01 Dec 2007)
New Revision: 9239
Modified:
modules/web/tags/JBP_WEB_1_1_0/web/build.xml
Log:
Fixing libraries ref
Modified: modules/web/tags/JBP_WEB_1_1_0/web/build.xml
===================================================================
--- modules/web/tags/JBP_WEB_1_1_0/web/build.xml 2007-11-30 22:36:48 UTC (rev 9238)
+++ modules/web/tags/JBP_WEB_1_1_0/web/build.xml 2007-12-01 11:48:45 UTC (rev 9239)
@@ -693,7 +693,7 @@
<path id="jboss.unit.tooling.test.classpath">
- <pathelement location="${jboss.portal/modules/test.lib}/jboss-unit-tooling-lib.jar"/>
+ <pathelement location="${jboss.portal/modules/test.lib}/jboss-unit-tooling-ant-lib.jar"/>
</path>
<taskdef
@@ -750,7 +750,7 @@
<path id="jboss.unit.tooling.test.classpath">
- <pathelement location="${jboss.portal/modules/test.lib}/jboss-unit-tooling-lib.jar"/>
+ <pathelement location="${jboss.portal/modules/test.lib}/jboss-unit-tooling-ant-lib.jar"/>
</path>
<taskdef
16 years, 5 months