mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-14 14:02:47 +00:00
comment out the dumps.
in the new profile xul, disable the buttons when they should be and ignore clicks if the buttons are disabled.
This commit is contained in:
parent
29f7d723c6
commit
e37e3055a2
@ -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<inputs.length; i++) {
|
||||
dump("Saving: ");
|
||||
dump("ID=" + inputs[i].id + " Value=" + inputs[i].value + "..");
|
||||
//dump("Saving: ");
|
||||
//dump("ID=" + inputs[i].id + " Value=" + inputs[i].value + "..");
|
||||
wizardHash[inputs[i].id] = inputs[i].value;
|
||||
}
|
||||
dump("done.\n");
|
||||
//dump("done.\n");
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
{
|
||||
dump("************** ON CANCEL\n");
|
||||
//dump("************** ON CANCEL\n");
|
||||
saveData();
|
||||
var i;
|
||||
for (i in wizardHash) {
|
||||
dump("element: "+i+"\n");
|
||||
dump("value: "+wizardHash[i]+"\n");
|
||||
//dump("element: "+i+"\n");
|
||||
//dump("value: "+wizardHash[i]+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,13 +190,16 @@ function getUrlFromTag(title)
|
||||
|
||||
function Startup()
|
||||
{
|
||||
dump("Doing Startup...\n");
|
||||
//dump("Doing Startup...\n");
|
||||
}
|
||||
|
||||
function Finish(opener)
|
||||
{
|
||||
if (finishButton.getAttribute("disabled") == "true") {
|
||||
return;
|
||||
}
|
||||
|
||||
dump("******FINISH ROUTINE\n");
|
||||
//dump("******FINISH ROUTINE\n");
|
||||
|
||||
if (isProfileData) {
|
||||
saveData();
|
||||
@ -173,14 +219,14 @@ function processCreateProfileData()
|
||||
{
|
||||
//Process Create Profile Data
|
||||
|
||||
dump("******processCreateProfileData ROUTINE\n");
|
||||
//dump("******processCreateProfileData ROUTINE\n");
|
||||
|
||||
var i;
|
||||
var data = "";
|
||||
|
||||
for (i in wizardHash) {
|
||||
dump("element: "+i+"\n");
|
||||
dump("value: "+wizardHash[i]+"\n");
|
||||
//dump("element: "+i+"\n");
|
||||
//dump("value: "+wizardHash[i]+"\n");
|
||||
|
||||
if (i == "ProfileName") {
|
||||
profName = wizardHash[i];
|
||||
@ -193,14 +239,19 @@ function processCreateProfileData()
|
||||
}
|
||||
}
|
||||
|
||||
dump("data: "+data+"\n");
|
||||
//dump("data: "+data+"\n");
|
||||
var profile = Components.classes["component://netscape/profile/manager"].createInstance();
|
||||
profile = profile.QueryInterface(Components.interfaces.nsIProfile);
|
||||
dump("profile = " + profile + "\n");
|
||||
|
||||
dump("********DATA: "+data+"\n\n");
|
||||
profile.createNewProfile(data);
|
||||
profile.startCommunicator(profName);
|
||||
//dump("profile = " + profile + "\n");
|
||||
//dump("********DATA: "+data+"\n\n");
|
||||
try {
|
||||
profile.createNewProfile(data);
|
||||
profile.startCommunicator(profName);
|
||||
}
|
||||
catch (ex) {
|
||||
//dump("failed to create & start\n");
|
||||
return;
|
||||
}
|
||||
ExitApp();
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,10 @@
|
||||
<html:iframe src="about:blank" flex="100%" name="content" id="content" scrolling="auto"/>
|
||||
|
||||
<box align="horizontal">
|
||||
<titledbutton id="back" value="&back.label;" onclick="onBack()" align="left" style="margin-top: 1em;"/>
|
||||
<titledbutton id="back" value="&back.label;" onclick="onBack()" align="left" disabled="true" style="margin-top: 1em;"/>
|
||||
<titledbutton id="next" value="&next.label;" onclick="onNext()" align="left" style="margin-top: 1em;"/>
|
||||
<titledbutton id="cancel" value="&cancel.label;" onclick="cancelApp()" align="left" style=" margin-top: 1em;"/>
|
||||
<titledbutton id="finish" value="&finish.label;" onclick="Finish(opener)" align="left" style=" margin-top: 1em;"/>
|
||||
<titledbutton id="finish" value="&finish.label;" onclick="Finish(opener)" disabled="true" align="left" style=" margin-top: 1em;"/>
|
||||
|
||||
</box>
|
||||
|
||||
|
@ -2,7 +2,7 @@ var selected = null;
|
||||
var currProfile = "";
|
||||
var profile = Components.classes["component://netscape/profile/manager"].createInstance();
|
||||
profile = profile.QueryInterface(Components.interfaces.nsIProfile);
|
||||
dump("profile = " + profile + "\n");
|
||||
//dump("profile = " + profile + "\n");
|
||||
|
||||
function openCreateProfile()
|
||||
{
|
||||
@ -20,7 +20,7 @@ function RenameProfile(w)
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
dump("Select a profile to rename.\n");
|
||||
//dump("Select a profile to rename.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ function RenameProfile(w)
|
||||
|
||||
if (migrate == "true")
|
||||
{
|
||||
dump("Migrate this profile before renaming it.\n");
|
||||
//dump("Migrate this profile before renaming it.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ function DeleteProfile(deleteFilesFlag)
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
dump("Select a profile to delete.\n");
|
||||
//dump("Select a profile to delete.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -60,10 +60,10 @@ function DeleteProfile(deleteFilesFlag)
|
||||
|
||||
function StartCommunicator()
|
||||
{
|
||||
dump("************Inside Start Communicator prof\n");
|
||||
//dump("************Inside Start Communicator prof\n");
|
||||
if (!selected)
|
||||
{
|
||||
dump("Select a profile to migrate.\n");
|
||||
//dump("Select a profile to migrate.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ function StartCommunicator()
|
||||
profile.migrateProfile(name);
|
||||
}
|
||||
|
||||
dump("************name: "+name+"\n");
|
||||
//dump("************name: "+name+"\n");
|
||||
profile.startCommunicator(name);
|
||||
ExitApp();
|
||||
}
|
||||
@ -90,24 +90,24 @@ function ExitApp()
|
||||
|
||||
function showSelection(node)
|
||||
{
|
||||
dump("************** In showSelection routine!!!!!!!!! \n");
|
||||
//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");
|
||||
//dump("num: "+num+"\n");
|
||||
|
||||
var name = node.getAttribute("rowName");
|
||||
dump("name: "+name+"\n");
|
||||
//dump("name: "+name+"\n");
|
||||
|
||||
//dump("Selected " + num + " : " + name + "\n");
|
||||
}
|
||||
|
||||
function addTreeItem(num, name, migrate)
|
||||
{
|
||||
dump("Adding element " + num + " : " + name + "\n");
|
||||
//dump("Adding element " + num + " : " + name + "\n");
|
||||
var body = document.getElementById("theTreeBody");
|
||||
|
||||
var newitem = document.createElement('treeitem');
|
||||
@ -138,12 +138,12 @@ function addTreeItem(num, name, migrate)
|
||||
|
||||
function loadElements()
|
||||
{
|
||||
dump("****************hacked onload handler adds elements to tree widget\n");
|
||||
//dump("****************hacked onload handler adds elements to tree widget\n");
|
||||
var profileList = "";
|
||||
|
||||
profileList = profile.getProfileList();
|
||||
|
||||
dump("Got profile list of '" + profileList + "'\n");
|
||||
//dump("Got profile list of '" + profileList + "'\n");
|
||||
profileList = profileList.split(",");
|
||||
try {
|
||||
currProfile = profile.currentProfile;
|
||||
@ -163,13 +163,15 @@ function loadElements()
|
||||
|
||||
function openRename()
|
||||
{
|
||||
if (!selected)
|
||||
dump("Select a profile to rename.\n");
|
||||
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");
|
||||
if (migrate == "true") {
|
||||
//dump("Migrate the profile before renaming it.\n");
|
||||
}
|
||||
else
|
||||
var win = window.openDialog('pmrename.xul', 'Renamer', 'chrome');
|
||||
}
|
||||
@ -180,7 +182,7 @@ function ConfirmDelete()
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
dump("Select a profile to delete.\n");
|
||||
//dump("Select a profile to delete.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -189,7 +191,7 @@ function ConfirmDelete()
|
||||
|
||||
if (migrate == "true")
|
||||
{
|
||||
dump("Migrate this profile before deleting it.\n");
|
||||
//dump("Migrate this profile before deleting it.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user