zotero/chrome/content/zotero/preferences/quickCopySiteEditor.xul
Dan Stillman 3815197b92 Don't allow site-specific Quick Copy setting without domain
And remove existing blank entry in schema update step

Closes #2053
2021-05-16 05:08:44 -04:00

127 lines
4.6 KiB
XML

<?xml version="1.0"?>
<!--
***** BEGIN LICENSE BLOCK *****
Copyright © 2007 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://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 *****
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/preferences.css"?>
<!DOCTYPE window [
<!ENTITY % prefWindow SYSTEM "chrome://zotero/locale/preferences.dtd">
%prefWindow;
<!ENTITY % common SYSTEM "chrome://zotero/locale/zotero.dtd">
%common;
]>
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="" buttons="cancel,accept"
id="zotero-quickCopySiteEditor"
onload="Zotero_QuickCopySiteEditor.onLoad(); Zotero_Preferences.Export.updateQuickCopyUI(); sizeToContent()"
ondialogaccept="Zotero_QuickCopySiteEditor.onAccept();">
<script src="chrome://zotero/content/include.js"/>
<script src="preferences.js"/>
<script src="preferences_export.js"/>
<vbox id="zotero-preferences-quickCopySiteEditor">
<label value="&zotero.preferences.quickCopy.siteEditor.domainPath; &zotero.preferences.quickCopy.siteEditor.domainPath.example;" control="zotero-quickCopy-domain"/>
<textbox id="zotero-quickCopy-domain" oninput="Zotero_QuickCopySiteEditor.onDomainInput(event)"/>
<separator class="thin"/>
<label value="&zotero.preferences.quickCopy.siteEditor.format;" control="zotero-quickCopy-menu"/>
<menulist id="zotero-quickCopy-menu"/>
<separator class="thin"/>
<label id="zotero-quickCopy-locale-menu-label" value="&zotero.preferences.quickCopy.siteEditor.locale;" control="zotero-quickCopy-locale-menu"/>
<hbox align="center">
<menulist id="zotero-quickCopy-locale-menu" oncommand="Zotero_Preferences.Export._lastSelectedLocale = this.value"/>
</hbox>
<separator class="thin"/>
<checkbox id="zotero-quickCopy-copyAsHTML" label="&zotero.preferences.quickCopy.copyAsHTML;"
oncommand="Zotero_Preferences.Export.buildQuickCopyFormatDropDown(
document.getElementById('zotero-quickCopy-menu'),
this.checked ? 'html' : '',
null,
io.translators
)"/>
</vbox>
<script>
<![CDATA[
var Zotero_QuickCopySiteEditor = new function () {
var menu = document.getElementById('zotero-quickCopy-menu');
this.onLoad = function () {
// Hide OK button initially if domain field is empty
document.documentElement.getButton('accept').disabled
= document.getElementById('zotero-quickCopy-domain').value.trim() === '';
};
this.onAccept = function () {
var io = window.arguments[0];
io.domain = document.getElementById('zotero-quickCopy-domain').value;
io.format = menu.value;
io.locale = '';
if (!document.getElementById('zotero-quickCopy-locale-menu').disabled) {
io.locale = document.getElementById('zotero-quickCopy-locale-menu').value;
}
io.ok = true;
}
this.onDomainInput = function (event) {
// Hide OK button if domain field is empty
document.documentElement.getButton('accept').disabled = event.target.value.trim() === '';
// Auto-select Wikipedia Citation Templates
if (event.target.value == 'wikipedia.org') {
menu.value = 'export=3f50aaac-7acc-4350-acd0-59cb77faf620';
Zotero_Preferences.Export.updateQuickCopyUI();
}
};
}
var io = window.arguments[0];
var contentType = io.asHTML ? 'html' : '';
document.getElementById('zotero-quickCopy-domain').value = io.domain ? io.domain : '';
Zotero_Preferences.Export.buildQuickCopyFormatDropDown(
document.getElementById('zotero-quickCopy-menu'),
contentType,
io.format,
io.translators
);
Zotero.Styles.populateLocaleList(
document.getElementById('zotero-quickCopy-locale-menu')
);
document.getElementById('zotero-quickCopy-copyAsHTML').checked = io.asHTML;
Zotero_Preferences.Export._lastSelectedLocale = io.locale;
]]>
</script>
</dialog>