RM-3132 (Update license headers)

This commit is contained in:
Tuna Aksoy
2016-03-14 17:04:23 +00:00
parent 687307edbe
commit aa690919b2
9 changed files with 745 additions and 745 deletions

View File

@@ -1,87 +1,87 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Update an rm constraint * Update an rm constraint
*/ */
function main() function main()
{ {
// Get the shortname // Get the shortname
var shortName = url.extension; var shortName = url.extension;
// Get the constraint // Get the constraint
var constraint = caveatConfig.getConstraint(shortName); var constraint = caveatConfig.getConstraint(shortName);
if (constraint != null) if (constraint != null)
{ {
var allowedValues, var allowedValues,
title = null; title = null;
if (json.has("constraintTitle")) if (json.has("constraintTitle"))
{ {
title = json.get("constraintTitle"); title = json.get("constraintTitle");
if (existsTitle(caveatConfig, title)) if (existsTitle(caveatConfig, title))
{ {
status.code = 400; status.code = 400;
model.errorMessage = "rm.admin.list-already-exists"; model.errorMessage = "rm.admin.list-already-exists";
model.title = title; model.title = title;
return; return;
} }
constraint.updateTitle(title); constraint.updateTitle(title);
} }
if (json.has("allowedValues")) if (json.has("allowedValues"))
{ {
values = json.getJSONArray("allowedValues"); values = json.getJSONArray("allowedValues");
var i = 0; var i = 0;
allowedValues = new Array(); allowedValues = new Array();
if (values != null) if (values != null)
{ {
for (var x = 0; x < values.length(); x++) for (var x = 0; x < values.length(); x++)
{ {
allowedValues[i++] = values.get(x); allowedValues[i++] = values.get(x);
} }
} }
constraint.updateAllowedValues(allowedValues); constraint.updateAllowedValues(allowedValues);
} }
// Pass the constraint detail to the template // Pass the constraint detail to the template
model.constraint = constraint; model.constraint = constraint;
} }
else else
{ {
// Return 404 // Return 404
status.setCode(404, "Constraint List " + shortName + " does not exist"); status.setCode(404, "Constraint List " + shortName + " does not exist");
return; return;
} }
} }
main(); main();

View File

@@ -1,81 +1,81 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Create a new RM Constraint List * Create a new RM Constraint List
*/ */
function main() function main()
{ {
// Parse the passed in details // Parse the passed in details
var title = null, var title = null,
name = null, name = null,
allowedValues = {}; allowedValues = {};
if (json.has("constraintName")) if (json.has("constraintName"))
{ {
name = json.get("constraintName"); name = json.get("constraintName");
} }
if (json.has("constraintTitle")) if (json.has("constraintTitle"))
{ {
title = json.get("constraintTitle"); title = json.get("constraintTitle");
} }
else else
{ {
title = name; title = name;
} }
if (existsTitle(caveatConfig, title)) if (existsTitle(caveatConfig, title))
{ {
status.code = 400; status.code = 400;
model.errorMessage = "rm.admin.list-already-exists"; model.errorMessage = "rm.admin.list-already-exists";
model.title = title; model.title = title;
return; return;
} }
if (json.has("allowedValues")) if (json.has("allowedValues"))
{ {
values = json.getJSONArray("allowedValues"); values = json.getJSONArray("allowedValues");
var i = 0; var i = 0;
allowedValues = new Array(); allowedValues = new Array();
if (values != null) if (values != null)
{ {
for (var x = 0; x < values.length(); x++) for (var x = 0; x < values.length(); x++)
{ {
allowedValues[i++] = values.get(x); allowedValues[i++] = values.get(x);
} }
} }
} }
model.constraint = caveatConfig.createConstraint(name, title, allowedValues); model.constraint = caveatConfig.createConstraint(name, title, allowedValues);
} }
main(); main();

View File

@@ -1,38 +1,38 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Document List Component: doclist * Document List Component: doclist
*/ */
model.doclist = rm_doclist_main(); model.doclist = rm_doclist_main();

