Bug 492274 - Remove unused enableURLs code and strings in autoconfig, r=bienvenu

This commit is contained in:
Phil Ringnalda 2009-05-11 19:20:34 -07:00
Родитель 008b7860a7
Коммит eaf72735e8
6 изменённых файлов: 1 добавлений и 212 удалений

Просмотреть файл

@ -47,9 +47,3 @@
<!ENTITY customfields-intro2.descr "Please look up the information in the paper or email with your account details that the provider sent you, usually when you signed up there, and enter it below.">
<!ENTITY customfields-cancel.label "Back">
<!ENTITY customfields-ok.label "OK">
<!ENTITY enableURLs-header.label "Enable account for &brandShortName;">
<!ENTITY enableURLs-intro1.descr "Your provider asks you to do some additional action to activate your account for use with &brandShortName;.">
<!ENTITY enableURLs-intro2.descr "Please visit the web pages below, login to your account where needed, and then follow the action mentioned below or on the page.">
<!ENTITY enableURLs-cancel.label "Back">
<!ENTITY enableURLs-ok.label "I've done all that">

Просмотреть файл

@ -50,6 +50,3 @@ password.error=Login did not succeed. Please double-check username and password.
customfields_example.label=Example:
customfields_empty.error=You need to fill out these fields, with the information given to you by your provider
customfields_tooMany.error=Too many input fields in config XML file
enableURLs_notvisited.error=You need to visit all these pages and perform the mentioned action for your account. Otherwise, your account will not work with Thunderbird.
enableURLs_openlink.label=Open
enableURLs_tooMany.error=Too many URLs in config XML file

Просмотреть файл

@ -95,7 +95,6 @@ function AccountConfig()
emailAddress : "%EMAILADDRESS%"
};
this.inputFields = [];
this.enableURLs = [];
this.domains = [];
};
@ -109,8 +108,6 @@ AccountConfig.prototype =
displayShortName : null,
// Array of Objects with properties varname (value without %), displayName, exampleValue
inputFields : null,
// Array of Objects with properties url {String}, instruction {String}
enableURLs : null,
// Array of Strings - email address domains for which this config is applicable
domains : null,
/**

Просмотреть файл

@ -125,7 +125,6 @@ EmailConfigWizard.prototype =
this._outgoingWarning = 'cleartext';
this._userPickedOutgoingServer = false;
this._customFields = {}; // map of: field ID from config file {String} -> field value entered by user {String}
this._visitedEnableURLs = {}; // map of: URL {String} -> visited {bool}
if (window.arguments && window.arguments[0] &&
window.arguments[0].msgWindow)
@ -490,7 +489,7 @@ EmailConfigWizard.prototype =
return this._foundConfig2(config);
},
// Continuation of foundConfig2() after custom fields and enableURLs.
// Continuation of foundConfig2() after custom fields.
_foundConfig2 : function(config)
{
this._currentConfigFilledIn = config.copy();
@ -1458,155 +1457,3 @@ CustomFieldsDialog.prototype =
}
var gCustomFieldsDialog = null;
/**
* Called by dialog logic, if the user needs to visit certain pages and do stuff
* in order for his account to work with Thunderbird.
* The dialog just shows all these descriptions, and clickable links,
* and tracks the clicks, and returns whether the URLs were opened.
*
* @param enableURLs {Array} @see AccountConfig.enableURLs
* @param alreadyVisited {Object} Map of: URL {String} -> bool
* URLs that the user has already visited in a previous run of the dialog.
* May be null.
*
*/
function EnableURLsDialog(enableURLs, alreadyVisited)
{
if (!alreadyVisited)
alreadyVisited = {};
this._visitedURLs = alreadyVisited;
}
EnableURLsDialog.prototype =
{
/**
* Open dialog, unless the needed data is already in |alreadyVisited|.
* @param successCallback, cancelCallback @see open()
*/
openIfNeeded : function(successCallback, cancelCallback)
{
var needVisits = false;
for (var i = 0; i < this._enableURLs.length; i++)
{
let url = this._enableURLs[i].url;
if (!this._visitedURLs[url])
needVisits = true;
}
if (!needVisits)
{
successCallback(this._visitedURLs);
return;
}
this.open(successCallback, cancelCallback);
},
/**
* @param successCallback {Function(this._visitedEnableURLs)}
* Will be called when the user visited all URLs and clicked OK.
* The first parameter contains the URLs (as map URL {String} -> bool).
*
* @param cancelCallback {Function()}
* The user cancelled the dialog
*/
open : function(successCallback, cancelCallback)
{
this._successCallback = successCallback;
this._cancelCallback = cancelCallback;
var rows = getElementById("enableURLs-rows");
var me = this;
// first, clear dialog from any possible previous use
while (rows.hasChildNodes())
rows.removeChild(rows.firstChild);
for (var i = 0; i < this._enableURLs.length; i++)
{
let url = this._enableURLs[i].url;
let instr = this._enableURLs[i].instruction;
// only 5 URLs allowed per spec, to cut down on dialog size and preserve sanity
if (i >= 5)
throw new Exception(gStringsBundle.getString("enableURLs_tooMany.error"));
// Create UI widgets
let row = document.createElement("row");
let descr = document.createElement("description");
let link = document.createElement("label");
let checkbox = document.createElement("checkbox");
row.appendChild(descr);
row.appendChild(link);
row.appendChild(checkbox);
rows.appendChild(row);
descr.setAttribute("class", "enableURLs-label");
link.setAttribute("class", "enableURLs-link text-link"); // class=text-link is the XUL magic which makes it a link
checkbox.setAttribute("class", "enableURLs-checkbox");
checkbox.disabled = true;
link.setAttribute("value", gStringsBundle.getString("enableURLs_openlink.label"));
link.addEventListener("click", function() { me.onLinkClick(link, checkbox); }, true );
// TODO accessibility Bug 475260: using onclick, because <label class="text-link"> does not send oncommand.
// Set labels and values
// URL was already sanitized in readFrom XML.js as loadable
descr.textContent = instr;
link.setAttribute("href", url);
checkbox.checked = this._visitedURLs[url] ? true : false;
}
_hide("mastervbox");
_show("enableURLs-box");
},
onLinkClick : function(linkLabel, checkbox)
{
var url = linkLabel.getAttribute("href");
this._visitedURLs[url] = true;
checkbox.setAttribute("checked", "true");
},
// UI button pressed
onCancel : function()
{
_show("mastervbox");
_hide("enableURLs-box");
gCustomFieldsDialog = null;
try {
this._cancelCallback();
} catch (e) {
// XXX TODO FIXME
alert(e.message); throw e; }
},
// UI button pressed
onOK : function()
{
try {
for (var i = 0; i < this._enableURLs.length; i++)
{
let url = this._enableURLs[i].url;
gEmailWizardLogger.info(url + " has been visited: " + this._visitedURLs[url]);
if (!this._visitedURLs[url])
{
getElementById("enableURLs-error").textContent =
gStringsBundle.getString("enableURLs_notvisited.error");
return;
}
}
_show("mastervbox");
_hide("enableURLs-box");
gEnableURLsDialog = null;
this._successCallback(this._visitedURLs);
} catch (e) {
// XXX TODO FIXME
alert(e.message); throw e;
}
}
}
var gEnableURLsDialog = null;

