!import
1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Alec Flett <alecf@netscape.com>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
setAccountTypeData
39 function setAccountTypeData()
40 {
41 var rg = document.getElementById("acctyperadio");
42 var selectedItemId = rg.selectedItem.id;
43 var mail = selectedItemId == "mailaccount";
44 var news = selectedItemId == "newsaccount";
45
46 var pageData = parent.GetPageData();
47 setPageData(pageData, "accounttype", "mailaccount", mail);
48 setPageData(pageData, "accounttype", "newsaccount", news);
49
50 // Other account type, e.g. Movemail
51 setPageData(pageData, "accounttype", "otheraccount", !(news || mail));
52 }
53
acctTypePageUnload
54 function acctTypePageUnload() {
55 gCurrentAccountData = null;
56 setAccountTypeData();
57 initializeIspData();
58 setupWizardPanels();
59 return true;
60 }
61
setupWizardPanels
62 function setupWizardPanels() {
63 if (gCurrentAccountData && gCurrentAccountData.useOverlayPanels) {
64 if ("testingIspServices" in this) {
65 if ("SetPageMappings" in this && testingIspServices()) {
66 SetPageMappings(document.documentElement.currentPage.id, "done");
67 }
68 }
69 }
70
71 var pageData = parent.GetPageData();
72
73 // We default this to false, even though we could set it to true if we
74 // are going to display the page. However as the accname page will set
75 // it to true for us, we'll just default it to false and not work it out
76 // twice.
77 setPageData(pageData, "accname", "userset", false);
78
79 // If we need to skip wizardpanels, set the wizard to jump to the
80 // summary page i.e., last page. Otherwise, set the flow based
81 // on type of account (mail or news) user is creating.
82 var skipPanels = "";
83 try {
84 if (gCurrentAccountData.wizardSkipPanels)
85 skipPanels = gCurrentAccountData.wizardSkipPanels.toString().toLowerCase();
86 } catch(ex) {}
87
88 // "done" is the only required panel for all accounts. We used to require an identity panel but not anymore.
89 // initialize wizardPanels with the optional mail/news panels
90 var wizardPanels, i;
91 var isMailAccount = pageData.accounttype.mailaccount;
92 if (skipPanels == "true") // Support old syntax of true/false for wizardSkipPanels
93 wizardPanels = new Array("identitypage");
94 else if (isMailAccount && isMailAccount.value)
95 wizardPanels = new Array("identitypage", "serverpage", "loginpage", "accnamepage");
96 else
97 wizardPanels = new Array("identitypage", "newsserver", "accnamepage");
98
99 // Create a hash table of the panels to skip
100 var skipArray = skipPanels.split(",");
101 var skipHash = new Array();
102 for (i = 0; i < skipArray.length; i++)
103 skipHash[skipArray[i]] = skipArray[i];
104
105 // Remove skipped panels
106 i = 0;
107 while (i < wizardPanels.length) {
108 if (wizardPanels[i] in skipHash)
109 wizardPanels.splice(i, 1);
110 else
111 i++;
112 }
113
114 wizardPanels.push("done");
115
116 // Set up order of panels
117 for (i = 0; i < (wizardPanels.length-1); i++)
118 setNextPage(wizardPanels[i], wizardPanels[i+1]);
119
120 // make the account type page go to the very first of our approved wizard panels...this is usually going to
121 // be accounttype --> identitypage unless we were configured to skip the identity page
122 setNextPage("accounttype",wizardPanels[0]);
123 }
124
initializeIspData
125 function initializeIspData()
126 {
127 if (!document.getElementById("mailaccount").selected) {
128 parent.SetCurrentAccountData(null);
129 }
130
131 // now reflect the datasource up into the parent
132 var accountSelection = document.getElementById("acctyperadio");
133
134 var ispName = accountSelection.selectedItem.id;
135
136 dump("initializing ISP data for " + ispName + "\n");
137
138 if (!ispName || ispName == "") return;
139
140 parent.PrefillAccountForIsp(ispName);
141 }