fx-compat: Convert Publications dialog to CE

This commit is contained in:
Tom Najdek 2022-10-03 14:17:03 +02:00
parent c65e8f1621
commit fc572ba2a6
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77
9 changed files with 599 additions and 510 deletions

View file

@ -0,0 +1,153 @@
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2022 Corporation for Digital Scholarship
Vienna, 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 <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
/* global XULElementBase: false */
{
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://zotero/content/elements/base.js", this);
const links = {
cc: 'https://wiki.creativecommons.org/Considerations_for_licensors_and_licensees',
cc0: 'https://wiki.creativecommons.org/CC0_FAQ'
};
const getLicenseData = (license) => {
var name, img, url, id;
switch (license) {
case 'reserved':
url = null;
name = 'All rights reserved';
img = 'chrome://zotero/skin/licenses/reserved.png';
id = null;
break;
case 'cc':
url = 'https://creativecommons.org/';
name = 'Creative Commons';
img = 'chrome://zotero/skin/licenses/cc-srr.png';
id = null;
break;
case 'cc0':
url = "https://creativecommons.org/publicdomain/zero/1.0/";
name = null;
img = 'chrome://zotero/skin/licenses/' + license + ".svg";
id = 'licenses-cc-0';
break;
default:
url = 'https://creativecommons.org/licenses/' + license.replace(/^cc-/, '') + '/4.0/';
name = null;
img = 'chrome://zotero/skin/licenses/' + license + ".svg";
id = `licenses-${license}`;
break;
}
return { url, name, img, id };
};
const makeLicenseInfo = (url, name, img, id) => {
const licenseInfo = `<div class="license-icon"><img title="${url}" src="${img}" /></div>`
+ (id ? `<div class="license-name" data-l10n-id="${id}" />` : `<div class="license-name">${name}</div>`);
return MozXULElement.parseXULToFragment(
url
? `<a xmlns="http://www.w3.org/1999/xhtml" class="license-info" href="${url}">${licenseInfo}</a>`
: `<div xmlns="http://www.w3.org/1999/xhtml" class="license-info">${licenseInfo}</div>`
);
};
const makeLicenseMoreInfo = (license) => {
const needsMoreInfo = license.startsWith('cc') && license !== 'cc';
const ccType = license === 'cc0' ? 'cc0' : 'cc';
return MozXULElement.parseXULToFragment(needsMoreInfo
? `<div xmlns="http://www.w3.org/1999/xhtml" class="license-more-info" data-l10n-id="licenses-${ccType}-more-info">
<a href="${links[ccType]}" data-l10n-name="license-considerations" />
</div>`
: ''
);
};
class PublicationsLicenseInfo extends XULElementBase {
get stylesheets() {
return [
'chrome://global/skin/global.css',
'chrome://zotero/skin/elements/license-info.css'
];
}
content = MozXULElement.parseXULToFragment(`
<div id="license-info"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
</div>
`);
validLicenses = new Set(['cc', 'cc-by', 'cc-by-sa', 'cc-by-nd', 'cc-by-nc', 'cc-by-nc-sa', 'cc-by-nc-nd', 'cc0', 'reserved']);
get license() {
return this._license;
}
set license(val) {
if (!this.validLicenses.has(val)) {
throw new Zotero.Error(`"${val}" is invalid value for attribute "license" in <licenseinfo>`);
}
this._license = val;
this.update();
}
get licenseName() {
return this.shadowRoot.querySelector('.license-name').getAttribute('label')
? this.shadowRoot.querySelector('.license-name').getAttribute('label')
: this.shadowRoot.querySelector('.license-name').textContent;
}
async init() {
this.license = this.getAttribute('license');
this.shadowRoot.getElementById('license-info').addEventListener('click', this.onURLInteract.bind(this));
this.shadowRoot.getElementById('license-info').addEventListener('keydown', this.onURLInteract.bind(this));
}
update() {
const { url, name, img, id } = getLicenseData(this.license);
const licenseInfoEl = makeLicenseInfo(url, name, img, id);
const licenseMoreEl = makeLicenseMoreInfo(this.license);
this.shadowRoot.getElementById('license-info').replaceChildren(licenseInfoEl, licenseMoreEl);
}
onURLInteract(ev) {
const aEl = ev.target.closest('[href]');
if (aEl && (ev.type === 'click' || (ev.type === 'keydown' && ev.key === ' '))) {
ev.preventDefault();
Zotero.launchURL(aEl.getAttribute('href'));
}
}
}
customElements.define('publications-license-info', PublicationsLicenseInfo);
}

