Merge branch '4.0'
Conflicts: chrome/content/zotero/xpcom/storage.js
This commit is contained in:
commit
992f08b8b3
|
@ -118,7 +118,7 @@ var ZoteroAdvancedSearch = new function() {
|
|||
|
||||
if (!name.value)
|
||||
{
|
||||
newName.value = untitled;
|
||||
name.value = untitled;
|
||||
}
|
||||
|
||||
var s = _searchBox.search.clone();
|
||||
|
|
|
@ -232,7 +232,7 @@ Zotero_Preferences.Export = {
|
|||
|
||||
|
||||
updateQuickCopyInstructions: function () {
|
||||
var prefix = Zotero.isMac ? 'Cmd+Shift+' : 'Ctrl+Alt+';
|
||||
var prefix = Zotero.isMac ? Zotero.getString('general.keys.cmdShift') : Zotero.getString('general.keys.ctrlShift');
|
||||
|
||||
var key = Zotero.Prefs.get('keys.copySelectedItemsToClipboard');
|
||||
var str = Zotero.getString('zotero.preferences.export.quickCopy.instructions', prefix + key);
|
||||
|
|
|
@ -30,7 +30,7 @@ Zotero_Preferences.Keys = {
|
|||
var rows = document.getElementById('zotero-prefpane-keys').getElementsByTagName('row');
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
// Display the appropriate modifier keys for the platform
|
||||
rows[i].firstChild.nextSibling.value = Zotero.isMac ? 'Cmd+Shift+' : 'Ctrl+Shift+';
|
||||
rows[i].firstChild.nextSibling.value = Zotero.isMac ? Zotero.getString('general.keys.cmdShift') : Zotero.getString('general.keys.ctrlShift');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1729,10 +1729,16 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
|
|||
var itemID = Zotero.Attachments.linkFromFile(file);
|
||||
}
|
||||
else {
|
||||
if (dragData.dropEffect != 'copy') {
|
||||
Components.utils.reportError("Invalid dropEffect '" + dragData.dropEffect + "' dropping file");
|
||||
}
|
||||
var itemID = Zotero.Attachments.importFromFile(file, false, targetLibraryID);
|
||||
// If moving, delete original file
|
||||
if (dragData.dropEffect == 'move') {
|
||||
try {
|
||||
file.remove(false);
|
||||
}
|
||||
catch (e) {
|
||||
Components.utils.reportError("Error deleting original file " + file.path + " after drag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parentCollectionID) {
|
||||
|
@ -1776,14 +1782,21 @@ Zotero.CollectionTreeView.prototype.onDragOver = function (event) {
|
|||
// - Setting the dropEffect only works on Linux and OS X.
|
||||
//
|
||||
// - Modifier keys don't show up in the drag event on OS X until the
|
||||
// drop, so since we can't show a correct effect, we leave it at
|
||||
// the default 'move', the least misleading option.
|
||||
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
|
||||
// so since we can't show a correct effect, we leave it at
|
||||
// the default 'move', the least misleading option, and set it
|
||||
// below in onDrop().
|
||||
//
|
||||
// - The cursor effect gets set by the system on Windows 7 and can't
|
||||
// be overridden.
|
||||
if (!Zotero.isMac) {
|
||||
if (event.ctrlKey && event.shiftKey) {
|
||||
event.dataTransfer.dropEffect = "link";
|
||||
if (event.shiftKey) {
|
||||
if (event.ctrlKey) {
|
||||
event.dataTransfer.dropEffect = "link";
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = "move";
|
||||
}
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = "copy";
|
||||
|
@ -1802,7 +1815,22 @@ Zotero.CollectionTreeView.prototype.onDragOver = function (event) {
|
|||
* Called by HTML 5 Drag and Drop when dropping onto the tree
|
||||
*/
|
||||
Zotero.CollectionTreeView.prototype.onDrop = function (event) {
|
||||
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
|
||||
if (event.dataTransfer.types.contains("application/x-moz-file")) {
|
||||
if (Zotero.isMac) {
|
||||
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
|
||||
if (event.metaKey) {
|
||||
if (event.altKey) {
|
||||
event.dataTransfer.dropEffect = 'link';
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = 'move';
|
||||
}
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ Zotero.Item.prototype.getField = function(field, unformatted, includeBaseMapped)
|
|||
} else if(creators.length === 2) {
|
||||
return creators[0].ref.lastName+" "+Zotero.getString('general.and')+" "+creators[1].ref.lastName;
|
||||
} else if(creators.length > 3) {
|
||||
return creators[0].ref.lastName+" et al."
|
||||
return creators[0].ref.lastName+" "+Zotero.getString('general.etAl');
|
||||
}
|
||||
} else if (field === 'id' || Zotero.Items.isPrimaryField(field)) {
|
||||
var privField = '_' + field;
|
||||
|
@ -3379,6 +3379,8 @@ Zotero.Item.prototype.__defineSetter__('attachmentSyncState', function (val) {
|
|||
case Zotero.Sync.Storage.SYNC_STATE_TO_UPLOAD:
|
||||
case Zotero.Sync.Storage.SYNC_STATE_TO_DOWNLOAD:
|
||||
case Zotero.Sync.Storage.SYNC_STATE_IN_SYNC:
|
||||
case Zotero.Sync.Storage.SYNC_STATE_FORCE_UPLOAD:
|
||||
case Zotero.Sync.Storage.SYNC_STATE_FORCE_DOWNLOAD:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -628,6 +628,7 @@ Zotero.Items = new function() {
|
|||
|
||||
/* This whole block is to get the firstCreator */
|
||||
var localizedAnd = Zotero.getString('general.and');
|
||||
var localizedEtAl = Zotero.getString('general.etAl');
|
||||
var sql = "COALESCE(" +
|
||||
// First try for primary creator types
|
||||
"CASE (" +
|
||||
|
@ -665,7 +666,7 @@ Zotero.Items = new function() {
|
|||
"LEFT JOIN itemTypeCreatorTypes ITCT " +
|
||||
"ON (IC.creatorTypeID=ITCT.creatorTypeID AND ITCT.itemTypeID=I.itemTypeID) " +
|
||||
"WHERE itemID=I.itemID AND primaryField=1 ORDER BY orderIndex LIMIT 1)" +
|
||||
" || ' et al.' " +
|
||||
" || ' " + localizedEtAl + "' " +
|
||||
") " +
|
||||
"END, " +
|
||||
|
||||
|
@ -691,7 +692,7 @@ Zotero.Items = new function() {
|
|||
"SELECT " +
|
||||
"(SELECT lastName FROM itemCreators NATURAL JOIN creators NATURAL JOIN creatorData " +
|
||||
"WHERE itemID=I.itemID AND creatorTypeID IN (3) ORDER BY orderIndex LIMIT 1)" +
|
||||
" || ' et al.' " +
|
||||
" || ' " + localizedEtAl + "' " +
|
||||
") " +
|
||||
"END, " +
|
||||
|
||||
|
@ -717,7 +718,7 @@ Zotero.Items = new function() {
|
|||
"SELECT " +
|
||||
"(SELECT lastName FROM itemCreators NATURAL JOIN creators NATURAL JOIN creatorData " +
|
||||
"WHERE itemID=I.itemID AND creatorTypeID IN (2) ORDER BY orderIndex LIMIT 1)" +
|
||||
" || ' et al.' " +
|
||||
" || ' " + localizedEtAl + "' " +
|
||||
") " +
|
||||
"END" +
|
||||
") AS firstCreator";
|
||||
|
|
|
@ -535,10 +535,10 @@ Zotero.Tag.prototype.diff = function (tag, includeMatches, ignoreOnlyDateModifie
|
|||
|
||||
// For the moment, just compare linked items and increase numDiffs if any differences
|
||||
var d1 = Zotero.Utilities.arrayDiff(
|
||||
otherData.linkedItems, thisData.linkedItems
|
||||
thisData.linkedItems, otherData.linkedItems
|
||||
);
|
||||
var d2 = Zotero.Utilities.arrayDiff(
|
||||
thisData.linkedItems, otherData.linkedItems
|
||||
otherData.linkedItems, thisData.linkedItems
|
||||
);
|
||||
numDiffs += d1.length + d2.length;
|
||||
|
||||
|
|
|
@ -1896,8 +1896,8 @@ Zotero.Integration.CitationEditInterface.prototype = {
|
|||
for(var i=0; i<me._sessionUpdateDeferreds.length; i++) {
|
||||
me._sessionUpdateDeferreds[i].reject(err);
|
||||
}
|
||||
throw err;
|
||||
}).done();
|
||||
Zotero.logError(err);
|
||||
});
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
|
|
|
@ -3015,10 +3015,16 @@ Zotero.ItemTreeView.prototype.drop = function(row, orient)
|
|||
var itemID = Zotero.Attachments.linkFromFile(file, sourceItemID);
|
||||
}
|
||||
else {
|
||||
if (dragData.dropEffect != 'copy') {
|
||||
Components.utils.reportError("Invalid dropEffect '" + dragData.dropEffect + "' dropping file");
|
||||
}
|
||||
var itemID = Zotero.Attachments.importFromFile(file, sourceItemID, targetLibraryID);
|
||||
// If moving, delete original file
|
||||
if (dragData.dropEffect == 'move') {
|
||||
try {
|
||||
file.remove(false);
|
||||
}
|
||||
catch (e) {
|
||||
Components.utils.reportError("Error deleting original file " + file.path + " after drag");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parentCollectionID) {
|
||||
var col = Zotero.Collections.get(parentCollectionID);
|
||||
|
@ -3056,14 +3062,21 @@ Zotero.ItemTreeView.prototype.onDragOver = function (event) {
|
|||
// - Setting the dropEffect only works on Linux and OS X.
|
||||
//
|
||||
// - Modifier keys don't show up in the drag event on OS X until the
|
||||
// drop, so since we can't show a correct effect, we leave it at
|
||||
// the default 'move', the least misleading option.
|
||||
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
|
||||
// so since we can't show a correct effect, we leave it at
|
||||
// the default 'move', the least misleading option, and set it
|
||||
// below in onDrop().
|
||||
//
|
||||
// - The cursor effect gets set by the system on Windows 7 and can't
|
||||
// be overridden.
|
||||
if (!Zotero.isMac) {
|
||||
if (event.ctrlKey && event.shiftKey) {
|
||||
event.dataTransfer.dropEffect = "link";
|
||||
if (event.shiftKey) {
|
||||
if (event.ctrlKey) {
|
||||
event.dataTransfer.dropEffect = "link";
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = "move";
|
||||
}
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = "copy";
|
||||
|
@ -3077,10 +3090,27 @@ Zotero.ItemTreeView.prototype.onDragOver = function (event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called by HTML 5 Drag and Drop when dropping onto the tree
|
||||
*/
|
||||
Zotero.ItemTreeView.prototype.onDrop = function (event) {
|
||||
if (event.dataTransfer.types.contains("application/x-moz-file")) {
|
||||
if (Zotero.isMac) {
|
||||
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
|
||||
if (event.metaKey) {
|
||||
if (event.altKey) {
|
||||
event.dataTransfer.dropEffect = 'link';
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = 'move';
|
||||
}
|
||||
}
|
||||
else {
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -443,6 +443,18 @@ Zotero.Schema = new function(){
|
|||
xpiZipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"]
|
||||
.createInstance(Components.interfaces.nsIZipReader);
|
||||
xpiZipReader.open(installLocation);
|
||||
|
||||
if(Zotero.isStandalone && !xpiZipReader.hasEntry("translators.index")) {
|
||||
// Symlinked dev Standalone build
|
||||
var installLocation2 = installLocation.parent,
|
||||
translatorsDir = installLocation2.clone();
|
||||
translatorsDir.append("translators");
|
||||
if(translatorsDir.exists()) {
|
||||
installLocation = installLocation2;
|
||||
isUnpacked = true;
|
||||
xpiZipReader.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
|
|
|
@ -1684,7 +1684,7 @@ Zotero.Search.prototype._buildQuery = function(){
|
|||
|
||||
|
||||
Zotero.Search.prototype._generateKey = function () {
|
||||
return Zotero.ID.getKey();
|
||||
return Zotero.Utilities.generateObjectKey();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1108,6 +1108,7 @@ Zotero.Translate.Base.prototype = {
|
|||
this._saveAttachments = saveAttachments === undefined || saveAttachments;
|
||||
this._savingAttachments = [];
|
||||
this._savingItems = 0;
|
||||
this._waitingForSave = false;
|
||||
|
||||
var me = this;
|
||||
if(typeof this.translator[0] === "object") {
|
||||
|
@ -1228,7 +1229,6 @@ Zotero.Translate.Base.prototype = {
|
|||
}
|
||||
return;
|
||||
}
|
||||
var oldState = this._currentState;
|
||||
|
||||
// reset async processes and propagate them to parent
|
||||
if(this._parentTranslator && this._runningAsyncProcesses) {
|
||||
|
@ -1241,7 +1241,7 @@ Zotero.Translate.Base.prototype = {
|
|||
var errorString = null;
|
||||
if(!returnValue && error) errorString = this._generateErrorString(error);
|
||||
|
||||
if(oldState === "detect") {
|
||||
if(this._currentState === "detect") {
|
||||
if(this._potentialTranslators.length) {
|
||||
var lastTranslator = this._potentialTranslators.shift();
|
||||
var lastProperToProxyFunction = this._properToProxyFunctions ? this._properToProxyFunctions.shift() : null;
|
||||
|
@ -1279,6 +1279,7 @@ Zotero.Translate.Base.prototype = {
|
|||
|
||||
if(returnValue) {
|
||||
if(this.saveQueue.length) {
|
||||
this._waitingForSave = true;
|
||||
this._saveItems(this.saveQueue);
|
||||
this.saveQueue = [];
|
||||
return;
|
||||
|
@ -1383,7 +1384,7 @@ Zotero.Translate.Base.prototype = {
|
|||
* Checks if saving done, and if so, fires done event
|
||||
*/
|
||||
"_checkIfDone":function() {
|
||||
if(!this._savingItems && !this._savingAttachments.length) {
|
||||
if(!this._savingItems && !this._savingAttachments.length && (!this._currentState || this._waitingForSave)) {
|
||||
this._runHandler("done", true);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1731,7 +1731,7 @@ Zotero.Utilities = {
|
|||
/**
|
||||
* Generates a valid object key for the server API
|
||||
*/
|
||||
"generateObjectKey":function getKey() {
|
||||
"generateObjectKey":function generateObjectKey() {
|
||||
// TODO: add 'L' and 'Y' after 3.0.11 cut-off
|
||||
var baseString = "23456789ABCDEFGHIJKMNPQRSTUVWXZ";
|
||||
return Zotero.Utilities.randomString(8, baseString);
|
||||
|
|
|
@ -341,7 +341,7 @@
|
|||
ondragstart="if (event.target.localName == 'treechildren') { ZoteroPane_Local.itemsView.onDragStart(event); }"
|
||||
ondragenter="return ZoteroPane_Local.itemsView.onDragEnter(event)"
|
||||
ondragover="return ZoteroPane_Local.itemsView.onDragOver(event)"
|
||||
ondragdrop="return ZoteroPane_Local.itemsView.onDrop(event)"
|
||||
ondrop="return ZoteroPane_Local.itemsView.onDrop(event)"
|
||||
oncommand="ZoteroPane_Local.serializePersist()"
|
||||
flex="1">
|
||||
<treecols id="zotero-items-columns-header">
|
||||
|
|
|
@ -30,6 +30,7 @@ general.no = No
|
|||
general.passed = Passed
|
||||
general.failed = Failed
|
||||
general.and = and
|
||||
general.etAl = et al.
|
||||
general.accessDenied = Access Denied
|
||||
general.permissionDenied = Permission Denied
|
||||
general.character.singular = character
|
||||
|
@ -48,6 +49,8 @@ general.useDefault = Use Default
|
|||
general.openDocumentation = Open Documentation
|
||||
general.numMore = %S more…
|
||||
general.openPreferences = Open Preferences
|
||||
general.keys.ctrlShift = Ctrl+Shift+
|
||||
general.keys.cmdShift = Cmd+Shift+
|
||||
|
||||
general.operationInProgress = A Zotero operation is currently in progress.
|
||||
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
|
||||
|
|
Loading…
Reference in New Issue
Block a user