View File

@@ -1,134 +1,134 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Copy multiple files action * Copy multiple files action
* @method POST * @method POST
*/ */
/** /**
* Entrypoint required by action.lib.js * Entrypoint required by action.lib.js
* *
* @method runAction * @method runAction
* @param p_params {object} Object literal containing files array * @param p_params {object} Object literal containing files array
* @return {object|null} object representation of action results * @return {object|null} object representation of action results
*/ */
function runAction(p_params) function runAction(p_params)
{ {
var results = [], var results = [],
destNode = p_params.destNode, destNode = p_params.destNode,
files = p_params.files, files = p_params.files,
file, fileNode, result, nodeRef, file, fileNode, result, nodeRef,
fromSite, copiedNode; fromSite, copiedNode;
// Must have array of files // Must have array of files
if (!files || files.length == 0) if (!files || files.length == 0)
{ {
status.setCode(status.STATUS_BAD_REQUEST, "No files."); status.setCode(status.STATUS_BAD_REQUEST, "No files.");
return; return;
} }
for (file in files) for (file in files)
{ {
nodeRef = files[file]; nodeRef = files[file];
result = result =
{ {
nodeRef: nodeRef, nodeRef: nodeRef,
action: "copyFile", action: "copyFile",
success: false success: false
}; };
try try
{ {
fileNode = search.findNode(nodeRef); fileNode = search.findNode(nodeRef);
if (fileNode == null) if (fileNode == null)
{ {
result.id = file; result.id = file;
result.nodeRef = nodeRef; result.nodeRef = nodeRef;
result.success = false; result.success = false;
result.error = "Can't find source node."; result.error = "Can't find source node.";
} }
if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly"))
{ {
result.name = fileNode.name; 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!"; result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!";
results.push(result); results.push(result);
continue; continue;
} }
else else
{ {
result.id = fileNode.name; result.id = fileNode.name;
result.name = fileNode.name; result.name = 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. // Retain the name of the site the node is currently in. Null if it's not in a site.
fromSite = String(fileNode.siteShortName); fromSite = String(fileNode.siteShortName);
// copy the node (deep copy for containers) // copy the node (deep copy for containers)
if (fileNode.isContainer) if (fileNode.isContainer)
{ {
copiedNode = fileNode.copy(destNode, true); copiedNode = fileNode.copy(destNode, true);
} }
else else
{ {
copiedNode = fileNode.copy(destNode); copiedNode = fileNode.copy(destNode);
} }
result.nodeRef = copiedNode.nodeRef.toString(); result.nodeRef = copiedNode.nodeRef.toString();
result.success = (result.nodeRef != null); result.success = (result.nodeRef != null);
if (result.success) if (result.success)
{ {
// If this was an inter-site copy, we'll need to clean up the permissions on the node // If this was an inter-site copy, we'll need to clean up the permissions on the node
if (fromSite != String(copiedNode.siteShortName)) if (fromSite != String(copiedNode.siteShortName))
{ {
siteService.cleanSitePermissions(copiedNode); siteService.cleanSitePermissions(copiedNode);
} }
} }
} }
} }
catch (e) catch (e)
{ {
result.id = file; result.id = file;
result.nodeRef = nodeRef; result.nodeRef = nodeRef;
result.success = false; result.success = false;
result.error = e.message; result.error = e.message;
// log the error // log the error
logger.error(e.message); logger.error(e.message);
} }
results.push(result); results.push(result);
} }
return results; return results;
} }
/* Bootstrap action script */ /* Bootstrap action script */
main(); main();

View File

