!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 Communicator client code, released
16 * March 31, 1998.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998-1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
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
39 /**
40 * Key value pairs to derive the tag based on the page loaded.
41 * Each key is the page loaded when user clicks on one of the items on
42 * the accounttree of the AccountManager window.
43 * Value is a tag that is preset which will be used to display
44 * context sensitive help.
45 */
46 var pageTagPairs = {
47 "chrome://messenger/content/am-main.xul": "mail_account_identity",
48 "chrome://messenger/content/am-server.xul": "mail",
49 "chrome://messenger/content/am-copies.xul": "mail_copies",
50 "chrome://messenger/content/am-addressing.xul": "mail_addressing_settings",
51 "chrome://messenger/content/am-junk.xul": "mail-account-junk",
52 "chrome://messenger/content/am-offline.xul": "mail-offline-accounts",
53 "chrome://messenger/content/am-smtp.xul": "mail_smtp",
54 "chrome://messenger/content/am-smime.xul": "mail_security_settings",
55 "chrome://messenger/content/am-serverwithnoidentities.xul": "mail_local_folders_settings",
56 "chrome://messenger/content/am-mdn.xul": "mail-account-receipts",
57 "chrome://messenger/content/am-fakeaccount.xul": "fake_account"
58 }
59
doHelpButton
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
60 function doHelpButton()
61 {
62 // Get the URI of the page loaded in the AccountManager's content frame.
63 var pageSourceURI = contentFrame.location.href;
64 // Get the help tag corresponding to the page loaded.
65 var helpTag = pageTagPairs[pageSourceURI];
66
67 // If the help tag is generic or offline, check if there is a need to set tags per server type
68 if ((helpTag == "mail") || (helpTag == "mail-offline-accounts")) {
69 // Get server type, as we may need to set help tags per server type for some pages
70 var serverType = GetServerType();
71
72 /**
73 * Check the page to be loaded. Following pages needed to be presented with the
74 * help content that is based on server type. For any pages with such requirement
75 * do add comments here about the page and a new case statement for pageSourceURI
76 * switch.
77 * - server settings ("chrome://messenger/content/am-server.xul")
78 * - offline/diskspace settings ("chrome://messenger/content/am-offline.xul")
79 */
80 switch (pageSourceURI) {
81 case "chrome://messenger/content/am-server.xul":
82 helpTag = "mail_server_" + serverType;
83 break;
84
85 case "chrome://messenger/content/am-offline.xul":
86 helpTag = "mail_offline_" + serverType;
87 break;
88
89 default :
90 break;
91 }
92 }
93
94 if ( helpTag )
95 openHelp(helpTag);
96 else
97 openHelp('mail');
98 }
99
100 /**
101 * Get server type of the seleted item
102 */
GetServerType
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
103 function GetServerType()
104 {
105 var serverType = null;
106 var idStruct = getServerIdAndPageIdFromTree(accounttree);
107 if (idStruct) {
108 var account = getAccountFromServerId(idStruct.serverId);
109 if (account) {
110 serverType = account.incomingServer.type;
111 }
112 }
113 return serverType;
114 }