From df743e37a548e5f7ea94286e2ac959cead9788d2 Mon Sep 17 00:00:00 2001 From: Dave Draper Date: Mon, 25 Jun 2012 13:50:08 +0000 Subject: [PATCH] RM-92: Prevent users from being able to create duplicate lists git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@38290 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../rmconstraint/rmconstraints.post.json.ftl | 6 +++- .../rmconstraint/rmconstraints.post.json.js | 31 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl index b572b81729..6687f6ed55 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl @@ -2,6 +2,10 @@ <#escape x as jsonUtils.encodeJSONString(x)> { - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + <#if !errorMessage??> + "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + <#else> + "message" : "${msg(errorMessage, title)}" + } \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js index 4c8b5a0804..ad822a97e7 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js @@ -19,7 +19,7 @@ function main() { for (var x = 0; x < values.length(); x++) { - allowedValues[i++] = values.get(x); + allowedValues[i++] = values.get(x); } } } @@ -38,10 +38,33 @@ function main() title = name; } - var constraint = caveatConfig.createConstraint(name, title, allowedValues); + + var constraints = caveatConfig.allConstraints; - // Pass the constraint detail to the template - model.constraint = constraint; + // Check for existing constraint... + var alreadyExists = false; + for (var i=0; i