From af304f0834c065745ed316e307b7efa37a11a655 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 8 Sep 2010 17:51:24 +0000 Subject: [PATCH] Commons: - Align bucket name checks between UI and data layer --- chrome/content/zotero/overlay.js | 17 +++++++++++------ chrome/content/zotero/xpcom/commons.js | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 9adde761c..0d9d94d54 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -1562,9 +1562,10 @@ var ZoteroPane = new function() while (true) { if (invalid) { // TODO: localize - var msg = "'" + name + "' is not a valid Zotero Commons collection identifier.\n\n" - + "Collection identifiers can contain basic Latin letters, numbers," - + "hyphens, and underscores. Spaces and other characters are not allowed."; + var msg = "'" + testName + "' is not a valid Zotero Commons collection identifier.\n\n" + + "Collection identifiers can contain basic Latin letters, numbers, " + + "hyphens, and underscores and must be no longer than 32 characters. " + + "Spaces and other characters are not allowed."; prompt.alert("", msg); invalid = false; } @@ -1574,9 +1575,11 @@ var ZoteroPane = new function() "", // TODO: localize "Enter an identifier for the collection '" + title + "'.\n\n" - + "The identifier will form the collection's URL on archive.org " - + "and can contain basic Latin letters, numbers, hyphens, and underscores. " + + "The identifier will form the collection's URL on archive.org. " + + "Identifiers can contain basic Latin letters, numbers, hyphens, and underscores " + + "and must be no longer than 32 characters. " + "Spaces and other characters are not allowed.\n\n" + // TEMP + '"zc-test-' + Zotero.Commons.userNameSlug + '-" ' + "will be automatically prepended to your entry.", newName, @@ -1593,7 +1596,9 @@ var ZoteroPane = new function() return; } - if (!Zotero.Commons.isValidBucketName(name)) { + // TEMP + var testName = 'zc-test-' + Zotero.Commons.userNameSlug + '-' + name; + if (!Zotero.Commons.isValidBucketName(testName)) { invalid = true; continue; } diff --git a/chrome/content/zotero/xpcom/commons.js b/chrome/content/zotero/xpcom/commons.js index dbf7832e8..8b2ad193f 100644 --- a/chrome/content/zotero/xpcom/commons.js +++ b/chrome/content/zotero/xpcom/commons.js @@ -232,6 +232,7 @@ Zotero.Commons = new function() { if (!_userName) { throw new Exception("Username not set in Zotero.Commons.createBucket()"); } + // TEMP name = "zc-test-" + this.userNameSlug + "-" + name; var headers = {