From 90cdcd16ec10401cfd22d4f2e9993623cdc9f28d Mon Sep 17 00:00:00 2001 From: "gayatrib%netscape.com" Date: Tue, 31 Aug 1999 00:19:28 +0000 Subject: [PATCH] New javascript file for cpw.xul --- profile/resources/cpw.js | 249 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 profile/resources/cpw.js diff --git a/profile/resources/cpw.js b/profile/resources/cpw.js new file mode 100644 index 00000000000..05e114e02fe --- /dev/null +++ b/profile/resources/cpw.js @@ -0,0 +1,249 @@ +var curPageIndex = 0; +var wizardMap = new Array("test-content1_1.xul", "test-tab2.xul", "test-tab3.xul", "test-tab4.xul"); +var content; +var count = 0; +var wizardHash = new Array; +var firstTime = true; + +var testMap = { + content1_1: { next: "content1_2" }, + content1_2: { next: "tab2", previous: "content1_1" }, + tab2: { next: "tab3", previous: "content1_2"}, + tab3: { next: "tab4", previous: "tab2"}, + tab4: { previous: "tab3"}, +} + +var pagePrefix="test-"; +var pagePostfix=".xul"; +var currentPageTag; + + +var profName = ""; +var profDir = ""; + +var toolkitCore; +nameGlobal = new Array(); +nameArray = new Array(); +var count = 0; +var dataCount = 0; + + +function wizardPageLoaded(tag) { + dump("**********wizardPageLoaded\n"); + + if (firstTime) { + Startup(); + } + + currentPageTag = tag; + dump("currentPageTag: "+currentPageTag+"\n"); + populatePage(); +} + + +function loadPage(thePage) +{ + if (!firstTime) { + saveData(); + } + + if (thePage == wizardMap[0]) { + curPageIndex = 0; + } + else if (thePage == wizardMap[1]) { + curPageIndex = 1; + } + else if (thePage == wizardMap[2]) { + curPageIndex = 2; + } + else if (thePage == wizardMap[3]) { + curPageIndex = 3; + } + + dump("***********COUNT: "+count+"\n\n"); + count++; + + dump("**********loadPage\n"); + dump("thePage: "+thePage+"\n"); + dump("curPageIndex: "+curPageIndex+"\n"); + displayPage(thePage); + + firstTime = false; + return(true); +} + + + +function onNext() +{ + dump("***********onNext\n"); + saveData(); + var nextPageTag = testMap[currentPageTag].next; + var url = getUrlFromTag(nextPageTag); + displayPage(url); +} + +function onBack() +{ + dump("***********onBack\n"); + saveData(); + previousPageTag = testMap[currentPageTag].previous; + var url = getUrlFromTag(previousPageTag); + displayPage(url); +} + +function displayPage(content) +{ + if (content != "") + { + var contentFrame = document.getElementById("content"); + if (contentFrame) + { + contentFrame.setAttribute("src", content); + } + } + +} + + +function populatePage() +{ + 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"); + + if (formElement) { + formElement.value = wizardHash[i]; + dump("wizardHash["+"i]: "+wizardHash[i]+"\n"); + } + } +} + +function saveData() +{ + 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"); + for (var i=0 ; i