From 71a803fb46a48a4b47690ed30f523a229aabe9e8 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Tue, 28 Sep 1999 09:30:48 +0000 Subject: [PATCH] comment out the dumps. in the new profile xul, disable the buttons when they should be and ignore clicks if the buttons are disabled. --- profile/resources/cpw.js | 119 +++++++++++++++------ profile/resources/cpw.xul | 36 ------- profile/resources/pm.js | 210 -------------------------------------- 3 files changed, 85 insertions(+), 280 deletions(-) diff --git a/profile/resources/cpw.js b/profile/resources/cpw.js index 59ea70daef2..d9d0d8b5ef9 100644 --- a/profile/resources/cpw.js +++ b/profile/resources/cpw.js @@ -4,8 +4,8 @@ var wizardHash = new Array; var firstTime = true; var testMap = { - content1_1: { next: "content1_2" }, - content1_2: { previous: "content1_1" }, + content1_1: { previous: null, next: "content1_2" }, + content1_2: { previous: "content1_1" , next: null}, } var pagePrefix="test-"; @@ -20,18 +20,21 @@ var profDir = ""; var isProfileData = false; function wizardPageLoaded(tag) { - dump("**********wizardPageLoaded\n"); + //dump("**********wizardPageLoaded\n"); if (firstTime) { Startup(); } - currentPageTag = tag; - dump("currentPageTag: "+currentPageTag+"\n"); - + currentPageTag = tag; + //dump("currentPageTag: "+currentPageTag+"\n"); + SetButtons(); populatePage(); } +var backButton = null; +var nextButton = null; +var finishButton = null; function loadPage(thePage) { @@ -39,19 +42,57 @@ function loadPage(thePage) saveData(); } - dump("**********loadPage\n"); - dump("thePage: "+thePage+"\n"); + //dump("**********loadPage\n"); + //dump("thePage: "+thePage+"\n"); displayPage(thePage); firstTime = false; return(true); } +function SetButtons() +{ + if (!currentPageTag) return; + if (!backButton) { + backButton = document.getElementById("back"); + } + if (!nextButton) { + nextButton = document.getElementById("next"); + } + if (!finishButton) { + finishButton = document.getElementById("finish"); + } + + //dump("currentPageTag == " + currentPageTag + "\n"); + nextTag = testMap[currentPageTag].next; + //dump("nextTag == " + nextTag + "\n"); + if (nextTag) { + nextButton.setAttribute("disabled", false); + finishButton.setAttribute("disabled", true); + } + else { + nextButton.setAttribute("disabled", true); + finishButton.setAttribute("disabled", false); + } + + prevTag = testMap[currentPageTag].previous; + //dump("prevTag == " + prevTag + "\n"); + if (prevTag) { + backButton.setAttribute("disabled", false); + } + else { + backButton.setAttribute("disabled", true); + } +} function onNext() { - dump("***********onNext\n"); + if (nextButton.getAttribute("disabled") == "true") { + return; + } + + //dump("***********onNext\n"); if (currentPageTag == "content1_1") { isProfileData = true; @@ -67,7 +108,9 @@ function onNext() function onBack() { - dump("***********onBack\n"); + if (backButton.getAttribute("disabled") == "true") { + return; + } if (currentPageTag != "content1_1") { saveData(); @@ -79,7 +122,7 @@ function onBack() function displayPage(content) { - dump("********INSIDE DISPLAYPAGE\n\n"); + //dump("********INSIDE DISPLAYPAGE\n\n"); if (content != "") { @@ -94,47 +137,47 @@ function displayPage(content) function populatePage() { - dump("************initializePage\n"); + //dump("************initializePage\n"); var contentWindow = window.frames["content"]; var doc = contentWindow.document; for (var i in wizardHash) { var formElement=doc.getElementById(i); - dump("formElement: "+formElement+"\n"); + //dump("formElement: "+formElement+"\n"); if (formElement) { formElement.value = wizardHash[i]; - dump("wizardHash["+"i]: "+wizardHash[i]+"\n"); + //dump("wizardHash["+"i]: "+wizardHash[i]+"\n"); } } } function saveData() { - dump("************ SAVE DATA\n"); + //dump("************ SAVE DATA\n"); var contentWindow = window.frames["content"]; var doc = contentWindow.document; var inputs = doc.getElementsByTagName("FORM")[0].elements; - dump("There are " + inputs.length + " input tags\n"); + //dump("There are " + inputs.length + " input tags\n"); for (var i=0 ; i - - - - - - - - - - - - - &newprofile.title; - - - - - - - - - - - - - - - - - diff --git a/profile/resources/pm.js b/profile/resources/pm.js index 51bf7cd2b2a..e69de29bb2d 100644 --- a/profile/resources/pm.js +++ b/profile/resources/pm.js @@ -1,210 +0,0 @@ -var selected = null; -var currProfile = ""; -var profile = Components.classes["component://netscape/profile/manager"].createInstance(); -profile = profile.QueryInterface(Components.interfaces.nsIProfile); -dump("profile = " + profile + "\n"); - -function openCreateProfile() -{ - // Need to call CreateNewProfile xuls - var win = window.openDialog('cpw.xul', 'CPW', 'chrome'); - return win; -} - -function CreateProfile() -{ - this.location.href = "resource:/res/profile/pm.xul"; -} - -function RenameProfile(w) -{ - if (!selected) - { - dump("Select a profile to rename.\n"); - return; - } - - var newName = w.document.getElementById("NewName").value; - var oldName = selected.getAttribute("rowName"); - var migrate = selected.getAttribute("rowMigrate"); - - if (migrate == "true") - { - dump("Migrate this profile before renaming it.\n"); - return; - } - - //dump("RenameProfile : " + oldName + " to " + newName + "\n"); - profile.RenameProfile(oldName, newName); - //this.location.replace(this.location); - this.location.href = "resource:/res/profile/pm.xul"; -} - -function DeleteProfile(deleteFilesFlag) -{ - if (!selected) - { - dump("Select a profile to delete.\n"); - return; - } - - var migrate = selected.getAttribute("rowMigrate"); - - var name = selected.getAttribute("rowName"); - //dump("Delete '" + name + "'\n"); - profile.DeleteProfile(name, deleteFilesFlag); - //this.location.replace(this.location); - //this.location.href = this.location; - this.location.href = "resource:/res/profile/pm.xul"; -} - -function StartCommunicator() -{ - dump("************Inside Start Communicator prof\n"); - if (!selected) - { - dump("Select a profile to migrate.\n"); - return; - } - - var migrate = selected.getAttribute("rowMigrate"); - var name = selected.getAttribute("rowName"); - - if (migrate == "true") - { - profile.migrateProfile(name); - } - - dump("************name: "+name+"\n"); - profile.startCommunicator(name); - ExitApp(); -} - -function ExitApp() -{ - // Need to call this to stop the event loop - var appShell = Components.classes['component://netscape/appshell/appShellService'].getService(); - appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService); - appShell.Quit(); -} - -function showSelection(node) -{ - dump("************** In showSelection routine!!!!!!!!! \n"); - // (see tree's onclick definition) - // Tree events originate in the smallest clickable object which is the cell. The object - // originating the event is available as event.target. We want the cell's row, so we go - // one further and get event.target.parentNode. - selected = node; - var num = node.getAttribute("rowNum"); - dump("num: "+num+"\n"); - - var name = node.getAttribute("rowName"); - dump("name: "+name+"\n"); - - //dump("Selected " + num + " : " + name + "\n"); -} - -function addTreeItem(num, name, migrate) -{ - dump("Adding element " + num + " : " + name + "\n"); - var body = document.getElementById("theTreeBody"); - - var newitem = document.createElement('treeitem'); - var newrow = document.createElement('treerow'); - newrow.setAttribute("rowNum", num); - newrow.setAttribute("rowName", name); - newrow.setAttribute("rowMigrate", migrate); - - var elem = document.createElement('treecell'); - - // Hack in a differentation for migration - if (migrate) - var text = document.createTextNode('Migrate'); - else - var text = document.createTextNode(''); - - elem.appendChild(text); - newrow.appendChild(elem); - - var elem = document.createElement('treecell'); - var text = document.createTextNode(name); - elem.appendChild(text); - newrow.appendChild(elem); - - newitem.appendChild(newrow); - body.appendChild(newitem); -} - -function loadElements() -{ - dump("****************hacked onload handler adds elements to tree widget\n"); - var profileList = ""; - - profileList = profile.getProfileList(); - - dump("Got profile list of '" + profileList + "'\n"); - profileList = profileList.split(","); - try { - currProfile = profile.currentProfile; - } - catch (ex) { - if (profileList != "") { - currProfile = profileList; - } - } - - for (var i=0; i < profileList.length; i++) - { - var pvals = profileList[i].split(" - "); - addTreeItem(i, pvals[0], (pvals[1] == "migrate")); - } -} - -function openRename() -{ - if (!selected) - dump("Select a profile to rename.\n"); - else - { - var migrate = selected.getAttribute("rowMigrate"); - if (migrate == "true") - dump("Migrate the profile before renaming it.\n"); - else - var win = window.openDialog('pmrename.xul', 'Renamer', 'chrome'); - } -} - - -function ConfirmDelete() -{ - if (!selected) - { - dump("Select a profile to delete.\n"); - return; - } - - var migrate = selected.getAttribute("rowMigrate"); - var name = selected.getAttribute("rowName"); - - if (migrate == "true") - { - dump("Migrate this profile before deleting it.\n"); - return; - } - - var win = window.openDialog('pmDelete.xul', 'Deleter', 'chrome'); - return win; -} - - -function ConfirmMigrateAll() -{ - var win = window.openDialog('pmMigrateAll.xul', 'MigrateAll', 'chrome'); - return win; -} - - -// -------------------------------------------- begin Hack for OnLoad handling -setTimeout('loadElements()', 0); -// -------------------------------------------- end Hack for OnLoad handling