mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3132 (Update license headers)
This commit is contained in:
@@ -1,87 +1,87 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
@@ -1,81 +1,81 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
@@ -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/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/rm-parse-args.lib.js">
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<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/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/rm-parse-args.lib.js">
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
/**
|
||||
* Document List Component: doclist
|
||||
*/
|
||||
model.doclist = rm_doclist_main();
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
/**
|
||||
* Document List Component: doclist
|
||||
*/
|
||||
model.doclist = rm_doclist_main();
|
||||
|
@@ -1,134 +1,134 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
@@ -1,109 +1,109 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
@@ -1,128 +1,128 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
@@ -1,69 +1,69 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
@@ -1,163 +1,163 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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;
|
||||
}
|
||||
|
@@ -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/rmsearch/faceted/rmsearch.lib.js">
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
<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">
|
||||
|
||||
/*
|
||||
* #%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 <http://www.gnu.org/licenses/>.
|
||||
* #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 <http://www.gnu.org/licenses/>.
|
||||
* #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();
|
||||
|
Reference in New Issue
Block a user