From 0d57f862f825c6e444e9cf08788dcc8b31323ecc Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Mon, 10 Dec 2001 00:24:45 +0000 Subject: [PATCH] 114325 - Update callers for hasAttribute work. r=ben sr=hewitt --- editor/ui/dialogs/content/EdInsertChars.js | 9 +- extensions/wallet/editor/WalletEditor.js | 883 ------------------ .../search/resources/content/FilterEditor.js | 2 +- .../resources/content/pref-mailnewsOverlay.js | 2 +- 4 files changed, 9 insertions(+), 887 deletions(-) diff --git a/editor/ui/dialogs/content/EdInsertChars.js b/editor/ui/dialogs/content/EdInsertChars.js index f9e2dcf5fda..4a662a8486d 100644 --- a/editor/ui/dialogs/content/EdInsertChars.js +++ b/editor/ui/dialogs/content/EdInsertChars.js @@ -199,8 +199,13 @@ function SelectLatinModifier() } function DisableLatinL(disable) { - LatinL_Label.setAttribute("disabled", disable ? "true" : "false"); - LatinL.setAttribute("disabled", disable ? "true" : "false"); + if (disable) { + LatinL_Label.setAttribute("disabled" "true"); + LatinL.setAttribute("disabled", "true"); + else { + LatinL_Label.removeAttribute("disabled"); + LatinL.removeAttribute("disabled"); + } } function UpdateLatinL() diff --git a/extensions/wallet/editor/WalletEditor.js b/extensions/wallet/editor/WalletEditor.js index 8af47b1cb08..e69de29bb2d 100644 --- a/extensions/wallet/editor/WalletEditor.js +++ b/extensions/wallet/editor/WalletEditor.js @@ -1,883 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released March - * 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/* universal global variables */ - -var walleteditor = null; // walleteditor interface -var walletservice = null; // walletservices interface -var walletList = []; // input stream -var bundle = null; // string bundle -var JS_STRINGS_FILE = "chrome://communicator/locale/wallet/WalletEditor.properties"; - -/* wallet-specific global variables */ - -var schemas = []; -var schemasLength; -var entries = []; -var entriesLength; -var strings = []; -var stringsLength; -var BREAK; - -/*** =================== ?? =================== ***/ - -function ViewEntriesFromXul(){ - ViewEntries(); -} -function ViewSynonymsFromXul(){ - ViewSynonyms(); -} - -/*** =================== STARTING AND STOPPING =================== ***/ - -/* decrypt a value */ -function Decrypt(crypt) { - try { - return walletservice.WALLET_Decrypt(crypt); - } catch (ex) { - return bundle.GetStringFromName("EncryptionFailure"); - } -} - -/* encrypt a value */ -function Encrypt(text) { - try { - return walletservice.WALLET_Encrypt(text); - } catch (ex) { - alert(bundle.GetStringFromName("UnableToUnlockDatabase")); - return ""; - } -} - -/* see if user was able to unlock the database */ -function EncryptionTest() { - try { - walletservice.WALLET_Encrypt("dummy"); - } catch (ex) { - alert(bundle.GetStringFromName("UnableToUnlockDatabase")); - window.close(); - } -} - -/* initializes the wallet editor dialog */ -function Startup() -{ - walleteditor = Components.classes["@mozilla.org/walleteditor/walleteditor-world;1"].createInstance(); - walleteditor = walleteditor.QueryInterface(Components.interfaces.nsIWalletEditor); - - walletservice = Components.classes['@mozilla.org/wallet/wallet-service;1']; - walletservice = walletservice.getService(); - walletservice = walletservice.QueryInterface(Components.interfaces.nsIWalletService); - - bundle = srGetStrBundle(JS_STRINGS_FILE); /* initialize string bundle */ - - EncryptionTest(); /* abort if user failed to unlock the database */ - - if (!FetchInput()) { - return; /* user failed to unlock the database */ - } - ViewSchema(); /* create the display of schemas */ - window.sizeToContent(); -} - -/* routine that executes when OK button is pressed */ -function onAccept(){ - var i, j, k; - var output = "OK" + BREAK; - for (i=0; i entryToDelete) { - schemas[i]--; - } - } - - schemasLength--; - for (i=CurrentSchema(); i<=schemasLength; i++) { - schemas[i] = schemas[i+1]; - } -} - -/* low-level delete-entry routine */ -function DeleteEntry0() { - var i; - entryToDelete = schemas[CurrentSchema()]+CurrentEntry(); - while (entries[entryToDelete]+2 < entries[entryToDelete+1]-1) { - DeleteSynonym0(); - } - - if ((schemas[CurrentSchema()+1] - schemas[CurrentSchema()]) == 1) { - if(strings[entries[entryToDelete]+1] != "") { - deleteString(entries[entryToDelete]+1); - } - return; - } - - while(strings[entries[entryToDelete]] != "") { - deleteString(entries[entryToDelete]); - } - deleteString(entries[entryToDelete]); - - entriesLength--; - for (i=entryToDelete; i<=entriesLength; i++) { - entries[i] = entries[i+1]; - } - - for (i=0; i<=schemasLength; i++) { - if (schemas[i] > entryToDelete) { - schemas[i]--; - } - } -} - -/* low-level delete-synonym routine */ -function DeleteSynonym0() { - stringToDelete = entries[schemas[CurrentSchema()]+CurrentEntry()]+2+CurrentSynonym(); - deleteString(stringToDelete); -} - -function myPrompt(message, oldValue, title) { - /* - * Can't simply call javascript's "prompt" because it puts up a checkbox (see bug 41390) - * so we are using a local rewrite of prompt here. - */ - -// if bug 41390 gets fixed, use the following line and delete rest of routine -// prompt(message, oldValue, title); /* use this if bug 41390 gets fixed */ - - var newValue = { value:oldValue }; - if (!title) { - title = " "; - } - var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(); - promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService); - promptService.prompt(window, title, message, newValue, null, { value:0 }) - return newValue.value; -} - -/* low-level add-schema routine */ -function AddSchema0() { - var i; - var text = myPrompt - (bundle.GetStringFromName("EnterNewSchema"), "", - bundle.GetStringFromName("AddingTitle")); - if (text == "") { - return; - } - schemaIndex = 0; - while ((schemaIndexschemaIndex; i--) { - schemas[i] = schemas[i-1]+1; - } - - entryIndex = schemas[schemaIndex]; - entriesLength++; - for (i=entriesLength; i>entryIndex; i--) { - entries[i] = entries[i-1]; - } - - stringIndex = entries[entryIndex]; - if (stringIndex == stringsLength) { - stringIndex--; - } - - addString(stringIndex, text); - addString(stringIndex+1, ""); - schemas[schemaIndex] = entryIndex; - entries[entryIndex] = stringIndex; -} - -/* low-level add-entry routine */ -function AddEntry0() { - var i; - var schemaId = document.getElementById("schematree").selectedItems[0].getAttribute("id"); - var schemanumb =parseInt(schemaId.substring(5, schemaId.length)); - var schemaName = strings[entries[schemas[schemanumb]]]; - var text = myPrompt - (bundle.GetStringFromName("EnterNewEntry")+" "+schemaName+" "+bundle.GetStringFromName("EnterNewEntry1"), "", - bundle.GetStringFromName("AddingTitle")); - if (text == "") { - return; - } - var crypt = Encrypt(text); - if (crypt == "") { - /* user failed to unlock the database */ - return; - } - stringIndex = entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]; - if(strings[entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+1]=="") { - addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+1, crypt); - return; - } - - addString(stringIndex, strings[entries[schemas[FirstSelectedSchema()]]]); - addString(stringIndex+1, crypt); - addString(stringIndex+2, ""); - - entriesLength++; - for (i=entriesLength; i>schemas[FirstSelectedSchema()]+FirstSelectedEntry(); i--) { - entries[i] = entries[i-1]; - } - entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()] = stringIndex; - - for (i=FirstSelectedSchema()+1; i<=schemasLength; i++) { - schemas[i]++; - } -} - -/* low-level add-synonym routine */ -function AddSynonym0() { - var schemaId = document.getElementById("schematree").selectedItems[0].getAttribute("id"); - var schemanumb =parseInt(schemaId.substring(5, schemaId.length)); - var entryId = document.getElementById("entrytree").selectedItems[0].getAttribute("id"); - var entrynumb =parseInt(entryId.substring(5, entryId.length)); - var entryName = Decrypt(strings[entries[schemas[schemanumb]+entrynumb]+1]); - var text = myPrompt - (bundle.GetStringFromName("EnterNewSynonym")+" "+entryName+" "+bundle.GetStringFromName("EnterNewSynonym1"), "", - bundle.GetStringFromName("AddingTitle")); - if (text == "") { - return; - } - var crypt = Encrypt(text); - if (crypt == "") { - /* user failed to unlock the database */ - return; - } - addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+2, crypt); -} - -function deleteString(stringToDelete) { - var i; - stringsLength--; - for (i=stringToDelete; i stringToDelete) { - entries[i]--; - } - } -} - -function addString(stringToAdd, text) { - var i; - stringsLength++; - for (i=stringsLength; i>stringToAdd; i--) { - strings[i] = strings[i-1]; - } - strings[stringToAdd] = text; - for (i=0; i<=entriesLength; i++) { - if (entries[i] >= stringToAdd) { - entries[i]++; - } - } -} - -/* high-level add-schema routine */ -function AddSchema() { - var button = document.getElementById("addSchema"); - if( button.getAttribute("disabled") == "true" ) { - return; - } - - InitSelectedSchemas(); - ClearSelectedEntries(); - ClearSelectedSynonyms(); - AddSchema0(); - ViewSchema(); //?? otherwise schema list doesn't get redrawn -} - -/* high-level add-entry routine */ -function AddEntry() { - var button = document.getElementById("addEntry"); - if( button.getAttribute("disabled") == "true" ) { - return; - } - - InitSelectedSchemas(); - InitSelectedEntries(); - ClearSelectedSynonyms(); - AddEntry0(); - ViewEntries(); //?? otherwise entry list doesn't get redrawn -} - -/* high-level add-synonym routine */ -function AddSynonym() { - var button = document.getElementById("addSynonym"); - if( button.getAttribute("disabled") == "true" ) { - return; - } - - InitSelectedSchemas(); - InitSelectedEntries(); - InitSelectedSynonyms(); - AddSynonym0(); - ViewSynonyms(); //?? otherwise synonym list doesn't get redrawn - ViewSynonyms(); //?? otherwise entry list doesn't get redrawn (??even needed twice) -} - -/* high-level delete-schema routine */ -function DeleteSchema() { - var button = document.getElementById("removeSchema"); - if( button.getAttribute("disabled") == "true" ) { - return; - } - var count = InitSelectedSchemas(); - ClearSelectedEntries(); - ClearSelectedSynonyms(); - for (var i=0; i>\n"); - for (j=schemas[i]; j>\n"); - for (k=entries[j]+2; k>\n"); - } - } - } - dump("\n"); -} - -/* debugging routine to dump raw strings */ -function DumpRawStrings() { - var i; - dump("Schemas follow\n"); - for (i=0; i