Просмотреть файл

@ -415,38 +415,4 @@
<button label="&customfields-ok.label;" oncommand="gCustomFieldsDialog.onOK();"/>
</hbox>
</vbox>
<vbox id="enableURLs-box" hidden="true" flex="1">
<description class="header">&enableURLs-header.label;</description>
<description class="intro">&enableURLs-intro1.descr;</description>
<description class="intro">&enableURLs-intro2.descr;</description>
<spacer flex="1"/>
<grid>
<columns>
<column/>
<column flex="1"/>
<column/>
</columns>
<rows id="enableURLs-rows">
<!-- Generated N times by JS via DOM:
<row align="top">
<description class="enableURLs-label">Text from config file</description>
<label href="url" class="enableURLs-link text-link" value="Open" onclick="me.onLinkClick(...);"/>
<checkbox class="enableURLs-checkbox" disabled="true" checked="false"/>
</row>
-->
</rows>
</grid>
<spacer flex="1"/>
<description id="enableURLs-error" class="errordescription"/>
<spacer/>
<hbox>
<button label="&enableURLs-cancel.label;" oncommand="gEnableURLsDialog.onCancel();"/>
<spacer flex="1"/>
<button label="&enableURLs-ok.label;" oncommand="gEnableURLsDialog.onOK();"/>
</hbox>
</vbox>
</window>

Просмотреть файл

@ -123,17 +123,5 @@ function readFromXML(clientConfigXML)
d.inputFields.push(fieldset);
}
for each (var enableURL in xml.enableURL)
{
if (!d.enableURLs)
d.enableURLs = new Array();
var fieldset =
{
url : sanitize.url(sanitize.nonemptystring(enableURL.@url)),
instruction : sanitize.label(sanitize.nonemptystring(enableURL.@instruction))
};
d.enableURLs.push(fieldset);
}
return d;
}