diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index 8b5e354ef..13086f869 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -755,7 +755,7 @@ Zotero.DataObject.prototype._clearFieldChange = function (field) { Zotero.DataObject.prototype.isEditable = function () { - return Zotero.Libraries.isEditable(this.libraryID); + return Zotero.Libraries.get(this.libraryID).editable; } @@ -772,7 +772,7 @@ Zotero.DataObject.prototype.editCheck = function () { if (!this.isEditable()) { throw new Error("Cannot edit " + this._objectType + " in read-only library " - + Zotero.Libraries.getName(this.libraryID)); + + Zotero.Libraries.get(this.libraryID).name); } } diff --git a/chrome/content/zotero/xpcom/data/dataObjects.js b/chrome/content/zotero/xpcom/data/dataObjects.js index 23c19411f..f7f50a3a6 100644 --- a/chrome/content/zotero/xpcom/data/dataObjects.js +++ b/chrome/content/zotero/xpcom/data/dataObjects.js @@ -861,12 +861,12 @@ Zotero.DataObjects.prototype.isEditable = function (obj) { return true; } - if (!Zotero.Libraries.isEditable(libraryID)) return false; + if (!Zotero.Libraries.get(libraryID).editable) return false; if (obj.objectType == 'item' && obj.isAttachment() && (obj.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL || obj.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) - && !Zotero.Libraries.isFilesEditable(libraryID) + && !Zotero.Libraries.get(libraryID).filesEditable(libraryID) ) { return false; } diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index e0b9791ed..c0020b3fd 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -1211,7 +1211,7 @@ Zotero.Item.prototype.isEditable = function() { if (this.isAttachment() && (this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL || this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) - && !Zotero.Libraries.isFilesEditable(this.libraryID) + && !Zotero.Libraries.get(this.libraryID).filesEditable ) { return false; } diff --git a/chrome/content/zotero/xpcom/storage/storageEngine.js b/chrome/content/zotero/xpcom/storage/storageEngine.js index 191dd1794..1b31e00f0 100644 --- a/chrome/content/zotero/xpcom/storage/storageEngine.js +++ b/chrome/content/zotero/xpcom/storage/storageEngine.js @@ -135,8 +135,10 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function* yield this.library.saveTx(); } + var filesEditable = Zotero.Libraries.get(libraryID).filesEditable; + // Check for updated files to upload - if (!Zotero.Libraries.isFilesEditable(libraryID)) { + if (!filesEditable) { Zotero.debug("No file editing access -- skipping file modification check for " + this.library.name); } @@ -189,7 +191,7 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function* } // Get files to upload - if (Zotero.Libraries.isFilesEditable(libraryID)) { + if (filesEditable) { let itemIDs = yield this.local.getFilesToUpload(libraryID); if (itemIDs.length) { Zotero.debug(itemIDs.length + " file" + (itemIDs.length == 1 ? '' : 's') + " to " diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index 2e324f099..2987fad35 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -677,7 +677,7 @@ Zotero.Sync.Data.Local = { var objectsClass = Zotero.DataObjectUtilities.getObjectsClassForObjectType(objectType); var objectTypePlural = Zotero.DataObjectUtilities.getObjectTypePlural(objectType); var ObjectType = Zotero.Utilities.capitalize(objectType); - var libraryName = Zotero.Libraries.getName(libraryID); + var libraryName = Zotero.Libraries.get(libraryID).name; var knownErrors = [ 'ZoteroUnknownTypeError', diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 4312c327d..e2469af9d 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -48,7 +48,7 @@ Zotero.Translate.ItemSaver = function(options) { this._collections = options.collections || false; // If group filesEditable==false, don't save attachments - this.attachmentMode = Zotero.Libraries.isFilesEditable(this._libraryID) ? options.attachmentMode : + this.attachmentMode = Zotero.Libraries.get(this._libraryID).filesEditable ? options.attachmentMode : Zotero.Translate.ItemSaver.ATTACHMENT_MODE_IGNORE; this._forceTagType = options.forceTagType; this._cookieSandbox = options.cookieSandbox; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 3677360cc..b766c953d 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1318,7 +1318,7 @@ var ZoteroPane = new function() // If a trash is selected, new collection depends on the // editability of the library if (collectionTreeRow.isTrash() && command == 'cmd_zotero_newCollection') { - var overrideEditable = Zotero.Libraries.isEditable(collectionTreeRow.ref.libraryID); + var overrideEditable = Zotero.Libraries.get(collectionTreeRow.ref.libraryID).editable; } else { var overrideEditable = false; @@ -3753,7 +3753,7 @@ var ZoteroPane = new function() } itemType = Zotero.ItemTypes.getID(itemType); var item = yield this.newItem(itemType, data, row); - var filesEditable = Zotero.Libraries.isFilesEditable(item.libraryID); + var filesEditable = Zotero.Libraries.get(item.libraryID).filesEditable; if (saveSnapshot) { var link = false; @@ -3867,7 +3867,7 @@ var ZoteroPane = new function() } var item = yield ZoteroPane_Local.newItem(itemType, {}, row) - var filesEditable = Zotero.Libraries.isFilesEditable(item.libraryID); + var filesEditable = Zotero.Libraries.get(item.libraryID).filesEditable; // Save snapshot if explicitly enabled or automatically pref is set and not explicitly disabled if (saveSnapshot || (saveSnapshot !== false && Zotero.Prefs.get('automaticSnapshots'))) {