diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js
index 435dd4a16f..f878a65502 100644
--- a/chrome/content/zotero/bibliography.js
+++ b/chrome/content/zotero/bibliography.js
@@ -32,6 +32,7 @@ var Zotero_File_Interface_Bibliography = new function() {
var _io, _saveStyle;
this.init = init;
+ this.styleChanged = styleChanged;
this.acceptSelection = acceptSelection;
/*
@@ -76,6 +77,7 @@ var Zotero_File_Interface_Bibliography = new function() {
styleMenu.selectedIndex = 0;
}
+ // ONLY FOR bibliography.xul: export options
if(document.getElementById("save-as-rtf")) {
// restore saved bibliographic settings
document.getElementById(Zotero.Prefs.get("export.bibliographySettings")).setAttribute("selected", "true");
@@ -87,13 +89,29 @@ var Zotero_File_Interface_Bibliography = new function() {
}
}
- // move to center of screen
+ // ONLY FOR integrationDocPrefs.xul: update status of displayAs
+ if(document.getElementById("displayAs")) {
+ if(_io.useEndnotes == 1) document.getElementById("displayAs").selectedIndex = 1;
+ styleChanged();
+ }
+
+ // FOR ALL: move to center of screen
window.sizeToContent();
window.moveTo(
(self.screen.width-window.innerWidth)/2,
(self.screen.height-window.innerHeight)/2
);
}
+
+ /*
+ * ONLY FOR integrationDocPrefs.xul: called when style is changed
+ */
+ function styleChanged() {
+ // update status of displayAs box based
+ var selectedStyle = document.getElementById("style-menu").selectedItem.value;
+ var styleClass = Zotero.Cite.getStyleClass(selectedStyle);
+ document.getElementById("displayAs").disabled = styleClass != "note";
+ }
function acceptSelection() {
// collect code
@@ -105,6 +123,11 @@ var Zotero_File_Interface_Bibliography = new function() {
Zotero.Prefs.set("export.bibliographySettings", _io.output);
}
+ // ONLY FOR integrationDocPrefs.xul: collect displayAs
+ if(document.getElementById("displayAs")) {
+ _io.useEndnotes = document.getElementById("displayAs").selectedIndex;
+ }
+
// save style (this happens only for "Export Bibliography," or Word
// integration when no bibliography style was previously selected)
if(_saveStyle) {
diff --git a/chrome/content/zotero/integrationDocPrefs.xul b/chrome/content/zotero/integrationDocPrefs.xul
index 6c9d53959f..91ec3e2939 100644
--- a/chrome/content/zotero/integrationDocPrefs.xul
+++ b/chrome/content/zotero/integrationDocPrefs.xul
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js
index be870adb22..1d6d741709 100644
--- a/chrome/content/zotero/xpcom/cite.js
+++ b/chrome/content/zotero/xpcom/cite.js
@@ -32,6 +32,7 @@ Zotero.Cite = new function() {
var _lastStyle = null;
this.getStyles = getStyles;
+ this.getStyleClass = getStyleClass;
this.getStyle = getStyle;
/*
@@ -50,22 +51,37 @@ Zotero.Cite = new function() {
return stylesObject;
}
+
+ /*
+ * gets the class of a given style
+ */
+ function getStyleClass(cslID) {
+ var csl = _getCSL(cslID);
+ var xml = new XML(Zotero.CSL.Global.cleanXML(csl));
+ return xml["@class"].toString();
+ }
+
/*
* gets CSL from the database, or, if it's the most recently used style,
* from the cache
*/
function getStyle(cslID) {
if(_lastStyle != cslID || Zotero.Prefs.get("cacheTranslatorData") == false) {
- // get style
- var sql = "SELECT csl FROM csl WHERE cslID = ?";
- var style = Zotero.DB.valueQuery(sql, [cslID]);
-
// create a CSL instance
- _lastCSL = new Zotero.CSL(style);
+ _lastCSL = new Zotero.CSL(_getCSL(cslID));
_lastStyle = cslID;
}
return _lastCSL;
}
+
+ /*
+ * get CSL for a given style from the database
+ */
+ function _getCSL(cslID) {
+ var style = Zotero.DB.valueQuery("SELECT csl FROM csl WHERE cslID = ?", [cslID]);
+ if(!style) throw "Zotero.Cite: invalid CSL ID";
+ return style;
+ }
}
/*
@@ -386,7 +402,7 @@ Zotero.CSL.prototype.preprocessItems = function(items) {
if(this.class == "author-date") {
var year = item._csl.date.year;
- if(lastAuthor == author) {
+ if(authorsAreSame) {
if(usedCitations[year]) {
if(!usedCitations[year]._csl.date.disambiguation) {
usedCitations[year]._csl.date.disambiguation = "a";
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
index 0e87401af9..ac778e0025 100644
--- a/chrome/content/zotero/xpcom/integration.js
+++ b/chrome/content/zotero/xpcom/integration.js
@@ -485,13 +485,13 @@ Zotero.Integration.SOAP = new function() {
*/
function restoreSession(vars) {
var sessionID = Zotero.randomString();
- var session = _sessions[sessionID] = new Zotero.Integration.Session(vars[0]);
+ var session = _sessions[sessionID] = new Zotero.Integration.Session(vars[0], vars[1]);
var encounteredItem = new Object();
var newField = new Object();
var regenerate = new Object();
- for(var i=1; i
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file