diff --git a/config/alfresco/messages/office-addin.properties b/config/alfresco/messages/office-addin.properties new file mode 100644 index 0000000000..9ce2a7014a --- /dev/null +++ b/config/alfresco/messages/office-addin.properties @@ -0,0 +1,9 @@ +## +## Microsoft Office Add-In Messages +## +office.title.my_alfresco=My Alfresco +office.title.navigation=Browse Spaces and Documents +office.title.search=Search Alfresco +office.title.document_details=Document Details +office.title.my_tasks=My Tasks +office.title.document_tags=Document Tags diff --git a/config/alfresco/office-addin-context.xml b/config/alfresco/office-addin-context.xml new file mode 100644 index 0000000000..c900fafc93 --- /dev/null +++ b/config/alfresco/office-addin-context.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + alfresco.messages.office-addin + + + + + diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.desc.xml new file mode 100644 index 0000000000..9927a2cb60 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.desc.xml @@ -0,0 +1,8 @@ + + Tagging Actions + Add and remove tags to nodes + /collaboration/tagActions + + user + required + diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.html.ftl new file mode 100644 index 0000000000..7ff46f8e78 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.html.ftl @@ -0,0 +1,52 @@ + + + + Tagging Test UI + + + +

Tagging Test UI

+
+ +
+ Space nodeRef: +
e.g. "e3741425-35cf-11dc-9762-4b73d0280543"
+
+ +
+ Tag: + +
+ +
+ + +
+ +
+ + + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.desc.xml new file mode 100644 index 0000000000..9927a2cb60 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.desc.xml @@ -0,0 +1,8 @@ + + Tagging Actions + Add and remove tags to nodes + /collaboration/tagActions + + user + required + diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.html.ftl new file mode 100644 index 0000000000..da081ef8cd --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.html.ftl @@ -0,0 +1,4 @@ +{ + "statusString":"${tagActions.resultString}", + "statusCode":${tagActions.resultCode?string} +} \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.js b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.js new file mode 100644 index 0000000000..09792e92d1 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.js @@ -0,0 +1,146 @@ +var action = args.a; + +/* Debug Inputs */ +if (args["add"] != null) {action = "add";} +else if (args["remove"] != null) {action = "remove";} + +model.tagActions = tagActions(action, args.n, args.t); + +function tagActions(action, nodeId, tagName) +{ + var resultString = "Action failed"; + var resultCode = false; + + if ((nodeId != "") && (nodeId != null) && + (tagName != "") && (tagName != null)) + { + var node = search.findNode("workspace://SpacesStore/" + nodeId); + tagName = tagName.toLowerCase(); + + if (node != null) + { + try + { + var tags, newTag; + + if (action == "add") + { + resultString = "Already tagged with '" + tagName + "'"; + tags = node.properties["cm:taggable"]; + if (tags == null) + { + tags = new Array(); + } + // Check node doesn't already have this tag + var hasTag = false; + for each (tag in tags) + { + if (tag != null) + { + if (tag.name == tagName) + { + hasTag = true; + break; + } + } + } + if (!hasTag) + { + // Make sure the tag is in the repo + newTag = createTag(tagName); + if (newTag != null) + { + // Add it to our node + tags.push(newTag); + tagsArray = new Array(); + tagsArray["cm:taggable"] = tags; + node.addAspect("cm:taggable", tagsArray); + + resultString = "Tag added"; + resultCode = true; + } + else + { + resultString = "Tag '" + tagName + "' not indexed"; + } + } + } + else if (action == "remove") + { + resultString = "Could not remove tag"; + var oldTags = node.properties["cm:taggable"]; + if (oldTags == null) + { + oldTags = new Array(); + } + tags = new Array(); + // Find this tag + for each (tag in oldTags) + { + if (tag != null) + { + if (tag.name != tagName) + { + tags.push(tag); + } + } + } + // Removed tag? + if (oldTags.length > tags.length) + { + if (tags.length == 0) + { + node.addAspect("cm:taggable"); + } + else + { + tagsArray = new Array(); + tagsArray["cm:taggable"] = tags; + node.addAspect("cm:taggable", tagsArray); + } + + resultString = "Tag removed"; + resultCode = true; + } + else + { + resultString = "Not tagged with '" + tagName + "'"; + } + } + else + { + resultString = "Unknown action"; + } + } + catch(e) + { + resultString = "Action failed due to exception [" + e.toString() + "]"; + } + } + } + + var result = + { + "resultString": resultString, + "resultCode": resultCode + }; + return result; +} + +/* + * Create a new tag if the passed-in one doesn't exist + */ +function createTag(tagName) +{ + var existingTags = classification.getRootCategories("cm:taggable"); + for each (existingTag in existingTags) + { + if (existingTag.name == tagName) + { + return existingTag; + } + } + + var tagNode = classification.createRootCategory("cm:taggable", tagName); + return tagNode; +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.desc.xml new file mode 100644 index 0000000000..11631c4af1 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.desc.xml @@ -0,0 +1,8 @@ + + Tagging Query + Query tag usage + /collaboration/tagQuery + + user + required + diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.html.ftl new file mode 100644 index 0000000000..5f922c71e4 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.html.ftl @@ -0,0 +1,12 @@ +{ +"countMin": "${tagQuery.countMin}", +"countMax": "${tagQuery.countMax}", +"tags": +<#assign n=0> +<#list tagQuery.tags as tag> + <#if (n > 0)>,<#else>[ +{"name": "${tag.name}", "count": "${tag.count}"} + <#assign n=n+1> + +] +} \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.js b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.js new file mode 100644 index 0000000000..991b0a4623 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.js @@ -0,0 +1,104 @@ +model.tagQuery = tagQuery(args["n"], args["m"]); + +function tagQuery(nodeRef, maxResults) +{ + var tags = new Array(); + var countMin = Number.MAX_VALUE, + countMax = 0; + + /* nodeRef input */ + var node = null; + if ((nodeRef != null) && (nodeRef != "")) + { + node = search.findNode(nodeRef); + } + if (node == null) + { + node = companyhome; + } + + /* maxResults input */ + if ((maxResults == null) || (maxResults == "")) + { + maxResults = -1; + } + + /* Query for tagged node(s) */ + var query = "PATH:\"" + node.qnamePath; + if (node.isContainer) + { + query += "//*"; + } + query += "\" AND ASPECT:\"{http://www.alfresco.org/model/content/1.0}taggable\""; + + var taggedNodes = search.luceneSearch(query); + + if (taggedNodes.length == 0) + { + countMin = 0; + } + else + { + /* Build a hashtable of tags and tag count */ + var tagHash = {}; + var count; + for each (taggedNode in taggedNodes) + { + for each(tag in taggedNode.properties["cm:taggable"]) + { + if (tag != null) + { + count = tagHash[tag.name]; + tagHash[tag.name] = count ? count+1 : 1; + } + } + } + + /* Convert the hashtable into an array of objects */ + for (key in tagHash) + { + tag = + { + name: key, + count: tagHash[key], + toString: function() + { + return this.name; + } + }; + tags.push(tag); + } + + /* Sort the results by count (descending) */ + tags.sort(sortByCountDesc); + + /* Trim the results to maxResults if specified */ + if (maxResults > -1) + { + tags = tags.slice(0, maxResults); + } + + /* Calculate the min and max tag count values */ + for each(tag in tags) + { + countMin = Math.min(countMin, tag.count); + countMax = Math.max(countMax, tag.count); + } + + /* Sort the results by tag name (ascending) */ + tags.sort(); + } + + var results = + { + "countMin": countMin, + "countMax": countMax, + "tags": tags + }; + return results; +} + +function sortByCountDesc(a, b) +{ + return (b.count - a.count); +} 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 f1637f45c4..8c9daa6b96 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.js @@ -8,19 +8,19 @@ var resultString = "Action failed", resultCode = false; // Is this action targetting a document? -var docId = args.d; -if ((docId != "") && (docId != null)) +var nodeId = args.n; +if ((nodeId != "") && (nodeId != null)) { - var doc = search.findNode("workspace://SpacesStore/" + docId); + var node = search.findNode("workspace://SpacesStore/" + nodeId); - if (doc != null && doc.isDocument) + if (node != null && node.isDocument) { try { if (runAction == "makepdf") { resultString = "Could not convert document"; - var nodeTrans = doc.transformDocument("application/pdf"); + var nodeTrans = node.transformDocument("application/pdf"); if (nodeTrans != null) { resultString = "Document converted"; @@ -30,7 +30,7 @@ if ((docId != "") && (docId != null)) else if (runAction == "delete") { resultString = "Could not delete document"; - if (doc.remove()) + if (node.remove()) { resultString = "Document deleted"; resultCode = true; @@ -38,7 +38,7 @@ if ((docId != "") && (docId != null)) } else if (runAction == "checkout") { - var workingCopy = doc.checkout(); + var workingCopy = node.checkout(); if (workingCopy != null) { resultString = "Document checked out"; @@ -47,7 +47,7 @@ if ((docId != "") && (docId != null)) } else if (runAction == "checkin") { - var originalDoc = doc.checkin(); + var originalDoc = node.checkin(); if (originalDoc != null) { resultString = "Document checked in"; @@ -57,7 +57,7 @@ if ((docId != "") && (docId != null)) else if (runAction == "makeversion") { resultString = "Could not version document"; - if (doc.addAspect("cm:versionable")) + if (node.addAspect("cm:versionable")) { resultString = "Document versioned"; resultCode = true; @@ -78,7 +78,7 @@ if ((docId != "") && (docId != null)) { workflow.parameters["bpm:workflowDueDate"] = dueDate; } - workflow.execute(doc); + workflow.execute(node); resultString = "New workflow started"; resultCode = true; } 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 3a0c4600bf..b3054bd498 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 @@ -1,4 +1,6 @@ <#assign doc_actions="${url.serviceContext}/office/docActions"> +<#assign tag_actions="${url.serviceContext}/collaboration/tagActions"> + <#if args.p?exists><#assign path=args.p><#else><#assign path=""> <#if args.e?exists><#assign extn=args.e><#else><#assign extn="doc"><#assign extnx=extn+"x"> <#if args.n?exists><#assign nav=args.n><#else><#assign nav=""> @@ -11,23 +13,25 @@ - Document Details + ${message("office.title.document_details")} + -
+
@@ -86,66 +90,113 @@
-
Version History<#if d.isDocument> for ${d.name}
+
+ +
-
- -<#if d.isDocument > - <#if hasAspect(d, "cm:versionable") == 1> - <#assign versionRow=0> - <#list d.versionHistory?sort_by("versionLabel")?reverse as record> - <#assign versionRow=versionRow+1> - - - - - + <#else> - - - +
- Open ${record.versionLabel} - - ${record.versionLabel}
- Author: ${record.creator}
- Date: ${record.createdDate?datetime}
- <#if record.description?exists> - Notes: ${record.description}
+
+
Tags<#if d.isDocument> for ${d.name}
+
+ <#if d.isDocument > +
+ +
+
+ + + +
+
+ <#if d.hasAspect("cm:taggable")> + <#if (d.properties["cm:taggable"]?size > 0)> + <#list d.properties["cm:taggable"]?sort_by("name") as tag> + <#if tag?exists> + + + - <#-- Only Word supports document compare --> - <#if extn = "doc"> - Compare with current
- -
- The current document is not versioned.
-
- -
+ + + +
+ The current document is not managed by Alfresco. +
-<#else> - - - The current document is not managed by Alfresco. - - - - +
+ + +
+
Version History<#if d.isDocument> for ${d.name}
+
+ + <#if d.isDocument > + <#if d.hasAspect("cm:versionable")> + <#assign versionRow=0> + <#list d.versionHistory?sort_by("versionLabel")?reverse as record> + <#assign versionRow=versionRow+1> + + + + + + <#else> + + + + + <#else> + + + + +
+ Open ${record.versionLabel} + + ${record.versionLabel}
+ Author: ${record.creator}
+ Date: ${record.createdDate?datetime}
+ <#if record.description?exists> + Notes: ${record.description}
+ + <#-- Only Word supports document compare --> + <#if extn = "doc"> + Compare with current
+ +
+ The current document is not versioned.
+
+ +
+ The current document is not managed by Alfresco. +
+
Document Actions
-
+
    <#if d.isDocument> <#if d.isLocked > - <#elseif hasAspect(d, "cm:workingcopy") == 1> + <#elseif d.hasAspect("cm:workingcopy")>
  • - + Check In Check In @@ -153,7 +204,7 @@
  • <#else>
  • - + Check Out Check Out @@ -169,7 +220,7 @@
  • <#if d.name?ends_with(extn) || d.name?ends_with(extnx)>
  • - + Transform to PDF Transform to PDF @@ -199,7 +250,5 @@
- - diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl index beadc381ac..29ce4a52a5 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl @@ -22,13 +22,14 @@ -
+
    -
  • My Alfresco
  • -
  • Browse Spaces and Documents
  • -
  • Search Alfresco
  • -
  • View Details
  • -
  • My Tasks
  • +
  • My Alfresco
  • +
  • Browse Spaces and Documents
  • +
  • Search Alfresco
  • +
  • View Details
  • +
  • My Tasks
  • +
  • ${message(
@@ -57,11 +58,11 @@ Modified: ${child.properties.modified?datetime} (${(child.size / 1024)?int}Kb)
- Check In + Check In Create Workflow... Insert File into Current Document <#if !child.name?ends_with(".pdf")> - Make PDF... + Make PDF...
@@ -117,7 +118,7 @@
Actions
-
+
    <#if d.isDocument> diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl index f40826b18b..576a603971 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl @@ -31,13 +31,14 @@ -
    +
      -
    • My Alfresco
    • -
    • Browse Spaces and Documents
    • -
    • Search Alfresco
    • -
    • View Details
    • -
    • My Tasks
    • +
    • My Alfresco
    • +
    • Browse Spaces and Documents
    • +
    • Search Alfresco
    • +
    • View Details
    • +
    • My Tasks
    • +
    • ${message(
    diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl index 7eeddbd1a5..4b277f2ecb 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl @@ -61,13 +61,13 @@ <#if res.isLocked > Locked <#elseif hasAspect(res, "cm:workingcopy") == 1> - Check In + Check In <#else> - Check Out + Check Out Insert File into Current Document <#if !res.name?ends_with(".pdf")> - Make PDF... + Make PDF... <#else> diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl index c304c69b75..9820f41580 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.html.ftl @@ -21,13 +21,14 @@
    -
    +
      -
    • My Alfresco
    • -
    • Browse Spaces and Documents
    • -
    • Search Alfresco
    • -
    • View Details
    • -
    • My Tasks
    • +
    • My Alfresco
    • +
    • Browse Spaces and Documents
    • +
    • Search Alfresco
    • +
    • View Details
    • +
    • My Tasks
    • +
    • ${message(
    @@ -72,7 +73,7 @@
    Title:
    - +
    Description:
    @@ -159,17 +160,17 @@ <#if child.isLocked > Locked <#elseif hasAspect(child, "cm:workingcopy") == 1> - Check In + Check In <#else> - Check Out + Check Out Create Workflow... Insert File into Current Document <#if !child.name?ends_with(".pdf")> - Make PDF... + Make PDF... <#if !child.isLocked> - Delete... + Delete...
    @@ -184,7 +185,7 @@ <#assign currentPath = thisSpace.displayPath + '/' + thisSpace.name /> <#assign currentPath = currentPath?substring(chLen+1)?url?replace('%2F', '/')?replace('\'', '\\\'') /> -
    +