diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js index 840235e188..7ffab5a4e0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js @@ -1,87 +1,87 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Update an rm constraint - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - var allowedValues, - title = null; - - if (json.has("constraintTitle")) - { - title = json.get("constraintTitle"); - if (existsTitle(caveatConfig, title)) - { - status.code = 400; - model.errorMessage = "rm.admin.list-already-exists"; - model.title = title; - return; - } - constraint.updateTitle(title); - } - - if (json.has("allowedValues")) - { - values = json.getJSONArray("allowedValues"); - - var i = 0; - allowedValues = new Array(); - - if (values != null) - { - for (var x = 0; x < values.length(); x++) - { - allowedValues[i++] = values.get(x); - } - } - constraint.updateAllowedValues(allowedValues); - } - - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Update an rm constraint + */ +function main() +{ + // Get the shortname + var shortName = url.extension; + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + var allowedValues, + title = null; + + if (json.has("constraintTitle")) + { + title = json.get("constraintTitle"); + if (existsTitle(caveatConfig, title)) + { + status.code = 400; + model.errorMessage = "rm.admin.list-already-exists"; + model.title = title; + return; + } + constraint.updateTitle(title); + } + + if (json.has("allowedValues")) + { + values = json.getJSONArray("allowedValues"); + + var i = 0; + allowedValues = new Array(); + + if (values != null) + { + for (var x = 0; x < values.length(); x++) + { + allowedValues[i++] = values.get(x); + } + } + constraint.updateAllowedValues(allowedValues); + } + + // Pass the constraint detail to the template + model.constraint = constraint; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js index d64fc3e1bf..82af0f127c 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js @@ -1,81 +1,81 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Create a new RM Constraint List - */ -function main() -{ - // Parse the passed in details - var title = null, - name = null, - allowedValues = {}; - - if (json.has("constraintName")) - { - name = json.get("constraintName"); - } - - if (json.has("constraintTitle")) - { - title = json.get("constraintTitle"); - } - else - { - title = name; - } - - if (existsTitle(caveatConfig, title)) - { - status.code = 400; - model.errorMessage = "rm.admin.list-already-exists"; - model.title = title; - return; - } - - if (json.has("allowedValues")) - { - values = json.getJSONArray("allowedValues"); - - var i = 0; - allowedValues = new Array(); - - if (values != null) - { - for (var x = 0; x < values.length(); x++) - { - allowedValues[i++] = values.get(x); - } - } - } - - model.constraint = caveatConfig.createConstraint(name, title, allowedValues); -} - -main(); + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Create a new RM Constraint List + */ +function main() +{ + // Parse the passed in details + var title = null, + name = null, + allowedValues = {}; + + if (json.has("constraintName")) + { + name = json.get("constraintName"); + } + + if (json.has("constraintTitle")) + { + title = json.get("constraintTitle"); + } + else + { + title = name; + } + + if (existsTitle(caveatConfig, title)) + { + status.code = 400; + model.errorMessage = "rm.admin.list-already-exists"; + model.title = title; + return; + } + + if (json.has("allowedValues")) + { + values = json.getJSONArray("allowedValues"); + + var i = 0; + allowedValues = new Array(); + + if (values != null) + { + for (var x = 0; x < values.length(); x++) + { + allowedValues[i++] = values.get(x); + } + } + } + + model.constraint = caveatConfig.createConstraint(name, title, allowedValues); +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js index cfef49a351..6cd9bfae07 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js @@ -1,38 +1,38 @@ - - - - - - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + + + + + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Document List Component: doclist - */ -model.doclist = rm_doclist_main(); + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Document List Component: doclist + */ +model.doclist = rm_doclist_main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js index 5b052a9ae2..3f582abae6 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js @@ -1,134 +1,134 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Copy multiple files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - file, fileNode, result, nodeRef, - fromSite, copiedNode; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "copyFile", - success: false - }; - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = "Can't find source node."; - } - if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) - { - result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; - results.push(result); - continue; - } - else - { - result.id = fileNode.name; - result.name = 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 = String(fileNode.siteShortName); - - // copy the node (deep copy for containers) - if (fileNode.isContainer) - { - copiedNode = fileNode.copy(destNode, true); - } - else - { - copiedNode = fileNode.copy(destNode); - } - - result.nodeRef = copiedNode.nodeRef.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 != String(copiedNode.siteShortName)) - { - siteService.cleanSitePermissions(copiedNode); - } - } - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = e.message; - - // log the error - logger.error(e.message); - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Copy multiple files action + * @method POST + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} Object literal containing files array + * @return {object|null} object representation of action results + */ +function runAction(p_params) +{ + var results = [], + destNode = p_params.destNode, + files = p_params.files, + file, fileNode, result, nodeRef, + fromSite, copiedNode; + + // Must have array of files + if (!files || files.length == 0) + { + status.setCode(status.STATUS_BAD_REQUEST, "No files."); + return; + } + + for (file in files) + { + nodeRef = files[file]; + result = + { + nodeRef: nodeRef, + action: "copyFile", + success: false + }; + + try + { + fileNode = search.findNode(nodeRef); + if (fileNode == null) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = "Can't find source node."; + } + if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) + { + result.name = fileNode.name; + result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + results.push(result); + continue; + } + else + { + result.id = fileNode.name; + result.name = 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 = String(fileNode.siteShortName); + + // copy the node (deep copy for containers) + if (fileNode.isContainer) + { + copiedNode = fileNode.copy(destNode, true); + } + else + { + copiedNode = fileNode.copy(destNode); + } + + result.nodeRef = copiedNode.nodeRef.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 != String(copiedNode.siteShortName)) + { + siteService.cleanSitePermissions(copiedNode); + } + } + } + } + catch (e) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = e.message; + + // log the error + logger.error(e.message); + } + + results.push(result); + } + + return results; +} + +/* Bootstrap action script */ +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js index 4b38d24f00..47f814827f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js @@ -1,109 +1,109 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Add multiple files as children action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - file, fileNode, result, nodeRef; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "addChild", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode === null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) - { - result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; - results.push(result); - continue; - } - else - { - result.id = fileNode.name; - result.name = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - destNode.addNode(fileNode); - result.success = true; - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = e.message; - - // log the error - logger.error(e.message); - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Add multiple files as children action + * @method POST + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} Object literal containing files array + * @return {object|null} object representation of action results + */ +function runAction(p_params) +{ + var results = [], + destNode = p_params.destNode, + files = p_params.files, + file, fileNode, result, nodeRef; + + // Must have array of files + if (!files || files.length == 0) + { + status.setCode(status.STATUS_BAD_REQUEST, "No files."); + return; + } + + for (file in files) + { + nodeRef = files[file]; + result = + { + nodeRef: nodeRef, + action: "addChild", + success: false + } + + try + { + fileNode = search.findNode(nodeRef); + if (fileNode === null) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + } + if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) + { + result.name = fileNode.name; + result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + results.push(result); + continue; + } + else + { + result.id = fileNode.name; + result.name = fileNode.name; + result.type = fileNode.isContainer ? "folder" : "document"; + destNode.addNode(fileNode); + result.success = true; + } + } + catch (e) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = e.message; + + // log the error + logger.error(e.message); + } + + results.push(result); + } + + return results; +} + +/* Bootstrap action script */ +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js index a84d6df07a..c0f57a6e95 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js @@ -1,128 +1,128 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Move multiple files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - parent = null, - file, fileNode, result, nodeRef, - fromSite; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "moveFile", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) - { - result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; - results.push(result); - continue; - } - else - { - if (p_params.parent && p_params.parent != null) - { - parent = search.findNode(p_params.parent); - } - result.id = fileNode.name; - result.name = 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 (String(fromSite) !== String(fileNode.siteShortName)) - { - siteService.cleanSitePermissions(fileNode); - } - } - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = e.message; - - // log the error - logger.error(e.message); - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Move multiple files action + * @method POST + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} Object literal containing files array + * @return {object|null} object representation of action results + */ +function runAction(p_params) +{ + var results = [], + destNode = p_params.destNode, + files = p_params.files, + parent = null, + file, fileNode, result, nodeRef, + fromSite; + + // Must have array of files + if (!files || files.length == 0) + { + status.setCode(status.STATUS_BAD_REQUEST, "No files."); + return; + } + + for (file in files) + { + nodeRef = files[file]; + result = + { + nodeRef: nodeRef, + action: "moveFile", + success: false + } + + try + { + fileNode = search.findNode(nodeRef); + if (fileNode == null) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + } + if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) + { + result.name = fileNode.name; + result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + results.push(result); + continue; + } + else + { + if (p_params.parent && p_params.parent != null) + { + parent = search.findNode(p_params.parent); + } + result.id = fileNode.name; + result.name = 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 (String(fromSite) !== String(fileNode.siteShortName)) + { + siteService.cleanSitePermissions(fileNode); + } + } + } + } + catch (e) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = e.message; + + // log the error + logger.error(e.message); + } + + results.push(result); + } + + return results; +} + +/* Bootstrap action script */ +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js index 7e7818b1c5..08fff35a02 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js @@ -1,69 +1,69 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -function getRmPermissions() -{ - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id, - node = ParseArgs.resolveNode(nodeRef); - - if (node == null) - { - node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - var permissionData = model.data, - settable = node.getSettablePermissions(), - canReadInherited = true; - - if (node.parent.hasPermission("ReadRecords")) - { - permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable); - } - else - { - canReadInherited = false; - } - - permissionData["canReadInherited"] = canReadInherited; - - model.data = permissionData; -} - -getRmPermissions(); + * along with Alfresco. If not, see . + * #L% + */ + +function getRmPermissions() +{ + /** + * nodeRef input: store_type, store_id and id + */ + var storeType = url.templateArgs.store_type, + storeId = url.templateArgs.store_id, + id = url.templateArgs.id, + nodeRef = storeType + "://" + storeId + "/" + id, + node = ParseArgs.resolveNode(nodeRef); + + if (node == null) + { + node = search.findNode(nodeRef); + if (node === null) + { + status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); + return null; + } + } + + var permissionData = model.data, + settable = node.getSettablePermissions(), + canReadInherited = true; + + if (node.parent.hasPermission("ReadRecords")) + { + permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable); + } + else + { + canReadInherited = false; + } + + permissionData["canReadInherited"] = canReadInherited; + + model.data = permissionData; +} + +getRmPermissions(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js index c8939c526b..dbc3f2a3fd 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js @@ -1,163 +1,163 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -/** - * Document List Component: treenode - */ -model.treenode = getTreenode(); - -/* Create collection of folders in the given space */ -function getTreenode() -{ - try - { - var items = new Array(), - hasSubfolders = true, - ignoredTypes = - { - "{http://www.alfresco.org/model/forum/1.0}forum": true, - "{http://www.alfresco.org/model/forum/1.0}topic": true, - "{http://www.alfresco.org/model/content/1.0}systemfolder": true, - "{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true - }, - skipPermissionCheck = args["perms"] == "false", - evalChildFolders = false, - item, rmNode, capabilities, cap; - - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - // Quick version if "skipPermissionCheck" flag set - if (skipPermissionCheck) - { - for each (item in parsedArgs.pathNode.children) - { - if (itemIsAllowed(item) && !(item.type in ignoredTypes)) - { - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders - }); - } - } - } - else - { - for each (item in parsedArgs.pathNode.children) - { - if (itemIsAllowed(item) && !(item.type in ignoredTypes)) - { - //capabilities = {}; - rmNode = rmService.getRecordsManagementNode(item); - - //for each (cap in rmNode.capabilitiesSet("Create")) - //{ - // capabilities[cap.name] = true; - //} - - // - - hasCreateCapability = rmNode.hasCapability("Create"); - - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders, - permissions: - { - create: hasCreateCapability - } - }); - } - } - } - - items.sort(sortByName); - - return ( - { - parent: parsedArgs.pathNode, - resultsTrimmed: false, - items: items - }); - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } -} - - -/* Sort the results by case-insensitive name */ -function sortByName(a, b) -{ - return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); -} - -/* Filter allowed types, etc. */ -function itemIsAllowed(item) -{ - // Must be a subtype of cm:folder - if (!item.isSubType("cm:folder")) - { - return false; - } - - var typeShort = String(item.typeShort); - - // Don't show Hold and Transfer top-level containers - if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer") - { - return false; - } - - // Must be a "dod:" or "rma:" namespaced type - if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0) - { - return false; - } - - return true; -} + * along with Alfresco. If not, see . + * #L% + */ + +/** + * Document List Component: treenode + */ +model.treenode = getTreenode(); + +/* Create collection of folders in the given space */ +function getTreenode() +{ + try + { + var items = new Array(), + hasSubfolders = true, + ignoredTypes = + { + "{http://www.alfresco.org/model/forum/1.0}forum": true, + "{http://www.alfresco.org/model/forum/1.0}topic": true, + "{http://www.alfresco.org/model/content/1.0}systemfolder": true, + "{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true + }, + skipPermissionCheck = args["perms"] == "false", + evalChildFolders = false, + item, rmNode, capabilities, cap; + + // Use helper function to get the arguments + var parsedArgs = ParseArgs.getParsedArgs(); + if (parsedArgs === null) + { + return; + } + + // Quick version if "skipPermissionCheck" flag set + if (skipPermissionCheck) + { + for each (item in parsedArgs.pathNode.children) + { + if (itemIsAllowed(item) && !(item.type in ignoredTypes)) + { + if (evalChildFolders) + { + hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; + } + + items.push( + { + node: item, + hasSubfolders: hasSubfolders + }); + } + } + } + else + { + for each (item in parsedArgs.pathNode.children) + { + if (itemIsAllowed(item) && !(item.type in ignoredTypes)) + { + //capabilities = {}; + rmNode = rmService.getRecordsManagementNode(item); + + //for each (cap in rmNode.capabilitiesSet("Create")) + //{ + // capabilities[cap.name] = true; + //} + + // + + hasCreateCapability = rmNode.hasCapability("Create"); + + if (evalChildFolders) + { + hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; + } + + items.push( + { + node: item, + hasSubfolders: hasSubfolders, + permissions: + { + create: hasCreateCapability + } + }); + } + } + } + + items.sort(sortByName); + + return ( + { + parent: parsedArgs.pathNode, + resultsTrimmed: false, + items: items + }); + } + catch(e) + { + status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); + return; + } +} + + +/* Sort the results by case-insensitive name */ +function sortByName(a, b) +{ + return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); +} + +/* Filter allowed types, etc. */ +function itemIsAllowed(item) +{ + // Must be a subtype of cm:folder + if (!item.isSubType("cm:folder")) + { + return false; + } + + var typeShort = String(item.typeShort); + + // Don't show Hold and Transfer top-level containers + if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer") + { + return false; + } + + // Must be a "dod:" or "rma:" namespaced type + if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0) + { + return false; + } + + return true; +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js index 0936851203..f361d3f023 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js @@ -1,53 +1,53 @@ - - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% + + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% * This file is part of the Alfresco software. - * + * * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: - * + * * Alfresco 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 3 of the License, or * (at your option) any later version. - * + * * Alfresco 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 Alfresco. If not, see . - * #L% - */ - -function main() { - var params = - { - siteId: args.site, - containerId: args.container, - repo: (args.repo !== null) ? (args.repo == "true") : false, - term: args.term, - tag: args.tag, - query: args.query, - rootNode: args.rootNode, - sort: args.sort, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, - facetFields: args.facetFields, - filters: args.filters, - spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false - }; - - model.data = getSearchResults(params); -}; - -main(); + * along with Alfresco. If not, see . + * #L% + */ + +function main() { + var params = + { + siteId: args.site, + containerId: args.container, + repo: (args.repo !== null) ? (args.repo == "true") : false, + term: args.term, + tag: args.tag, + query: args.query, + rootNode: args.rootNode, + sort: args.sort, + maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, + pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, + startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, + facetFields: args.facetFields, + filters: args.filters, + spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false + }; + + model.data = getSearchResults(params); +}; + +main();