@@ -1,109 +1,109 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Add multiple files as children action * Add multiple files as children action
* @method POST * @method POST
*/ */
/** /**
* Entrypoint required by action.lib.js * Entrypoint required by action.lib.js
* *
* @method runAction * @method runAction
* @param p_params {object} Object literal containing files array * @param p_params {object} Object literal containing files array
* @return {object|null} object representation of action results * @return {object|null} object representation of action results
*/ */
function runAction(p_params) function runAction(p_params)
{ {
var results = [], var results = [],
destNode = p_params.destNode, destNode = p_params.destNode,
files = p_params.files, files = p_params.files,
file, fileNode, result, nodeRef; file, fileNode, result, nodeRef;
// Must have array of files // Must have array of files
if (!files || files.length == 0) if (!files || files.length == 0)
{ {
status.setCode(status.STATUS_BAD_REQUEST, "No files."); status.setCode(status.STATUS_BAD_REQUEST, "No files.");
return; return;
} }
for (file in files) for (file in files)
{ {
nodeRef = files[file]; nodeRef = files[file];
result = result =
{ {
nodeRef: nodeRef, nodeRef: nodeRef,
action: "addChild", action: "addChild",
success: false success: false
} }
try try
{ {
fileNode = search.findNode(nodeRef); fileNode = search.findNode(nodeRef);
if (fileNode === null) if (fileNode === null)
{ {
result.id = file; result.id = file;
result.nodeRef = nodeRef; result.nodeRef = nodeRef;
result.success = false; result.success = false;
} }
if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly"))
{ {
result.name = fileNode.name; 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!"; result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!";
results.push(result); results.push(result);
continue; continue;
} }
else else
{ {
result.id = fileNode.name; result.id = fileNode.name;
result.name = fileNode.name; result.name = fileNode.name;
result.type = fileNode.isContainer ? "folder" : "document"; result.type = fileNode.isContainer ? "folder" : "document";
destNode.addNode(fileNode); destNode.addNode(fileNode);
result.success = true; result.success = true;
} }
} }
catch (e) catch (e)
{ {
result.id = file; result.id = file;
result.nodeRef = nodeRef; result.nodeRef = nodeRef;
result.success = false; result.success = false;
result.error = e.message; result.error = e.message;
// log the error // log the error
logger.error(e.message); logger.error(e.message);
} }
results.push(result); results.push(result);
} }
return results; return results;
} }
/* Bootstrap action script */ /* Bootstrap action script */
main(); main();

View File

@@ -1,128 +1,128 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Move multiple files action * Move multiple files action
* @method POST * @method POST
*/ */
/** /**
* Entrypoint required by action.lib.js * Entrypoint required by action.lib.js
* *
* @method runAction * @method runAction
* @param p_params {object} Object literal containing files array * @param p_params {object} Object literal containing files array
* @return {object|null} object representation of action results * @return {object|null} object representation of action results
*/ */
function runAction(p_params) function runAction(p_params)
{ {
var results = [], var results = [],
destNode = p_params.destNode, destNode = p_params.destNode,
files = p_params.files, files = p_params.files,
parent = null, parent = null,
file, fileNode, result, nodeRef, file, fileNode, result, nodeRef,
fromSite; fromSite;
// Must have array of files // Must have array of files
if (!files || files.length == 0) if (!files || files.length == 0)
{ {
status.setCode(status.STATUS_BAD_REQUEST, "No files."); status.setCode(status.STATUS_BAD_REQUEST, "No files.");
return; return;
} }
for (file in files) for (file in files)
{ {
nodeRef = files[file]; nodeRef = files[file];
result = result =
{ {
nodeRef: nodeRef, nodeRef: nodeRef,
action: "moveFile", action: "moveFile",
success: false success: false
} }
try try
{ {
fileNode = search.findNode(nodeRef); fileNode = search.findNode(nodeRef);
if (fileNode == null) if (fileNode == null)
{ {
result.id = file; result.id = file;
result.nodeRef = nodeRef; result.nodeRef = nodeRef;
result.success = false; result.success = false;
} }
if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly"))
{ {
result.name = fileNode.name; 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!"; result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!";
results.push(result); results.push(result);
continue; continue;
} }
else else
{ {
if (p_params.parent && p_params.parent != null) if (p_params.parent && p_params.parent != null)
{ {
parent = search.findNode(p_params.parent); parent = search.findNode(p_params.parent);
} }
result.id = fileNode.name; result.id = fileNode.name;
result.name = fileNode.name; result.name = 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. // Retain the name of the site the node is currently in. Null if it's not in a site.
fromSite = fileNode.siteShortName; fromSite = fileNode.siteShortName;
// move the node // move the node
result.success = fileNode.move(parent, destNode); result.success = fileNode.move(parent, destNode);
if (result.success) if (result.success)
{ {
// If this was an inter-site move, we'll need to clean up the permissions on the node // If this was an inter-site move, we'll need to clean up the permissions on the node
if (String(fromSite) !== String(fileNode.siteShortName)) if (String(fromSite) !== String(fileNode.siteShortName))
{ {
siteService.cleanSitePermissions(fileNode); siteService.cleanSitePermissions(fileNode);
} }
} }
} }
} }
catch (e) catch (e)
{ {
result.id = file; result.id = file;
result.nodeRef = nodeRef; result.nodeRef = nodeRef;
result.success = false; result.success = false;
result.error = e.message; result.error = e.message;
// log the error // log the error
logger.error(e.message); logger.error(e.message);
} }
results.push(result); results.push(result);
} }
return results; return results;
} }
/* Bootstrap action script */ /* Bootstrap action script */
main(); main();

