closes #53, export to footnote or bibliography

closes #180, make all contextual menu export/create bibliography options work right

also:
- add Chicago Note style output
- unregister RDF data sources from cache after import
This commit is contained in:
Simon Kornblith 2006-08-14 20:34:13 +00:00
parent 46fa6484a5
commit feff0aa531
4 changed files with 386 additions and 101 deletions

View file

@ -2,13 +2,16 @@ Scholar_File_Interface = new function() {
var _unresponsiveScriptPreference, _importCollection;
this.exportFile = exportFile;
this.exportProject = exportProject;
this.exportItems = exportItems;
this.importFile = importFile;
this.bibliographyFromProject = bibliographyFromProject;
this.bibliographyFromItems = bibliographyFromItems;
/*
* Creates Scholar.Translate instance and shows file picker for file export
*/
function exportFile() {
function exportFile(items) {
var translation = new Scholar.Translate("export");
var translators = translation.getTranslators();
@ -21,6 +24,9 @@ Scholar_File_Interface = new function() {
}
var rv = fp.show();
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
if(items) {
translation.setItems(items);
}
translation.setLocation(fp.file);
translation.setTranslator(translators[fp.filterIndex]);
translation.setHandler("options", _exportOptions);
@ -34,6 +40,26 @@ Scholar_File_Interface = new function() {
}
}
/*
* exports a collection
*/
function exportProject() {
var collection = ScholarPane.getSelectedCollection();
if(!collection) throw("no collection currently selected");
exportFile(Scholar.getItems(collection.getID()));
}
/*
* exports items
*/
function exportItems() {
var items = ScholarPane.getSelectedItems();
if(!items || !items.length) throw("no items currently selected");
exportFile(items);
}
/*
* closes items exported indicator
*/
@ -145,15 +171,25 @@ Scholar_File_Interface = new function() {
}
/*
* Creates a bibliography
* Creates a bibliography from a project
*/
function bibliographyFromProject() {
var collection = ScholarPane.getSelectedCollection();
if(!collection) throw("error in bibliographyFromProject: no collection currently selected");
if(!collection) throw("no collection currently selected");
_doBibliographyOptions(Scholar.getItems(collection.getID()));
}
/*
* Creates a bibliography from a items
*/
function bibliographyFromItems() {
var items = ScholarPane.getSelectedItems();
if(!items || !items.length) throw("no items currently selected");
_doBibliographyOptions(items);
}
/*
* Shows bibliography options and creates a bibliography
*/