commit 1746450abf022fdb41093c8837c8bfb2afeb0ec8
parent 0bd4f19df1be9492a9c8af2307d6cb5b17853fbd
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 20 Nov 2009 08:22:08 +0000
- Add separate message for group quota errors
- Allow errors to suppress "Report Error..." button
Diffstat:
2 files changed, 60 insertions(+), 19 deletions(-)
diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js
@@ -419,8 +419,47 @@ Zotero.Sync.Storage.Session.ZFS.prototype._getFileUploadParameters = function (i
self.onError(e);
}
else {
+ // TODO: localize
+
+ var text, buttonText = null, buttonCallback;
+
+ // Group file
+ if (item.libraryID) {
+ var group = Zotero.Groups.getByLibraryID(item.libraryID);
+ text = "The group '" + group.name + "' has reached its "
+ + "Zotero File Storage quota. Some files were not uploaded. "
+ + "Other Zotero data will continue to sync to the server.\n\n"
+ + "The group owner can increase the group's storage capacity "
+ + "from the storage settings section on zotero.org.";
+ }
+ // Personal file
+ else {
+ text = "You have reached your Zotero File Storage quota. Some files were not uploaded. "
+ + "Other Zotero data will continue to sync to the server.\n\n"
+ + "See your zotero.org account settings for additional storage options.";
+ buttonText = "Open Account Settings";
+ buttonCallback = function () {
+ var url = "https://www.zotero.org/settings/storage";
+
+ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var win = wm.getMostRecentWindow("navigator:browser");
+ var browser = win.getBrowser();
+ browser.selectedTab = browser.addTab(url);
+ }
+ }
+
Zotero.debug(req.responseText);
- var e = new Zotero.Error("File would exceed Zotero File Storage quota", "ZFS_OVER_QUOTA");
+
+ var e = new Zotero.Error(
+ "File would exceed Zotero File Storage quota",
+ "ZFS_OVER_QUOTA",
+ {
+ dialogText: text,
+ dialogButtonText: buttonText,
+ dialogButtonCallback: buttonCallback
+ }
+ );
self.onError(e);
}
return;
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -722,26 +722,22 @@ Zotero.Sync.Runner = new function () {
var buttonCallback;
if (e) {
- if (e.error == Zotero.Error.ERROR_ZFS_OVER_QUOTA) {
- // TODO: localize
- message = "You have reached your Zotero File Storage quota. Some files were not synced. "
- + "Other Zotero data will continue to sync to the server.\n\n"
- + "See your zotero.org account settings for additional storage options.";
-
- buttonText = "Open Account Settings";
- buttonCallback = function () {
- var url = "https://www.zotero.org/settings/storage";
-
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
- var browser = win.getBrowser();
- browser.selectedTab = browser.addTab(url);
+ if (e.data) {
+ if (e.data.dialogText) {
+ message = e.data.dialogText;
+ }
+ if (typeof e.data.dialogButtonText != 'undefined') {
+ buttonText = e.data.dialogButtonText;
+ buttonCallback = e.data.dialogButtonCallback;
}
}
-
if (!message) {
- message = e.message ? e.message : e;
+ if (e.message) {
+ message = e.message;
+ }
+ else {
+ message = e;
+ }
}
}
@@ -764,7 +760,7 @@ Zotero.Sync.Runner = new function () {
// If secondary button not specified, just use an alert
if (!buttonText) {
- prompt.alert(title, message);
+ pr.alert(title, message);
return;
}
@@ -793,6 +789,12 @@ Zotero.Sync.Runner = new function () {
Components.utils.reportError(message);
}
+ // If secondary button is explicitly null, just use an alert
+ if (buttonText === null) {
+ pr.alert(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(