View File

@@ -1,69 +1,69 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
function getRmPermissions() function getRmPermissions()
{ {
/** /**
* nodeRef input: store_type, store_id and id * nodeRef input: store_type, store_id and id
*/ */
var storeType = url.templateArgs.store_type, var storeType = url.templateArgs.store_type,
storeId = url.templateArgs.store_id, storeId = url.templateArgs.store_id,
id = url.templateArgs.id, id = url.templateArgs.id,
nodeRef = storeType + "://" + storeId + "/" + id, nodeRef = storeType + "://" + storeId + "/" + id,
node = ParseArgs.resolveNode(nodeRef); node = ParseArgs.resolveNode(nodeRef);
if (node == null) if (node == null)
{ {
node = search.findNode(nodeRef); node = search.findNode(nodeRef);
if (node === null) if (node === null)
{ {
status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'");
return null; return null;
} }
} }
var permissionData = model.data, var permissionData = model.data,
settable = node.getSettablePermissions(), settable = node.getSettablePermissions(),
canReadInherited = true; canReadInherited = true;
if (node.parent.hasPermission("ReadRecords")) if (node.parent.hasPermission("ReadRecords"))
{ {
permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable); permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable);
} }
else else
{ {
canReadInherited = false; canReadInherited = false;
} }
permissionData["canReadInherited"] = canReadInherited; permissionData["canReadInherited"] = canReadInherited;
model.data = permissionData; model.data = permissionData;
} }
getRmPermissions(); getRmPermissions();

View File

