diff --git a/chrome/content/zotero/publicationsDialog.js b/chrome/content/zotero/publicationsDialog.js
new file mode 100644
index 0000000000..8e3f02cda2
--- /dev/null
+++ b/chrome/content/zotero/publicationsDialog.js
@@ -0,0 +1,420 @@
+/*
+ ***** BEGIN LICENSE BLOCK *****
+
+ Copyright © 2015 Center for History and New Media
+ George Mason University, Fairfax, Virginia, USA
+ https://www.zotero.org
+
+ This file is part of Zotero.
+
+ Zotero is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Zotero 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 Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Zotero. If not, see .
+
+ ***** END LICENSE BLOCK *****
+*/
+
+var Zotero_Publications_Dialog = new function () {
+ var _initialized = false;
+ var _io;
+ var _hasFiles = false;
+ var _hasNotes = false;
+ var _hasRights = null;
+ var _includeFiles = true;
+ var _includeNotes = true;
+ var _useRights = true;
+ var _shareSettings = {
+ sharing: 'cc',
+ adaptations: 'no',
+ commercial: 'yes'
+ };
+ var _license = null;
+
+ function _init() {
+ try {
+ var wizard = document.getElementById('zotero-publications-wizard');
+ wizard.getButton('finish').label =
+ Zotero.getString('publications.buttons.addToMyPublications');
+
+ if (window.arguments && window.arguments.length) {
+ _io = window.arguments[0];
+ _hasFiles = _io.hasFiles;
+ _hasNotes = _io.hasNotes;
+ _hasRights = _io.hasRights;
+ if (_hasRights == 'none') _useRights = false;
+ delete _io.hasFiles;
+ delete _io.hasNotes;
+ delete _io.hasRights;
+ }
+ _initialized = true;
+ }
+ catch (e) {
+ window.close();
+ throw e;
+ }
+ }
+
+
+ this.updatePage = function () {
+ if (!_initialized) {
+ _init();
+ }
+
+ var wizard = document.getElementById('zotero-publications-wizard');
+ var currentPage = wizard.currentPage;
+ var pageid = currentPage.pageid;
+
+ if (pageid == 'intro') {
+ let str = 'publications.authorship.checkbox';
+ let filesCheckbox = document.getElementById('include-files');
+ let notesCheckbox = document.getElementById('include-notes')
+
+ // Enable the checkboxes only when relevant
+ filesCheckbox.disabled = !_hasFiles;
+ filesCheckbox.checked = _hasFiles && _includeFiles;
+ notesCheckbox.disabled = !_hasNotes;
+ notesCheckbox.checked = _hasNotes && _includeNotes;
+
+ // Adjust the checkbox text based on whether there are files or notes
+ if (filesCheckbox.checked || notesCheckbox.checked) {
+ if (filesCheckbox.checked && notesCheckbox.checked) {
+ str += '.filesNotes';
+ }
+ else if (filesCheckbox.checked) {
+ str += '.files';
+ }
+ else {
+ str += '.notes';
+ }
+ }
+ }
+ else if (pageid == 'choose-sharing') {
+ let useRightsBox = document.getElementById('use-rights');
+ let useRightsCheckbox = document.getElementById('use-rights-checkbox');
+ if (_hasRights == 'none') {
+ useRightsBox.hidden = true;
+ document.getElementById('sharing-radiogroup').focus();
+ }
+ else {
+ let str = 'publications.sharing.useRightsField';
+ if (_hasRights == 'some') {
+ str += 'WhereAvailable';
+ }
+ useRightsCheckbox.label = Zotero.getString(str);
+ useRightsCheckbox.checked = _useRights;
+ this.updateUseRights(useRightsCheckbox.checked);
+ }
+ }
+ // Select appropriate radio button from current license
+ else if (pageid == 'choose-license') {
+ document.getElementById('adaptations-' + _shareSettings.adaptations).selected = true;
+ document.getElementById('commercial-' + _shareSettings.commercial).selected = true;
+ }
+
+ _updateLicense();
+ this.updateNextButton();
+ };
+
+
+ this.updateNextButton = function () {
+ var wizard = document.getElementById('zotero-publications-wizard');
+ var currentPage = wizard.currentPage;
+ var nextPage = wizard.wizardPages[wizard.pageIndex + 1];
+ var pageid = wizard.currentPage.pageid;
+ var nextButton = wizard.getButton('next');
+ var finishButton = wizard.getButton('finish');
+
+ // Require authorship checkbox on first page to be checked to advance
+ wizard.canAdvance = document.getElementById('confirm-authorship-checkbox').checked;
+
+ if (!nextPage) {
+ return;
+ }
+
+ if (currentPage.pageid == 'intro' ||
+ // If CC selected on sharing page and we're not using existing rights for all
+ // items, go to license chooser next
+ (currentPage.pageid == 'choose-sharing'
+ && _shareSettings.sharing == 'cc'
+ && !(_hasRights == 'all' && _useRights))) {
+ this.lastPage = false;
+ finishButton.hidden = true;
+ nextButton.hidden = false;
+ nextButton.label = Zotero.getString(
+ 'publications.buttons.next',
+ Zotero.getString('publications.buttons.' + nextPage.pageid)
+ );
+ }
+ // Otherwise this is the last page
+ else {
+ this.lastPage = true;
+ nextButton.hidden = true;
+ finishButton.hidden = false;
+ }
+ }
+
+
+ /**
+ * Update files/notes settings from checkboxes
+ */
+ this.updateInclude = function () {
+ var filesCheckbox = document.getElementById('include-files');
+ var notesCheckbox = document.getElementById('include-notes')
+ _includeFiles = filesCheckbox.checked;
+ _includeNotes = notesCheckbox.checked;
+ }
+
+
+ /**
+ * Update rights setting from checkbox and hide sharing setting if necessary
+ */
+ this.updateUseRights = function (useRights) {
+ _useRights = useRights;
+
+ // If all items have rights and we're using them, the sharing page is the last page
+ document.getElementById('choose-sharing-options').hidden = _hasRights == 'all' && useRights;
+ this.updateNextButton();
+ }
+
+
+ /**
+ * Update sharing and license settings
+ */
+ this.updateSharing = function (id) {
+ var matches = id.match(/^(sharing|adaptations|commercial)-(.+)$/);
+ var setting = matches[1];
+ var value = matches[2];
+ _shareSettings[setting] = value;
+ _updateLicense();
+ this.updateNextButton();
+ }
+
+
+ this.onAdvance = function () {
+ if (this.lastPage) {
+ this.finish();
+ return false;
+ }
+ return true;
+ }
+
+
+ this.onFinish = function () {
+ _io.includeFiles = document.getElementById('include-files').checked;
+ _io.includeNotes = document.getElementById('include-notes').checked;
+ _io.useRights = _useRights;
+ _io.license = _license;
+ _io.licenseName = _getLicenseName(_license);
+ }
+
+ this.finish = function () {
+ this.onFinish();
+ window.close();
+ }
+
+
+ /**
+ * Update the calculated license and image
+ *
+ * Possible licenses:
+ *
+ * 'cc-by'
+ * 'cc-by-sa'
+ * 'cc-by-nd'
+ * 'cc-by-nc'
+ * 'cc-by-nc-sa'
+ * 'cc-by-nc-nd'
+ * 'cc0'
+ * 'reserved'
+ */
+ function _updateLicense() {
+ var s = _shareSettings.sharing;
+ var a = _shareSettings.adaptations;
+ var c = _shareSettings.commercial;
+
+ if (s == 'cc0' || s == 'reserved') {
+ _license = s;
+ }
+ else {
+ _license = 'cc-by';
+ if (c == 'no') {
+ _license += '-nc';
+ }
+ if (a == 'no') {
+ _license += '-nd';
+ }
+ else if (a == 'sharealike') {
+ _license += '-sa';
+ }
+ }
+ _updateLicenseSummary();
+ }
+
+
+ /**
+ *
+ */
+ function _updateLicenseSummary() {
+ var wizard = document.getElementById('zotero-publications-wizard');
+ var currentPage = wizard.currentPage;
+ var groupbox = currentPage.getElementsByAttribute('class', 'license-info')[0];
+ if (!groupbox) return;
+ if (groupbox.hasChildNodes()) {
+ let hbox = groupbox.lastChild;
+ var icon = currentPage.getElementsByAttribute('class', 'license-icon')[0];
+ var div = currentPage.getElementsByAttribute('class', 'license-description')[0];
+ }
+ else {
+ let hbox = document.createElement('hbox');
+ hbox.align = "center";
+ groupbox.appendChild(hbox);
+
+ var icon = document.createElement('image');
+ icon.className = 'license-icon';
+ icon.setAttribute('style', 'width: 88px');
+ hbox.appendChild(icon);
+
+ let sep = document.createElement('separator');
+ sep.orient = 'vertical';
+ sep.setAttribute('style', 'width: 10px');
+ hbox.appendChild(sep);
+
+ var div = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
+ div.className = 'license-description';
+ div.setAttribute('style', 'width: 400px');
+ hbox.appendChild(div);
+ }
+
+ // Show generic CC icon on sharing page
+ if (currentPage.pageid == 'choose-sharing' && _shareSettings.sharing == 'cc') {
+ var license = 'cc';
+ }
+ else {
+ var license = _license;
+ }
+
+ icon.src = _getLicenseImage(license);
+ var url = _getLicenseURL(license);
+ if (url) {
+ icon.setAttribute('tooltiptext', url);
+ icon.style.cursor = 'pointer';
+ icon.onclick = function () {
+ try {
+ let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ let win = wm.getMostRecentWindow("navigator:browser");
+ win.ZoteroPane_Local.loadURI(url, { shiftKey: true })
+ }
+ catch (e) {
+ Zotero.logError(e);
+ }
+ return false;
+ };
+ }
+ else {
+ icon.removeAttribute('tooltiptext');
+ icon.style.cursor = 'auto';
+ }
+
+ div.innerHTML = _getLicenseHTML(license);
+ Zotero.Utilities.Internal.updateHTMLInXUL(div, { linkEvent: { shiftKey: true } });
+
+ _updateLicenseMoreInfo();
+ }
+
+
+ function _getLicenseImage(license) {
+ // Use generic "Some Rights Reserved" image
+ if (license == 'cc') {
+ return "chrome://zotero/skin/licenses/cc-srr.png";
+ }
+ else if (license == 'reserved') {
+ return "chrome://zotero/skin/licenses/reserved.png";
+ }
+ return "chrome://zotero/skin/licenses/" + license + ".svg";
+ }
+
+
+ function _getLicenseHTML(license) {
+ switch (license) {
+ case 'cc':
+ return 'Creative Commons';
+
+ case 'reserved':
+ return "All rights reserved";
+
+ case 'cc0':
+ return 'CC0 1.0 Universal Public Domain Dedication';
+
+ default:
+ return ''
+ + Zotero.getString('licenses.' + license) + "";
+ }
+ }
+
+
+ function _getLicenseName(license) {
+ switch (license) {
+ case 'reserved':
+ return "All rights reserved";
+
+ case 'cc0':
+ return 'CC0 1.0 Universal Public Domain Dedication';
+
+ default:
+ return Zotero.getString('licenses.' + license) + " (" + license.toUpperCase() + ")";
+ }
+ }
+
+
+ function _getLicenseURL(license) {
+ switch (license) {
+ case 'reserved':
+ return "";
+
+ case 'cc':
+ return 'https://creativecommons.org/';
+
+ case 'cc0':
+ return "https://creativecommons.org/publicdomain/zero/1.0/";
+
+ default:
+ return "https://creativecommons.org/licenses/" + license.replace(/^cc-/, '') + "/4.0/"
+ }
+ }
+
+
+ function _updateLicenseMoreInfo() {
+ var wizard = document.getElementById('zotero-publications-wizard');
+ var currentPage = wizard.currentPage;
+ var s = _shareSettings.sharing;
+
+ var div = currentPage.getElementsByAttribute('class', 'license-more-info')[0];
+ if (s == 'cc0' || currentPage.pageid == 'choose-license') {
+ let links = {
+ cc: 'https://wiki.creativecommons.org/Considerations_for_licensors_and_licensees',
+ cc0: 'https://wiki.creativecommons.org/CC0_FAQ'
+ };
+ div.innerHTML = Zotero.getString(
+ 'publications.' + s + '.moreInfo.text',
+ // Add link to localized string
+ ''
+ + Zotero.getString('publications.' + s + '.moreInfo.linkText')
+ + ''
+ );
+ Zotero.Utilities.Internal.updateHTMLInXUL(div, { linkEvent: { shiftKey: true } });
+ }
+ else {
+ div.innerHTML = "";
+ }
+ }
+}
diff --git a/chrome/content/zotero/publicationsDialog.xul b/chrome/content/zotero/publicationsDialog.xul
new file mode 100644
index 0000000000..b4f229e1af
--- /dev/null
+++ b/chrome/content/zotero/publicationsDialog.xul
@@ -0,0 +1,107 @@
+
+
+ %zoteroDTD;
+ %publicationsDTD;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &zotero.publications.intro;
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &zotero.publications.sharing.text;
+
+ &zotero.publications.sharing.prompt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &zotero.publications.chooseLicense.text;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js
index 5c89b73ed8..96d6ac9ab1 100644
--- a/chrome/content/zotero/xpcom/collectionTreeView.js
+++ b/chrome/content/zotero/xpcom/collectionTreeView.js
@@ -1353,7 +1353,7 @@ Zotero.CollectionTreeView.prototype.canDropCheck = function (row, orient, dataTr
if (treeRow.isPublications() && treeRow.ref.libraryID != item.libraryID) {
if (item.isAttachment() || item.isNote()) {
- Zotero.debug("Standalone attachments and notes cannot be added to My Publications");
+ Zotero.debug("Top-level attachments and notes cannot be added to My Publications");
return false;
}
skip = false;
@@ -1575,7 +1575,15 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
var sourceTreeRow = Zotero.DragDrop.getDragSource(dataTransfer);
var targetTreeRow = Zotero.DragDrop.getDragTarget(event);
- var copyItem = Zotero.Promise.coroutine(function* (item, targetLibraryID) {
+ var copyOptions = {
+ tags: Zotero.Prefs.get('groups.copyTags'),
+ childNotes: Zotero.Prefs.get('groups.copyChildNotes'),
+ childLinks: Zotero.Prefs.get('groups.copyChildLinks'),
+ childFileAttachments: Zotero.Prefs.get('groups.copyChildFileAttachments')
+ };
+ var copyItem = Zotero.Promise.coroutine(function* (item, targetLibraryID, options) {
+ var targetLibraryType = Zotero.Libraries.getType(targetLibraryID);
+
// Check if there's already a copy of this item in the library
var linkedItem = yield item.getLinkedItem(targetLibraryID);
if (linkedItem) {
@@ -1651,7 +1659,15 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
}
// Create new clone item in target library
- var newItem = yield item.clone(targetLibraryID, false, !Zotero.Prefs.get('groups.copyTags'));
+ var newItem = yield item.clone(targetLibraryID, false, !options.tags);
+
+ // Set Rights field for My Publications
+ if (options.license) {
+ if (!options.useRights || !newItem.getField('rights')) {
+ newItem.setField('rights', options.licenseName);
+ }
+ }
+
var newItemID = yield newItem.save();
// Record link
@@ -1664,7 +1680,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
// For regular items, add child items if prefs and permissions allow
// Child notes
- if (Zotero.Prefs.get('groups.copyChildNotes')) {
+ if (options.childNotes) {
yield item.loadChildItems();
var noteIDs = item.getNotes();
var notes = yield Zotero.Items.getAsync(noteIDs);
@@ -1678,9 +1694,8 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
}
// Child attachments
- var copyChildLinks = Zotero.Prefs.get('groups.copyChildLinks');
- var copyChildFileAttachments = Zotero.Prefs.get('groups.copyChildFileAttachments');
- if (copyChildLinks || copyChildFileAttachments) {
+ if (options.childLinks || options.childFileAttachments) {
+ yield item.loadChildItems();
var attachmentIDs = item.getAttachments();
var attachments = yield Zotero.Items.getAsync(attachmentIDs);
for each(var attachment in attachments) {
@@ -1694,19 +1709,19 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
// Skip imported files if we don't have pref and permissions
if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_URL) {
- if (!copyChildLinks) {
+ if (!options.childLinks) {
Zotero.debug("Skipping child link attachment on drag");
continue;
}
}
else {
- if (!copyChildFileAttachments || !targetTreeRow.filesEditable) {
+ if (!options.childFileAttachments
+ || (!targetTreeRow.filesEditable && !targetTreeRow.isPublications())) {
Zotero.debug("Skipping child file attachment on drag");
continue;
}
}
-
- Zotero.Attachments.copyAttachmentToLibrary(attachment, targetLibraryID, newItemID);
+ yield Zotero.Attachments.copyAttachmentToLibrary(attachment, targetLibraryID, newItemID);
}
}
@@ -1747,7 +1762,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
// Items
else {
var item = yield Zotero.Items.getAsync(desc.id);
- var id = yield copyItem(item, targetLibraryID);
+ var id = yield copyItem(item, targetLibraryID, copyOptions);
// Standalone attachments might not get copied
if (!id) {
continue;
@@ -1797,6 +1812,19 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
return;
}
+ if (targetTreeRow.isPublications()) {
+ let items = yield Zotero.Items.getAsync(ids);
+ let io = yield this._treebox.treeBody.ownerDocument.defaultView.ZoteroPane
+ .showPublicationsWizard(items);
+ copyOptions.childNotes = io.includeNotes;
+ copyOptions.childFileAttachments = io.includeFiles;
+ copyOptions.childLinks = true;
+ copyOptions.tags = true; // TODO: add checkbox
+ ['useRights', 'license', 'licenseName'].forEach(function (field) {
+ copyOptions[field] = io[field];
+ });
+ }
+
yield Zotero.DB.executeTransaction(function* () {
var items = yield Zotero.Items.getAsync(ids);
if (!items) {
@@ -1833,7 +1861,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
var newIDs = [];
for each(var item in newItems) {
- var id = yield copyItem(item, targetLibraryID)
+ var id = yield copyItem(item, targetLibraryID, copyOptions)
// Standalone attachments might not get copied
if (!id) {
continue;
@@ -2167,7 +2195,7 @@ Zotero.CollectionTreeRow.prototype.__defineGetter__('editable', function () {
if (this.isTrash() || this.isShare() || this.isBucket()) {
return false;
}
- if (this.isPublications || !this.isWithinGroup()) {
+ if (!this.isWithinGroup() || this.isPublications()) {
return true;
}
var libraryID = this.ref.libraryID;
@@ -2190,7 +2218,7 @@ Zotero.CollectionTreeRow.prototype.__defineGetter__('filesEditable', function ()
if (this.isTrash() || this.isShare()) {
return false;
}
- if (!this.isWithinGroup()) {
+ if (!this.isWithinGroup() || this.isPublications()) {
return true;
}
var libraryID = this.ref.libraryID;
diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js
index d314ec4a1f..301058476d 100644
--- a/chrome/content/zotero/xpcom/data/collection.js
+++ b/chrome/content/zotero/xpcom/data/collection.js
@@ -289,6 +289,7 @@ Zotero.Collection.prototype._saveData = Zotero.Promise.coroutine(function* (env)
var collectionID = env.id = this._id = this.id ? this.id : yield Zotero.ID.get('collections');
var libraryID = env.libraryID = this.libraryID || Zotero.Libraries.userLibraryID;
var key = env.key = this._key = this.key ? this.key : this._generateKey();
+ var libraryType = env.libraryType = Zotero.Libraries.getType(libraryID);
Zotero.debug("Saving collection " + this.id);
diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js
index 5d734540f9..cbefdcfa65 100644
--- a/chrome/content/zotero/xpcom/data/dataObject.js
+++ b/chrome/content/zotero/xpcom/data/dataObject.js
@@ -507,6 +507,11 @@ Zotero.DataObject.prototype.isEditable = function () {
Zotero.DataObject.prototype.editCheck = function () {
+ if ((this._objectType == 'collection' || this._objectType == 'search')
+ && Zotero.Libraries.getType(this.libraryID) == 'publications') {
+ throw new Error(this._ObjectTypePlural + " cannot be added to My Publications");
+ }
+
if (!Zotero.Sync.Server.updatesInProgress && !Zotero.Sync.Storage.updatesInProgress && !this.isEditable()) {
throw ("Cannot edit " + this._objectType + " in read-only Zotero library");
}
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
index bf7ec11dd0..6519ff73f0 100644
--- a/chrome/content/zotero/xpcom/data/item.js
+++ b/chrome/content/zotero/xpcom/data/item.js
@@ -1184,6 +1184,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
var itemID = env.id = this._id = this.id ? this.id : yield Zotero.ID.get('items');
var libraryID = env.libraryID = this.libraryID || Zotero.Libraries.userLibraryID;
var key = env.key = this._key = this.key ? this.key : this._generateKey();
+ var libraryType = env.libraryType = Zotero.Libraries.getType(libraryID);
sqlColumns.push(
'itemTypeID',
@@ -1435,9 +1436,17 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
}
}
+ if (libraryType == 'publications' && !this.isRegularItem() && !parentItemID) {
+ throw new Error("Top-level attachments and notes cannot be added to My Publications");
+ }
+
// Trashed status
if (this._changed.deleted) {
if (this._deleted) {
+ if (libraryType == 'publications') {
+ throw new Error("Items in My Publications cannot be moved to trash");
+ }
+
sql = "REPLACE INTO deletedItems (itemID) VALUES (?)";
}
else {
@@ -1525,6 +1534,10 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
let syncState = this.attachmentSyncState;
if (this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
+ if (libraryType == 'publications') {
+ throw new Error("Linked files cannot be added to My Publications");
+ }
+
// Save attachment within attachment base directory as relative path
if (Zotero.Prefs.get('saveRelativeAttachmentPath')) {
path = Zotero.Attachments.getBaseDirectoryRelativePath(path);
@@ -1592,6 +1605,10 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
// Collections
if (this._changed.collections) {
+ if (libraryType == 'publications') {
+ throw new Error("Items in My Publications cannot be added to collections");
+ }
+
let oldCollections = this._previousData.collections || [];
let newCollections = this._collections;
diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js
index 636cdfc7ac..d8232822df 100644
--- a/chrome/content/zotero/xpcom/itemTreeView.js
+++ b/chrome/content/zotero/xpcom/itemTreeView.js
@@ -641,13 +641,6 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
// Top-level item
if (this.isContainer(row)) {
- // If removed from My Publications, remove row
- if (collectionTreeRow.isPublications() && !item.publication) {
- this._removeRow(row);
- this._treebox.rowCountChanged(row, -1)
- continue;
- }
-
//yield this.toggleOpenState(row);
//yield this.toggleOpenState(row);
sort = id;
@@ -754,7 +747,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
for (let i=0; i attachment.isFileAttachment());
+ }
+ // Notes
+ if (!io.hasNotes && item.numNotes()) {
+ io.hasNotes = true;
+ }
+ // Rights
+ if (item.getField('rights')) {
+ noItemsHaveRights = false;
+ }
+ else {
+ allItemsHaveRights = false;
+ }
+ }
+ io.hasRights = allItemsHaveRights ? 'all' : (noItemsHaveRights ? 'none' : 'some');
+ window.openDialog('chrome://zotero/content/publicationsDialog.xul','','chrome,modal', io);
+ return io.license ? io : false;
+ });
+
+
/**
* Test if the user can edit the currently selected view
*
diff --git a/chrome/locale/en-US/zotero/publications.dtd b/chrome/locale/en-US/zotero/publications.dtd
new file mode 100644
index 0000000000..901bf56824
--- /dev/null
+++ b/chrome/locale/en-US/zotero/publications.dtd
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd
index 1d494062ba..c901be1921 100644
--- a/chrome/locale/en-US/zotero/zotero.dtd
+++ b/chrome/locale/en-US/zotero/zotero.dtd
@@ -1,4 +1,6 @@
-
+
+
+
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
index c0c80012c6..7a09edf9e0 100644
--- a/chrome/locale/en-US/zotero/zotero.properties
+++ b/chrome/locale/en-US/zotero/zotero.properties
@@ -999,3 +999,23 @@ styles.editor.warning.renderError = Error generating citations and bibliography
styles.editor.output.individualCitations = Individual Citations
styles.editor.output.singleCitation = Single Citation (with position "first")
styles.preview.instructions = Select one or more items in Zotero and click the "Refresh" button to see how these items are rendered by the installed CSL citation styles.
+
+publications.sharing.useRightsField = Use the existing Rights field
+publications.sharing.useRightsFieldWhereAvailable = Use the existing Rights field where available
+publications.cc.moreInfo.text = Be sure you have read the Creative Commons %S before placing your work under a CC license. Note that the license you apply cannot be revoked, even if you later choose different terms or cease publishing the work.
+publications.cc.moreInfo.linkText = Considerations for licensors
+publications.cc0.moreInfo.text = Be sure you have read the Creative Commons %S before applying CC0 to your work. Please note that dedicating your work to the public domain is irreversible, even if you later choose different terms or cease publishing the work.
+publications.cc0.moreInfo.linkText = CC0 FAQ
+publications.error.linkedFilesCannotBeAdded = Linked files cannot be added My Publications
+
+publications.buttons.next = Next: %S
+publications.buttons.choose-sharing = Sharing
+publications.buttons.choose-license = Choose a License
+publications.buttons.addToMyPublications = Add to My Publications
+
+licenses.cc-by = Creative Commons Attribution 4.0 International License
+licenses.cc-by-nd = Creative Commons Attribution-NoDerivatives 4.0 International License
+licenses.cc-by-sa = Creative Commons Attribution-ShareAlike 4.0 International License
+licenses.cc-by-nc = Creative Commons Attribution-NonCommercial 4.0 International License
+licenses.cc-by-nc-nd = Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
+licenses.cc-by-nc-sa = Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
diff --git a/chrome/skin/default/zotero/licenses/cc-by-nc-nd.svg b/chrome/skin/default/zotero/licenses/cc-by-nc-nd.svg
new file mode 100644
index 0000000000..37a32df762
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc-by-nc-nd.svg
@@ -0,0 +1,243 @@
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/cc-by-nc-sa.svg b/chrome/skin/default/zotero/licenses/cc-by-nc-sa.svg
new file mode 100644
index 0000000000..514c251b7a
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc-by-nc-sa.svg
@@ -0,0 +1,202 @@
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/cc-by-nc.svg b/chrome/skin/default/zotero/licenses/cc-by-nc.svg
new file mode 100644
index 0000000000..597a6220f2
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc-by-nc.svg
@@ -0,0 +1,190 @@
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/cc-by-nd.svg b/chrome/skin/default/zotero/licenses/cc-by-nd.svg
new file mode 100644
index 0000000000..6efd00d844
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc-by-nd.svg
@@ -0,0 +1,203 @@
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/cc-by-sa.svg b/chrome/skin/default/zotero/licenses/cc-by-sa.svg
new file mode 100644
index 0000000000..f8502975ce
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc-by-sa.svg
@@ -0,0 +1,199 @@
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/cc-by.svg b/chrome/skin/default/zotero/licenses/cc-by.svg
new file mode 100644
index 0000000000..e44c25f0a4
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc-by.svg
@@ -0,0 +1,155 @@
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/cc-srr.png b/chrome/skin/default/zotero/licenses/cc-srr.png
new file mode 100644
index 0000000000..b94eaf7107
Binary files /dev/null and b/chrome/skin/default/zotero/licenses/cc-srr.png differ
diff --git a/chrome/skin/default/zotero/licenses/cc0.svg b/chrome/skin/default/zotero/licenses/cc0.svg
new file mode 100644
index 0000000000..195592b7b1
--- /dev/null
+++ b/chrome/skin/default/zotero/licenses/cc0.svg
@@ -0,0 +1,98 @@
+
+
+
+
diff --git a/chrome/skin/default/zotero/licenses/reserved.png b/chrome/skin/default/zotero/licenses/reserved.png
new file mode 100644
index 0000000000..c3efc5b79a
Binary files /dev/null and b/chrome/skin/default/zotero/licenses/reserved.png differ
diff --git a/chrome/skin/default/zotero/publicationsDialog.css b/chrome/skin/default/zotero/publicationsDialog.css
new file mode 100644
index 0000000000..baf93d939a
--- /dev/null
+++ b/chrome/skin/default/zotero/publicationsDialog.css
@@ -0,0 +1,16 @@
+groupbox {
+ padding: 0;
+}
+
+groupbox > .groupbox-body {
+ -moz-appearance: none;
+}
+
+checkbox, description, groupbox > .groupbox-body, radio, div:not(.license-more-info), label {
+ font-size: small;
+}
+
+a {
+ color: -moz-nativehyperlinktext;
+ text-decoration: underline;
+}
diff --git a/chrome/skin/default/zotero/zotero.css b/chrome/skin/default/zotero/zotero.css
index 9d496e9cb3..32854a3369 100644
--- a/chrome/skin/default/zotero/zotero.css
+++ b/chrome/skin/default/zotero/zotero.css
@@ -177,6 +177,7 @@ label.zotero-text-link {
text-decoration: underline;
border: 1px solid transparent;
cursor: pointer;
+ color: -moz-nativehyperlinktext;
}
.zotero-clicky