Merge branch '3.0'

Conflicts:
	chrome/content/zotero/xpcom/translation/translate_firefox.js
	chrome/content/zotero/xpcom/translation/translate_item.js
This commit is contained in:
Simon Kornblith 2012-07-08 13:15:27 -04:00
commit 471af0c8ab
4 changed files with 35 additions and 32 deletions

View file

@ -856,10 +856,18 @@ Zotero.Integration.Document.prototype._createNewSession = function(data) {
*/
Zotero.Integration.Document.prototype._getSession = function(require, dontRunSetDocPrefs, callback) {
var dataString = this._doc.getDocumentData(),
data,
me = this;
if(!dataString) {
if(dataString) {
try {
data = new Zotero.Integration.DocumentData(dataString);
} catch(e) {};
}
if(!data) {
var haveFields = false;
var data = new Zotero.Integration.DocumentData();
data = new Zotero.Integration.DocumentData();
if(require) {
// check to see if fields already exist
@ -902,7 +910,6 @@ Zotero.Integration.Document.prototype._getSession = function(require, dontRunSet
callback(true);
});
} else {
var data = new Zotero.Integration.DocumentData(dataString);
if(data.dataVersion < DATA_VERSION) {
if(data.dataVersion == 1
&& data.prefs.fieldType == "Field"

View file

@ -328,17 +328,16 @@ Zotero.Translate.ItemSaver.prototype = {
"_saveAttachmentDownload":function(attachment, parentID, attachmentCallback) {
Zotero.debug("Translate: Adding attachment", 4);
// determine whether to save attachments at all
var automaticSnapshots = Zotero.Prefs.get("automaticSnapshots");
var downloadAssociatedFiles = Zotero.Prefs.get("downloadAssociatedFiles");
if(!attachment.url && !attachment.document) {
Zotero.debug("Translate: Not adding attachment: no URL specified", 2);
} else {
var shouldAttach = ((attachment.document
|| (attachment.mimeType && attachment.mimeType == "text/html")) && automaticSnapshots)
|| downloadAssociatedFiles;
if(!shouldAttach) return false;
// Determine whether to save an attachment
if(attachment.document
|| (attachment.mimeType && attachment.mimeType == "text/html")) {
if(!Zotero.Prefs.get("automaticSnapshots")) return;
} else {
if(!Zotero.Prefs.get("downloadAssociatedFiles")) return;
}
if(attachment.document) {
attachment.document = Zotero.Translate.DOMWrapper.unwrap(attachment.document);
@ -377,28 +376,25 @@ Zotero.Translate.ItemSaver.prototype = {
} else {
// if snapshot is not explicitly set to false, retrieve snapshot
if(attachment.document) {
if(automaticSnapshots) {
try {
attachment.linkMode = "imported_url";
Zotero.Attachments.importFromDocument(attachment.document,
parentID, attachment.title, null, function(status, err) {
if(status) {
attachmentCallback(attachment, 100);
} else {
attachmentCallback(attachment, false, err);
}
}, this._libraryID);
attachmentCallback(attachment, 0);
} catch(e) {
Zotero.debug("Translate: Error attaching document", 2);
attachmentCallback(attachment, false, e);
}
return true;
try {
attachment.linkMode = "imported_url";
Zotero.Attachments.importFromDocument(attachment.document,
parentID, attachment.title, null, function(status, err) {
if(status) {
attachmentCallback(attachment, 100);
} else {
attachmentCallback(attachment, false, err);
}
}, this._libraryID);
attachmentCallback(attachment, 0);
} catch(e) {
Zotero.debug("Translate: Error attaching document", 2);
attachmentCallback(attachment, false, e);
}
return true;
// Save attachment if snapshot pref enabled or not HTML
// (in which case downloadAssociatedFiles applies)
} else if(this._saveFiles && (automaticSnapshots || !attachment.mimeType
|| attachment.mimeType != "text/html")) {
} else {
var mimeType = (attachment.mimeType ? attachment.mimeType : null);
var title = (attachment.title ? attachment.title : null);

View file

@ -585,7 +585,7 @@ annotations.oneWindowWarning = Annotations for a snapshot may only be opened in
integration.fields.label = Fields
integration.referenceMarks.label = ReferenceMarks
integration.fields.caption = Microsoft Word Fields are less likely to be accidentally modified, but cannot be shared with OpenOffice.
integration.fields.fileFormatNotice = The document must be saved in the .doc or .docx file format.
integration.fields.fileFormatNotice = The document must be saved in the .doc file format.
integration.referenceMarks.caption = OpenOffice ReferenceMarks are less likely to be accidentally modified, but cannot be shared with Microsoft Word.
integration.referenceMarks.fileFormatNotice = The document must be saved in the .odt file format.

@ -1 +1 @@
Subproject commit 153776b6d3644f0bfaa0b52b72eae9da4080d1e6
Subproject commit 571e15017390b41c31534284fc724d1602198c03