@@ -1,163 +1,163 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
/** /**
* Document List Component: treenode * Document List Component: treenode
*/ */
model.treenode = getTreenode(); model.treenode = getTreenode();
/* Create collection of folders in the given space */ /* Create collection of folders in the given space */
function getTreenode() function getTreenode()
{ {
try try
{ {
var items = new Array(), var items = new Array(),
hasSubfolders = true, hasSubfolders = true,
ignoredTypes = ignoredTypes =
{ {
"{http://www.alfresco.org/model/forum/1.0}forum": true, "{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/forum/1.0}topic": true,
"{http://www.alfresco.org/model/content/1.0}systemfolder": true, "{http://www.alfresco.org/model/content/1.0}systemfolder": true,
"{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true "{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true
}, },
skipPermissionCheck = args["perms"] == "false", skipPermissionCheck = args["perms"] == "false",
evalChildFolders = false, evalChildFolders = false,
item, rmNode, capabilities, cap; item, rmNode, capabilities, cap;
// Use helper function to get the arguments // Use helper function to get the arguments
var parsedArgs = ParseArgs.getParsedArgs(); var parsedArgs = ParseArgs.getParsedArgs();
if (parsedArgs === null) if (parsedArgs === null)
{ {
return; return;
} }
// Quick version if "skipPermissionCheck" flag set // Quick version if "skipPermissionCheck" flag set
if (skipPermissionCheck) if (skipPermissionCheck)
{ {
for each (item in parsedArgs.pathNode.children) for each (item in parsedArgs.pathNode.children)
{ {
if (itemIsAllowed(item) && !(item.type in ignoredTypes)) if (itemIsAllowed(item) && !(item.type in ignoredTypes))
{ {
if (evalChildFolders) if (evalChildFolders)
{ {
hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0;
} }
items.push( items.push(
{ {
node: item, node: item,
hasSubfolders: hasSubfolders hasSubfolders: hasSubfolders
}); });
} }
} }
} }
else else
{ {
for each (item in parsedArgs.pathNode.children) for each (item in parsedArgs.pathNode.children)
{ {
if (itemIsAllowed(item) && !(item.type in ignoredTypes)) if (itemIsAllowed(item) && !(item.type in ignoredTypes))
{ {
//capabilities = {}; //capabilities = {};
rmNode = rmService.getRecordsManagementNode(item); rmNode = rmService.getRecordsManagementNode(item);
//for each (cap in rmNode.capabilitiesSet("Create")) //for each (cap in rmNode.capabilitiesSet("Create"))
//{ //{
// capabilities[cap.name] = true; // capabilities[cap.name] = true;
//} //}
// //
hasCreateCapability = rmNode.hasCapability("Create"); hasCreateCapability = rmNode.hasCapability("Create");
if (evalChildFolders) if (evalChildFolders)
{ {
hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0;
} }
items.push( items.push(
{ {
node: item, node: item,
hasSubfolders: hasSubfolders, hasSubfolders: hasSubfolders,
permissions: permissions:
{ {
create: hasCreateCapability create: hasCreateCapability
} }
}); });
} }
} }
} }
items.sort(sortByName); items.sort(sortByName);
return ( return (
{ {
parent: parsedArgs.pathNode, parent: parsedArgs.pathNode,
resultsTrimmed: false, resultsTrimmed: false,
items: items items: items
}); });
} }
catch(e) catch(e)
{ {
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString());
return; return;
} }
} }
/* Sort the results by case-insensitive name */ /* Sort the results by case-insensitive name */
function sortByName(a, b) function sortByName(a, b)
{ {
return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1);
} }
/* Filter allowed types, etc. */ /* Filter allowed types, etc. */
function itemIsAllowed(item) function itemIsAllowed(item)
{ {
// Must be a subtype of cm:folder // Must be a subtype of cm:folder
if (!item.isSubType("cm:folder")) if (!item.isSubType("cm:folder"))
{ {
return false; return false;
} }
var typeShort = String(item.typeShort); var typeShort = String(item.typeShort);
// Don't show Hold and Transfer top-level containers // Don't show Hold and Transfer top-level containers
if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer") if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer")
{ {
return false; return false;
} }
// Must be a "dod:" or "rma:" namespaced type // Must be a "dod:" or "rma:" namespaced type
if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0) if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0)
{ {
return false; return false;
} }
return true; return true;
} }

View File

@@ -1,53 +1,53 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js">
/* /*
* #%L * #%L
* Alfresco Records Management Module * Alfresco Records Management Module
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* *
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
function main() { function main() {
var params = var params =
{ {
siteId: args.site, siteId: args.site,
containerId: args.container, containerId: args.container,
repo: (args.repo !== null) ? (args.repo == "true") : false, repo: (args.repo !== null) ? (args.repo == "true") : false,
term: args.term, term: args.term,
tag: args.tag, tag: args.tag,
query: args.query, query: args.query,
rootNode: args.rootNode, rootNode: args.rootNode,
sort: args.sort, sort: args.sort,
maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS,
pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE,
startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0,
facetFields: args.facetFields, facetFields: args.facetFields,
filters: args.filters, filters: args.filters,
spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false
}; };
model.data = getSearchResults(params); model.data = getSearchResults(params);
}; };
main(); main();