View file

@ -23,212 +23,7 @@
***** 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 _keepRights = true;
var _shareSettings = {
sharing: 'reserved', // 'reserved', 'cc', 'cc0'
adaptations: 'no',
commercial: 'no'
};
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') _keepRights = false;
delete _io.hasFiles;
delete _io.hasNotes;
delete _io.hasRights;
}
_initialized = true;
}
catch (e) {
window.close();
throw e;
}
}
this.updatePage = function () {
if (!_initialized) {
_init();
this.updateInclude();
}
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 keepRightsBox = document.getElementById('keep-rights');
let keepRightsCheckbox = document.getElementById('keep-rights-checkbox');
if (_hasRights == 'none') {
keepRightsBox.hidden = true;
document.getElementById('sharing-radiogroup').focus();
}
else {
let str = 'publications.sharing.keepRightsField';
if (_hasRights == 'some') {
str += 'WhereAvailable';
}
keepRightsCheckbox.label = Zotero.getString(str);
keepRightsCheckbox.checked = _keepRights;
this.updateKeepRights(keepRightsCheckbox.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 nextButton = wizard.getButton('next');
// Require authorship checkbox on first page to be checked to advance
wizard.canAdvance = document.getElementById('confirm-authorship-checkbox').checked;
if (!nextPage) {
return;
}
if (_hasFiles
&& _includeFiles
&& (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' && _keepRights)))) {
this.lastPage = false;
nextButton.label = Zotero.getString(
'publications.buttons.next',
Zotero.getString('publications.buttons.' + nextPage.pageid)
);
}
// Otherwise this is the last page
else {
this.lastPage = true;
// Due to issues with linux not handling finish button hiding correctly
// we just set the next button label to be the one for the finish button
// and leave visibility handling up to mr wizard
nextButton.label = Zotero.getString('publications.buttons.addToMyPublications');
}
}
/**
* Update files/notes settings from checkboxes
*/
this.updateInclude = function () {
var filesCheckbox = document.getElementById('include-files');
var notesCheckbox = document.getElementById('include-notes')
var authorshipCheckbox = document.getElementById('confirm-authorship-checkbox');
_includeFiles = filesCheckbox.checked;
_includeNotes = notesCheckbox.checked;
authorshipCheckbox.label = Zotero.getString(
'publications.intro.authorship' + (_includeFiles ? '.files' : '')
);
this.updateNextButton();
}
/**
* Update rights setting from checkbox and hide sharing setting if necessary
*/
this.updateKeepRights = function (keepRights) {
_keepRights = keepRights;
// 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' && keepRights;
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.keepRights = _keepRights;
_io.license = _license;
_io.licenseName = _getLicenseName(_license);
}
this.finish = function () {
this.onFinish();
window.close();
}
/**
/**
* Update the calculated license and image
*
* Possible licenses:
@ -242,185 +37,180 @@ var Zotero_Publications_Dialog = new function () {
* 'cc0'
* 'reserved'
*/
function _updateLicense() {
var s = _shareSettings.sharing;
var a = _shareSettings.adaptations;
var c = _shareSettings.commercial;
if (s == 'cc0' || s == 'reserved') {
_license = s;
const getLicense = (sharing, adaptations, commercial, currentPage) => {
if (sharing === 'cc0' || sharing === 'reserved') {
return sharing;
}
else {
_license = 'cc-by';
if (c == 'no') {
_license += '-nc';
}
if (a == 'no') {
_license += '-nd';
}
else if (a == 'sharealike') {
_license += '-sa';
}
}
_updateLicenseSummary();
if (currentPage !== 'choose-license') {
return 'cc';
}
/**
*
*/
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];
let license = 'cc-by';
if (commercial === 'no') {
license += '-nc';
}
else {
let hbox = document.createXULElement('hbox');
hbox.align = "center";
groupbox.appendChild(hbox);
var icon = document.createXULElement('image');
icon.className = 'license-icon';
icon.setAttribute('style', 'width: 88px');
hbox.appendChild(icon);
let sep = document.createXULElement('separator');
sep.orient = 'vertical';
sep.setAttribute('style', 'width: 10px');
hbox.appendChild(sep);
var div = document.createElement('div');
div.className = 'license-description';
div.setAttribute('style', 'width: 400px');
hbox.appendChild(div);
if (adaptations === 'no') {
license += '-nd';
}
// Show generic CC icon on sharing page
if (currentPage.pageid == 'choose-sharing' && _shareSettings.sharing == 'cc') {
var license = 'cc';
else if (adaptations === 'sharealike') {
license += '-sa';
}
else {
var license = _license;
return license;
};
const id = document.getElementById.bind(document);
const Zotero_Publications_Dialog = { // eslint-disable-line no-unused-vars, camelcase
async init() {
this.io = window.arguments?.[0] ?? {};
this.wizard = id('publications-dialog-wizard');
id('include-files')
.addEventListener('CheckboxStateChange', this.onIntroPageCheckboxChange.bind(this));
id('confirm-authorship-checkbox')
.addEventListener('CheckboxStateChange', this.onIntroPageCheckboxChange.bind(this));
id('sharing-radiogroup')
.addEventListener('select', this.onLicenseAspectRadioChange.bind(this));
id('choose-adaptations')
.addEventListener('select', this.onLicenseAspectRadioChange.bind(this));
id('choose-commercial')
.addEventListener('select', this.onLicenseAspectRadioChange.bind(this));
id('keep-rights-checkbox')
.addEventListener('CheckboxStateChange', this.onKeepRightsCheckboxChange.bind(this));
this.wizard.getPageById('intro')
.addEventListener('pageshow', this.onIntroPageShow.bind(this));
this.wizard.getPageById('choose-sharing')
.addEventListener('pageshow', this.onSharingPageShow.bind(this));
this.wizard.getPageById('choose-license')
.addEventListener('pageshow', this.onLicensePageShow.bind(this));
this.wizard.addEventListener('wizardnext', this.onWizardNext.bind(this));
this.wizard.addEventListener('wizardfinish', this.onFinish.bind(this));
// wizard.shadowRoot content isn't exposed to our css
this.wizard.shadowRoot
.querySelector('.wizard-header-label').style.fontSize = '16px';
this.updateNextButton();
this.updateIntroPage();
},
onIntroPageShow() {
this.updateNextButton();
this.updateIntroPage();
this.updateFocus();
},
onSharingPageShow() {
this.updateSharingPage();
this.updateNextButton();
this.updateLicense();
this.updateFocus();
},
onLicensePageShow() {
this.updateNextButton();
this.updateLicense();
this.updateFocus();
},
onWizardNext(ev) {
if ((this.wizard.currentPage.pageid === 'intro' && !id('include-files').checked)
|| (this.wizard.currentPage.pageid === 'choose-sharing'
&& (id('sharing-radiogroup').selectedItem.value !== 'cc'
|| (this.io.hasRights === 'all' && id('keep-rights-checkbox').checked)
))
) {
ev.preventDefault();
this.onFinish();
window.close();
}
},
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 '<a href="' + _getLicenseURL(license) + '">Creative Commons</a>';
case 'reserved':
return "All rights reserved";
case 'cc0':
return '<a href="' + _getLicenseURL(license) + '">CC0 1.0 Universal Public Domain Dedication</a>';
default:
return '<a href="' + _getLicenseURL(license) + '">'
+ Zotero.getString('licenses.' + license) + "</a>";
}
}
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
'<a href="' + links[s] + '">'
+ Zotero.getString('publications.' + s + '.moreInfo.linkText')
+ '</a>'
onFinish() {
this.io.includeFiles = id('include-files').checked;
this.io.includeNotes = id('include-notes').checked;
this.io.keepRights = id('keep-rights-checkbox').checked;
if (this.wizard.currentPage.pageid !== 'intro') {
this.io.license = getLicense(
id('sharing-radiogroup').selectedItem.value,
id('choose-adaptations').selectedItem.value,
id('choose-commercial').selectedItem.value,
this.wizard.currentPage.pageid
);
Zotero.Utilities.Internal.updateHTMLInXUL(div, { linkEvent: { shiftKey: true } });
this.io.licenseName = id('final-license-info').licenseName;
}
else {
div.innerHTML = "";
},
onIntroPageCheckboxChange() {
this.updateIntroPage();
this.updateNextButton();
},
onKeepRightsCheckboxChange() {
this.updateSharingPage();
this.updateNextButton();
},
onLicenseAspectRadioChange() {
this.updateNextButton();
this.updateLicense();
},
updateIntroPage() {
id('include-files').disabled = !this.io.hasFiles;
id('include-notes').disabled = !this.io.hasNotes;
id('confirm-authorship-checkbox').dataset.l10nId = id('include-files').checked
? 'publications-intro-authorship-files'
: 'publications-intro-authorship';
},
updateSharingPage() {
id('keep-rights').style.display
= this.io.hasRights === 'none' ? 'none' : '';
id('keep-rights-checkbox').disabled = this.io.hasRights === 'none';
id('keep-rights-checkbox').dataset.l10nId
= this.io.hasRights === 'some'
? 'publications-sharing-keep-rights-field-where-available'
: 'publications-sharing-keep-rights-field';
id('choose-sharing-options').style.display
= this.io.hasRights === 'all' && id('keep-rights-checkbox').checked ? 'none' : '';
},
updateLicense() {
const license = getLicense(
id('sharing-radiogroup').selectedItem.value,
id('choose-adaptations').selectedItem.value,
id('choose-commercial').selectedItem.value,
this.wizard.currentPage.pageid
);
id('sharing-license-info').license = license;
id('final-license-info').license = license;
},
updateFocus() {
this.wizard.currentPage.querySelector('radiogroup:not([disabled]),checkbox:not([disabled])').focus();
},
updateNextButton() {
const nextButton = this.wizard.getButton('next');
this.wizard.canAdvance = id('confirm-authorship-checkbox').checked;
if (this.io.hasRights === 'all' && id('keep-rights-checkbox').checked) {
nextButton.dataset.l10nId = 'publications-buttons-add-to-my-publications';
}
else if (this.wizard.currentPage.pageid === 'intro') {
nextButton.dataset.l10nId = id('include-files').checked
? 'publications-buttons-next-sharing'
: 'publications-buttons-add-to-my-publications';
}
}
else if (this.wizard.currentPage.pageid === 'choose-sharing') {
nextButton.dataset.l10nId
= id('sharing-radiogroup').selectedItem.value === 'cc'
? 'publications-buttons-next-choose-license'
: 'publications-buttons-add-to-my-publications';
}
},
};

View file

@ -0,0 +1,93 @@
<?xml version="1.0"?>
<!--
***** BEGIN LICENSE BLOCK *****
Copyright © 2022 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 <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
-->
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/zotero-react-client.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="Zotero_Publications_Dialog.init()"
>
<linkset>
<html:link rel="localization" href="zotero.ftl" />
</linkset>
<script src="chrome://global/content/customElements.js" />
<script src="chrome://zotero/content/elements/publicationsLicenseInfo.js" />
<wizard
id="publications-dialog-wizard"
class="publications-dialog-wizard"
width="600" height="550"
>
<wizardpage pageid="intro" data-l10n-id="publications-intro-page">
<p class="description" data-l10n-id="publications-intro" />
<checkbox native="true" id="include-files" data-l10n-id="publications-include-checkbox-files" />
<checkbox native="true" id="include-notes" data-l10n-id="publications-include-checkbox-notes" />
<p class="description" data-l10n-id="publications-include-adjust-at-any-time" />
<div class="confirm-authorship-checkbox">
<checkbox native="true" id="confirm-authorship-checkbox" data-l10n-id="publications-intro-authorship" />
</div>
</wizardpage>
<wizardpage pageid="choose-sharing" data-l10n-id="publications-sharing-page">
<div id="keep-rights">
<checkbox native="true" id="keep-rights-checkbox" data-l10n-id="publications-sharing-keep-rights-field" />
</div>
<div id="choose-sharing-options">
<p class="description" data-l10n-id="publications-sharing-text" />
<p class="description" data-l10n-id="publications-sharing-prompt" />
<radiogroup id="sharing-radiogroup" align="start">
<radio value="reserved" data-l10n-id="publications-sharing-reserved" />
<radio value="cc" data-l10n-id="publications-sharing-cc" />
<radio value="cc0" data-l10n-id="publications-sharing-cc0" />
</radiogroup>
<publications-license-info license="reserved" id="sharing-license-info" />
</div>
</wizardpage>
<wizardpage pageid="choose-license" data-l10n-id="publications-license-page">
<p class="description" data-l10n-id="publications-choose-license-text" />
<h2 data-l10n-id="publications-choose-license-adaptations-prompt" />
<radiogroup id="choose-adaptations" align="start">
<radio value="no" data-l10n-id="publications-choose-license-no" />
<radio value="sharealike" data-l10n-id="publications-choose-license-sharealike" />
<radio value="yes" data-l10n-id="publications-choose-license-yes" />
</radiogroup>
<h2 data-l10n-id="publications-choose-license-commercial-prompt" />
<radiogroup id="choose-commercial" align="start">
<radio value="no" data-l10n-id="publications-choose-license-no" />
<radio value="yes" data-l10n-id="publications-choose-license-yes" />
</radiogroup>
<publications-license-info license="cc-by-nc-nd" id="final-license-info" />
</wizardpage>
</wizard>
<script src="include.js" />
<script src="publicationsDialog.js" />
</window>

View file

@ -1,109 +0,0 @@
<?xml version="1.0"?>
<!--
***** 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 <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
-->
<!DOCTYPE window [
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %zoteroDTD;
<!ENTITY % publicationsDTD SYSTEM "chrome://zotero/locale/publications.dtd"> %publicationsDTD;
]>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/publicationsDialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/publicationsDialog.css"?>
<wizard id="zotero-publications-wizard" title="&zotero.publications.my_publications;"
width="600"
height="550"
onwizardnext="return Zotero_Publications_Dialog.onAdvance()"
onwizardfinish="return Zotero_Publications_Dialog.onFinish()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="include.js"/>
<script src="publicationsDialog.js"/>
<!-- NOTES AND ATTACHMENTS? -->
<wizardpage pageid="intro" label="&zotero.publications.my_publications;"
onpageshow="Zotero_Publications_Dialog.updatePage()">
<description>&zotero.publications.intro;</description>
<separator/>
<checkbox id="include-files" label="&zotero.publications.include.checkbox.files;"
oncommand="Zotero_Publications_Dialog.updateInclude()"/>
<checkbox id="include-notes" label="&zotero.publications.include.checkbox.notes;"
oncommand="Zotero_Publications_Dialog.updateInclude()"/>
<separator/>
<description>&zotero.publications.include.adjustAtAnyTime;</description>
<separator/>
<checkbox id="confirm-authorship-checkbox"
oncommand="Zotero_Publications_Dialog.updateNextButton()"/>
</wizardpage>
<wizardpage pageid="choose-sharing" label="&zotero.publications.sharing.title;"
onpageshow="Zotero_Publications_Dialog.updatePage()">
<vbox id="keep-rights">
<checkbox id="keep-rights-checkbox"
oncommand="Zotero_Publications_Dialog.updateKeepRights(this.checked)"/>
<separator/>
</vbox>
<vbox id="choose-sharing-options">
<description>&zotero.publications.sharing.text;</description>
<separator/>
<description>&zotero.publications.sharing.prompt;</description>
<separator class="thin"/>
<radiogroup id="sharing-radiogroup"
oncommand="Zotero_Publications_Dialog.updateSharing(this.selectedItem.id)">
<radio id="sharing-reserved" label="&zotero.publications.sharing.reserved;"/>
<radio id="sharing-cc" label="&zotero.publications.sharing.cc;"/>
<radio id="sharing-cc0" label="&zotero.publications.sharing.cc0;"/>
</radiogroup>
<groupbox class="license-info"/>
<separator/>
<div xmlns="http://www.w3.org/1999/xhtml" class="license-more-info"/>
</vbox>
</wizardpage>
<wizardpage pageid="choose-license" label="&zotero.publications.chooseLicense.title;"
onpageshow="Zotero_Publications_Dialog.updatePage()">
<description>&zotero.publications.chooseLicense.text;</description>
<separator/>
<label value="&zotero.publications.chooseLicense.adaptations.prompt;" control="choose-adaptations"/>
<radiogroup id="choose-adaptations" oncommand="Zotero_Publications_Dialog.updateSharing(this.selectedItem.id)">
<radio id="adaptations-no" label="&zotero.general.no;" accesskey="N"/>
<radio id="adaptations-sharealike" label="&zotero.publications.chooseLicense.adaptations.sharealike;" accesskey="S"/>
<radio id="adaptations-yes" label="&zotero.general.yes;" accesskey="Y"/>
</radiogroup>
<separator/>
<label value="&zotero.publications.chooseLicense.commercial.prompt;" control="choose-commercial"/>
<radiogroup id="choose-commercial" oncommand="Zotero_Publications_Dialog.updateSharing(this.selectedItem.id)">
<radio id="commercial-no" label="&zotero.general.no;" accesskey="N"/>
<radio id="commercial-yes" label="&zotero.general.yes;" accesskey="Y"/>
</radiogroup>
<groupbox class="license-info"/>
<separator/>
<div xmlns="http://www.w3.org/1999/xhtml" class="license-more-info"/>
</wizardpage>
</wizard>

View file

@ -4752,7 +4752,7 @@ var ZoteroPane = new function()
}
}
io.hasRights = allItemsHaveRights ? 'all' : (noItemsHaveRights ? 'none' : 'some');
window.openDialog('chrome://zotero/content/publicationsDialog.xul','','chrome,modal', io);
window.openDialog('chrome://zotero/content/publicationsDialog.xhtml','','chrome,modal', io);
return io.license ? io : false;
};

View file

@ -111,3 +111,68 @@ integration-prefs-footnotes =
.label = Footnotes
integration-prefs-endnotes =
.label = Endnotes
publications-intro-page =
.label = My Publications
publications-intro = Items you add to My Publications will be shown on your profile page on zotero.org. If you choose to include attached files, they will be made publicly available under the license you specify. Only add work you yourself have created, and only include files if you have the rights to distribute them and wish to do so.
publications-include-checkbox-files =
.label = Include files
publications-include-checkbox-notes =
.label = Include notes
publications-include-adjust-at-any-time = You can adjust what to show at any time from the My Publications collection.
publications-intro-authorship =
.label = I created this work.
publications-intro-authorship-files =
.label = I created this work and have the rights to distribute included files.
publications-sharing-page =
.label = Choose how your work may be shared
publications-sharing-keep-rights-field =
.label = Keep the existing Rights field
publications-sharing-keep-rights-field-where-available =
.label = Keep the existing Rights field where available
publications-sharing-text = You can reserve all rights to your work, license it under a Creative Commons license, or dedicate it to the public domain. In all cases, the work will be made publicly available via zotero.org.
publications-sharing-prompt = Would you like to allow your work to be shared by others?
publications-sharing-reserved =
.label = No, only publish my work on zotero.org
publications-sharing-cc =
.label = Yes, under a Creative Commons license
publications-sharing-cc0 =
.label = Yes, and place my work in the public domain
publications-license-page =
.label = Choose a Creative Commons license
publications-choose-license-text = A Creative Commons license allows others to copy and redistribute your work as long as they give appropriate credit, provide a link to the license, and indicate if changes were made. Additional conditions can be specified below.
publications-choose-license-adaptations-prompt = Allow adaptations of your work to be shared?
publications-choose-license-yes =
.label = Yes
.accesskey = Y
publications-choose-license-no =
.label = No
.accesskey = N
publications-choose-license-sharealike =
.label = Yes, as long as others share alike
.accesskey = S
publications-choose-license-commercial-prompt = Allow commercial uses of your work?
publications-buttons-add-to-my-publications =
.label = Add to My Publications
publications-buttons-next-sharing =
.label = Next: Sharing
publications-buttons-next-choose-license =
.label = Choose a License
licenses-cc-0 = CC0 1.0 Universal Public Domain Dedication
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
licenses-cc-more-info = Be sure you have read the Creative Commons <a data-l10n-name="license-considerations">Considerations for licensors</a> 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.
licenses-cc0-more-info = Be sure you have read the Creative Commons <a data-l10n-name="license-considerations">CC0 FAQ</a> 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.

View file

@ -37,6 +37,7 @@
@import "components/mainWindow";
@import "components/notesList";
@import "components/progressMeter";
@import "components/publications-dialog.scss";
@import "components/rtfScan.scss";
@import "components/search";
@import "components/syncButtonTooltip";

View file

@ -0,0 +1,46 @@
.publications-dialog-wizard {
font-size: 12px;
div {
display: block;
}
h2 {
margin: 1em 0 0;
padding: 0;
font-size: 13px;
font-weight: normal;
}
h2 + radiogroup {
margin-top: 0;
}
p.description {
display: block;
margin: 1em 0;
}
checkbox {
margin-left: 4px; // indent required for correct focus ring rendering
}
radiogroup {
font-size: 12px;
margin-top: 1em;
radio:first-child {
margin-top: 9px;
}
}
wizardpage {
display: flex;
flex-direction: column;
}
#include-files,
#include-notes {
margin-top: 5px;
}
}

View file

@ -0,0 +1,50 @@
@import "../abstracts/variables";
@import "../abstracts/functions";
@import "../abstracts/mixins";
@import "../abstracts/placeholders";
@import "../abstracts/utilities";
@import "../themes/light";
:host {
display: block;
width: 100%;
}
.license-info {
display: flex;
padding: var(--license-info-padding, 0 20px);
margin: var(--license-info-margin, 1em 0 0 0);
.license-icon {
flex: 0 1 auto;
> img {
max-width: var(--license-icon-max-width, 88px);
}
}
.license-name {
margin-left: var(--license-info-name-margin-left, 12px);
flex: 1 1 auto;
display: flex;
align-items: center;
}
}
.license-more-info {
margin: var(--license-more-info-margin, 1.5em 0 0 0);
font-size: var(--license-more-info-font-size, 11px);
}
a {
display: inline;
color: var(--license-info-link-color, -moz-nativehyperlinktext);
text-decoration: var(--license-info-link-decoration, none);
&:hover,
&:active,
&:focus {
outline: none;
text-decoration: var(--license-info-link-decoration-hover, $link-hover-decoration);
}
}