zotero/chrome/chromeFiles/content/scholar/fileInterface.js
Simon Kornblith 45b9234996 addresses #78, figure out import/export architecture
- changes scrapers table to translators table; all import/export/web translators now belong in this table
- adds Scholar.Translate to handle translation issues. eventually, Scholar.Ingester.Document will become part of this interface
- adds Scholar_File_Interface (in fileInterface.js) to handle UI for export and eventually import. (David, when you have time, please connect Scholar_File_Interface.exportFile to a button.)
- adds an export translator for MODS. all of our metadata, but not our hierarchy (projects, etc.) translates directly and unambiguously into valid MODS. eventually, we can use RDF or another format to handle hierarchy.
- adds utilities.getVersion() and utilities.inArray() for simplified scraper coding
- fixes minor interface issues with the nifty chrome scraping status window
2006-06-29 00:56:50 +00:00

26 lines
No EOL
866 B
JavaScript

Scholar_File_Interface = new function() {
this.exportFile = exportFile;
/*
* Creates Scholar.Translate instance and shows file picker for file export
*/
function exportFile() {
var translation = new Scholar.Translate("export");
var translators = translation.getTranslators();
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
fp.init(window, "Export", nsIFilePicker.modeSave);
for(var i in translators) {
fp.appendFilter(translators[i].label, translators[i].target);
}
var rv = fp.show();
if (rv == nsIFilePicker.returnOK) {
translation.setLocation(fp.file);
translation.setTranslator(translators[fp.filterIndex]);
translation.setHandler("done", Scholar_Ingester_Interface.exportDone);
translation.translate();
}
}
}