Closes #548, Add export format support to Quick Copy

This commit is contained in:
Dan Stillman 2007-03-21 18:54:23 +00:00
parent 30281f7976
commit cf95e4db2a
6 changed files with 51 additions and 15 deletions

View File

@ -53,7 +53,7 @@ var Zotero_File_Interface_Export = new function() {
var selectedTranslator = Zotero.Prefs.get("export.lastTranslator");
// add styles to list
for(i in translators) {
for(var i in translators) {
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("label", translators[i].label);
listbox.appendChild(itemNode);

View File

@ -167,10 +167,10 @@ var Zotero_File_Interface = new function() {
/*
* exports items to clipboard
*/
function exportItemsToClipboard(items, format) {
function exportItemsToClipboard(items, translatorID) {
var translation = new Zotero.Translate("export");
translation.setItems(items);
translation.setTranslator(format);
translation.setTranslator(translatorID);
translation.setHandler("done", _copyToClipboard);
translation.translate();
}

View File

@ -881,11 +881,14 @@ var ZoteroPane = new function()
return;
}
// TODO: we only support bibliography output at the moment
var mode = Zotero.Prefs.get("export.quickCopy.mode");
var [mode, format] = Zotero.Prefs.get("export.quickCopy.setting").split('=');
Zotero.debug(mode);
Zotero.debug(format);
if (mode == 'bibliography') {
var style = Zotero.Prefs.get("export.quickCopy.setting");
Zotero_File_Interface.copyItemsToClipboard(items, style);
Zotero_File_Interface.copyItemsToClipboard(items, format);
}
else if (mode == 'export') {
Zotero_File_Interface.exportItemsToClipboard(items, format);
}
}

View File

@ -136,18 +136,50 @@ function populateOpenURLResolvers() {
function populateQuickCopyList() {
var formatMenu = document.getElementById("quickCopy-menu");
var listbox = formatMenu.firstChild;
var styles = Zotero.Cite.getStyles();
var format = Zotero.Prefs.get("export.quickCopy.setting");
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("label", Zotero.getString('zotero.preferences.export.quickCopy.bibStyles'));
itemNode.setAttribute("disabled", true);
listbox.appendChild(itemNode);
// add styles to list
for (i in styles) {
var styles = Zotero.Cite.getStyles();
for (var i in styles) {
var val = 'bibliography=' + i;
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("value", i);
itemNode.setAttribute("value", val);
itemNode.setAttribute("label", styles[i]);
listbox.appendChild(itemNode);
if (i == format) {
if (val == format) {
formatMenu.selectedItem = itemNode;
}
}
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("label", Zotero.getString('zotero.preferences.export.quickCopy.exportFormats'));
itemNode.setAttribute("disabled", true);
listbox.appendChild(itemNode);
// add export formats to list
var translation = new Zotero.Translate("export");
var translators = translation.getTranslators();
for (var i in translators) {
// Skip RDF formats
switch (translators[i].translatorID) {
case '6e372642-ed9d-4934-b5d1-c11ac758ebb7':
case '14763d24-8ba0-45df-8f52-b8d1108e7ac9':
continue;
}
var val = 'export=' + translators[i].translatorID;
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("value", val);
itemNode.setAttribute("label", translators[i].label);
listbox.appendChild(itemNode);
if (val == format) {
formatMenu.selectedItem = itemNode;
}
}

View File

@ -290,6 +290,8 @@ zotero.preferences.update.error = Error
zotero.preferences.openurl.resolversFound.zero = %S resolvers found
zotero.preferences.openurl.resolversFound.singular = %S resolver found
zotero.preferences.openurl.resolversFound.plural = %S resolvers found
zotero.preferences.export.quickCopy.bibStyles = Bibliographic Styles
zotero.preferences.export.quickCopy.exportFormats = Export Formats
zotero.preferences.export.quickCopy.instructions = Select one or more references and press the shortcut key (%S) to copy the references to the clipboard.
fileInterface.itemsImported = Importing items...

View File

@ -42,10 +42,9 @@ pref("extensions.zotero.fulltext.pdfMaxPages", 100);
// Export and citation settings
pref("extensions.zotero.export.lastTranslator", '14763d24-8ba0-45df-8f52-b8d1108e7ac9');
pref("extensions.zotero.export.translatorSettings", 'true,false');
pref("extensions.zotero.export.lastStyle", 'http://purl.org/net/xbiblio/csl/styles/apa.csl');
pref("extensions.zotero.export.lastStyle", 'http://purl.org/net/xbiblio/csl/styles/chicago-note.csl');
pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf');
pref("extensions.zotero.export.quickCopy.mode", 'bibliography');
pref("extensions.zotero.export.quickCopy.setting", 'http://purl.org/net/xbiblio/csl/styles/apa.csl');
pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://purl.org/net/xbiblio/csl/styles/chicago-note.csl');
pref("extensions.zotero.annotations.warnOnClose", true);