Merge branch '3.0'

Conflicts:
	chrome/content/zotero/integration/quickFormat.js
	chrome/content/zotero/xpcom/attachments.js
	chrome/content/zotero/xpcom/utilities.js
	install.rdf
	styles
	update.rdf
This commit is contained in:
Dan Stillman 2012-11-20 03:22:49 -05:00
commit ac195d2a5e
15 changed files with 124 additions and 45 deletions

View file

@ -100,8 +100,6 @@ var Zotero_QuickFormat = new function () {
}
}
window.sizeToContent();
// Nodes for citation properties panel
panel = document.getElementById("citation-properties");
panelPrefix = document.getElementById("prefix");
@ -130,8 +128,8 @@ var Zotero_QuickFormat = new function () {
this.onLoad = function(event) {
if(event.target !== document) return;
// make sure we are visible
window.setTimeout(function() {
window.sizeToContent();
window.setTimeout(function() {
window.resizeTo(window.outerWidth, qfb.clientHeight);
var screenX = window.screenX;
var screenY = window.screenY;
var xRange = [window.screen.availLeft, window.screen.width-window.outerWidth];
@ -741,7 +739,6 @@ var Zotero_QuickFormat = new function () {
qfs.removeAttribute("multiline");
window.sizeToContent();
}
var panelShowing = referencePanel.state === "open" || referencePanel.state === "showing";
if(numReferences || numSeparators) {
@ -752,13 +749,11 @@ var Zotero_QuickFormat = new function () {
}
if(!referenceHeight && firstReference) {
referenceHeight = firstReference.scrollHeight;
if(firstReference === referenceBox.lastChild) referenceHeight += 1;
referenceHeight = firstReference.scrollHeight + 1;
}
if(!separatorHeight && firstSeparator) {
separatorHeight = firstSeparator.scrollHeight;
if(firstSeparator === referenceBox.lastChild) separatorHeight += 1;
separatorHeight = firstSeparator.scrollHeight + 1;
}
if(!panelFrameHeight) {
@ -794,7 +789,7 @@ var Zotero_QuickFormat = new function () {
}
referencePanel.openPopup(document.documentElement, "after_start", 15,
null, false, false, null);
qfb.clientHeight-window.clientHeight, false, false, null);
if(!Zotero.isMac && !Zotero.isWin) {
// reinstate noautohide after the window is shown

View file

@ -155,11 +155,10 @@ var ZoteroItemPane = new function() {
this.removeNote = function (id) {
var note = Zotero.Items.get(id);
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
if (note && ps.confirm(null, '', Zotero.getString('pane.item.notes.delete.confirm'))) {
note.erase();
if (ps.confirm(null, '', Zotero.getString('pane.item.notes.delete.confirm'))) {
Zotero.Items.trash(id);
}
}

@ -1 +1 @@
Subproject commit 92270bbba9fb59a57042003a7637afc8e694a94f
Subproject commit 071ffc63f4093550d18de5e62e32db506f2b5aa0

View file

@ -496,7 +496,7 @@ var wpdDOMSaver = {
// currentURL to the URL of the frame document and afterwards back to the baseURL
if (this.frameNumber < this.frameList.length) {
var newFileName = this.saveDocumentEx(this.frameList[this.frameNumber++].document, this.name + "_" + this.frameNumber);
aNode.setAttribute("src", newFileName);
aNode.setAttribute("src", this.relativeLinkFix(newFileName));
}
} catch (ex) {
wpdCommon.addError("[wpdCommon.processDOMNode]:\n -> aNode.nodeName: " + aNode.nodeName + "\n -> " + ex);
@ -574,7 +574,9 @@ var wpdDOMSaver = {
return aHTMLText;
},
// While we're replacing references with local file paths,
// we don't want to have the browser try and fetch them
// We prefix them with 'about:blank?' and remove later via repairRelativeLinks
relativeLinkFix: function (aFileName) {
return "about:blank?" + aFileName;
},
@ -584,7 +586,7 @@ var wpdDOMSaver = {
// that sending an invalid request to the server when the img src
// is a relative link to a file in a different directory
repairRelativeLinks: function (aHTMLText) {
return aHTMLText.replace(/(src)="about:blank\?([^"]*)"/g, '$1="$2"');
return aHTMLText.replace(/(src|background|data|href)="about:blank\?([^"]*)"/g, '$1="$2"');
},

View file

@ -302,6 +302,7 @@ Zotero.Attachments = new function(){
var errString = "Downloaded PDF did not have MIME type "
+ "'application/pdf' in Attachments.importFromURL()";
Zotero.debug(errString, 2);
Zotero.debug(str);
attachmentItem.erase();
if(callback) callback(false, new Error(errString));
return;

View file

@ -57,7 +57,7 @@ if (!Array.indexOf) {
};
}
var CSL = {
PROCESSOR_VERSION: "1.0.407",
PROCESSOR_VERSION: "1.0.409",
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g,
STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/,
@ -906,6 +906,7 @@ CSL.getSortCompare = function () {
};
CSL.debug("Using collation sort");
} catch (e) {
CSL.debug("Using localeCompare sort");
strcmp = function (a, b) {
return a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase());
};
@ -2668,6 +2669,24 @@ CSL.Engine.prototype.retrieveItem = function (id) {
Item.legislation_id = legislation_id.join("::");
}
}
Item["title-short"] = Item.shortTitle;
if (Item.title && this.sys.getAbbreviation) {
var jurisdiction = this.transform.loadAbbreviation(Item.jurisdiction, "title", Item.title);
if (this.transform.abbrevs[jurisdiction].title) {
if (this.transform.abbrevs[jurisdiction].title[Item.title]) {
Item["title-short"] = this.transform.abbrevs[jurisdiction].title[Item.title];
}
}
}
Item["container-title-short"] = Item.journalAbbreviation;
if (Item["container-title"] && this.sys.getAbbreviation) {
var jurisdiction = this.transform.loadAbbreviation(Item.jurisdiction, "title", Item["container-title"]);
if (this.transform.abbrevs[jurisdiction].title) {
if (this.transform.abbrevs[jurisdiction].title[Item["container-title"]]) {
Item["container-title-short"] = this.transform.abbrevs[jurisdiction].title[Item["container-title"]];
}
}
}
return Item;
};
CSL.Engine.prototype.setOpt = function (token, name, value) {
@ -3546,6 +3565,12 @@ CSL.getBibliographyEntries = function (bibsection) {
for (i = 0, ilen = rule.triggers.length; i < ilen; i += 1) {
if (clonedItem[rule.triggers[i]]) {
delete clonedItem[rule.triggers[i]];
if (rule.triggers[i] === "title-short") {
delete clonedItem.shortTitle;
}
if (rule.triggers[i] === "container-title-short") {
delete clonedItem.journalAbbreviation;
}
}
}
var newID = clonedItem.id + ":gen";
@ -4246,6 +4271,8 @@ CSL.getSpliceDelimiter = function (last_collapsed, pos) {
this.tmp.splice_delimiter = this.citation.opt["after-collapse-delimiter"];
} else if (this.tmp.have_collapsed && this.opt.xclass === "in-text" && this.opt.update_mode !== CSL.NUMERIC) {
this.tmp.splice_delimiter = ", ";
} else if (this.tmp.use_cite_group_delimiter) {
this.tmp.splice_delimiter = this.citation.opt.cite_group_delimiter;
} else if (this.tmp.cite_locales[pos - 1]) {
var alt_affixes = this.tmp.cite_affixes[this.tmp.cite_locales[pos - 1]];
if (alt_affixes && alt_affixes.delimiter) {
@ -4913,8 +4940,10 @@ CSL.Node.citation = {
}
if (this.tokentype === CSL.END) {
state.opt.grouped_sort = state.opt.xclass === "in-text"
&& state.citation.opt.collapse
&& state.citation.opt.collapse.length
&& (state.citation.opt.collapse
&& state.citation.opt.collapse.length)
|| (state.citation.opt.cite_group_delimiter
&& state.citation.opt.cite_group_delimiter.length)
&& state.opt.update_mode !== CSL.POSITION
&& state.opt.update_mode !== CSL.NUMERIC;
if (state.opt.grouped_sort
@ -6164,7 +6193,9 @@ CSL.NameOutput.prototype._collapseAuthor = function () {
}
if ((this.item && this.item["suppress-author"] && this._first_creator_variable == this.variables[0])
|| (this.state[this.state.tmp.area].opt.collapse
&& this.state[this.state.tmp.area].opt.collapse.length)) {
&& this.state[this.state.tmp.area].opt.collapse.length)
|| (this.state[this.state.tmp.area].opt.cite_group_delimiter
&& this.state[this.state.tmp.area].opt.cite_group_delimiter.length)) {
if (this.state.tmp.authorstring_request) {
mystr = "";
myqueue = this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs;
@ -6175,7 +6206,7 @@ CSL.NameOutput.prototype._collapseAuthor = function () {
this.state.tmp.offset_characters = oldchars;
this.state.registry.authorstrings[this.Item.id] = mystr;
} else if (!this.state.tmp.just_looking
&& !this.state.tmp.suppress_decorations) {
&& !this.state.tmp.suppress_decorations && (this.item["suppress-author"] || (this.state[this.state.tmp.area].opt.collapse && this.state[this.state.tmp.area].opt.collapse.length) || this.state[this.state.tmp.area].opt.cite_group_delimiter && this.state[this.state.tmp.area].opt.cite_group_delimiter)) {
mystr = "";
myqueue = this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs;
oldchars = this.state.tmp.offset_characters;
@ -6183,9 +6214,14 @@ CSL.NameOutput.prototype._collapseAuthor = function () {
mystr = this.state.output.string(this.state, myqueue, false);
}
if (mystr === this.state.tmp.last_primary_names_string) {
this.state.tmp.name_node.top.blobs.pop();
this.state.tmp.name_node.children = [];
this.state.tmp.offset_characters = oldchars;
if (this.item["suppress-author"] || (this.state[this.state.tmp.area].opt.collapse && this.state[this.state.tmp.area].opt.collapse.length)) {
this.state.tmp.name_node.top.blobs.pop();
this.state.tmp.name_node.children = [];
this.state.tmp.offset_characters = oldchars;
}
if (this.state[this.state.tmp.area].opt.cite_group_delimiter && this.state[this.state.tmp.area].opt.cite_group_delimiter) {
this.state.tmp.use_cite_group_delimiter = true;
}
} else {
this.state.tmp.last_primary_names_string = mystr;
if (this.variables.indexOf(this._first_creator_variable) > -1 && this.item && this.item["suppress-author"] && this.Item.type !== "legal_case") {
@ -6195,6 +6231,9 @@ CSL.NameOutput.prototype._collapseAuthor = function () {
this.state.tmp.term_predecessor = false;
}
this.state.tmp.have_collapsed = false;
if (this.state[this.state.tmp.area].opt.cite_group_delimiter && this.state[this.state.tmp.area].opt.cite_group_delimiter) {
this.state.tmp.use_cite_group_delimiter = false;
}
}
}
}
@ -7983,7 +8022,7 @@ CSL.Node.names = {
}
state.build.names_level += -1;
this.label = state.build.name_label;
state.build.name_label = undefined;
state.build.name_label = {};
state.build.names_variables.pop();
var mywith = "with";
var with_default_prefix = "";
@ -9270,6 +9309,11 @@ CSL.Attributes["@collapse"] = function (state, arg) {
state[this.name].opt.collapse = arg;
}
};
CSL.Attributes["@cite-group-delimiter"] = function (state, arg) {
if (arg) {
state[state.tmp.area].opt.cite_group_delimiter = arg;
}
};
CSL.Attributes["@names-delimiter"] = function (state, arg) {
state.setOpt(this, "names-delimiter", arg);
};
@ -9647,9 +9691,6 @@ CSL.Transform = function (state) {
if (["genre", "event", "medium"].indexOf(myabbrev_family) > -1) {
myabbrev_family = "title";
}
if (["title-short"].indexOf(myabbrev_family) > -1) {
myabbrev_family = "title";
}
value = "";
if (state.sys.getAbbreviation) {
var jurisdiction = state.transform.loadAbbreviation(Item.jurisdiction, myabbrev_family, basevalue);

View file

@ -815,7 +815,7 @@ Zotero.Item.prototype.setField = function(field, value, loadIn) {
}
// If existing value, make sure it's actually changing
if (this._itemData[fieldID] === value) {
if ((this._itemData[fieldID] + "") === (value + "")) {
return false;
}
@ -2923,6 +2923,7 @@ Zotero.Item.prototype.relinkAttachmentFile = function(file, skipItemUpdate) {
this._skipModTimeUpdate = true;
}
this.save();
this._skipModTimeUpdate = false;
return false;
}
@ -2996,7 +2997,7 @@ Zotero.Item.prototype.__defineSetter__('attachmentLinkMode', function (val) {
+ "' in Zotero.Item.attachmentLinkMode setter");
}
if (val === this._attachmentLinkMode) {
if (val === this.attachmentLinkMode) {
return;
}
@ -3048,7 +3049,7 @@ Zotero.Item.prototype.__defineSetter__('attachmentMIMEType', function (val) {
val = '';
}
if (val == this._attachmentMIMEType) {
if (val == this.attachmentMIMEType) {
return;
}
@ -3103,7 +3104,7 @@ Zotero.Item.prototype.__defineSetter__('attachmentCharset', function (val) {
val = null;
}
if (val == this._attachmentCharset) {
if (val == this.attachmentCharset) {
return;
}
@ -3151,7 +3152,7 @@ Zotero.Item.prototype.__defineSetter__('attachmentPath', function (val) {
val = '';
}
if (val == this._attachmentPath) {
if (val == this.attachmentPath) {
return;
}
@ -3209,7 +3210,7 @@ Zotero.Item.prototype.__defineSetter__('attachmentSyncState', function (val) {
+ "' in Zotero.Item.attachmentSyncState setter");
}
if (val == this._attachmentSyncState) {
if (val == this.attachmentSyncState) {
return;
}

View file

@ -1263,13 +1263,13 @@ Zotero.Sync.Server = new function () {
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, true);
_error(e, false, true);
}
_error(response.firstChild.firstChild.nodeValue, true);
_error(response.firstChild.firstChild.nodeValue, false, true);
}
if (_sessionID) {
_error("Session ID already set in Zotero.Sync.Server.login()", true)
_error("Session ID already set in Zotero.Sync.Server.login()", false, true)
}
// <response><sessionID>[abcdefg0-9]{32}</sessionID></response>
@ -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', true);
_error('Invalid session ID received from server', false, true);
}
@ -2584,6 +2584,42 @@ Zotero.Sync.Server.Data = new function() {
if (_timeToYield()) yield true;
// TEMP: Resend tags requested by server
try {
if (xml.fixtags.length()) {
for each(var tagsNode in xml.fixtags.tags) {
var libraryID = _libID(tagsNode.@libraryID);
if (libraryID && !Zotero.Libraries.isEditable(libraryID)) {
continue;
}
var tagsKeys = tagsNode.toString().split(' ');
for each(var key in tagsKeys) {
var sql = "SELECT tagID FROM tags WHERE libraryID=? AND key=?";
var tagID = Zotero.DB.valueQuery(sql, [libraryID, key]);
var sql = "SELECT COUNT(*) > 0 FROM itemTags WHERE tagID=?";
if (Zotero.DB.valueQuery(sql, [tagID])) {
var sql = "UPDATE tags SET clientDateModified=CURRENT_TIMESTAMP "
+ "WHERE tagID=?";
Zotero.DB.query(sql, [tagID]);
syncSession.addToUpdated({
objectType: 'tag',
libraryID: libraryID,
key: key
});
}
}
}
}
}
catch (e) {
Components.utils.reportError(e);
Zotero.debug(e);
}
if (_timeToYield()) yield true;
// Get unmodified creators embedded within items -- this is necessary if, say,
// a creator was deleted locally and appears in a new/modified item remotely
var embeddedCreators = {};

View file

@ -65,7 +65,7 @@ const CSL_TEXT_MAPPINGS = {
"section":["section"],
"genre":["type"],
"source":["libraryCatalog"],
"dimension": ["artworkSize", "runningTime"],
"dimensions": ["artworkSize", "runningTime"],
"medium":["medium", "system"],
"scale":["scale"],
"archive":["archive"],

View file

@ -35,7 +35,7 @@ const ZOTERO_CONFIG = {
API_URL: 'https://api.zotero.org/',
PREF_BRANCH: 'extensions.zotero.',
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
VERSION: "3.0.9.SOURCE"
VERSION: "3.0.10.SOURCE"
};
// Commonly used imports accessible anywhere

View file

@ -29,7 +29,7 @@
<!ENTITY quitApplicationCmd.accesskey "Q">
<!ENTITY editMenu.label "退出">
<!ENTITY editMenu.label "编辑">
<!ENTITY editMenu.accesskey "E">
<!ENTITY undoCmd.label "撤销">
<!ENTITY undoCmd.key "Z">

View file

@ -6,7 +6,11 @@
<em:id>zotero@chnm.gmu.edu</em:id>
<em:name>Zotero</em:name>
<<<<<<< HEAD
<em:version>3.5a1.SOURCE</em:version>
=======
<em:version>3.0.10.SOURCE</em:version>
>>>>>>> 3.0
<em:creator>Center for History and New Media<br/>George Mason University</em:creator>
<em:contributor>Dan Cohen</em:contributor>
<em:contributor>Sean Takats</em:contributor>

View file

@ -1 +1 @@
2012-11-06 16:30:00
2012-11-18 22:15:00

2
styles

@ -1 +1 @@
Subproject commit 1e8b58267ae7e6025e2f3bd5c0d55f73a37f30f3
Subproject commit 90265e1171d5f7e597984d9a7ff90c6f55e7cac3

@ -1 +1 @@
Subproject commit fc00df4eec4c4b9fa3d1e52d17eb46ff0cdfb50a
Subproject commit 14794d840b2476cca38cbcd7f17d8c3952a4536d