Remove store references in document option. Closes #1216
This commit is contained in:
parent
5e3c7bf63d
commit
3c19bbffe4
5 changed files with 6 additions and 45 deletions
|
@ -166,12 +166,6 @@ var Zotero_File_Interface_Bibliography = new function() {
|
||||||
document.getElementById("automaticJournalAbbreviations-checkbox").checked = true;
|
document.getElementById("automaticJournalAbbreviations-checkbox").checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(document.getElementById("storeReferences")) {
|
|
||||||
if(_io.storeReferences || _io.storeReferences === undefined) {
|
|
||||||
document.getElementById("storeReferences").checked = true;
|
|
||||||
if(_io.requireStoreReferences) document.getElementById("storeReferences").disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set style to false, in case this is cancelled
|
// set style to false, in case this is cancelled
|
||||||
_io.style = false;
|
_io.style = false;
|
||||||
|
@ -271,7 +265,6 @@ var Zotero_File_Interface_Bibliography = new function() {
|
||||||
}
|
}
|
||||||
_io.useEndnotes = document.getElementById("displayAs").selectedIndex;
|
_io.useEndnotes = document.getElementById("displayAs").selectedIndex;
|
||||||
_io.fieldType = (document.getElementById("formatUsing").selectedIndex == 0 ? _io.primaryFieldType : _io.secondaryFieldType);
|
_io.fieldType = (document.getElementById("formatUsing").selectedIndex == 0 ? _io.primaryFieldType : _io.secondaryFieldType);
|
||||||
_io.storeReferences = document.getElementById("storeReferences").checked;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember style and locale if user selected these explicitly
|
// remember style and locale if user selected these explicitly
|
||||||
|
|
|
@ -84,8 +84,5 @@
|
||||||
<checkbox id="automaticJournalAbbreviations-checkbox" label="&zotero.integration.prefs.automaticJournalAbbeviations.label;"/>
|
<checkbox id="automaticJournalAbbreviations-checkbox" label="&zotero.integration.prefs.automaticJournalAbbeviations.label;"/>
|
||||||
<description class="radioDescription">&zotero.integration.prefs.automaticJournalAbbeviations.caption;</description>
|
<description class="radioDescription">&zotero.integration.prefs.automaticJournalAbbeviations.caption;</description>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
<checkbox id="storeReferences" label="&zotero.integration.prefs.storeReferences.label;"/>
|
|
||||||
<description class="radioDescription">&zotero.integration.prefs.storeReferences.caption;</description>
|
|
||||||
</vbox>
|
</vbox>
|
||||||
</dialog>
|
</dialog>
|
|
@ -1242,10 +1242,6 @@ Zotero.Integration.Document.prototype.setDocPrefs = function() {
|
||||||
if(!haveSession) {
|
if(!haveSession) {
|
||||||
// This is a brand new document; don't try to get fields
|
// This is a brand new document; don't try to get fields
|
||||||
return setDocPrefs();
|
return setDocPrefs();
|
||||||
} else if(me._session.reload) {
|
|
||||||
// Always reload before setDocPrefs so we can permit/deny unchecking storeReferences as
|
|
||||||
// appropriate
|
|
||||||
return fieldGetter.updateSession().then(setDocPrefs);
|
|
||||||
} else {
|
} else {
|
||||||
// Can get fields while dialog is open
|
// Can get fields while dialog is open
|
||||||
return Zotero.Promise.all([
|
return Zotero.Promise.all([
|
||||||
|
@ -1691,9 +1687,7 @@ Zotero.Integration.Fields.prototype._updateDocument = function* (forceCitations,
|
||||||
|
|
||||||
var fieldCode = this._session.getCitationField(citation);
|
var fieldCode = this._session.getCitationField(citation);
|
||||||
if(fieldCode != citation.properties.field) {
|
if(fieldCode != citation.properties.field) {
|
||||||
field.setCode(
|
field.setCode(`ITEM CSL_CITATION ${fieldCode}`);
|
||||||
(this._session.data.prefs.storeReferences ? "ITEM CSL_CITATION" : "ITEM")
|
|
||||||
+" "+fieldCode);
|
|
||||||
|
|
||||||
if(this._session.data.prefs.fieldType === "ReferenceMark" && isRich
|
if(this._session.data.prefs.fieldType === "ReferenceMark" && isRich
|
||||||
&& !citation.properties.dontUpdate) {
|
&& !citation.properties.dontUpdate) {
|
||||||
|
@ -1715,8 +1709,7 @@ Zotero.Integration.Fields.prototype._updateDocument = function* (forceCitations,
|
||||||
if(forceBibliography || this._session.bibliographyDataHasChanged) {
|
if(forceBibliography || this._session.bibliographyDataHasChanged) {
|
||||||
var bibliographyData = this._session.getBibliographyData();
|
var bibliographyData = this._session.getBibliographyData();
|
||||||
for (let field of bibliographyFields) {
|
for (let field of bibliographyFields) {
|
||||||
field.setCode("BIBL "+bibliographyData
|
field.setCode(`BIBL ${bibliographyData} CSL_BIBLIOGRAPHY`);
|
||||||
+(this._session.data.prefs.storeReferences ? " CSL_BIBLIOGRAPHY" : ""));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2173,7 +2166,6 @@ Zotero.Integration.Session.prototype.setDocPrefs = Zotero.Promise.coroutine(func
|
||||||
io.fieldType = this.data.prefs.fieldType;
|
io.fieldType = this.data.prefs.fieldType;
|
||||||
io.primaryFieldType = primaryFieldType;
|
io.primaryFieldType = primaryFieldType;
|
||||||
io.secondaryFieldType = secondaryFieldType;
|
io.secondaryFieldType = secondaryFieldType;
|
||||||
io.storeReferences = this.data.prefs.storeReferences;
|
|
||||||
io.automaticJournalAbbreviations = this.data.prefs.automaticJournalAbbreviations;
|
io.automaticJournalAbbreviations = this.data.prefs.automaticJournalAbbreviations;
|
||||||
io.requireStoreReferences = !Zotero.Utilities.isEmpty(this.embeddedItems);
|
io.requireStoreReferences = !Zotero.Utilities.isEmpty(this.embeddedItems);
|
||||||
}
|
}
|
||||||
|
@ -2194,7 +2186,6 @@ Zotero.Integration.Session.prototype.setDocPrefs = Zotero.Promise.coroutine(func
|
||||||
data.style.styleID = io.style;
|
data.style.styleID = io.style;
|
||||||
data.style.locale = io.locale;
|
data.style.locale = io.locale;
|
||||||
data.prefs.fieldType = io.fieldType;
|
data.prefs.fieldType = io.fieldType;
|
||||||
data.prefs.storeReferences = io.storeReferences;
|
|
||||||
data.prefs.automaticJournalAbbreviations = io.automaticJournalAbbreviations;
|
data.prefs.automaticJournalAbbreviations = io.automaticJournalAbbreviations;
|
||||||
|
|
||||||
var forceStyleReset = oldData
|
var forceStyleReset = oldData
|
||||||
|
@ -2254,7 +2245,6 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) {
|
||||||
const saveProperties = ["custom", "unsorted", "formattedCitation", "plainCitation", "dontUpdate"];
|
const saveProperties = ["custom", "unsorted", "formattedCitation", "plainCitation", "dontUpdate"];
|
||||||
const saveCitationItemKeys = ["locator", "label", "suppress-author", "author-only", "prefix",
|
const saveCitationItemKeys = ["locator", "label", "suppress-author", "author-only", "prefix",
|
||||||
"suffix"];
|
"suffix"];
|
||||||
var addSchema = false;
|
|
||||||
|
|
||||||
var type;
|
var type;
|
||||||
var field = [];
|
var field = [];
|
||||||
|
@ -2285,7 +2275,6 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) {
|
||||||
|
|
||||||
// always store itemData, since we have no way to get it back otherwise
|
// always store itemData, since we have no way to get it back otherwise
|
||||||
serializeCitationItem.itemData = citationItem.itemData;
|
serializeCitationItem.itemData = citationItem.itemData;
|
||||||
addSchema = true;
|
|
||||||
} else {
|
} else {
|
||||||
serializeCitationItem.id = citationItem.id;
|
serializeCitationItem.id = citationItem.id;
|
||||||
serializeCitationItem.uris = this.uriMap.getURIsForItemID(citationItem.id);
|
serializeCitationItem.uris = this.uriMap.getURIsForItemID(citationItem.id);
|
||||||
|
@ -2293,11 +2282,7 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) {
|
||||||
// XXX For compatibility with older versions of Zotero; to be removed at a later date
|
// XXX For compatibility with older versions of Zotero; to be removed at a later date
|
||||||
serializeCitationItem.uri = serializeCitationItem.uris;
|
serializeCitationItem.uri = serializeCitationItem.uris;
|
||||||
|
|
||||||
// add itemData only if requested
|
serializeCitationItem.itemData = this.style.sys.retrieveItem(citationItem.id);
|
||||||
if(this.data.prefs.storeReferences) {
|
|
||||||
serializeCitationItem.itemData = this.style.sys.retrieveItem(citationItem.id);
|
|
||||||
addSchema = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy saveCitationItemKeys
|
// copy saveCitationItemKeys
|
||||||
|
@ -2310,10 +2295,7 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) {
|
||||||
citationItems[j] = JSON.stringify(serializeCitationItem);
|
citationItems[j] = JSON.stringify(serializeCitationItem);
|
||||||
}
|
}
|
||||||
field.push('"citationItems":['+citationItems.join(",")+"]");
|
field.push('"citationItems":['+citationItems.join(",")+"]");
|
||||||
|
field.push('"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"');
|
||||||
if(addSchema) {
|
|
||||||
field.push('"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"');
|
|
||||||
}
|
|
||||||
|
|
||||||
return "{"+field.join(",")+"}";
|
return "{"+field.join(",")+"}";
|
||||||
}
|
}
|
||||||
|
@ -3146,7 +3128,6 @@ Zotero.Integration.DocumentData.prototype.unserializeXML = function(xmlData) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.prefs.noteType = 0;
|
this.prefs.noteType = 0;
|
||||||
}
|
}
|
||||||
if (this.prefs["storeReferences"] === undefined) this.prefs["storeReferences"] = false;
|
|
||||||
if (this.prefs["automaticJournalAbbreviations"] === undefined) this.prefs["automaticJournalAbbreviations"] = false;
|
if (this.prefs["automaticJournalAbbreviations"] === undefined) this.prefs["automaticJournalAbbreviations"] = false;
|
||||||
this.zoteroVersion = doc.documentElement.getAttribute("zotero-version");
|
this.zoteroVersion = doc.documentElement.getAttribute("zotero-version");
|
||||||
if (!this.zoteroVersion) this.zoteroVersion = "2.0";
|
if (!this.zoteroVersion) this.zoteroVersion = "2.0";
|
||||||
|
@ -3180,8 +3161,7 @@ Zotero.Integration.DocumentData.prototype.unserialize = function(input) {
|
||||||
this.style = {"styleID":prefParameters[1],
|
this.style = {"styleID":prefParameters[1],
|
||||||
"hasBibliography":(prefParameters[3] == "1" || prefParameters[3] == "True"),
|
"hasBibliography":(prefParameters[3] == "1" || prefParameters[3] == "True"),
|
||||||
"bibliographyStyleHasBeenSet":false};
|
"bibliographyStyleHasBeenSet":false};
|
||||||
this.prefs = {"fieldType":((prefParameters[5] == "1" || prefParameters[5] == "True") ? "Bookmark" : "Field"),
|
this.prefs = {"fieldType":((prefParameters[5] == "1" || prefParameters[5] == "True") ? "Bookmark" : "Field")};
|
||||||
"storeReferences":false};
|
|
||||||
if(prefParameters[2] == "note") {
|
if(prefParameters[2] == "note") {
|
||||||
if(prefParameters[4] == "1" || prefParameters[4] == "True") {
|
if(prefParameters[4] == "1" || prefParameters[4] == "True") {
|
||||||
this.prefs.noteType = NOTE_ENDNOTE;
|
this.prefs.noteType = NOTE_ENDNOTE;
|
||||||
|
|
|
@ -232,9 +232,6 @@
|
||||||
<!ENTITY zotero.integration.prefs.automaticJournalAbbeviations.label "Automatically abbreviate journal titles">
|
<!ENTITY zotero.integration.prefs.automaticJournalAbbeviations.label "Automatically abbreviate journal titles">
|
||||||
<!ENTITY zotero.integration.prefs.automaticJournalAbbeviations.caption "MEDLINE journal abbreviations will be automatically generated using journal titles. The “Journal Abbr” field will be ignored.">
|
<!ENTITY zotero.integration.prefs.automaticJournalAbbeviations.caption "MEDLINE journal abbreviations will be automatically generated using journal titles. The “Journal Abbr” field will be ignored.">
|
||||||
|
|
||||||
<!ENTITY zotero.integration.prefs.storeReferences.label "Store references in document">
|
|
||||||
<!ENTITY zotero.integration.prefs.storeReferences.caption "Storing references in your document slightly increases file size, but will allow you to share your document with others without using a Zotero group. Zotero 3.0 or later is required to update documents created with this option.">
|
|
||||||
|
|
||||||
<!ENTITY zotero.integration.showEditor.label "Show Editor">
|
<!ENTITY zotero.integration.showEditor.label "Show Editor">
|
||||||
<!ENTITY zotero.integration.classicView.label "Classic View">
|
<!ENTITY zotero.integration.classicView.label "Classic View">
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,6 @@ describe("Zotero.Integration", function () {
|
||||||
data.prefs = {
|
data.prefs = {
|
||||||
noteType: 0,
|
noteType: 0,
|
||||||
fieldType: "Field",
|
fieldType: "Field",
|
||||||
storeReferences: true,
|
|
||||||
automaticJournalAbbreviations: true
|
automaticJournalAbbreviations: true
|
||||||
};
|
};
|
||||||
data.style = {styleID, locale: 'en-US', hasBibliography: true, bibliographyStyleHasBeenSet: true};
|
data.style = {styleID, locale: 'en-US', hasBibliography: true, bibliographyStyleHasBeenSet: true};
|
||||||
|
@ -266,7 +265,6 @@ describe("Zotero.Integration", function () {
|
||||||
style: "http://www.zotero.org/styles/cell",
|
style: "http://www.zotero.org/styles/cell",
|
||||||
locale: 'en-US',
|
locale: 'en-US',
|
||||||
fieldType: 'Field',
|
fieldType: 'Field',
|
||||||
storeReferences: true,
|
|
||||||
automaticJournalAbbreviations: false,
|
automaticJournalAbbreviations: false,
|
||||||
useEndnotes: 0
|
useEndnotes: 0
|
||||||
};
|
};
|
||||||
|
@ -476,7 +474,7 @@ describe("Zotero.Integration", function () {
|
||||||
|
|
||||||
describe("DocumentData", function() {
|
describe("DocumentData", function() {
|
||||||
it('should properly unserialize old XML document data', function() {
|
it('should properly unserialize old XML document data', function() {
|
||||||
var serializedXMLData = "<data data-version=\"3\" zotero-version=\"5.0.SOURCE\"><session id=\"F0NFmZ32\"/><style id=\"http://www.zotero.org/styles/cell\" hasBibliography=\"1\" bibliographyStyleHasBeenSet=\"1\"/><prefs><pref name=\"fieldType\" value=\"ReferenceMark\"/><pref name=\"storeReferences\" value=\"true\"/><pref name=\"automaticJournalAbbreviations\" value=\"true\"/><pref name=\"noteType\" value=\"0\"/></prefs></data>";
|
var serializedXMLData = "<data data-version=\"3\" zotero-version=\"5.0.SOURCE\"><session id=\"F0NFmZ32\"/><style id=\"http://www.zotero.org/styles/cell\" hasBibliography=\"1\" bibliographyStyleHasBeenSet=\"1\"/><prefs><pref name=\"fieldType\" value=\"ReferenceMark\"/><pref name=\"automaticJournalAbbreviations\" value=\"true\"/><pref name=\"noteType\" value=\"0\"/></prefs></data>";
|
||||||
var data = new Zotero.Integration.DocumentData(serializedXMLData);
|
var data = new Zotero.Integration.DocumentData(serializedXMLData);
|
||||||
var expectedData = {
|
var expectedData = {
|
||||||
style: {
|
style: {
|
||||||
|
@ -487,7 +485,6 @@ describe("Zotero.Integration", function () {
|
||||||
},
|
},
|
||||||
prefs: {
|
prefs: {
|
||||||
fieldType: 'ReferenceMark',
|
fieldType: 'ReferenceMark',
|
||||||
storeReferences: true,
|
|
||||||
automaticJournalAbbreviations: true,
|
automaticJournalAbbreviations: true,
|
||||||
noteType: 0
|
noteType: 0
|
||||||
},
|
},
|
||||||
|
@ -509,7 +506,6 @@ describe("Zotero.Integration", function () {
|
||||||
},
|
},
|
||||||
prefs: {
|
prefs: {
|
||||||
fieldType: 'ReferenceMark',
|
fieldType: 'ReferenceMark',
|
||||||
storeReferences: true,
|
|
||||||
automaticJournalAbbreviations: false,
|
automaticJournalAbbreviations: false,
|
||||||
noteType: 0
|
noteType: 0
|
||||||
},
|
},
|
||||||
|
@ -537,7 +533,6 @@ describe("Zotero.Integration", function () {
|
||||||
data.prefs = {
|
data.prefs = {
|
||||||
noteType: 1,
|
noteType: 1,
|
||||||
fieldType: "Field",
|
fieldType: "Field",
|
||||||
storeReferences: true,
|
|
||||||
automaticJournalAbbreviations: true
|
automaticJournalAbbreviations: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -574,7 +569,6 @@ describe("Zotero.Integration", function () {
|
||||||
data.prefs = {
|
data.prefs = {
|
||||||
noteType: 1,
|
noteType: 1,
|
||||||
fieldType: "Field",
|
fieldType: "Field",
|
||||||
storeReferences: true,
|
|
||||||
automaticJournalAbbreviations: true
|
automaticJournalAbbreviations: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue