- Align bucket name checks between UI and data layer
This commit is contained in:
Dan Stillman 2010-09-08 17:51:24 +00:00
parent 6c7413ed72
commit af304f0834
2 changed files with 12 additions and 6 deletions

View file

@ -1562,9 +1562,10 @@ var ZoteroPane = new function()
while (true) { while (true) {
if (invalid) { if (invalid) {
// TODO: localize // TODO: localize
var msg = "'" + name + "' is not a valid Zotero Commons collection identifier.\n\n" var msg = "'" + testName + "' is not a valid Zotero Commons collection identifier.\n\n"
+ "Collection identifiers can contain basic Latin letters, numbers," + "Collection identifiers can contain basic Latin letters, numbers, "
+ "hyphens, and underscores. Spaces and other characters are not allowed."; + "hyphens, and underscores and must be no longer than 32 characters. "
+ "Spaces and other characters are not allowed.";
prompt.alert("", msg); prompt.alert("", msg);
invalid = false; invalid = false;
} }
@ -1574,9 +1575,11 @@ var ZoteroPane = new function()
"", "",
// TODO: localize // TODO: localize
"Enter an identifier for the collection '" + title + "'.\n\n" "Enter an identifier for the collection '" + title + "'.\n\n"
+ "The identifier will form the collection's URL on archive.org " + "The identifier will form the collection's URL on archive.org. "
+ "and can contain basic Latin letters, numbers, hyphens, and underscores. " + "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" + "Spaces and other characters are not allowed.\n\n"
// TEMP
+ '"zc-test-' + Zotero.Commons.userNameSlug + '-" ' + '"zc-test-' + Zotero.Commons.userNameSlug + '-" '
+ "will be automatically prepended to your entry.", + "will be automatically prepended to your entry.",
newName, newName,
@ -1593,7 +1596,9 @@ var ZoteroPane = new function()
return; return;
} }
if (!Zotero.Commons.isValidBucketName(name)) { // TEMP
var testName = 'zc-test-' + Zotero.Commons.userNameSlug + '-' + name;
if (!Zotero.Commons.isValidBucketName(testName)) {
invalid = true; invalid = true;
continue; continue;
} }

View file

@ -232,6 +232,7 @@ Zotero.Commons = new function() {
if (!_userName) { if (!_userName) {
throw new Exception("Username not set in Zotero.Commons.createBucket()"); throw new Exception("Username not set in Zotero.Commons.createBucket()");
} }
// TEMP
name = "zc-test-" + this.userNameSlug + "-" + name; name = "zc-test-" + this.userNameSlug + "-" + name;
var headers = { var headers = {