Replace nsIPrompt with nsIPromptService for Fx4 compatibility
This commit is contained in:
parent
50934eef0c
commit
749b13bc02
11 changed files with 193 additions and 157 deletions
|
@ -183,9 +183,9 @@
|
|||
var relItem = Zotero.Items.get(io.dataOut[0]);
|
||||
if (relItem.libraryID != this.item.libraryID) {
|
||||
// FIXME
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
prompt.alert("", "You cannot relate items in different libraries in this Zotero release.");
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", "You cannot relate items in different libraries in this Zotero release.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,9 +224,9 @@ var Zotero_File_Interface = new function() {
|
|||
var clip = Components.classes["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Components.interfaces.nsIClipboard);
|
||||
if (!clip.hasDataMatchingFlavors(["text/unicode"], 1, clip.kGlobalClipboard)) {
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
prompt.alert("", Zotero.getString('fileInterface.importClipboardNoDataError'));
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", Zotero.getString('fileInterface.importClipboardNoDataError'));
|
||||
return;
|
||||
}
|
||||
var trans = Components.classes["@mozilla.org/widget/transferable;1"]
|
||||
|
@ -279,11 +279,12 @@ var Zotero_File_Interface = new function() {
|
|||
var unsupportedFormat = "The selected file is not in a supported format.";
|
||||
var viewSupportedFormats = "View Supported Formats...";
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_OK)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_IS_STRING);
|
||||
var index = pr.confirmEx(
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_OK)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING);
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
"",
|
||||
unsupportedFormat,
|
||||
buttonFlags,
|
||||
|
|
|
@ -152,9 +152,9 @@ var ZoteroItemPane = new function() {
|
|||
|
||||
this.removeNote = function (id) {
|
||||
var note = Zotero.Items.get(id);
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
if (note && pr.confirm('', Zotero.getString('pane.item.notes.delete.confirm'))) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,11 +142,12 @@ var ZoteroPane = new function()
|
|||
Zotero.restoreFromServer = false;
|
||||
|
||||
setTimeout(function () {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL);
|
||||
var index = pr.confirmEx(
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
"Zotero Restore",
|
||||
"The local Zotero database has been cleared."
|
||||
+ " "
|
||||
|
@ -161,14 +162,16 @@ var ZoteroPane = new function()
|
|||
onSuccess: function () {
|
||||
Zotero.Sync.Runner.setSyncIcon();
|
||||
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Restore Completed",
|
||||
"The local Zotero database has been successfully restored."
|
||||
);
|
||||
},
|
||||
|
||||
onError: function (msg) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Restore Failed",
|
||||
"An error occurred while restoring from the server:\n\n"
|
||||
+ msg
|
||||
|
@ -314,10 +317,10 @@ var ZoteroPane = new function()
|
|||
{
|
||||
if (!ZoteroPane.loaded) {
|
||||
if (Zotero.locked) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var msg = Zotero.getString('general.operationInProgress') + '\n\n' + Zotero.getString('general.operationInProgress.waitUntilFinished');
|
||||
pr.alert("", msg);
|
||||
ps.alert(null, "", msg);
|
||||
return;
|
||||
}
|
||||
ZoteroPane.onLoad();
|
||||
|
@ -365,9 +368,9 @@ var ZoteroPane = new function()
|
|||
// TODO: Add a better error page/window here with reporting
|
||||
// instructions
|
||||
// window.loadURI('chrome://zotero/content/error.xul');
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", errMsg);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", errMsg);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1497,12 +1500,15 @@ var ZoteroPane = new function()
|
|||
|
||||
|
||||
this.emptyTrash = function () {
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var result = prompt.confirm("",
|
||||
Zotero.getString('pane.collections.emptyTrash') + "\n\n" +
|
||||
Zotero.getString('general.actionCannotBeUndone'));
|
||||
var result = ps.confirm(
|
||||
null,
|
||||
"",
|
||||
Zotero.getString('pane.collections.emptyTrash') + "\n\n"
|
||||
+ Zotero.getString('general.actionCannotBeUndone')
|
||||
);
|
||||
if (result) {
|
||||
Zotero.Items.emptyTrash();
|
||||
Zotero.purgeDataObjects(true);
|
||||
|
@ -1513,20 +1519,21 @@ var ZoteroPane = new function()
|
|||
var self = this;
|
||||
|
||||
Zotero.Commons.getBuckets(function () {
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var invalid = false;
|
||||
|
||||
while (true) {
|
||||
if (invalid) {
|
||||
// TODO: localize
|
||||
prompt.alert("", "Invalid title. Please try again.");
|
||||
ps.alert(null, "", "Invalid title. Please try again.");
|
||||
invalid = false;
|
||||
}
|
||||
|
||||
var newTitle = {};
|
||||
var result = prompt.prompt(
|
||||
null,
|
||||
"",
|
||||
// TODO: localize
|
||||
"Enter a title for this Zotero Commons collection:",
|
||||
|
@ -1566,12 +1573,13 @@ var ZoteroPane = new function()
|
|||
+ "Collection identifiers can contain basic Latin letters, numbers, "
|
||||
+ "hyphens, and underscores and must be no longer than 32 characters. "
|
||||
+ "Spaces and other characters are not allowed.";
|
||||
prompt.alert("", msg);
|
||||
ps.alert(null, "", msg);
|
||||
invalid = false;
|
||||
}
|
||||
|
||||
var newName = { value: origName };
|
||||
var result = prompt.prompt(
|
||||
var result = ps.prompt(
|
||||
null,
|
||||
"",
|
||||
// TODO: localize
|
||||
"Enter an identifier for the collection '" + title + "'.\n\n"
|
||||
|
@ -1697,9 +1705,9 @@ var ZoteroPane = new function()
|
|||
}
|
||||
}
|
||||
if (!canCopy) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", Zotero.getString("fileInterface.noReferencesError"));
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", Zotero.getString("fileInterface.noReferencesError"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2811,9 +2819,9 @@ var ZoteroPane = new function()
|
|||
|
||||
var itemGroup = ZoteroPane.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex);
|
||||
if (link && itemGroup.isWithinGroup()) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", "Linked files cannot be added to group libraries.");
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", "Linked files cannot be added to group libraries.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3285,16 +3293,16 @@ var ZoteroPane = new function()
|
|||
|
||||
|
||||
this.displayCannotEditLibraryMessage = function () {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", "You cannot make changes to the currently selected library.");
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", "You cannot make changes to the currently selected library.");
|
||||
}
|
||||
|
||||
|
||||
this.displayCannotEditLibraryFilesMessage = function () {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
pr.alert("", "You cannot add files to the currently selected library.");
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "", "You cannot add files to the currently selected library.");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -211,13 +211,14 @@ function updateStorageSettings(enabled, protocol, skipWarnings) {
|
|||
if (oldProtocol == 'zotero' && protocol == 'webdav') {
|
||||
var sql = "SELECT COUNT(*) FROM version WHERE schema='storage_zfs'";
|
||||
if (Zotero.DB.valueQuery(sql)) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ pr.BUTTON_DELAY_ENABLE;
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ ps.BUTTON_DELAY_ENABLE;
|
||||
var account = Zotero.Sync.Server.username;
|
||||
var index = pr.confirmEx(
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
// TODO: localize
|
||||
"Purge Attachment Files on Zotero Servers?",
|
||||
|
||||
|
@ -236,13 +237,15 @@ function updateStorageSettings(enabled, protocol, skipWarnings) {
|
|||
|
||||
Zotero.Sync.Storage.purgeDeletedStorageFiles('zfs', function (success) {
|
||||
if (success) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString("general.success"),
|
||||
"Attachment files from your personal library have been removed from the Zotero servers."
|
||||
);
|
||||
}
|
||||
else {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString("general.error"),
|
||||
"An error occurred. Please try again later."
|
||||
);
|
||||
|
@ -343,11 +346,12 @@ function handleSyncResetSelect(obj) {
|
|||
}
|
||||
|
||||
function handleSyncReset(action) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
if (!Zotero.Sync.Server.enabled) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString('general.error'),
|
||||
// TODO: localize
|
||||
"You must enter a username and password in the "
|
||||
|
@ -362,10 +366,11 @@ function handleSyncReset(action) {
|
|||
|
||||
switch (action) {
|
||||
case 'restore-from-server':
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ pr.BUTTON_POS_1_DEFAULT;
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ ps.BUTTON_POS_1_DEFAULT;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
// TODO: localize
|
||||
Zotero.getString('general.warning'),
|
||||
"All data in this copy of Zotero will be erased and replaced with "
|
||||
|
@ -390,8 +395,9 @@ function handleSyncReset(action) {
|
|||
file.append('restore-from-server');
|
||||
Zotero.File.putContents(file, '');
|
||||
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING);
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING);
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
Zotero.getString('general.restartRequired'),
|
||||
// TODO: localize
|
||||
"Firefox must be restarted to complete the restore process.",
|
||||
|
@ -421,10 +427,11 @@ function handleSyncReset(action) {
|
|||
break;
|
||||
|
||||
case 'restore-to-server':
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ pr.BUTTON_POS_1_DEFAULT;
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ ps.BUTTON_POS_1_DEFAULT;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
// TODO: localize
|
||||
Zotero.getString('general.warning'),
|
||||
"All data belonging to user '" + account + "' on the Zotero server "
|
||||
|
@ -448,14 +455,16 @@ function handleSyncReset(action) {
|
|||
|
||||
onSuccess: function () {
|
||||
Zotero.Sync.Runner.setSyncIcon();
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Restore Completed",
|
||||
"Data on the Zotero server has been successfully restored."
|
||||
);
|
||||
},
|
||||
onError: function (msg) {
|
||||
// TODO: combine with error dialog for regular syncs
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Restore Failed",
|
||||
"An error occurred uploading your data to the server.\n\n"
|
||||
+ "Click the sync error icon in the Zotero toolbar "
|
||||
|
@ -475,10 +484,11 @@ function handleSyncReset(action) {
|
|||
break;
|
||||
|
||||
case 'full-sync':
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ pr.BUTTON_POS_1_DEFAULT;
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ ps.BUTTON_POS_1_DEFAULT;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
// TODO: localize
|
||||
Zotero.getString('general.warning'),
|
||||
"The local Zotero library will be completely merged with data belonging to user '" + account + "' on the Zotero server. "
|
||||
|
@ -496,14 +506,16 @@ function handleSyncReset(action) {
|
|||
Zotero.Sync.Server.sync(/*{
|
||||
onSuccess: function () {
|
||||
Zotero.Sync.Runner.setSyncIcon();
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Full Sync Completed",
|
||||
"The local Zotero library has been merged with data from the Zotero server."
|
||||
);
|
||||
},
|
||||
onError: function (msg) {
|
||||
// TODO: combine with error dialog for regular syncs
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Full Sync Failed",
|
||||
"An error occurred while performing the full sync.\n\n"
|
||||
+ "Click the sync error icon in the Zotero toolbar "
|
||||
|
@ -522,10 +534,11 @@ function handleSyncReset(action) {
|
|||
break;
|
||||
|
||||
case 'reset-storage-history':
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ pr.BUTTON_POS_1_DEFAULT;
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ ps.BUTTON_POS_1_DEFAULT;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
// TODO: localize
|
||||
Zotero.getString('general.warning'),
|
||||
"All file sync history will be cleared.\n\n"
|
||||
|
@ -538,7 +551,8 @@ function handleSyncReset(action) {
|
|||
switch (index) {
|
||||
case 0:
|
||||
Zotero.Sync.Storage.resetAllSyncStates();
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"File Sync History Cleared",
|
||||
"The file sync history has been cleared."
|
||||
);
|
||||
|
@ -1375,11 +1389,12 @@ Zotero_Preferences.Debug_Output = {
|
|||
|
||||
Zotero.debug(xmlhttp.responseText);
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
if (!xmlhttp.responseXML) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString('general.error'),
|
||||
'Invalid response from server'
|
||||
);
|
||||
|
@ -1387,7 +1402,8 @@ Zotero_Preferences.Debug_Output = {
|
|||
}
|
||||
var reported = xmlhttp.responseXML.getElementsByTagName('reported');
|
||||
if (reported.length != 1) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString('general.error'),
|
||||
'The server returned an error. Please try again.'
|
||||
);
|
||||
|
@ -1395,7 +1411,8 @@ Zotero_Preferences.Debug_Output = {
|
|||
}
|
||||
|
||||
var reportID = reported[0].getAttribute('reportID');
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
"Submitted",
|
||||
"Debug output has been sent to the Zotero server.\n\n"
|
||||
+ "The Debug ID is D" + reportID + "."
|
||||
|
@ -1403,8 +1420,8 @@ Zotero_Preferences.Debug_Output = {
|
|||
}
|
||||
|
||||
var bufferUploader = function (data) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var oldLen = output.length;
|
||||
var newLen = data.length;
|
||||
|
@ -1414,7 +1431,8 @@ Zotero_Preferences.Debug_Output = {
|
|||
+ savings + "% savings)");
|
||||
|
||||
if (Zotero.Utilities.HTTP.browserIsOffline()) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString(
|
||||
'general.error',
|
||||
Zotero.appName + " is in offline mode."
|
||||
|
@ -1467,7 +1485,8 @@ Zotero_Preferences.Debug_Output = {
|
|||
req.sendAsBinary(data);
|
||||
}
|
||||
catch (e) {
|
||||
pr.alert(
|
||||
ps.alert(
|
||||
null,
|
||||
Zotero.getString('general.error'),
|
||||
"An error occurred sending debug output."
|
||||
);
|
||||
|
|
|
@ -56,11 +56,12 @@
|
|||
try {
|
||||
if (data.integrityCheck) {
|
||||
if (!Zotero.DB.integrityCheck()) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL);
|
||||
var index = pr.confirmEx(
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
Zotero.getString('general.error'),
|
||||
Zotero.getString('upgrade.integrityCheckFailed'),
|
||||
buttonFlags, Zotero.getString('upgrade.loadDBRepairTool'),
|
||||
|
|
|
@ -390,9 +390,9 @@ Zotero.Commons = new function() {
|
|||
|
||||
this.error = function (message) {
|
||||
Components.utils.reportError(message);
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
prompt.alert("Zotero Commons Error", message);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
ps.alert(null, "Zotero Commons Error", message);
|
||||
}
|
||||
|
||||
|
||||
|
@ -789,21 +789,22 @@ Zotero.Commons.Bucket.prototype.uploadItems = function (ids) {
|
|||
}
|
||||
}
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var validItemsMessage = "Only titled items with bibliographic metadata and at least one attached file can be added to the Zotero Commons.";
|
||||
|
||||
if (itemsToUpload.length == 0) {
|
||||
Zotero.debug("No regular items to upload");
|
||||
pr.alert("", validItemsMessage);
|
||||
ps.alert(null, "", validItemsMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemsToUpload.length != items.length) {
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL);
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
"",
|
||||
"Some of the dragged items will not be uploaded."
|
||||
+ "\n\n"
|
||||
|
@ -819,9 +820,10 @@ Zotero.Commons.Bucket.prototype.uploadItems = function (ids) {
|
|||
}
|
||||
}
|
||||
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL);
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
"Zotero Commons Upload",
|
||||
"By uploading items to Zotero Commons you agree to the terms of use at zotero.org and archive.org. "
|
||||
+ "Please make sure metadata for your items is set properly."
|
||||
|
|
|
@ -219,8 +219,8 @@ Zotero.Schema = new function(){
|
|||
// This is mostly temporary
|
||||
// TEMP - NSF
|
||||
this.importSchema = function (str, uri) {
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
if (!uri.match(/https?:\/\/([^\.]+\.)?zotero.org\//)) {
|
||||
Zotero.debug("Ignoring schema file from non-zotero.org domain");
|
||||
|
@ -234,7 +234,7 @@ Zotero.Schema = new function(){
|
|||
if (str == "%%%ZOTERO_NSF_TEMP_INSTALL%%%") {
|
||||
Zotero.debug(Zotero.ItemTypes.getID("nsfReviewer"));
|
||||
if (Zotero.ItemTypes.getID("nsfReviewer")) {
|
||||
prompt.alert("Zotero Item Type Already Exists", "The 'NSF Reviewer' item type already exists in Zotero.");
|
||||
ps.alert(null, "Zotero Item Type Already Exists", "The 'NSF Reviewer' item type already exists in Zotero.");
|
||||
Zotero.debug("nsfReviewer item type already exists");
|
||||
return;
|
||||
}
|
||||
|
@ -305,12 +305,12 @@ Zotero.Schema = new function(){
|
|||
s.addCondition('tag', 'isNot', 'Completed');
|
||||
s.save();
|
||||
|
||||
prompt.alert("Zotero Item Type Added", "The 'NSF Reviewer' item type and 'Overdue NSF Reviewers' saved search have been installed.");
|
||||
ps.alert(null, "Zotero Item Type Added", "The 'NSF Reviewer' item type and 'Overdue NSF Reviewers' saved search have been installed.");
|
||||
}
|
||||
else if (str == "%%%ZOTERO_NSF_TEMP_UNINSTALL%%%") {
|
||||
var itemTypeID = Zotero.ItemTypes.getID('nsfReviewer');
|
||||
if (!itemTypeID) {
|
||||
prompt.alert("Zotero Item Type Does Not Exist", "The 'NSF Reviewer' item type does not exist in Zotero.");
|
||||
ps.alert(null, "Zotero Item Type Does Not Exist", "The 'NSF Reviewer' item type does not exist in Zotero.");
|
||||
Zotero.debug("nsfReviewer item types doesn't exist", 2);
|
||||
return;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ Zotero.Schema = new function(){
|
|||
s2.addCondition('itemType', 'is', 'nsfReviewer');
|
||||
s2.addCondition('deleted', 'true');
|
||||
if (s.search() || s2.search()) {
|
||||
prompt.alert("Error", "All 'NSF Reviewer' items must be deleted before the item type can be removed from Zotero.");
|
||||
ps.alert(null, "Error", "All 'NSF Reviewer' items must be deleted before the item type can be removed from Zotero.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ Zotero.Schema = new function(){
|
|||
|
||||
_reloadSchema();
|
||||
|
||||
prompt.alert("Zotero Item Type Removed", "The 'NSF Reviewer' item type has been uninstalled.");
|
||||
ps.alert(null, "Zotero Item Type Removed", "The 'NSF Reviewer' item type has been uninstalled.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2941,10 +2941,10 @@ Zotero.Schema = new function(){
|
|||
//
|
||||
// Conditional should be same as in showUpgradeWizard()
|
||||
if (e.name && e.name == "NS_ERROR_FAILURE" && e.message.match(/nsIFile\.moveTo/)) {
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.getService(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var title = Zotero.getString('upgrade.failed.title');
|
||||
pr.alert(title, Zotero.getString('upgrade.couldNotMigrate') + "\n\n" + Zotero.getString('upgrade.couldNotMigrate.restart'));
|
||||
ps.alert(null, title, Zotero.getString('upgrade.couldNotMigrate') + "\n\n" + Zotero.getString('upgrade.couldNotMigrate.restart'));
|
||||
}
|
||||
|
||||
throw(e);
|
||||
|
|
|
@ -1582,12 +1582,13 @@ Zotero.Sync.Storage = new function () {
|
|||
setTimeout(function () {
|
||||
var group = Zotero.Groups.get(e.data.groupID);
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ pr.BUTTON_DELAY_ENABLE;
|
||||
var index = pr.confirmEx(
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ ps.BUTTON_DELAY_ENABLE;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
Zotero.getString('general.warning'),
|
||||
Zotero.getString('sync.storage.error.fileEditingAccessLost', group.name) + "\n\n"
|
||||
+ Zotero.getString('sync.error.groupWillBeReset') + "\n\n"
|
||||
|
|
|
@ -836,22 +836,22 @@ Zotero.Sync.Runner = new function () {
|
|||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
// Warning
|
||||
if (status == 'warning') {
|
||||
var title = Zotero.getString('general.warning');
|
||||
|
||||
// If secondary button not specified, just use an alert
|
||||
if (!buttonText) {
|
||||
pr.alert(title, message);
|
||||
ps.alert(null, title, message);
|
||||
return;
|
||||
}
|
||||
|
||||
var buttonFlags = pr.BUTTON_POS_0 * pr.BUTTON_TITLE_OK
|
||||
+ pr.BUTTON_POS_1 * pr.BUTTON_TITLE_IS_STRING;
|
||||
Zotero.debug(buttonFlags);
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_OK
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
title,
|
||||
message,
|
||||
buttonFlags,
|
||||
|
@ -880,13 +880,14 @@ Zotero.Sync.Runner = new function () {
|
|||
}
|
||||
// If secondary button is explicitly null, just use an alert
|
||||
else if (buttonText === null) {
|
||||
pr.alert(title, message);
|
||||
ps.alert(null, title, message);
|
||||
return;
|
||||
}
|
||||
|
||||
var buttonFlags = pr.BUTTON_POS_0 * pr.BUTTON_TITLE_OK
|
||||
+ pr.BUTTON_POS_1 * pr.BUTTON_TITLE_IS_STRING;
|
||||
var index = pr.confirmEx(
|
||||
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_OK
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
Zotero.getString('general.error'),
|
||||
message,
|
||||
buttonFlags,
|
||||
|
@ -1844,12 +1845,13 @@ Zotero.Sync.Server = new function () {
|
|||
var libraryID = parseInt(firstChild.getAttribute('libraryID'));
|
||||
var group = Zotero.Groups.getByLibraryID(libraryID);
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ pr.BUTTON_DELAY_ENABLE;
|
||||
var index = pr.confirmEx(
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ ps.BUTTON_DELAY_ENABLE;
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
Zotero.getString('general.warning'),
|
||||
Zotero.getString('sync.error.writeAccessLost', group.name) + "\n\n"
|
||||
+ Zotero.getString('sync.error.groupWillBeReset') + "\n\n"
|
||||
|
@ -2015,13 +2017,13 @@ Zotero.Sync.Server = new function () {
|
|||
if (lastUserID && lastUserID != userID) {
|
||||
var groups = Zotero.Groups.getAll();
|
||||
|
||||
var pr = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
|
||||
+ (pr.BUTTON_POS_2) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ pr.BUTTON_POS_1_DEFAULT
|
||||
+ pr.BUTTON_DELAY_ENABLE;
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL)
|
||||
+ (ps.BUTTON_POS_2) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ ps.BUTTON_POS_1_DEFAULT
|
||||
+ ps.BUTTON_DELAY_ENABLE;
|
||||
|
||||
var msg = "This Zotero database was last synced with a different "
|
||||
+ "zotero.org account ('" + lastUsername + "') from the "
|
||||
|
@ -2063,7 +2065,8 @@ Zotero.Sync.Server = new function () {
|
|||
}
|
||||
|
||||
if (!noPrompt) {
|
||||
var index = pr.confirmEx(
|
||||
var index = ps.confirmEx(
|
||||
null,
|
||||
Zotero.getString('general.warning'),
|
||||
msg,
|
||||
buttonFlags,
|
||||
|
@ -2183,10 +2186,10 @@ Zotero.Sync.Server = new function () {
|
|||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
var pr = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
|
||||
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL);
|
||||
var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
|
||||
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
|
||||
// TODO: localize
|
||||
if (e.error == Zotero.Error.ERROR_SYNC_USERNAME_NOT_SET) {
|
||||
var title = Zotero.getString('sync.error.usernameNotSet');
|
||||
|
@ -2197,7 +2200,7 @@ Zotero.Sync.Server = new function () {
|
|||
var msg = "The Zotero sync server did not accept your username and password.\n\n"
|
||||
+ "Please check that you have entered your zotero.org login information correctly in the Zotero sync preferences.";
|
||||
}
|
||||
var index = pr.confirmEx(
|
||||
var index = ps.confirmEx(
|
||||
win,
|
||||
title,
|
||||
msg,
|
||||
|
|
|
@ -1519,8 +1519,8 @@ Zotero.Prefs = new function(){
|
|||
|
||||
// Import settings bundles
|
||||
this.importSettings = function (str, uri) {
|
||||
var prompt = Components.classes["@mozilla.org/network/default-prompt;1"]
|
||||
.createInstance(Components.interfaces.nsIPrompt);
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
if (!uri.match(/https:\/\/([^\.]+\.)?zotero.org\//)) {
|
||||
Zotero.debug("Ignoring settings file not from https://zotero.org");
|
||||
|
@ -1530,7 +1530,8 @@ Zotero.Prefs = new function(){
|
|||
str = Zotero.Utilities.prototype.trim(str.replace(/<\?xml.*\?>\s*/, ''));
|
||||
Zotero.debug(str);
|
||||
|
||||
var confirm = prompt.confirm(
|
||||
var confirm = ps.confirm(
|
||||
null,
|
||||
"",
|
||||
"Apply settings from zotero.org?"
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue