diff --git a/chrome/content/zotero/locale/csl b/chrome/content/zotero/locale/csl index 671108216a..36d26a584a 160000 --- a/chrome/content/zotero/locale/csl +++ b/chrome/content/zotero/locale/csl @@ -1 +1 @@ -Subproject commit 671108216acf9995f96571588b52ea66e324aabf +Subproject commit 36d26a584ac869f2dfbdd528f57141a3bbcf016f diff --git a/chrome/content/zotero/xpcom/cookieSandbox.js b/chrome/content/zotero/xpcom/cookieSandbox.js index b54d380697..e17a7423fe 100755 --- a/chrome/content/zotero/xpcom/cookieSandbox.js +++ b/chrome/content/zotero/xpcom/cookieSandbox.js @@ -31,8 +31,9 @@ * @param {String|nsIURI} uri URI of page to manage cookies for (cookies for domains that are not * subdomains of this URI are ignored) * @param {String} cookieData Cookies with which to initiate the sandbox + * @param {String} userAgent User agent to use for sandboxed requests */ -Zotero.CookieSandbox = function(browser, uri, cookieData) { +Zotero.CookieSandbox = function(browser, uri, cookieData, userAgent) { this._observerService = Components.classes["@mozilla.org/observer-service;1"]. getService(Components.interfaces.nsIObserverService); @@ -54,6 +55,8 @@ Zotero.CookieSandbox = function(browser, uri, cookieData) { } } + if(userAgent) this.userAgent = userAgent; + Zotero.CookieSandbox.Observer.register(); if(browser) { this.attachToBrowser(browser); @@ -206,6 +209,10 @@ Zotero.CookieSandbox.Observer = new function() { return; } + if(trackedBy.userAgent) { + channel.setRequestHeader("User-Agent", trackedBy.userAgent, false); + } + // add cookies to be sent to this domain channel.setRequestHeader("Cookie", trackedBy.cookieString, false); Zotero.debug("CookieSandbox: Added cookies for request to "+channelURI, 5); diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 8002bf860d..3570f2b86d 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -2167,7 +2167,7 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) { // add itemData only if requested if(this.data.prefs.storeReferences) { - serializeCitationItem.itemData = citationItem.item; + serializeCitationItem.itemData = Zotero.Cite.System.retrieveItem(citationItem.id); addSchema = true; } } @@ -2507,6 +2507,8 @@ Zotero.Integration.Session.prototype.deleteCitation = function(index) { Zotero.Integration.Session.prototype.getBibliography = function() { this.updateUncitedItems(); + if(Zotero.Utilities.isEmpty(this.citationsByItemID)) return false; + // generate bibliography var bib = this.style.makeBibliography(); diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index b0bdb82c2b..3cbdc711d8 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -410,6 +410,12 @@ Zotero.Search.prototype.addCondition = function(condition, operator, value, requ for each(var part in parts) { this.addCondition('blockStart'); + + // If search string is 8 characters, see if this is a item key + if (operator == 'contains' && part.text.length == 8) { + this.addCondition('key', 'is', part.text, false); + } + if (condition == 'quicksearch-titleCreatorYear') { this.addCondition('title', operator, part.text, false); this.addCondition('year', operator, part.text, false); @@ -2180,6 +2186,19 @@ Zotero.SearchConditions = new function(){ noLoad: true }, + { + name: 'key', + operators: { + is: true, + isNot: true, + beginsWith: true + }, + table: 'items', + field: 'key', + special: true, + noLoad: true + }, + { name: 'annotation', operators: { diff --git a/chrome/content/zotero/xpcom/server.js b/chrome/content/zotero/xpcom/server.js index d81b35800c..c16e3c0187 100755 --- a/chrome/content/zotero/xpcom/server.js +++ b/chrome/content/zotero/xpcom/server.js @@ -383,9 +383,12 @@ Zotero.Server.DataListener.prototype._processEndpoint = function(method, postDat // pass to endpoint if((endpoint.init.length ? endpoint.init.length : endpoint.init.arity) === 3) { + const uaRe = /[\r\n]User-Agent: +([^\r\n]+)/i; + var m = uaRe.exec(this.header); var url = { "pathname":this.pathname, - "query":this.query ? Zotero.Server.decodeQueryString(this.query.substr(1)) : {} + "query":this.query ? Zotero.Server.decodeQueryString(this.query.substr(1)) : {}, + "userAgent":m && m[1] }; endpoint.init(url, decodedData, sendResponseCallback); diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js old mode 100755 new mode 100644 index 5590fb82a5..c1ae2dff57 --- a/chrome/content/zotero/xpcom/server_connector.js +++ b/chrome/content/zotero/xpcom/server_connector.js @@ -129,7 +129,7 @@ Zotero.Server.Connector.Detect.prototype = { * @param {Object} data POST data or GET query string * @param {Function} sendResponseCallback function to send HTTP response */ - "init":function(data, sendResponseCallback) { + "init":function(url, data, sendResponseCallback) { this.sendResponse = sendResponseCallback; this._parsedPostData = data; @@ -146,7 +146,7 @@ Zotero.Server.Connector.Detect.prototype = { var pageShowCalled = false; var me = this; this._translate.setCookieSandbox(new Zotero.CookieSandbox(this._browser, - this._parsedPostData["uri"], this._parsedPostData["cookie"])); + this._parsedPostData["uri"], this._parsedPostData["cookie"], url.userAgent)); this._browser.addEventListener("DOMContentLoaded", function() { try { if(me._browser.contentDocument.location.href == "about:blank") return; @@ -322,7 +322,7 @@ Zotero.Server.Connector.SaveItem.prototype = { * @param {Object} data POST data or GET query string * @param {Function} sendResponseCallback function to send HTTP response */ - "init":function(data, sendResponseCallback) { + "init":function(url, data, sendResponseCallback) { // figure out where to save var libraryID = null; var collectionID = null; @@ -332,8 +332,8 @@ Zotero.Server.Connector.SaveItem.prototype = { var collection = zp.getSelectedCollection(); } catch(e) {} - var cookieSandbox = data["uri"] && data["cookie"] ? new Zotero.CookieSandbox(null, data["uri"], - data["cookie"]) : null; + var cookieSandbox = data["uri"] ? new Zotero.CookieSandbox(null, data["uri"], + data["cookie"] || "", url.userAgent) : null; for(var i=0; i"; var browser = Zotero.Browser.createHiddenBrowser(); var pageShowCalled = false; - var cookieSandbox = new Zotero.CookieSandbox(browser, data["url"], data["cookie"]); + var cookieSandbox = new Zotero.CookieSandbox(browser, data["url"], data["cookie"], url.userAgent); browser.addEventListener("pageshow", function() { if(browser.contentDocument.location.href == "about:blank" || browser.contentDocument.readyState !== "complete") return; diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 62adc49eeb..cda54ae6c0 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -1256,20 +1256,20 @@ Zotero.Sync.Server = new function () { Zotero.Sync.Runner.setSyncStatus(Zotero.getString('sync.status.loggingIn')); Zotero.HTTP.doPost(url, body, function (xmlhttp) { - _checkResponse(xmlhttp); + _checkResponse(xmlhttp, true); var response = xmlhttp.responseXML.childNodes[0]; if (response.firstChild.tagName == 'error') { if (response.firstChild.getAttribute('code') == 'INVALID_LOGIN') { var e = new Zotero.Error(Zotero.getString('sync.error.invalidLogin'), "INVALID_SYNC_LOGIN"); - _error(e); + _error(e, true); } - _error(response.firstChild.firstChild.nodeValue); + _error(response.firstChild.firstChild.nodeValue, true); } if (_sessionID) { - _error("Session ID already set in Zotero.Sync.Server.login()") + _error("Session ID already set in Zotero.Sync.Server.login()", true) } // [abcdefg0-9]{32} @@ -1278,7 +1278,7 @@ Zotero.Sync.Server = new function () { var re = /^[abcdefg0-9]{32}$/; if (!re.test(_sessionID)) { _sessionID = null; - _error('Invalid session ID received from server'); + _error('Invalid session ID received from server', true); } @@ -1352,7 +1352,7 @@ Zotero.Sync.Server = new function () { Zotero.HTTP.doPost(url, body, function (xmlhttp) { Zotero.debug(xmlhttp.responseText); - _checkResponse(xmlhttp); + _checkResponse(xmlhttp, !restart); if (_invalidSession(xmlhttp)) { Zotero.debug("Invalid session ID -- logging in"); @@ -1772,13 +1772,10 @@ Zotero.Sync.Server = new function () { } - function _checkResponse(xmlhttp) { + function _checkResponse(xmlhttp, noReloadOnFailure) { if (!xmlhttp.responseText) { - // Check SSL cert var channel = xmlhttp.channel; - if (!channel instanceof Ci.nsIChannel) { - _error('No HTTPS channel available'); - } + // Check SSL cert var secInfo = channel.securityInfo; if (secInfo instanceof Ci.nsITransportSecurityInfo) { secInfo.QueryInterface(Ci.nsITransportSecurityInfo); @@ -1794,14 +1791,19 @@ Zotero.Sync.Server = new function () { Zotero.debug(e); } // TODO: localize - _error("SSL certificate error connecting to " + host + "\n\nSee http://zotero.org/support/kb/ssl_certificate_error for more information."); + _error("SSL certificate error connecting to " + host + + "\n\nSee http://zotero.org/support/kb/ssl_certificate_error for more information.", + false, noReloadOnFailure); } else if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_BROKEN) == Ci.nsIWebProgressListener.STATE_IS_BROKEN) { - _error("SSL connection error"); + _error("SSL connection error", false, noReloadOnFailure); } } // TODO: localize - _error('Empty response from server. Please try again in a few minutes.'); + if (xmlhttp.status === 0) { + _error('Error connecting to server. Check your Internet connection.', false, noReloadOnFailure); + } + _error('Empty response from server. Please try again in a few minutes.', false, noReloadOnFailure); } if (!xmlhttp.responseXML || !xmlhttp.responseXML.childNodes[0] || @@ -1809,7 +1811,7 @@ Zotero.Sync.Server = new function () { !xmlhttp.responseXML.childNodes[0].firstChild) { Zotero.debug(xmlhttp.responseText); // TODO: localize - _error('Invalid response from server. Please try again in a few minutes.', xmlhttp.responseText); + _error('Invalid response from server. Please try again in a few minutes.', xmlhttp.responseText, noReloadOnFailure); } var firstChild = xmlhttp.responseXML.firstChild.firstChild; @@ -1828,7 +1830,7 @@ Zotero.Sync.Server = new function () { else { var timeStr = time.toLocaleString(); } - _error("Auto-syncing disabled until " + timeStr); + _error("Auto-syncing disabled until " + timeStr, false, noReloadOnFailure); } if (firstChild.localName == 'error') { @@ -2244,7 +2246,7 @@ Zotero.Sync.Server = new function () { } - function _error(e, extraInfo) { + function _error(e, extraInfo, skipReload) { if (e.name && e.name == 'ZOTERO_ERROR') { switch (e.error) { case Zotero.Error.ERROR_MISSING_OBJECT: @@ -2337,7 +2339,9 @@ Zotero.Sync.Server = new function () { _syncInProgress = false; Zotero.DB.rollbackAllTransactions(); - Zotero.reloadDataObjects(); + if (!skipReload) { + Zotero.reloadDataObjects(); + } Zotero.Sync.EventListener.resetIgnored(); _callbacks.onError(e); diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 1faad2968e..9d10e808ca 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1376,7 +1376,7 @@ Zotero.Translate.Base.prototype = { "for(var key in this) {"+ "if("+createArrays+".indexOf(key) !== -1) {"+ "for each(var item in this[key]) {"+ - "for(var key2 in item[key2]) {"+ + "for(var key2 in item) {"+ "if(typeof item[key2] === 'xml') {"+ "item[key2] = item[key2].toString();"+ "}"+ diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index cbfe0cfea9..5c7773aa9e 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -553,6 +553,7 @@ fulltext.indexState.partial = Partial exportOptions.exportNotes = Export Notes exportOptions.exportFileData = Export Files +exportOptions.useJournalAbbreviation = Use Journal Abbreviation charset.UTF8withoutBOM = Unicode (UTF-8 without BOM) charset.autoDetect = (auto detect) diff --git a/chrome/skin/default/zotero/standalone.css b/chrome/skin/default/zotero/standalone.css index 86070d2815..01c16f53d4 100644 --- a/chrome/skin/default/zotero/standalone.css +++ b/chrome/skin/default/zotero/standalone.css @@ -1,4 +1,4 @@ #zotero-tb-item-from-page, #zotero-tb-snapshot-from-page, #zotero-tb-link-from-page, -#zotero-tb-fullscreen, #zotero-fullscreen-close-separator { +#zotero-tb-fullscreen, #zotero-fullscreen-close-separator, #zotero-close-button { display: none; } \ No newline at end of file diff --git a/translators b/translators index 521c957010..af463b24e4 160000 --- a/translators +++ b/translators @@ -1 +1 @@ -Subproject commit 521c95701073a239b27e717c99dfb384b481df58 +Subproject commit af463b24e40f0b426a40b55cf5f0d74dcab0d5b0