commit 23704117fbbfc90f18e90c61874fa120e6e1de3a Author: Kathy Brade brade@pearlcrescent.com Date: Wed Feb 11 15:09:24 2015 -0500
Bug 13271: Ask about bridges before proxy in wizard.
Reorder wizardpage elements and fix associated logic. Replace "proxy" with "local proxy" within prompts to help users distinguish bridges from proxies that are needed for local Internet access. Reorder Network Settings dialog elements to match wizard order. Remove unneeded label=" " from wizardpage elements. Linux and Windows: Fix problem where prev/next buttons were displayed on first wizard page. Use showWizardNavButtons() in more places. --- src/chrome/content/network-settings-wizard.xul | 62 +++++++++++----------- src/chrome/content/network-settings.js | 67 ++++++++++++++---------- src/chrome/content/network-settings.xul | 16 +++--- src/chrome/locale/en/network-settings.dtd | 8 +-- 4 files changed, 83 insertions(+), 70 deletions(-)
diff --git a/src/chrome/content/network-settings-wizard.xul b/src/chrome/content/network-settings-wizard.xul index 33ba6c5..9c75894 100644 --- a/src/chrome/content/network-settings-wizard.xul +++ b/src/chrome/content/network-settings-wizard.xul @@ -29,7 +29,7 @@
<!-- This page requires a setTimeout for onpageshow because it may be shown first --> - <wizardpage label=" " pageid="first" next="proxy" onextra2="onCopyLog();" + <wizardpage pageid="first" next="proxy" onextra2="onCopyLog();" onpageshow="setTimeout(function() { showWizardNavButtons(false); }, 0);"> <hbox class="tbb-header"> <vbox class="tbb-logo-box" align="start"> @@ -54,72 +54,74 @@ </vbox> </wizardpage>
- <wizardpage label=" " pageid="proxy" next="bridges" onextra2="onCopyLog();" + <wizardpage pageid="bridges" next="proxy" onextra2="onCopyLog();" onpageshow="showWizardNavButtons(true);" - onpageadvanced="return onWizardProxyNext(this);"> + onpageadvanced="return onWizardUseBridgesNext(this)"> <vbox class="tbb-logo-box" align="start"> <image class="tbb-logo" /> </vbox> <separator class="tbb-logo-separator" /> <hbox> <vbox flex="1"> - <label class="question">&torSettings.proxyQuestion;</label> - <radiogroup id="proxyRadioGroup"> - <radio id="proxyRadioYes" label="&torSettings.yes;" /> - <radio id="proxyRadioNo" label="&torSettings.no;" selected="true" /> + <label class="question">&torSettings.bridgeQuestion;</label> + <radiogroup id="useBridgesRadioGroup"> + <radio id="bridgesRadioYes" label="&torSettings.yes;" /> + <radio id="bridgesRadioNo" label="&torSettings.no;" selected="true" /> </radiogroup> - <description class="questionHelp">&torSettings.proxyHelp; + <description class="questionHelp">&torSettings.bridgeHelp; </description> </vbox> </hbox> </wizardpage>
- <wizardpage pageid="proxyYES" next="bridges" onextra2="onCopyLog();" - onpageadvanced="return (getAndValidateProxySettings() != null)"> + <wizardpage pageid="bridgeSettings" next="proxy" onextra2="onCopyLog();" + onpageshow="onWizardBridgeSettingsShow();"> <vbox class="tbb-logo-box" align="start"> <image class="tbb-logo" /> </vbox> <separator class="tbb-logo-separator" /> - <label class="instructions">&torSettings.enterProxy;</label> - <groupbox id="proxySpecificSettings" /> + <vbox> + <label id="bridgeSettingsPrompt" + class="question">&torSettings.bridgeSettingsPrompt;</label> + <groupbox id="bridgeSpecificSettings" /> + </vbox> </wizardpage>
- <wizardpage pageid="bridges" onextra2="onCopyLog();" - onpageshow="onWizardUseBridgesRadioChange(this)"> + <wizardpage pageid="proxy" onextra2="onCopyLog();" + onpageshow="onWizardUseProxyRadioChange()" + onpageadvanced="return onWizardProxyNext(this);"> <vbox class="tbb-logo-box" align="start"> <image class="tbb-logo" /> </vbox> <separator class="tbb-logo-separator" /> <hbox> <vbox flex="1"> - <label class="question">&torSettings.bridgeQuestion;</label> - <radiogroup id="useBridgesRadioGroup" - oncommand="onWizardUseBridgesRadioChange()"> - <radio id="bridgesRadioYes" label="&torSettings.yes;" /> - <radio id="bridgesRadioNo" label="&torSettings.no;" selected="true" /> + <label class="question">&torSettings.proxyQuestion;</label> + <radiogroup id="proxyRadioGroup" + oncommand="onWizardUseProxyRadioChange()"> + <radio id="proxyRadioYes" label="&torSettings.yes;" /> + <radio id="proxyRadioNo" label="&torSettings.no;" selected="true" /> </radiogroup> - <description class="questionHelp">&torSettings.bridgeHelp; + <description class="questionHelp">&torSettings.proxyHelp; </description> </vbox> </hbox> </wizardpage>
- <wizardpage label=" " pageid="bridgeSettings" onextra2="onCopyLog();" - onpageshow="onWizardBridgeSettingsShow()"> + <wizardpage pageid="proxyYES" onextra2="onCopyLog();" + onpageshow="onWizardProxySettingsShow()" + onpageadvanced="return (getAndValidateProxySettings() != null)"> <vbox class="tbb-logo-box" align="start"> <image class="tbb-logo" /> </vbox> <separator class="tbb-logo-separator" /> - <vbox> - <label id="bridgeSettingsPrompt" - class="question">&torSettings.bridgeSettingsPrompt;</label> - <groupbox id="bridgeSpecificSettings" /> - </vbox> + <label class="instructions">&torSettings.enterProxy;</label> + <groupbox id="proxySpecificSettings" /> </wizardpage>
<!-- This page requires a setTimeout for onpageshow because it may be shown first --> - <wizardpage label=" " pageid="startingTor" next="notUsed" + <wizardpage pageid="startingTor" next="notUsed" onpageshow="setTimeout(function() { showWizardNavButtons(false); }, 0);"> <spring flex="1" /> <hbox> @@ -130,7 +132,7 @@ <spring flex="1" /> </wizardpage>
- <wizardpage label=" " pageid="errorPanel" next="notUsed" + <wizardpage pageid="errorPanel" next="notUsed" onpageshow="showWizardNavButtons(false);" onextra2="onCopyLog();"> <spring flex="1" /> @@ -149,7 +151,7 @@ <spring flex="1" /> </wizardpage>
- <wizardpage class="help" label=" " pageid="bridgeHelp" next="notUsed" + <wizardpage class="help" pageid="bridgeHelp" next="notUsed" onpageadvanced="closeHelp(); return false;"> <vbox id="bridgeHelpContent" /> </wizardpage> diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js index aa07e1e..3277553 100644 --- a/src/chrome/content/network-settings.js +++ b/src/chrome/content/network-settings.js @@ -248,7 +248,7 @@ function getWizard()
function onWizardConfigure() { - getWizard().advance("proxy"); + getWizard().advance("bridges"); }
@@ -257,34 +257,51 @@ function onWizardProxyNext(aWizPage) if (aWizPage) { var hasProxy = getElemValue("proxyRadioYes", false); - aWizPage.next = (hasProxy) ? "proxyYES" : "bridges"; + aWizPage.next = (hasProxy) ? "proxyYES" : ""; }
return true; }
-function onWizardUseBridgesRadioChange(aWizPage) +function onWizardUseProxyRadioChange() { var wizard = getWizard(); - if (!aWizPage) - aWizPage = wizard.currentPage; + if (wizard && wizard.currentPage) + { + var hasProxy = getElemValue("proxyRadioYes", false); + wizard.setAttribute("lastpage", !hasProxy); + wizard._wizardButtons.onPageChange(); + } +} + + +function onWizardProxySettingsShow() +{ + var wizard = getWizard(); + if (wizard) + { + wizard.setAttribute("lastpage", true); + wizard._wizardButtons.onPageChange(); + } +} + + +function onWizardUseBridgesNext(aWizPage) +{ if (aWizPage) { var useBridges = getElemValue("bridgesRadioYes", false); - aWizPage.next = (useBridges) ? "bridgeSettings" : ""; - wizard.setAttribute("lastpage", !useBridges); - wizard._wizardButtons.onPageChange(); + aWizPage.next = (useBridges) ? "bridgeSettings" : "proxy"; } + + return true; }
function onWizardBridgeSettingsShow() { - var wizard = getWizard(); - wizard.setAttribute("lastpage", true); - wizard._wizardButtons.onPageChange(); - var btn = document.documentElement.getButton("finish"); + var btn = document.documentElement.getButton("next"); if (btn) btn.focus(); } @@ -335,10 +352,7 @@ var gObserver = { var haveWizard = (getWizard() != null); showPanel(); if (haveWizard) - { - showOrHideButton("back", true, false); - showOrHideButton("next", true, false); - } + showWizardNavButtons(true); readTorSettings(); } else if (kTorProcessDidNotStartTopic == aTopic) @@ -400,8 +414,8 @@ function readTorSettings() try { // TODO: retrieve > 1 key at one time inside initProxySettings() et al. - didSucceed = initProxySettings() && initFirewallSettings() && - initBridgeSettings(); + didSucceed = initBridgeSettings() && + initProxySettings() && initFirewallSettings(); } catch (e) { TorLauncherLogger.safelog(4, "Error in readTorSettings: ", e); }
@@ -437,6 +451,9 @@ function showPanel(aPanelID) else if (wizard.currentPage.pageid != aPanelID) wizard.goTo(aPanelID);
+ if (wizard && (aPanelID == "first")) + setTimeout( function() { showWizardNavButtons(false); }, 0); + showOrHideButton("accept", (aPanelID == "settings"), true); }
@@ -466,10 +483,7 @@ function showStartingTorPanel() { var haveWizard = (getWizard() != null); if (haveWizard) - { - showOrHideButton("back", false, false); - showOrHideButton("next", false, false); - } + showWizardNavButtons(false);
showPanel("startingTor"); } @@ -505,10 +519,7 @@ function showErrorMessage(aTorExited, aErrorMsg)
var haveWizard = (getWizard() != null); if (haveWizard) - { - showOrHideButton("back", false, false); - showOrHideButton("next", false, false); - } + showWizardNavButtons(false);
var haveErrorOrWarning = (gTorProcessService.TorBootstrapErrorOccurred || gProtocolSvc.TorLogHasWarnOrErr) @@ -969,8 +980,8 @@ function applySettings() var didSucceed = false; try { - didSucceed = applyProxySettings() && applyFirewallSettings() && - applyBridgeSettings(); + didSucceed = applyBridgeSettings() && + applyProxySettings() && applyFirewallSettings(); } catch (e) { TorLauncherLogger.safelog(4, "Error in applySettings: ", e); }
diff --git a/src/chrome/content/network-settings.xul b/src/chrome/content/network-settings.xul index 4f98559..9fffbec 100644 --- a/src/chrome/content/network-settings.xul +++ b/src/chrome/content/network-settings.xul @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!-- - - Copyright (c) 2014, The Tor Project, Inc. + - Copyright (c) 2015, The Tor Project, Inc. - See LICENSE for licensing information. - vim: set sw=2 sts=2 ts=8 et syntax=xml: --> @@ -33,6 +33,13 @@ <deck id="deck"> <vbox id="settings"> <vbox> + <checkbox id="useBridges" groupboxID="bridgeSpecificSettings" + label="&torsettings.useBridges.checkbox;" + oncommand="toggleElemUI(this);" /> + <groupbox id="bridgeSpecificSettings" /> + </vbox> + + <vbox> <separator orient="horizontal" class="thin" /> <checkbox id="useProxy" groupboxID="proxySpecificSettings" label="&torsettings.useProxy.checkbox;" @@ -46,13 +53,6 @@ oncommand="toggleElemUI(this)"/> <groupbox id="firewallSpecificSettings" /> </vbox> - - <vbox> - <checkbox id="useBridges" groupboxID="bridgeSpecificSettings" - label="&torsettings.useBridges.checkbox;" - oncommand="toggleElemUI(this);" /> - <groupbox id="bridgeSpecificSettings" /> - </vbox> </vbox> <vbox id="startingTor"> <spring flex="1" /> diff --git a/src/chrome/locale/en/network-settings.dtd b/src/chrome/locale/en/network-settings.dtd index 3661088..5ce6ee8 100644 --- a/src/chrome/locale/en/network-settings.dtd +++ b/src/chrome/locale/en/network-settings.dtd @@ -9,15 +9,15 @@
<!ENTITY torSettings.firstQuestion "Which of the following best describes your situation?"> <!ENTITY torSettings.configurePrompt1 "This computer's Internet connection is censored or proxied."> -<!ENTITY torSettings.configurePrompt2 "I need to configure bridge or proxy settings."> +<!ENTITY torSettings.configurePrompt2 "I need to configure bridge or local proxy settings."> <!ENTITY torSettings.configure "Configure"> <!ENTITY torSettings.connectPrompt2 "I would like to connect directly to the Tor network."> <!ENTITY torSettings.connectPrompt3 "This will work in most situations."> <!ENTITY torSettings.connect "Connect">
-<!ENTITY torSettings.proxyQuestion "Does this computer need to use a proxy to access the Internet?"> +<!ENTITY torSettings.proxyQuestion "Does this computer need to use a local proxy to access the Internet?"> <!-- see https://www.torproject.org/docs/proxychain.html.en --> -<!ENTITY torSettings.proxyHelp "If you are not sure how to answer this question, look at the Internet settings in another browser to see whether it is configured to use a proxy."> +<!ENTITY torSettings.proxyHelp "If you are not sure how to answer this question, look at the Internet settings in another browser to see whether it is configured to use a local proxy."> <!ENTITY torSettings.enterProxy "Enter the proxy settings."> <!ENTITY torSettings.bridgeQuestion "Does your Internet Service Provider (ISP) block or otherwise censor connections to the Tor Network?"> <!ENTITY torSettings.bridgeHelp "If you are not sure how to answer this question, choose No.  If you choose Yes, you will be asked to configure Tor Bridges, which are unlisted relays that make it more difficult to block connections to the Tor Network."> @@ -30,7 +30,7 @@
<!ENTITY torsettings.optional "Optional">
-<!ENTITY torsettings.useProxy.checkbox "This computer needs to use a proxy to access the Internet"> +<!ENTITY torsettings.useProxy.checkbox "This computer needs to use a local proxy to access the Internet"> <!ENTITY torsettings.useProxy.type "Proxy Type:"> <!ENTITY torsettings.useProxy.address "Address:"> <!ENTITY torsettings.useProxy.address.placeholder "IP address or hostname">