Bug 260264 Fixup radiogroups to use new .value functionality of radio.xml (Patch for mailnews v0.2)

p=me r=neil.parkwaycc.co.uk sr=bienvenu
This commit is contained in:
bugzilla%arlen.demon.co.uk 2004-09-30 14:44:44 +00:00
Родитель d33896aeeb
Коммит 3dcf430c06
6 изменённых файлов: 15 добавлений и 61 удалений

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

@ -29,7 +29,7 @@ function enabling()
// this is the hidden text element that assigned a value from the prefs
var overrideGlobalPref = document.getElementById("identity.overrideGlobalPref");
switch(autocomplete.selectedItem.value)
switch(autocomplete.value)
{
case "0":
directoriesList.setAttribute("disabled", true);
@ -84,7 +84,7 @@ function onSave()
// So, we need the two elements overrideGlobalPref and directoryServer
// to save the state when the directory is
// set to none and the first radio button is selected.
switch(autocomplete.selectedItem.value)
switch(autocomplete.value)
{
case "0":
override.setAttribute('value', "");

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

@ -201,7 +201,7 @@ function modifyStaticText(smtpMod, smtpBox)
function setServerType()
{
var pageData = parent.GetPageData();
var serverType = (document.getElementById("servertype")).selectedItem.value;
var serverType = document.getElementById("servertype").value;
var deferStorageBox = document.getElementById("deferStorageBox");
deferStorageBox.hidden = serverType == "imap";
setPageData(pageData, "server", "servertype", serverType);

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

@ -53,7 +53,6 @@ var gSmtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"].ge
var gSavedUsername="";
var gPort;
var gDefaultPort;
var gSmtpS;
function initSmtpSettings(server) {
@ -66,22 +65,16 @@ function initSmtpSettings(server) {
gSmtpTrySSL = document.getElementById("smtp.trySSL");
gDefaultPort = document.getElementById("smtp.defaultPort");
gPort = document.getElementById("smtp.port");
gSmtpS = document.getElementById("smtp.alwaysSmtpS");
if (server) {
gSmtpHostname.value = server.hostname;
gSmtpPort.value = server.port ? server.port : "";
gSmtpUsername.value = server.username;
gSmtpAuthMethod.setAttribute("value", server.authMethod);
var elements = gSmtpTrySSL.getElementsByAttribute("value", server.trySSL);
if (!elements.item(0))
elements = gSmtpTrySSL.getElementsByAttribute("value", "1");
gSmtpTrySSL.selectedItem = elements[0];
gSmtpTrySSL.value = (server.trySSL < 4) ? server.trySSL : 1;
} else {
gSmtpAuthMethod.setAttribute("value", "1");
gSmtpTrySSL.selectedItem =
gSmtpTrySSL.getElementsByAttribute("value", "1")[0];
gSmtpTrySSL.value = 1;
}
gSmtpUseUsername.checked = (gSmtpAuthMethod.getAttribute("value") == "1");
@ -152,7 +145,7 @@ function saveSmtpSettings(server)
//dump("Saved authmethod = " + server.authMethod +
// " but checked = " + gSmtpUseUsername.checked + "\n");
server.username = gSmtpUsername.value;
server.trySSL = gSmtpTrySSL.selectedItem.value;
server.trySSL = gSmtpTrySSL.value;
}
}
@ -185,7 +178,7 @@ function updateControls() {
function selectProtocol(init) {
var prevDefaultPort = gDefaultPort.value;
if (gSmtpTrySSL.selectedItem == gSmtpS) {
if (gSmtpTrySSL.value == 3) {
gDefaultPort.value = "465";
if(gPort.value == "" || (!init && gPort.value == "25" && prevDefaultPort != gDefaultPort.value))
gPort.value = gDefaultPort.value;

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

@ -192,11 +192,7 @@ function initializeBooleanWidgets()
booleanAnd = firstTerm.booleanAnd;
// target radio items have value="and" or value="or"
var targetValue = booleanAnd ? "and" : "or";
var targetElement = gSearchBooleanRadiogroup.getElementsByAttribute("value", targetValue)[0];
gSearchBooleanRadiogroup.selectedItem = targetElement;
gSearchBooleanRadiogroup.value = booleanAnd ? "and" : "or";
for (var i=1; i<gSearchTerms.length; i++)
{
@ -296,7 +292,7 @@ function createSearchRow(index, scope, searchTerm)
boolOp.id = "boolOp" + index;
if (index == 0)
boolOp.setAttribute('value', gBooleanInitialText);
else if ( gSearchBooleanRadiogroup.selectedItem.value == 'and')
else if (gSearchBooleanRadiogroup.value == 'and')
boolOp.setAttribute('value', gBooleanAndText);
else
boolOp.setAttribute('value', gBooleanOrText);
@ -366,7 +362,7 @@ function initializeTermFromIndex(index)
// the UI
else
{
searchTermObj.booleanAnd = getBooleanAnd();
searchTermObj.booleanAnd = (gSearchBooleanRadiogroup.value == "and");
if (index)
{
// if we weren't pre-initialized with a searchTerm then steal the search attribute from the
@ -435,15 +431,6 @@ function removeSearchRow(index)
gSearchTerms.length--;
}
function getBooleanAnd()
{
if (gSearchBooleanRadiogroup.selectedItem)
return (gSearchBooleanRadiogroup.selectedItem.getAttribute("value") == "and") ? true : false;
// default to false
return false;
}
// save the search terms from the UI back to the actual search terms
// searchTerms: nsISupportsArray of terms
// termOwner: object which can contain and create the terms

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

@ -79,19 +79,7 @@ function onInit()
gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name");
var selectedItemId = null;
var encryptionPolicy = gIdentity.getIntAttribute("encryptionpolicy");
switch (encryptionPolicy)
{
case 2:
selectedItemId = 'encrypt_mail_always';
break;
default:
selectedItemId = 'encrypt_mail_never';
break;
}
gEncryptionChoices.selectedItem = document.getElementById(selectedItemId);
gEncryptionChoices.value = gIdentity.getIntAttribute("encryptionpolicy");
if (!gEncryptionCertName.value)
{
@ -129,7 +117,7 @@ function onPreInit(account, accountValues)
function onSave()
{
// find out which radio for the encryption radio group is selected and set that on our hidden encryptionChoice pref....
var newValue = gEncryptionChoices.selectedItem.value;
var newValue = gEncryptionChoices.value;
gHiddenEncryptionPolicy.setAttribute('value', newValue);
gIdentity.setIntAttribute("encryptionpolicy", newValue);
gIdentity.setUnicharAttribute("encryption_cert_name", gEncryptionCertName.value);
@ -360,7 +348,7 @@ function enableEncryptionControls(do_enable)
else {
gEncryptAlways.setAttribute("disabled", "true");
gNeverEncrypt.setAttribute("disabled", "true");
gEncryptionChoices.selectedItem = document.getElementById('encrypt_mail_never');
gEncryptionChoices.value = 0;
}
}

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

@ -90,20 +90,7 @@ function OnLoadImportDialog()
function SetUpImportType()
{
// set dialog title
var typeRadioGroup = document.getElementById("importFields");
switch (importType)
{
case "mail":
typeRadioGroup.selectedItem = document.getElementById("mailRadio");
break;
case "addressbook":
typeRadioGroup.selectedItem = document.getElementById("addressbookRadio");
break;
case "settings":
typeRadioGroup.selectedItem = document.getElementById("settingsRadio");
break;
}
document.getElementById("importFields").value = importType;
ListModules();
}
@ -164,8 +151,7 @@ function ImportDialogOKButton()
if ( listbox && listbox.selectedItems && (listbox.selectedItems.length == 1) )
{
var importTypeRadioGroup = document.getElementById("importFields");
importType = importTypeRadioGroup.selectedItem.getAttribute("value");
importType = document.getElementById("importFields").value;
var index = listbox.selectedItems[0].getAttribute('list-index');
var module = importService.GetModule(importType, index);
var name = importService.GetModuleName(importType, index);