- Fix errors when auto-saving proxies with transparent setting off (due to proxy variable not being set)

- Fixed display of proxy settings validation failure window
- Tweaked validation failure window title
This commit is contained in:
Dan Stillman 2008-11-14 19:15:18 +00:00
parent 03a0cced19
commit 3d615f2b9c
3 changed files with 27 additions and 18 deletions

View file

@ -111,8 +111,13 @@ var Zotero_ProxyEditor = new function() {
var hasErrors = proxy.validate();
if(hasErrors) {
Components.interfaces.nsIPromptService.getService().alert(window,
Zotero.getString("proxies.error"), Zotero.getString("proxies.error."+hasErrors));
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
promptService.alert(
window,
Zotero.getString("proxies.error"),
Zotero.getString("proxies.error." + hasErrors)
);
if(window.arguments && window.arguments[0]) proxy.revert();
return false;
}

View file

@ -95,25 +95,29 @@ Zotero.Proxies = new function() {
Components.utils.reportError(e);
}
if (!proxy) {
continue;
}
// if transparent is turned off, just save the proxy
if(!transparent) {
// if transparent is turned off, just save the proxy
proxy.save();
} else if(proxy) {
// otherwise, make sure we want it
var io = {site:proxy.hosts[0], proxy:channel.URI.hostPort};
var window = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");
window.openDialog('chrome://zotero/content/proxy.xul', '', 'chrome,modal', io);
if(io.add) proxy.save();
if(io.disable) {
transparent = false;
Zotero.Prefs.set("proxies.transparent", false);
}
break;
}
// otherwise, make sure we want it
var io = {site:proxy.hosts[0], proxy:channel.URI.hostPort};
var window = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");
window.openDialog('chrome://zotero/content/proxy.xul', '', 'chrome,modal', io);
if(io.add) proxy.save();
if(io.disable) {
transparent = false;
Zotero.Prefs.set("proxies.transparent", false);
}
break;
}
}

View file

@ -509,7 +509,7 @@ sync.storage.kbRemaining = %SKB remaining
sync.storage.none = None
proxies.multiSite = Multi-Site
proxies.error = Information Validation Error
proxies.error = Invalid Proxy Settings
proxies.error.scheme.noHTTP = Valid proxy schemes must start with "http://" or "https://"
proxies.error.host.invalid = You must enter a full hostname for the site served by this proxy (e.g., jstor.org).
proxies.error.scheme.noHost = A multi-site proxy scheme must contain the host variable (%h).