- Fix broken charset detection and full-text indexing during import on trunk
- Fix collection refresh after import
This commit is contained in:
parent
dd89fb6d47
commit
401f766e9a
4 changed files with 52 additions and 14 deletions
|
@ -301,7 +301,10 @@ var Zotero_File_Interface = new function() {
|
|||
Zotero_File_Interface.Progress.close();
|
||||
Zotero.UnresponsiveScriptIndicator.enable();
|
||||
|
||||
if(!worked) {
|
||||
if (worked) {
|
||||
Zotero.Notifier.trigger('refresh', 'collection', _importCollection.id);
|
||||
}
|
||||
else {
|
||||
_importCollection.erase();
|
||||
window.alert(Zotero.getString("fileInterface.importError"));
|
||||
}
|
||||
|
|
|
@ -1289,20 +1289,32 @@ Zotero.Attachments = new function(){
|
|||
// ignore spurious about:blank loads
|
||||
if(browser.contentDocument.location.href == "about:blank") return;
|
||||
|
||||
var charsetID = Zotero.CharacterSets.getID(charset);
|
||||
if (charsetID) {
|
||||
var disabled = Zotero.Notifier.disable();
|
||||
var item = Zotero.Items.get(itemID);
|
||||
item.attachmentCharset = charsetID;
|
||||
item.save();
|
||||
if (disabled) {
|
||||
Zotero.Notifier.enable();
|
||||
var writeCallback = function () {
|
||||
var charsetID = Zotero.CharacterSets.getID(charset);
|
||||
if (charsetID) {
|
||||
var disabled = Zotero.Notifier.disable();
|
||||
|
||||
var item = Zotero.Items.get(itemID);
|
||||
item.attachmentCharset = charsetID;
|
||||
item.save();
|
||||
|
||||
if (disabled) {
|
||||
Zotero.Notifier.enable();
|
||||
}
|
||||
}
|
||||
|
||||
// Chain fulltext indexer inside the charset callback,
|
||||
// since it's asynchronous and a prerequisite
|
||||
Zotero.Fulltext.indexDocument(browser.contentDocument, itemID);
|
||||
}
|
||||
|
||||
// Chain fulltext indexer inside the charset callback,
|
||||
// since it's asynchronous and a prerequisite
|
||||
Zotero.Fulltext.indexDocument(browser.contentDocument, itemID);
|
||||
// Since the callback can be called during an import process that uses
|
||||
// Zotero.wait(), try to queue the callback to run at the end,
|
||||
// or run now if not queued
|
||||
var queued = Zotero.addUnlockCallback(writeCallback);
|
||||
if (!queued) {
|
||||
writeCallback();
|
||||
}
|
||||
};
|
||||
|
||||
Zotero.File.addCharsetListener(browser, callback, itemID);
|
||||
|
|
|
@ -99,6 +99,7 @@ Zotero.Notifier = new function(){
|
|||
**/
|
||||
function trigger(event, type, ids, extraData, force){
|
||||
if (_disabled){
|
||||
Zotero.debug("Notifications are disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -327,7 +328,7 @@ Zotero.Notifier = new function(){
|
|||
}
|
||||
|
||||
|
||||
function enable(enable) {
|
||||
function enable() {
|
||||
Zotero.debug('Enabling Notifier notifications');
|
||||
_disabled = false;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,6 @@ var Zotero = new function(){
|
|||
*/
|
||||
this.__defineGetter__('locked', function () _locked);
|
||||
|
||||
|
||||
var _startupError;
|
||||
var _startupErrorHandler;
|
||||
var _zoteroDirectory = false;
|
||||
|
@ -152,6 +151,7 @@ var Zotero = new function(){
|
|||
var _waiting;
|
||||
|
||||
var _locked;
|
||||
var _unlockCallbacks = [];
|
||||
var _progressMeters;
|
||||
var _lastPercentage;
|
||||
|
||||
|
@ -1132,6 +1132,14 @@ var Zotero = new function(){
|
|||
* Hide Zotero pane overlay in all windows
|
||||
*/
|
||||
this.hideZoteroPaneOverlay = function () {
|
||||
// Run any queued callbacks
|
||||
if (_unlockCallbacks.length) {
|
||||
var func;
|
||||
while (func = _unlockCallbacks.shift()) {
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var enumerator = wm.getEnumerator("navigator:browser");
|
||||
|
@ -1145,6 +1153,20 @@ var Zotero = new function(){
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a callback to be called when the Zotero pane overlay closes
|
||||
*
|
||||
* @param {Boolean} TRUE if added, FALSE if not locked
|
||||
*/
|
||||
this.addUnlockCallback = function (callback) {
|
||||
if (!_locked) {
|
||||
return false;
|
||||
}
|
||||
_unlockCallbacks.push(callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function _showWindowZoteroPaneOverlay(win) {
|
||||
win.document.getElementById('zotero-collections-tree').disabled = true;
|
||||
win.document.getElementById('zotero-items-tree').disabled = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue