diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/archive/archivednodes.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/archive/archivednodes.get.json.ftl index 5ec865e573..aea8b73189 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/archive/archivednodes.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/archive/archivednodes.get.json.ftl @@ -1,3 +1,4 @@ +<#import "../generic-paged-results.lib.ftl" as genericPaging /> <#escape x as jsonUtils.encodeJSONString(x)> { "data": @@ -20,13 +21,7 @@ ] } - <#if paging??>, - "paging": - { - "totalItems": ${paging.totalItems?c}, - "maxItems": ${paging.maxItems?c}, - "skipCount": ${paging.skipCount?c} - } - + + <@genericPaging.pagingJSON /> } - \ No newline at end of file + diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_de.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_de.properties new file mode 100755 index 0000000000..13fe2446c0 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_de.properties @@ -0,0 +1,7 @@ +# Audit Control Web Script I18N +audit.err.app.notProvided=Application name not supplied. +audit.err.app.notFound=Application not found: {0} +audit.err.path.notProvided=No path was supplied after the application name. +audit.err.action.invalid=Parameter 'action' must be either 'enable' or 'disable' +audit.err.value.classNotFound='valueType' not recognised: {0} +audit.err.value.convertFailed=Unable to convert ''{0}'' to type ''{1}'' \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_es.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_es.properties new file mode 100755 index 0000000000..13fe2446c0 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_es.properties @@ -0,0 +1,7 @@ +# Audit Control Web Script I18N +audit.err.app.notProvided=Application name not supplied. +audit.err.app.notFound=Application not found: {0} +audit.err.path.notProvided=No path was supplied after the application name. +audit.err.action.invalid=Parameter 'action' must be either 'enable' or 'disable' +audit.err.value.classNotFound='valueType' not recognised: {0} +audit.err.value.convertFailed=Unable to convert ''{0}'' to type ''{1}'' \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_fr.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_fr.properties new file mode 100755 index 0000000000..13fe2446c0 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_fr.properties @@ -0,0 +1,7 @@ +# Audit Control Web Script I18N +audit.err.app.notProvided=Application name not supplied. +audit.err.app.notFound=Application not found: {0} +audit.err.path.notProvided=No path was supplied after the application name. +audit.err.action.invalid=Parameter 'action' must be either 'enable' or 'disable' +audit.err.value.classNotFound='valueType' not recognised: {0} +audit.err.value.convertFailed=Unable to convert ''{0}'' to type ''{1}'' \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_it.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_it.properties new file mode 100755 index 0000000000..13fe2446c0 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_it.properties @@ -0,0 +1,7 @@ +# Audit Control Web Script I18N +audit.err.app.notProvided=Application name not supplied. +audit.err.app.notFound=Application not found: {0} +audit.err.path.notProvided=No path was supplied after the application name. +audit.err.action.invalid=Parameter 'action' must be either 'enable' or 'disable' +audit.err.value.classNotFound='valueType' not recognised: {0} +audit.err.value.convertFailed=Unable to convert ''{0}'' to type ''{1}'' \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_ja.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_ja.properties new file mode 100755 index 0000000000..13fe2446c0 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/audit/control_ja.properties @@ -0,0 +1,7 @@ +# Audit Control Web Script I18N +audit.err.app.notProvided=Application name not supplied. +audit.err.app.notFound=Application not found: {0} +audit.err.path.notProvided=No path was supplied after the application name. +audit.err.action.invalid=Parameter 'action' must be either 'enable' or 'disable' +audit.err.value.classNotFound='valueType' not recognised: {0} +audit.err.value.convertFailed=Unable to convert ''{0}'' to type ''{1}'' \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.delete.js b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.delete.js index 50b75a7a96..4e40727205 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.delete.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.delete.js @@ -39,8 +39,8 @@ function main() } var data = { - title: decodeURIComponent(args["itemTitle"]), - page: decodeURIComponent(args["page"]) + (strParams != "" ? "?" + strParams.substring(0, strParams.length - 1) : "") + title: args["itemTitle"], + page: args["page"] + (strParams != "" ? "?" + strParams.substring(0, strParams.length - 1) : "") } activities.postActivity("org.alfresco.comments.comment-deleted", args["site"], "comments", jsonUtils.toJSONString(data)); } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js index 18eaa6ea71..46988e6b1d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js @@ -7,14 +7,21 @@ */ function getCommentsList(node, index, count, reverse) { + // Get all the comments on the node. These should be in date order, + // oldest to newest, as they're in repo order var nodes = getComments(node); - var result = getPagedResultsData(nodes, index, count, getCommentData); - if (reverse == "true" && result.items.length > 0) + // If they want newest first, sort that before we page it + if (reverse == "true" && nodes.length > 0) { // Don't want to mutate the result.items array. Therefore we use slice(0) to get a (shallow) copy of it. - result.items = result.items.slice(0).reverse(); + nodes = nodes.slice(0).reverse(); } + + // Now do any paging that's required + var result = getPagedResultsData(nodes, index, count, getCommentData); + + // All done! return result; } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerchildren.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerchildren.get.js index 53d18c43bb..56496a758c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerchildren.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerchildren.get.js @@ -7,6 +7,7 @@ function main() argsSearchTerm = args['searchTerm'], argsMaxResults = args['size'], argsXPath = args['xpath'], + argsRootNode = args['rootNode'], pathElements = url.service.split("/"), parent = null, rootNode = companyhome, @@ -73,27 +74,16 @@ function main() if (url.templateArgs.type == "node") { - // nodeRef input - if (nodeRef == "alfresco://company/home") + parent = resolveNode(nodeRef); + if (parent === null) { - parent = companyhome; + status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); + return null; } - else if (nodeRef == "alfresco://user/home") + + if (argsRootNode != null) { - parent = userhome; - } - else if (nodeRef == "alfresco://sites/home") - { - parent = companyhome.childrenByXPath("st:sites")[0]; - } - else - { - parent = search.findNode(nodeRef); - if (parent === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } + rootNode = resolveNode(argsRootNode) || companyhome; } var query = "+PARENT:\"" + parent.nodeRef + "\""; @@ -410,4 +400,44 @@ function findDoclib(nodeRef) return resultNodeRef; } +/** + * Resolve "virtual" nodeRefs, nodeRefs and xpath expressions into nodes + * + * @method resolveNode + * @param reference {string} "virtual" nodeRef, nodeRef or xpath expressions + * @return {ScriptNode|null} Node corresponding to supplied expression. Returns null if node cannot be resolved. + */ +function resolveNode(reference) +{ + var node = null; + try + { + if (reference == "alfresco://company/home") + { + node = companyhome; + } + else if (reference == "alfresco://user/home") + { + node = userhome; + } + else if (reference == "alfresco://sites/home") + { + node = companyhome.childrenByXPath("st:sites")[0]; + } + else if (reference.indexOf("://") > 0) + { + node = search.findNode(reference); + } + else if (reference.substring(0, 1) == "/") + { + node = search.xpathSearch(reference)[0]; + } + } + catch (e) + { + return null; + } + return node; +} + main(); \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/generic-paged-results.lib.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/generic-paged-results.lib.ftl index 66187af094..25e372549b 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/generic-paged-results.lib.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/generic-paged-results.lib.ftl @@ -29,3 +29,20 @@ Usage: ] + +<#-- + Renders information on the paging of results. + This version is paging information only, without the data. +--> +<#macro pagingJSON pagingVar="paging"> +<#escape x as jsonUtils.encodeJSONString(x)> + <#if .vars[pagingVar]??>, + "paging": + { + "totalItems": ${.vars[pagingVar].totalItems?c}, + "maxItems": ${.vars[pagingVar].maxItems?c}, + "skipCount": ${.vars[pagingVar].skipCount?c} + } + + + diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl index 94437b2e66..446fa7e25c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/authority.lib.ftl @@ -18,4 +18,7 @@ } - \ No newline at end of file + + +<#-- Renders paging objects. --> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.desc.xml index b553846d11..a02a0c757c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.desc.xml @@ -6,11 +6,12 @@ The authorityType parameter is used to specify return authorities of the given type. Valid values are GROUP and USER. The optional maxItems parameter sets the maximum number of items to be returned. If no value is set then all items are returned. The optional skipCount parameter determines how many items to skip before returning the first result. If no skipCount value is set then no items are skipped. + If the optional sortBy parameter is given, then the results may be sorted. Possible values are "authorityName" (default), "shortName" and "displayName" ]]> - /api/groups/{shortName}/children?authorityType={authorityType?}&maxItems={maxItems?}&skipCount={skipCount?} + /api/groups/{shortName}/children?authorityType={authorityType?}&maxItems={maxItems?}&skipCount={skipCount?}&sortBy={sortBy?} argument user required draft_public_api - \ No newline at end of file + diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.js index 4c92d0c480..809f1f4dc2 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.js @@ -8,17 +8,14 @@ function main() var shortName = urlElements[0]; var authorityType = args["authorityType"]; - var maxItems = args["maxItems"]; - var skipCount= args["skipCount"]; + var sortBy = args["sortBy"]; + var paging = utils.createPaging(args); - if(maxItems == null) + if(sortBy == null) { - maxItems = -1; - } - if(skipCount == null) - { - skipCount = -1; + sortBy = "authorityName"; } + var group = groups.getGroup(shortName); if (group == null) { @@ -38,17 +35,20 @@ function main() } if (authorityType == "GROUP") { - model.children = group.getChildGroups(maxItems, skipCount); + model.children = group.getChildGroups(paging, sortBy); + model.paging = paging; } if (authorityType == "USER") { - model.children = group.getChildUsers(); + model.children = group.getChildUsers(paging, sortBy); + model.paging = paging; } } else { - model.children = group.getChildAuthorities(); + model.children = group.getChildAuthorities(paging, sortBy); + model.paging = paging; } } -main(); \ No newline at end of file +main(); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.json.ftl index 0c707e4fe5..56c748df97 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/children.get.json.ftl @@ -1,6 +1,7 @@ <#-- get children --> <#import "authority.lib.ftl" as authorityLib/> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> { "data": [ <#list children as c> @@ -8,4 +9,6 @@ <#if c_has_next>, ] -} \ No newline at end of file + + <@genericPaging.pagingJSON /> +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.desc.xml index 64ec42a94b..773e90c2ac 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.desc.xml @@ -7,14 +7,15 @@
Returns an Array of groups in JSON format. ]]> - /api/groups?shortNameFilter={shortNameFilter?}&zone={zone?}&maxItems={maxItems?}&skipCount={skipCount?} + /api/groups?shortNameFilter={shortNameFilter?}&zone={zone?}&maxItems={maxItems?}&skipCount={skipCount?}&sortBy={sortBy?} argument user required draft_public_api - \ No newline at end of file + diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.js index f0d655877d..ee70d17544 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.js @@ -7,26 +7,22 @@ function main () // Get the args var shortNameFilter = args["shortNameFilter"]; var zone = args["zone"]; - var maxItems = args["maxItems"]; - var skipCount = args["skipCount"]; + var sortBy = args["sortBy"]; + var paging = utils.createPaging(args); if(shortNameFilter == null) { shortNameFilter = ""; } - - if(maxItems== null) - { - maxItems = -1; - } - - if(skipCount== null) - { - skipCount = -1; - } + + if(sortBy == null) + { + sortBy = "authorityName"; + } // Do the search - model.groups = groups.searchGroupsInZone(shortNameFilter, zone, maxItems, skipCount); + model.groups = groups.searchGroupsInZone(shortNameFilter, zone, paging, sortBy); + model.paging = paging; } -main(); \ No newline at end of file +main(); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.json.ftl index d0648ceb0b..328e2c8399 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/groups.get.json.ftl @@ -1,6 +1,7 @@ <#-- list / search / groups --> <#import "authority.lib.ftl" as authorityLib/> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> { "data": [ <#list groups as group> @@ -8,4 +9,6 @@ <#if group_has_next>, ] -} \ No newline at end of file + + <@genericPaging.pagingJSON /> +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.desc.xml index 1c73654a99..dc06da694b 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.desc.xml @@ -6,11 +6,12 @@ The optional level attribute can be ALL, in which case all parents are returned. The optional maxItems parameter sets the maximum number of items to be returned. If no value is set then all items are returned. The optional skipCount parameter determines how many items to skip before returning the first result. If no skipCount value is set then no items are skipped. + If the optional sortBy parameter is given, then the results may be sorted. Possible values are "authorityName" (default), "shortName" and "displayName" ]]> - /api/groups/{shortName}/parents?level={level?}&maxItems={maxItems?}&skipCount={skipCount?} + /api/groups/{shortName}/parents?level={level?}&maxItems={maxItems?}&skipCount={skipCount?}&sortBy={sortBy?} argument user required draft_public_api - \ No newline at end of file + diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.js index c3a26fc6dc..3c91827eac 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.js @@ -8,8 +8,8 @@ function main () var shortName = urlElements[0]; var level = args["level"]; - var maxItems = args["maxItems"]; - var skipCount = args["skipCount"]; + var sortBy = args["sortBy"]; + var paging = utils.createPaging(args); var group = groups.getGroup(shortName); if (group == null) @@ -20,13 +20,10 @@ function main () } model.group = group; - if(maxItems == null) + + if(sortBy == null) { - maxItems = -1; - } - if(skipCount == null) - { - skipCount = -1; + sortBy = "authorityName"; } if (level != null) @@ -36,12 +33,14 @@ function main () status.setCode(status.STATUS_BAD_REQUEST, "The level argument has does not have a correct value."); return; } - model.parents = group.getAllParentGroups(maxItems, skipCount); + model.parents = group.getAllParentGroups(paging, sortBy); + model.paging = paging; } else { - model.parents = group.getParentGroups(maxItems, skipCount); + model.parents = group.getParentGroups(paging, sortBy); + model.paging = paging; } } -main(); \ No newline at end of file +main(); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.json.ftl index 51930c974f..2aac10d77d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/parent.get.json.ftl @@ -1,6 +1,7 @@ <#-- get parents --> <#import "authority.lib.ftl" as authorityLib/> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> { "data": [ <#list parents as thegroup> @@ -8,4 +9,6 @@ <#if thegroup_has_next>, ] -} \ No newline at end of file + + <@genericPaging.pagingJSON /> +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.desc.xml index daae1c8dbe..b07cab4305 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.desc.xml @@ -10,11 +10,12 @@ The shortname filter can contain the wild card characters * and ? but these must be url encoded for this script. The optional maxItems parameter sets the maximum number of items to be returned. If no value is set then all items are returned. The optional skipCount parameter determines how many items to skip before returning the first result. If no skipCount value is set then no items are skipped. + If the optional sortBy parameter is given, then the results may be sorted. Possible values are "authorityName" (default), "shortName" and "displayName" ]]> - /api/rootgroups?shortNameFilter={shortNameFilter?}&zone={zone?}&maxItems={maxItems?}&skipCount={skipCount?} + /api/rootgroups?shortNameFilter={shortNameFilter?}&zone={zone?}&maxItems={maxItems?}&skipCount={skipCount?}&sortBy={sortBy?} argument user required draft_public_api - \ No newline at end of file + diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.js index 68a808ec28..b973655d40 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.js @@ -7,28 +7,25 @@ function main () // Get the args var shortNameFilter = args["shortNameFilter"]; var zone = args["zone"]; - var maxItems= args["maxItems"]; - var skipCount= args["skipCount"]; - - if(maxItems == null) - { - maxItems = -1; - } - - if(skipCount == null) - { - skipCount = -1; - } + var sortBy = args["sortBy"]; + var paging = utils.createPaging(args); + if(sortBy == null) + { + sortBy = "authorityName"; + } + if(shortNameFilter == null) { - model.groups = groups.getAllRootGroupsInZone(zone, maxItems, skipCount); + model.groups = groups.getAllRootGroupsInZone(zone, paging, sortBy); + model.paging = paging; } else { // Do the search - model.groups = groups.searchRootGroupsInZone(shortNameFilter, zone, maxItems, skipCount); + model.groups = groups.searchRootGroupsInZone(shortNameFilter, zone, paging, sortBy); + model.paging = paging; } } -main(); \ No newline at end of file +main(); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.json.ftl index 6bf003d94e..679d33fbde 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/groups/rootgroups.get.json.ftl @@ -1,6 +1,7 @@ <#-- list / search / rootgroups --> <#import "authority.lib.ftl" as authorityLib/> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> { "data": [ <#list groups as group> @@ -8,4 +9,6 @@ <#if group_has_next>, ] -} \ No newline at end of file + + <@genericPaging.pagingJSON /> +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_de.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_de.properties new file mode 100644 index 0000000000..cb7f0a29ea --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_de.properties @@ -0,0 +1,11 @@ +# User CSV Upload Web Script I18N +person.err.userCSV.invalidForm=Das Formular wurde nicht als Multipart hochgeladen +person.err.userCSV.noFile=Es wurde keine Datei hochgeladen +person.err.userCSV.corruptFile=Die Datei war besch\u00e4digt oder unvollst\u00e4ndig + +person.err.userCSV.general=Es gab ein Problem beim Erstellen der Benutzer +person.err.userCSV.generalArgs=Es gab ein Problem beim Erstellen der Benutzer: {0} +person.err.userCSV.blankColumn=Spalte {0} (Spalte Nummer\u00a0{1}) darf nicht leer sein, aber war es in Zeile {2} + +person.msg.userCSV.created=Erstellt f\u00fcr {0} +person.msg.userCSV.existing=Bereits vorhanden diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_es.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_es.properties new file mode 100644 index 0000000000..55b051db1a --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_es.properties @@ -0,0 +1,11 @@ +# User CSV Upload Web Script I18N +person.err.userCSV.invalidForm=El formulario no se ha cargado como varias partes +person.err.userCSV.noFile=No se ha cargado ning\u00fan archivo +person.err.userCSV.corruptFile=El archivo estaba da\u00f1ado o truncado + +person.err.userCSV.general=Se ha producido un problema al crear los usuarios +person.err.userCSV.generalArgs=Se ha producido un problema al crear los usuarios: {0} +person.err.userCSV.blankColumn=La columna {0} (n\u00famero de columna {1}) no debe estar en blanco, pero lo estaba en la l\u00ednea {2} + +person.msg.userCSV.created=Creado por {0} +person.msg.userCSV.existing=Ya existe diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_fr.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_fr.properties new file mode 100644 index 0000000000..6956941b1b --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_fr.properties @@ -0,0 +1,11 @@ +# User CSV Upload Web Script I18N +person.err.userCSV.invalidForm=Le formulaire n'a pas \u00e9t\u00e9 t\u00e9l\u00e9charg\u00e9 en tant que multipart +person.err.userCSV.noFile=Aucun fichier n'a \u00e9t\u00e9 t\u00e9l\u00e9charg\u00e9 +person.err.userCSV.corruptFile=Le fichier \u00e9tait corrompu ou tronqu\u00e9 + +person.err.userCSV.general=Un probl\u00e8me est survenu lors de la cr\u00e9ation des utilisateurs +person.err.userCSV.generalArgs=Un probl\u00e8me est survenu lors de la cr\u00e9ation des utilisateurs : {0} +person.err.userCSV.blankColumn=La colonne {0} (num\u00e9ro de colonne : {1}) ne doit pas \u00eatre vide, or elle est vide \u00e0 la ligne {2} + +person.msg.userCSV.created=Cr\u00e9\u00e9 pour {0} +person.msg.userCSV.existing=Existe d\u00e9j\u00e0 diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_it.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_it.properties new file mode 100644 index 0000000000..347ce01d53 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_it.properties @@ -0,0 +1,11 @@ +# User CSV Upload Web Script I18N +person.err.userCSV.invalidForm=Il modulo non \u00e8 stato caricato come multiparte +person.err.userCSV.noFile=Nessun file caricato +person.err.userCSV.corruptFile=Il file \u00e8 stato danneggiato o troncato + +person.err.userCSV.general=Si \u00e8 verificato un problema con la creazione degli utenti +person.err.userCSV.generalArgs=Si \u00e8 verificato un problema con la creazione degli utenti: {0} +person.err.userCSV.blankColumn=La colonna {0} (numero colonna {1}) non deve essere vuota, ma era alla riga {2} + +person.msg.userCSV.created=Creato per {0} +person.msg.userCSV.existing=Esiste gi\u00e0 diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_ja.properties b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_ja.properties new file mode 100644 index 0000000000..219fab0718 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/person/user-csv-upload.post_ja.properties @@ -0,0 +1,11 @@ +# User CSV Upload Web Script I18N +person.err.userCSV.invalidForm=\u3053\u306e\u5f62\u5f0f\u306fmultipart\u3068\u3057\u3066\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +person.err.userCSV.noFile=\u30d5\u30a1\u30a4\u30eb\u306f\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f +person.err.userCSV.corruptFile=\u30d5\u30a1\u30a4\u30eb\u304c\u58ca\u308c\u3066\u3044\u308b\u304b\u3001\u5207\u308a\u6368\u3066\u3089\u308c\u307e\u3057\u305f + +person.err.userCSV.general=\u30e6\u30fc\u30b6\u306e\u4f5c\u6210\u4e2d\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f +person.err.userCSV.generalArgs=\u30e6\u30fc\u30b6\u306e\u4f5c\u6210\u4e2d\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f: {0} +person.err.userCSV.blankColumn=\u5217 {0} (\u5217\u756a\u53f7{1})\u3092\u7a7a\u767d\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u304c\u3001\u884c{2}\u306b\u3042\u308a\u307e\u3059\u3002 + +person.msg.userCSV.created={0}\u7528\u306b\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f +person.msg.userCSV.existing=\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059 diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/task-instances.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/task-instances.get.json.ftl index 0e741446d8..110962c3a6 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/task-instances.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/task-instances.get.json.ftl @@ -1,5 +1,6 @@ <#-- List Workflow Task Instances --> <#import "workflow.lib.ftl" as workflowLib /> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> { "data": [ @@ -8,8 +9,6 @@ <#if task_has_next>, ] - <#if paging??>, - "paging": - <@workflowLib.pagingJSON paging=paging /> - -} \ No newline at end of file + + <@genericPaging.pagingJSON pagingVar="paging" /> +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow-instances.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow-instances.get.json.ftl index e90cc3058b..7b47e6282b 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow-instances.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow-instances.get.json.ftl @@ -1,6 +1,7 @@ <#-- Workflow Instances collection --> <#import "workflow.lib.ftl" as workflowLib /> +<#import "../generic-paged-results.lib.ftl" as genericPaging /> { "data": [ @@ -9,8 +10,6 @@ <#if workflowInstance_has_next>, ] - <#if paging??>, - "paging": - <@workflowLib.pagingJSON paging=paging /> - -} \ No newline at end of file + + <@genericPaging.pagingJSON pagingVar="paging" /> +} diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl index 1abe75fb78..916d387a71 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl @@ -169,14 +169,3 @@ } - -<#-- Renders a paging object. --> -<#macro pagingJSON paging> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "totalItems": ${paging.totalItems?c}, - "maxItems": ${paging.maxItems?c}, - "skipCount": ${paging.skipCount?c} - } - - \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/calendar/event.put.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/slingshot/calendar/event.put.json.ftl index 051b86cfb1..cb022bf6fc 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/calendar/event.put.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/calendar/event.put.json.ftl @@ -1,11 +1,12 @@ +<#escape x as jsonUtils.encodeJSONString(x)> { <#if result.error??> "error": "${result.error}" <#else> "data": { - "summary" : "${result.summary}", - "location" : "${result.location}", - "description" : "${result.description}", + "summary" : "${result.summary?js_string}", + "location" : "${result.location?js_string}", + "description" : "${result.description?js_string}", "dtstart" : "${result.dtstart}", "dtend" : "${result.dtend}", "uri" : "${result.uri}", @@ -15,4 +16,5 @@ } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js index f4c7a36ac1..137b176757 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js @@ -17,7 +17,8 @@ function runAction(p_params) var results = [], destNode = p_params.destNode, files = p_params.files, - file, fileNode, result, nodeRef; + file, fileNode, result, nodeRef, + fromSite, copiedNode; // Must have array of files if (!files || files.length === 0) @@ -48,17 +49,33 @@ function runAction(p_params) else { result.id = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; + result.type = fileNode.isContainer ? "folder" : "document" + + // Retain the name of the site the node is currently in. Null if it's not in a site. + fromSite = fileNode.siteShortName; + // copy the node (deep copy for containers) if (fileNode.isContainer) { - result.nodeRef = fileNode.copy(destNode, true).nodeRef.toString(); + copiedNode = fileNode.copy(destNode, true).nodeRef; + result.nodeRef = copiedNode.toString(); } else { - result.nodeRef = fileNode.copy(destNode).nodeRef.toString(); + copiedNode = fileNode.copy(destNode).nodeRef; + result.nodeRef = copiedNode.toString(); } + result.success = (result.nodeRef !== null); + + if (result.success) + { + // If this was an inter-site copy, we'll need to clean up the permissions on the node + if (fromSite !== copiedNode.siteShortName) + { + siteService.cleanSitePermissions(copiedNode); + } + } } } catch (e) diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js index a4c2db6385..7795fe239d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js @@ -18,7 +18,8 @@ function runAction(p_params) destNode = p_params.destNode, files = p_params.files, parent = null, - file, fileNode, result, nodeRef; + file, fileNode, result, nodeRef, + fromSite; // Must have array of files if (!files || files.length == 0) @@ -54,8 +55,21 @@ function runAction(p_params) } result.id = fileNode.name; result.type = fileNode.isContainer ? "folder" : "document"; + + // Retain the name of the site the node is currently in. Null if it's not in a site. + fromSite = fileNode.siteShortName; + // move the node result.success = fileNode.move(parent, destNode); + + if (result.success) + { + // If this was an inter-site move, we'll need to clean up the permissions on the node + if (fromSite !== fileNode.siteShortName) + { + siteService.cleanSitePermissions(fileNode); + } + } } } catch (e) diff --git a/source/java/org/alfresco/repo/web/scripts/archive/ArchivedNodesGet.java b/source/java/org/alfresco/repo/web/scripts/archive/ArchivedNodesGet.java index 31079cd7aa..586e49a9c4 100644 --- a/source/java/org/alfresco/repo/web/scripts/archive/ArchivedNodesGet.java +++ b/source/java/org/alfresco/repo/web/scripts/archive/ArchivedNodesGet.java @@ -27,6 +27,8 @@ import java.util.SortedSet; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.util.ModelUtil; +import org.alfresco.util.PagingDetails; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptRequest; @@ -42,9 +44,6 @@ public class ArchivedNodesGet extends AbstractArchivedNodeWebScript private static final String MAX_ITEMS = "maxItems"; private static final String SKIP_COUNT = "skipCount"; - private static final String PAGING_TOTAL_ITEMS = "totalItems"; - - List nodeFilters = new ArrayList(); /** @@ -89,25 +88,16 @@ public class ArchivedNodesGet extends AbstractArchivedNodeWebScript } } - // Paging parameters. - int maxItems = getIntParameter(req, MAX_ITEMS, deletedNodes.size()); - int skipCount = getIntParameter(req, SKIP_COUNT, 0); - - // Paging was required - Map pagingModel = new HashMap(); - pagingModel.put(PAGING_TOTAL_ITEMS, deletedNodes.size()); - pagingModel.put(MAX_ITEMS, maxItems); - pagingModel.put(SKIP_COUNT, skipCount); - - int endIndex = skipCount + maxItems; - if (endIndex > deletedNodes.size()) - { - endIndex = deletedNodes.size(); - } - // from skipCount (inclusive) to endIndex (exclusive) - model.put(DELETED_NODES, deletedNodes.subList(skipCount, endIndex)); - model.put("paging", pagingModel); + // Grab the paging parameters + PagingDetails paging = new PagingDetails( + getIntParameter(req, MAX_ITEMS, deletedNodes.size()), + getIntParameter(req, SKIP_COUNT, 0) + ); + // Now do the paging + model.put(DELETED_NODES, ModelUtil.page(deletedNodes, paging)); + model.put("paging", ModelUtil.buildPaging(paging)); + return model; } } diff --git a/source/java/org/alfresco/repo/web/scripts/bean/AVMRemoteStore.java b/source/java/org/alfresco/repo/web/scripts/bean/AVMRemoteStore.java index 770fdcd8ea..7de178a619 100644 --- a/source/java/org/alfresco/repo/web/scripts/bean/AVMRemoteStore.java +++ b/source/java/org/alfresco/repo/web/scripts/bean/AVMRemoteStore.java @@ -71,8 +71,8 @@ public class AVMRemoteStore extends BaseRemoteStore { private static final Log logger = LogFactory.getLog(AVMRemoteStore.class); private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance(); - private static ThreadLocal transformer = new ThreadLocal(){ - + private static ThreadLocal transformer = new ThreadLocal() + { /* (non-Javadoc) * @see java.lang.ThreadLocal#initialValue() */ @@ -88,7 +88,6 @@ public class AVMRemoteStore extends BaseRemoteStore throw new RuntimeException(e); } } - }; private String rootPath = "/"; private AVMService avmService; @@ -451,6 +450,8 @@ public class AVMRemoteStore extends BaseRemoteStore @Override protected void listDocuments(WebScriptResponse res, String store, String path, boolean recurse) throws IOException { + res.setContentType("text/plain;charset=UTF-8"); + String avmPath = buildAVMPath(store, path); AVMNodeDescriptor node = this.avmService.lookup(-1, avmPath); if (node == null) @@ -481,6 +482,8 @@ public class AVMRemoteStore extends BaseRemoteStore @Override protected void listDocuments(WebScriptResponse res, final String store, String path, String pattern) throws IOException { + res.setContentType("text/plain;charset=UTF-8"); + String avmPath = buildAVMPath(store, path); AVMNodeDescriptor node = this.avmService.lookup(-1, avmPath); if (node == null) diff --git a/source/java/org/alfresco/repo/web/scripts/workflow/AbstractWorkflowWebscript.java b/source/java/org/alfresco/repo/web/scripts/workflow/AbstractWorkflowWebscript.java index 7344e4c7d1..2fad449290 100644 --- a/source/java/org/alfresco/repo/web/scripts/workflow/AbstractWorkflowWebscript.java +++ b/source/java/org/alfresco/repo/web/scripts/workflow/AbstractWorkflowWebscript.java @@ -33,6 +33,7 @@ import org.alfresco.service.cmr.security.AuthorityService; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.util.ModelUtil; import org.springframework.extensions.surf.util.ISO8601DateFormat; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.DeclarativeWebScript; @@ -237,7 +238,7 @@ public abstract class AbstractWorkflowWebscript extends DeclarativeWebScript if (maxItems != DEFAULT_MAX_ITEMS || skipCount != DEFAULT_SKIP_COUNT) { // maxItems or skipCount parameter was provided so we need to include paging into response - model.put("paging", modelBuilder.buildPaging(totalItems, maxItems == DEFAULT_MAX_ITEMS ? totalItems : maxItems, skipCount)); + model.put("paging", ModelUtil.buildPaging(totalItems, maxItems == DEFAULT_MAX_ITEMS ? totalItems : maxItems, skipCount)); } return model; @@ -259,20 +260,8 @@ public abstract class AbstractWorkflowWebscript extends DeclarativeWebScript return results; } - List> pagingResults = new ArrayList>(results.size()); - - int endPosition = results.size(); - if (skipCount + maxItems <= endPosition) - { - endPosition = skipCount + maxItems; - } - - for (int i = skipCount; i < endPosition; i++) - { - pagingResults.add(results.get(i)); - } - - return pagingResults; + // Do the paging + return ModelUtil.page(results, maxItems, skipCount); } /** diff --git a/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java b/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java index ae22198118..af60c87a64 100644 --- a/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java +++ b/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java @@ -140,10 +140,6 @@ public class WorkflowModelBuilder public static final String WORKFLOW_DEFINITION_START_TASK_DEFINITION_TYPE = "startTaskDefinitionType"; public static final String WORKFLOW_DEFINITION_TASK_DEFINITIONS = "taskDefinitions"; - public static final String PAGING_TOTAL_ITEMS = "totalItems"; - public static final String PAGING_MAX_ITEMS = "maxItems"; - public static final String PAGING_SKIP_COUNT = "skipCount"; - private static final String PREFIX_SEPARATOR = Character.toString(QName.NAMESPACE_PREFIX); private final NamespaceService namespaceService; @@ -379,25 +375,6 @@ public class WorkflowModelBuilder return model; } - /** - * Returns representation of paging object - * - * @param totalItems all count of object - * @param maxItems max count of object that should be returned - * @param skipCount count of skipped objects - * @return - */ - public Map buildPaging(int totalItems, int maxItems, int skipCount) - { - HashMap model = new HashMap(); - - model.put(PAGING_TOTAL_ITEMS, totalItems); - model.put(PAGING_MAX_ITEMS, maxItems); - model.put(PAGING_SKIP_COUNT, skipCount); - - return model; - } - private Object isPooled(Map properties) { Collection actors = (Collection) properties.get(WorkflowModel.ASSOC_POOLED_ACTORS); diff --git a/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilderTest.java b/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilderTest.java index 6d06be2a4c..924c25e4d2 100644 --- a/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilderTest.java +++ b/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilderTest.java @@ -289,15 +289,6 @@ public class WorkflowModelBuilderTest extends TestCase } - public void testBuildPaging() - { - Map model = builder.buildPaging(100, 50, 50); - - assertEquals(100, model.get(WorkflowModelBuilder.PAGING_TOTAL_ITEMS)); - assertEquals(50, model.get(WorkflowModelBuilder.PAGING_MAX_ITEMS)); - assertEquals(50, model.get(WorkflowModelBuilder.PAGING_SKIP_COUNT)); - } - private WorkflowNode makeNode() { String name = "The Node Name";