diff --git a/config/alfresco/messages/publishing-service.properties b/config/alfresco/messages/publishing-service.properties
index 5f4ca0c27a..b7566e125a 100644
--- a/config/alfresco/messages/publishing-service.properties
+++ b/config/alfresco/messages/publishing-service.properties
@@ -4,12 +4,13 @@ publishing.neitherNameNorIdSpecified=Neither channel name nor identifier has bee
publish-content.title=Publish
publish-content.description=Publish content to a publishing channel
-publish-content.publish-channel-name.display-label=Channel to publish content to
-publish-content.publish-channel-id.display-label=Channel to publish content to
+publish-content.publishChannelName.display-label=Channel to publish content to
+publish-content.publishChannelId.display-label=Channel to publish content to
publish-content.unpublish.display-label=Unpublish
-publish-content.status-update.display-label=Status update
-publish-content.include-link-in-status-update.display-label=Append link to status update
-publish-content.status-update-channel-names.display-label=Channels to post status update to
-publish-content.status-update-channel-ids.display-label=Channels to post status update to
-publish-content.scheduled-time.display-label=Time to publish
+publish-content.statusUpdate.display-label=Status update
+publish-content.includeLinkInStatusUpdate.display-label=Append link to status update
+publish-content.statusUpdateChannelNames.display-label=Channels to post status update to
+publish-content.statusUpdateChannelIds.display-label=Channels to post status update to
+publish-content.scheduledTime.display-label=Scheduled time
publish-content.comment.display-label=Comment
+publish-content.nodeToLinkStatusUpdateTo.display-label=Node to link status update to
diff --git a/config/alfresco/publishing-context-highlevel.xml b/config/alfresco/publishing-context-highlevel.xml
index 677512f056..614b8abb67 100644
--- a/config/alfresco/publishing-context-highlevel.xml
+++ b/config/alfresco/publishing-context-highlevel.xml
@@ -75,12 +75,10 @@
+
+
-
-
- {http://www.alfresco.org/model/content/1.0}content
-
-
+
statusUpdateChannelNames = buildStringList(action.getParameterValue(PARAM_STATUS_UPDATE_CHANNEL_NAMES));
+ List statusUpdateChannelNames = buildStringList(action
+ .getParameterValue(PARAM_STATUS_UPDATE_CHANNEL_NAMES));
List statusUpdateChannelIds = buildStringList(action.getParameterValue(PARAM_STATUS_UPDATE_CHANNEL_IDS));
Boolean includeLinkInStatusUpdate = (Boolean) action.getParameterValue(PARAM_INCLUDE_LINK_IN_STATUS_UPDATE);
boolean appendLink = ((includeLinkInStatusUpdate == null) || includeLinkInStatusUpdate);
Date scheduledTime = (Date) action.getParameterValue(PARAM_SCHEDULED_TIME);
String comment = (String) action.getParameterValue(PARAM_COMMENT);
- Channel publishChannel = publishChannelId == null ? channelService.getChannelByName(publishChannelName) :
- channelService.getChannelById(publishChannelId);
+ Channel publishChannel = publishChannelId == null ? channelService.getChannelByName(publishChannelName)
+ : channelService.getChannelById(publishChannelId);
if (publishChannel != null)
{
PublishingDetails details = publishingService.createPublishingDetails();
details.setPublishChannelId(publishChannel.getId());
- if (unpublish)
- {
- details.addNodesToUnpublish(actionedUponNodeRef);
- }
- else
- {
- details.addNodesToPublish(actionedUponNodeRef);
- }
+ List nodes = setNodes(actionedUponNodeRef, unpublish, details);
if (statusUpdateChannelNames != null)
{
for (String statusUpdateChannelName : statusUpdateChannelNames)
@@ -200,12 +224,25 @@ public class PublishContentActionExecuter extends ActionExecuterAbstractBase
}
}
}
- if (!details.getStatusUpdateChannels().isEmpty())
+ if (!unpublish && !details.getStatusUpdateChannels().isEmpty())
{
details.setStatusMessage(statusUpdate);
if (appendLink)
{
- details.setStatusNodeToLinkTo(actionedUponNodeRef);
+ NodeRef nodeToLinkTo = (NodeRef) action.getParameterValue(PARAM_NODE_TO_LINK_STATUS_UPDATE_TO);
+ if (nodeToLinkTo == null)
+ {
+ //No node has been specified explicitly as being the one to link to
+ //We'll make an assumption if only one node is being published...
+ if (nodes.size() == 1)
+ {
+ nodeToLinkTo = nodes.get(0);
+ }
+ }
+ if ((nodeToLinkTo != null) && nodes.contains(nodeToLinkTo))
+ {
+ details.setStatusNodeToLinkTo(nodeToLinkTo);
+ }
}
}
if (scheduledTime != null)
@@ -219,16 +256,56 @@ public class PublishContentActionExecuter extends ActionExecuterAbstractBase
}
else
{
- throw new AlfrescoRuntimeException(MSG_CHANNEL_NOT_FOUND, new Object[] { publishChannelId == null ? publishChannelName : publishChannelId});
+ throw new AlfrescoRuntimeException(MSG_CHANNEL_NOT_FOUND,
+ new Object[] { publishChannelId == null ? publishChannelName : publishChannelId });
}
}
+ /**
+ * This method sets the node(s) to publish or unpublish on the supplied publishing details.
+ * If the actionedUponNode is a folder then it will include all content nodes within that folder.
+ * @param actionedUponNodeRef
+ * @param unpublish
+ * @param details
+ */
+ private List setNodes(NodeRef actionedUponNodeRef, boolean unpublish, PublishingDetails details)
+ {
+ List nodes = new ArrayList();
+ QName nodeType = nodeService.getType(actionedUponNodeRef);
+ if (dictionaryService.isSubClass(nodeType, ContentModel.TYPE_FOLDER))
+ {
+ List children = nodeService.getChildAssocs(actionedUponNodeRef);
+ for (ChildAssociationRef childRef : children)
+ {
+ NodeRef child = childRef.getChildRef();
+ if (dictionaryService.isSubClass(nodeService.getType(child), ContentModel.TYPE_CONTENT))
+ {
+ nodes.add(child);
+ }
+ }
+ }
+ else
+ {
+ nodes.add(actionedUponNodeRef);
+ }
+
+ if (unpublish)
+ {
+ details.addNodesToUnpublish(nodes);
+ }
+ else
+ {
+ details.addNodesToPublish(nodes);
+ }
+ return nodes;
+ }
+
private List buildStringList(Serializable parameterValue)
{
List result = null;
if (parameterValue != null && String.class.isAssignableFrom(parameterValue.getClass()))
{
- String[] split = ((String)parameterValue).split(",");
+ String[] split = ((String) parameterValue).split(",");
result = Arrays.asList(split);
}
return result;
@@ -261,6 +338,9 @@ public class PublishContentActionExecuter extends ActionExecuterAbstractBase
paramList.add(new ParameterDefinitionImpl(PARAM_SCHEDULED_TIME, DataTypeDefinition.DATETIME, false,
getParamDisplayLabel(PARAM_SCHEDULED_TIME), false));
+ paramList.add(new ParameterDefinitionImpl(PARAM_NODE_TO_LINK_STATUS_UPDATE_TO, DataTypeDefinition.NODE_REF, false,
+ getParamDisplayLabel(PARAM_NODE_TO_LINK_STATUS_UPDATE_TO), false));
+
paramList.add(new ParameterDefinitionImpl(PARAM_COMMENT, DataTypeDefinition.TEXT, false,
getParamDisplayLabel(PARAM_COMMENT), false));
}