fix for #13587, #22316, #13591, #16898 - overall wizard behavior

fix next, finish buttons, get rid of superflous "click next" instructions, get enabling/disabling of buttons correct, etc


git-svn-id: svn://10.0.0.236/trunk@56729 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com
2000-01-04 08:19:45 +00:00
parent c6836b2d84
commit 3582a5126e
2 changed files with 29 additions and 11 deletions

View File

@@ -47,6 +47,7 @@ function onLoad() {
smtpService =
Components.classes["component://netscape/messengercompose/smtp"].getService(Components.interfaces.nsISmtpService);;
init();
try {
wizardContents["smtp.hostname"] = smtpService.defaultServer.hostname;
dump("initialized with " + wizardContents["smtp.hostname"] + "\n");
@@ -54,13 +55,13 @@ function onLoad() {
catch (ex) {
//dump("failed to get the smtp hostname\n");
}
init();
}
function wizardPageLoaded(tag) {
init();
currentPageTag=tag;
initializePage(contentWindow, wizardContents);
updateButtons(wizardMap[currentPageTag], window.parent);
}
function onNext(event) {
@@ -82,6 +83,7 @@ function onNext(event) {
saveContents(contentWindow, wizardContents);
nextPage(contentWindow);
}
function onCancel(event) {
@@ -102,13 +104,25 @@ function getUrlFromTag(title) {
}
// helper functions that actually do stuff
function setNextEnabled(enabled) {
function setNextText(doc, hasNext) {
if (hasNext)
doc.getElementById("nextButton").setAttribute("value", "Next >");
else
doc.getElementById("nextButton").setAttribute("value", "Finish");
}
function setNextEnabled(doc, enabled) {
if (enabled)
doc.getElementById("nextButton").removeAttribute("disabled");
else
doc.getElementById("nextButton").setAttribute("disabled", "true");
}
function setBackEnabled(enabled) {
function setBackEnabled(doc, enabled) {
if (enabled)
doc.getElementById("backButton").removeAttribute("disabled");
else
doc.getElementById("backButton").setAttribute("disabled", "true");
}
function nextPage(win) {
@@ -135,6 +149,13 @@ function initializePage(win, hash) {
}
function updateButtons(mapEntry, wizardWindow) {
//setNextEnabled(wizardWindow.document, mapEntry.next ? true : false);
setNextText(wizardWindow.document, mapEntry.next ? true : false);
setBackEnabled(wizardWindow.document, mapEntry.previous ? true : false);
}
function saveContents(win, hash) {
var inputs = win.document.getElementsByTagName("FORM")[0].elements;

View File

@@ -35,9 +35,6 @@ Rights Reserved.
<html:iframe flex="100%" style="width: 100%; height:100%; border: none"
src="chrome://messenger/content/aw-accounttype.xul"
name="wizardContents" scrolling="auto"/>
<html:div>
&instructions.label;
</html:div>
<html:br/><html:hr/>
<box align="horizontal" style="margin: 10px">
<!--
@@ -45,8 +42,8 @@ Rights Reserved.
<titledbutton value="Load Page" onclick="onLoadPage(event);"/>
-->
<spring flex="100%"/>
<titledbutton class="dialog push" value="&lt; &backButton.label;" onclick="onBack(event);"/>
<titledbutton class="dialog push" value="&nextButton.label; &gt;" onclick="onNext(event);"/>
<titledbutton class="dialog push" id="backButton" value="&lt; &backButton.label;" onclick="onBack(event);"/>
<titledbutton class="dialog push" id="nextButton" value="&nextButton.label; &gt;" onclick="onNext(event);"/>
<spring style="width: 10px"/>
<titledbutton class="dialog push" value="&cancelButton.label;" onclick="onCancel(event);"/>
</box>