diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js
index 3ca0d1e519..9cd350e70d 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js
@@ -1,97 +1,158 @@
-// Client has requested certain actions on the current document
+// Client has requested server-side action
/* Inputs */
-var docId = args.d,
- runAction = args.a;
+var runAction = args.a;
/* Outputs */
-var resultString = "Action failed.",
+var resultString = "Action failed",
resultCode = false;
-var doc = search.findNode("workspace://SpacesStore/" + docId);
+// Is this action targetting a document?
+var docId = args.d;
+if ((docId != "") && (docId != null))
+{
+ var doc = search.findNode("workspace://SpacesStore/" + docId);
-if (doc != null && doc.isDocument)
+ if (doc != null && doc.isDocument)
+ {
+ try
+ {
+ if (runAction == "makepdf")
+ {
+ resultString = "Could not convert document";
+ var nodeTrans = doc.transformDocument("application/pdf");
+ if (nodeTrans != null)
+ {
+ resultString = "Document converted";
+ resultCode = true;
+ }
+ }
+ else if (runAction == "delete")
+ {
+ resultString = "Could not delete document";
+ if (doc.remove())
+ {
+ resultString = "Document deleted";
+ resultCode = true;
+ }
+ }
+ else if (runAction == "checkout")
+ {
+ var workingCopy = doc.checkout();
+ if (workingCopy != null)
+ {
+ resultString = "Document checked out";
+ resultCode = true;
+ }
+ }
+ else if (runAction == "checkin")
+ {
+ var originalDoc = doc.checkin();
+ if (originalDoc != null)
+ {
+ resultString = "Document checked in";
+ resultCode = true;
+ }
+ }
+ else if (runAction == "makeversion")
+ {
+ resultString = "Could not version document";
+ if (doc.addAspect("cm:versionable"))
+ {
+ resultString = "Document versioned";
+ resultCode = true;
+ }
+ }
+ else if (runAction == "workflow")
+ {
+ var workflowType = "jbpm$wf:" + args.wt;
+ var assignTo = people.getPerson(args.at);
+ var dueDate = new Date(args.dd);
+ var description = args.desc;
+
+ var workflow = actions.create("start-workflow");
+ workflow.parameters.workflowName = workflowType;
+ workflow.parameters["bpm:workflowDescription"] = description;
+ workflow.parameters["bpm:assignee"] = assignTo;
+ if ((args.dd) && (args.dd != ""))
+ {
+ workflow.parameters["bpm:workflowDueDate"] = dueDate;
+ }
+ workflow.execute(doc);
+ resultString = "New workflow started";
+ resultCode = true;
+ }
+ else if (runAction == "test")
+ {
+ resultString = "Test complete.";
+ resultCode = true;
+ }
+ else
+ {
+ resultString = "Unknown action";
+ }
+ }
+ catch(e)
+ {
+ resultString = "Action failed due to exception";
+ }
+ }
+}
+else // Non document-based actions
{
try
{
- if (runAction == "makepdf")
+ if (runAction == "newspace")
{
- resultString = "Could not convert document";
- var nodeTrans = doc.transformDocument("application/pdf");
- if (nodeTrans != null)
+ resultString = "Could not create space";
+ var nodeId = args.n,
+ spaceName = args.sn,
+ spaceTitle = (args.st == "undefined") ? "" : args.st,
+ spaceDescription = (args.sd == "undefined") ? "" : args.sd,
+ templateId = args.t;
+ var nodeNew;
+
+ if ((spaceName == null) || (spaceName == ""))
{
- resultString = "Document converted";
- resultCode = true;
+ resultString = "Space must have a Name";
}
- }
- else if (runAction == "delete")
- {
- resultString = "Could not delete document";
- if (doc.remove())
+ else
{
- resultString = "Document deleted";
- resultCode = true;
+ var nodeParent = search.findNode("workspace://SpacesStore/" + nodeId);
+ // Copy from template?
+ if ((templateId != null) && (templateId != ""))
+ {
+ nodeTemplate = search.findNode("workspace://SpacesStore/" + templateId);
+ nodeNew = nodeTemplate.copy(nodeParent, true);
+ nodeNew.name = spaceName;
+ }
+ else
+ {
+ nodeNew = nodeParent.createFolder(spaceName);
+ }
+ // Always add title & description, default icon
+ nodeNew.properties["cm:title"] = spaceTitle;
+ nodeNew.properties["cm:description"] = spaceDescription;
+ nodeNew.properties["app:icon"] = "space-icon-default";
+ nodeNew.save();
+ // Add uifacets aspect for the web client
+ nodeNew.addAspect("app:uifacets");
+ if (nodeNew != null)
+ {
+ resultString = "New space created";
+ resultCode = true;
+ }
}
}
- else if (runAction == "checkout")
- {
- var workingCopy = doc.checkout();
- if (workingCopy != null)
- {
- resultString = "Document checked out";
- resultCode = true;
- }
- }
- else if (runAction == "checkin")
- {
- var originalDoc = doc.checkin();
- if (originalDoc != null)
- {
- resultString = "Document checked in";
- resultCode = true;
- }
- }
- else if (runAction == "makeversion")
- {
- resultString = "Could not version document";
- if (doc.addAspect("cm:versionable"))
- {
- resultString = "Document versioned";
- resultCode = true;
- }
- }
- else if (runAction == "workflow")
- {
- var workflowType = "jbpm$wf:" + args.wt;
- var assignTo = people.getPerson(args.at);
- var dueDate = new Date(args.dd);
- var description = args.desc;
-
- var workflow = actions.create("start-workflow");
- workflow.parameters.workflowName = workflowType;
- workflow.parameters["bpm:workflowDescription"] = description;
- workflow.parameters["bpm:assignee"] = assignTo;
- if ((args.dd) && (args.dd != ""))
- {
- workflow.parameters["bpm:workflowDueDate"] = dueDate;
- }
- workflow.execute(doc);
- resultString = "New workflow started.";
- resultCode = true;
- }
- else if (runAction == "test")
- {
- resultString = "Test complete.";
- resultCode = true;
- }
else
{
- resultString = "Unknown action.";
+ resultString = "Unknown action";
}
}
catch(e)
{
resultString = "Action failed due to exception";
+ resultString = e.toString();
}
}
model.resultString = resultString;
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl
index b4d7ea7996..37fb61a5c0 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl
@@ -43,10 +43,11 @@
(No documents) | +
+ | -
+
+
${child.name}
<#if child.properties.description?exists>
${child.properties.description} #if> - |
-
(No subspaces) | -
+ | -
+
+
<#if child.name?ends_with(".doc")>
-
- ${child.name}
- + ${child.name} <#else> - - ${child.name} - + ${child.name} #if> + <#if child.properties.description?exists> - ${child.properties.description} + ${child.properties.description} #if> Modified: ${child.properties.modified?datetime}, Size: ${(child.size / 1024)?int}Kb <#if child.isLocked > @@ -123,25 +160,23 @@ <#if !child.isLocked > ![]() |
-
(No documents) | -