diff --git a/chrome/chromeFiles/content/scholar/bibliography.js b/chrome/chromeFiles/content/scholar/bibliography.js
index b41388303c..8418d1b649 100644
--- a/chrome/chromeFiles/content/scholar/bibliography.js
+++ b/chrome/chromeFiles/content/scholar/bibliography.js
@@ -40,7 +40,7 @@ var Scholar_File_Interface_Bibliography = new function() {
styleMenu.selectedIndex = 0;
}
- if(document.getElementById("copy-to-clipboard") && navigator.appVersion.indexOf('Mac') != -1) {
+ if(Scholar.isMac && document.getElementById("copy-to-clipboard")) {
document.getElementById("copy-to-clipboard").hidden = "true";
}
}
diff --git a/chrome/chromeFiles/content/scholar/fileInterface.js b/chrome/chromeFiles/content/scholar/fileInterface.js
index 63c7d13c2f..a02c40543c 100644
--- a/chrome/chromeFiles/content/scholar/fileInterface.js
+++ b/chrome/chromeFiles/content/scholar/fileInterface.js
@@ -11,17 +11,32 @@ var Scholar_File_Interface = new function() {
/*
* Creates Scholar.Translate instance and shows file picker for file export
*/
- function exportFile(items) {
+ function exportFile(name, items) {
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);
+
+ fp.init(window, Scholar.getString("fileInterface.export"), nsIFilePicker.modeSave);
+
+ // set file name and extension.
+ name = (name ? name : Scholar.getString("pane.collections.library"));
+ fp.defaultString = name+"."+translators[0].target;
+
+ // add save filters
for(var i in translators) {
- fp.appendFilter(translators[i].label, translators[i].target);
+ var label = translators[i].label;
+
+ // put extensions in parentheses if Mac (Windows users already
+ // get extension)
+ label += " (."+translators[i].target+")";
+
+ fp.appendFilter(label, "*."+translators[i].target);
}
+
+
var rv = fp.show();
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
if(items) {
@@ -47,7 +62,7 @@ var Scholar_File_Interface = new function() {
var collection = ScholarPane.getSelectedCollection();
if (collection)
{
- exportFile(Scholar.getItems(collection.getID()));
+ exportFile(collection.getName(), Scholar.getItems(collection.getID()));
return;
}
@@ -56,7 +71,7 @@ var Scholar_File_Interface = new function() {
{
var search = new Scholar.Search();
search.load(searchRef['id']);
- exportFile(Scholar.Items.get(search.search()));
+ exportFile(search.getName(), Scholar.Items.get(search.search()));
return;
}
@@ -71,7 +86,7 @@ var Scholar_File_Interface = new function() {
var items = ScholarPane.getSelectedItems();
if(!items || !items.length) throw("no items currently selected");
- exportFile(items);
+ exportFile(Scholar.getString("fileInterface.exportedItems"), items);
}
/*
@@ -93,7 +108,7 @@ var Scholar_File_Interface = new function() {
/*
* closes items exported indicator
*/
- function _exportDone(obj) {
+ function _exportDone(obj, worked) {
Scholar_File_Interface.Progress.close();
_restoreUnresponsive();
}
@@ -108,7 +123,9 @@ var Scholar_File_Interface = new function() {
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
- fp.init(window, "Import", nsIFilePicker.modeOpen);
+ fp.init(window, Scholar.getString("fileInterface.import"), nsIFilePicker.modeOpen);
+
+ fp.appendFilters(nsIFilePicker.filterAll);
for(var i in translators) {
fp.appendFilter(translators[i].label, "*."+translators[i].target);
}
@@ -121,7 +138,7 @@ var Scholar_File_Interface = new function() {
if(translators.length) {
// create a new collection to take in imported items
var date = new Date();
- _importCollection = Scholar.Collections.add("Imported "+date.toLocaleString());
+ _importCollection = Scholar.Collections.add(Scholar.getString("fileInterface.imported")+" "+date.toLocaleString());
// import items
translation.setTranslator(translators[0]);
@@ -138,6 +155,8 @@ var Scholar_File_Interface = new function() {
function() {
translation.translate();
});
+ } else {
+ window.alert(Scholar.getString("fileInterface.fileFormatUnsupported"));
}
}
}
@@ -172,6 +191,10 @@ var Scholar_File_Interface = new function() {
Scholar_File_Interface.Progress.close();
_restoreUnresponsive();
+
+ if(!worked) {
+ window.alert(Scholar.getString("fileInterface.importError"));
+ }
}
/*
@@ -201,7 +224,7 @@ var Scholar_File_Interface = new function() {
var collection = ScholarPane.getSelectedCollection();
if (collection)
{
- _doBibliographyOptions(Scholar.getItems(collection.getID()));
+ _doBibliographyOptions(collection.getName(), Scholar.getItems(collection.getID()));
return;
}
@@ -210,7 +233,7 @@ var Scholar_File_Interface = new function() {
{
var search = new Scholar.Search();
search.load(searchRef['id']);
- _doBibliographyOptions(Scholar.Items.get(search.search()));
+ _doBibliographyOptions(search.getName(), Scholar.Items.get(search.search()));
return;
}
@@ -224,13 +247,13 @@ var Scholar_File_Interface = new function() {
var items = ScholarPane.getSelectedItems();
if(!items || !items.length) throw("no items currently selected");
- _doBibliographyOptions(items);
+ _doBibliographyOptions(Scholar.getString("fileInterface.untitledBibliography"), items);
}
/*
* Shows bibliography options and creates a bibliography
*/
- function _doBibliographyOptions(items) {
+ function _doBibliographyOptions(name, items) {
var io = new Object();
var newDialog = window.openDialog("chrome://scholar/content/bibliography.xul",
"_blank","chrome,modal,centerscreen", io);
@@ -275,7 +298,7 @@ var Scholar_File_Interface = new function() {
Scholar.Browser.deleteHiddenBrowser(browser);
bibliographyStream.close();
} else if(io.output == "save-as-html") {
- var fStream = _saveBibliography("HTML");
+ var fStream = _saveBibliography(name, "HTML");
if(fStream !== false) {
var html = "";
@@ -283,7 +306,7 @@ var Scholar_File_Interface = new function() {
html +='\n';
html +='
\n';
html +='\n';
- html +='Bibliography\n';
+ html +=''+Scholar.getString("fileInterface.bibliographyHTMLTitle")+'\n';
html +='\n';
html +='\n';
html += bibliography;
@@ -301,7 +324,7 @@ var Scholar_File_Interface = new function() {
fStream.close();
}
} else if(io.output == "save-as-rtf") {
- var fStream = _saveBibliography("RTF");
+ var fStream = _saveBibliography(name, "RTF");
if(fStream !== false) {
fStream.write(bibliography, bibliography.length);
fStream.close();
@@ -331,7 +354,7 @@ var Scholar_File_Interface = new function() {
}
}
- function _saveBibliography(format) {
+ function _saveBibliography(name, format) {
// savable bibliography, using a file stream
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
@@ -339,11 +362,15 @@ var Scholar_File_Interface = new function() {
fp.init(window, "Save Bibliography", nsIFilePicker.modeSave);
if(format == "RTF") {
+ var extension = "rtf";
fp.appendFilter("RTF", "*.rtf");
} else {
+ var extension = "html";
fp.appendFilters(nsIFilePicker.filterHTML);
}
+ fp.defaultString = name+"."+extension;
+
var rv = fp.show();
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
// open file
diff --git a/chrome/chromeFiles/content/scholar/xpcom/integration.js b/chrome/chromeFiles/content/scholar/xpcom/integration.js
index 79d3922a14..cba97500fe 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/integration.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/integration.js
@@ -1,7 +1,7 @@
Scholar.Integration = new function() {
var _contentLengthRe = /[\r\n]Content-Length: *([0-9]+)/i;
var _XMLRe = /<\?[^>]+\?>/;
- this.ns = "http://chnm.gmu.edu/firefoxscholar/soap";
+ this.ns = "http://www.zotero.org/namespaces/SOAP";
this.init = init;
this.handleHeader = handleHeader;
diff --git a/chrome/chromeFiles/content/scholar/xpcom/scholar.js b/chrome/chromeFiles/content/scholar/xpcom/scholar.js
index 4c67a314a1..f0f6b81cf1 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/scholar.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/scholar.js
@@ -74,6 +74,7 @@ var Scholar = new function(){
.getService(Components.interfaces.nsIAppShellService)
.hiddenDOMWindow;
this.platform = win.navigator.platform;
+ this.isMac = (this.platform.substr(0, 3) == "Mac");
// Load in the localization stringbundle for use by getString(name)
var src = 'chrome://scholar/locale/scholar.properties';
diff --git a/chrome/chromeFiles/content/scholar/xpcom/translate.js b/chrome/chromeFiles/content/scholar/xpcom/translate.js
index ae21743c3e..50c48f57bc 100644
--- a/chrome/chromeFiles/content/scholar/xpcom/translate.js
+++ b/chrome/chromeFiles/content/scholar/xpcom/translate.js
@@ -125,7 +125,9 @@ Scholar.Translate.init = function() {
if(cachePref) {
// fetch translator list
- var translators = Scholar.DB.query("SELECT translatorID, type, label, target, detectCode IS NULL as noDetectCode FROM translators ORDER BY target IS NULL");
+ var translators = Scholar.DB.query("SELECT translatorID, type, label, "+
+ "target, detectCode IS NULL as noDetectCode FROM translators "+
+ "ORDER BY target IS NULL, translatorID = '14763d24-8ba0-45df-8f52-b8d1108e7ac9' DESC");
var detectCodes = Scholar.DB.query("SELECT translatorID, detectCode FROM translators WHERE target IS NULL");
Scholar.Translate.cache = new Object();
@@ -370,7 +372,9 @@ Scholar.Translate.prototype.getTranslators = function() {
if(Scholar.Translate.cache) {
var translators = Scholar.Translate.cache[this.type];
} else {
- var sql = "SELECT translatorID, label, target, detectCode IS NULL as noDetectCode FROM translators WHERE type IN ("+this._numericTypes+") ORDER BY target IS NULL";
+ var sql = "SELECT translatorID, label, target, detectCode IS NULL as "+
+ "noDetectCode FROM translators WHERE type IN ("+this._numericTypes+") "+
+ "ORDER BY target IS NULL, translatorID = '14763d24-8ba0-45df-8f52-b8d1108e7ac9' DESC";
var translators = Scholar.DB.query(sql);
}
diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties
index 2a4ce90b6b..9835731c38 100644
--- a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties
+++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties
@@ -97,6 +97,14 @@ db.dbRestoreFailed = The Zotero database appears to have become corrupted, an
fileInterface.itemsImported = Importing items...
fileInterface.itemsExported = Exporting items...
+fileInterface.import = Import
+fileInterface.export = Export
+fileInterface.exportedItems = Exported Items
+fileInterface.imported = Imported
+fileInterface.fileFormatUnsupported = No translator could be found for the given file.
+fileInterface.importError = An error occurred while trying to import the selected file. Please ensure that the file is valid and try again.
+fileInterface.untitledBibliography = Untitled Bibliography
+fileInterface.bibliographyHTMLTitle = Bibliography
searchOperator.is = is
searchOperator.isNot = is not
diff --git a/scrapers.sql b/scrapers.sql
index b2b671e5ec..56b09d728b 100644
--- a/scrapers.sql
+++ b/scrapers.sql
@@ -1,4 +1,4 @@
--- 64
+-- 65
-- Set the following timestamp to the most recent scraper update date
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-15 15:42:00'));
@@ -3779,7 +3779,7 @@ function doSearch(item) {
Scholar.wait();
}');
-REPLACE INTO "translators" VALUES ('0e2235e7-babf-413c-9acf-f27cce5f059c', '2006-07-05 23:40:00', 3, 'MODS (XML)', 'Simon Kornblith', 'xml',
+REPLACE INTO "translators" VALUES ('0e2235e7-babf-413c-9acf-f27cce5f059c', '2006-07-05 23:40:00', 3, 'MODS', 'Simon Kornblith', 'xml',
'Scholar.addOption("exportNotes", true);
function detectImport() {
@@ -4256,7 +4256,7 @@ function doImport() {
}
}');
-REPLACE INTO "translators" VALUES ('14763d24-8ba0-45df-8f52-b8d1108e7ac9', '2006-07-07 12:44:00', 2, 'Biblio/DC/FOAF/PRISM/VCard (RDF/XML)', 'Simon Kornblith', 'rdf',
+REPLACE INTO "translators" VALUES ('14763d24-8ba0-45df-8f52-b8d1108e7ac9', '2006-08-30 11:37:00', 2, 'Zotero RDF', 'Simon Kornblith', 'rdf',
'Scholar.configure("getCollections", true);
Scholar.configure("dataMode", "rdf");
Scholar.addOption("exportNotes", true);
@@ -4334,7 +4334,7 @@ function doExport() {
foaf:"http://xmlns.com/foaf/0.1/",
vcard:"http://nwalsh.com/rdf/vCard#",
link:"http://purl.org/rss/1.0/modules/link/",
- fs:"http://chnm.gmu.edu/firefoxscholar/rdf#"
+ fs:"http://www.zotero.org/namespaces/export#"
};
// add namespaces
@@ -4673,7 +4673,7 @@ function doExport() {
}
}');
-REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006-07-05 23:40:00', 2, 'Unqualified Dublin Core (RDF/XML)', 'Simon Kornblith', 'rdf',
+REPLACE INTO "translators" VALUES ('6e372642-ed9d-4934-b5d1-c11ac758ebb7', '2006-07-05 23:40:00', 2, 'Unqualified Dublin Core RDF', 'Simon Kornblith', 'rdf',
'Scholar.configure("dataMode", "rdf");',
'function doExport() {
var dc = "http://purl.org/dc/elements/1.1/";
@@ -4977,7 +4977,7 @@ function doImport() {
foaf:"http://xmlns.com/foaf/0.1/",
vcard:"http://nwalsh.com/rdf/vCard#",
link:"http://purl.org/rss/1.0/modules/link/",
- fs:"http://chnm.gmu.edu/firefoxscholar/rdf#"
+ fs:"http://www.zotero.org/namespaces/export#"
};
callNumberTypes = [