This is just some static backup of the original site, don't expect every link to work!

source: content/prefDialog/vI_prefDialog_TB3FolderPicker.js @ d5349d

ng_0.9
Last change on this file since d5349d was d5349d, checked in by rene <rene@…>, 8 years ago

cleanup for javascript strict mode

  • Property mode set to 100644
File size: 4.7 KB
Line 
1
2/**
3* some code copied and adapted from Thunderbird Sources
4* thanks to all Thunderbird Developers
5*/
6
7/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
8 * ***** BEGIN LICENSE BLOCK *****
9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10 *
11 * The contents of this file are subject to the Mozilla Public License Version
12 * 1.1 (the "License"); you may not use this file except in compliance with
13 * the License. You may obtain a copy of the License at
14 * http://www.mozilla.org/MPL/
15 *
16 * Software distributed under the License is distributed on an "AS IS" basis,
17 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18 * for the specific language governing rights and limitations under the
19 * License.
20 *
21 * The Original Code is Mozilla Communicator client code, released
22 * March 31, 1998.
23 *
24 * The Initial Developer of the Original Code is
25 * Netscape Communications Corporation.
26 * Portions created by the Initial Developer are Copyright (C) 1998-1999
27 * the Initial Developer. All Rights Reserved.
28 *
29 * Contributor(s):
30 *
31 * Alternatively, the contents of this file may be used under the terms of
32 * either of the GNU General Public License Version 2 or later (the "GPL"),
33 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
34 * in which case the provisions of the GPL or the LGPL are applicable instead
35 * of those above. If you wish to allow use of your version of this file only
36 * under the terms of either the GPL or the LGPL, and not to allow others to
37 * use your version of this file under the terms of the MPL, indicate your
38 * decision by deleting the provisions above and replace them with the notice
39 * and other provisions required by the GPL or the LGPL. If you do not delete
40 * the provisions above, a recipient may use your version of this file under
41 * the terms of any one of the MPL, the GPL or the LGPL.
42 *
43 * ***** END LICENSE BLOCK ***** */
44
45Components.utils.import("resource://v_identity/vI_nameSpaceWrapper.js");
46virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
47
48var InitFolderDisplays = function(msgFolder, accountPickerId, folderPickerId) {
49    var accountPicker = document.getElementById(accountPickerId);
50    var folderPicker = document.getElementById(folderPickerId);
51    InitFolderDisplay(msgFolder.server.rootFolder, accountPicker);
52    InitFolderDisplay(msgFolder, folderPicker);
53}
54
55// Initialize the folder display based on prefs values
56var InitFolderDisplay = function(folder, folderPicker) {
57    try {
58      folderPicker.firstChild.selectFolder(folder);
59    } catch(ex) {
60      folderPicker.setAttribute("label", folder.prettyName);
61    }
62    folderPicker.folder = folder;
63}
64
65// Capture any menulist changes
66var noteSelectionChange = function(radioItemId, aEvent)
67{
68    var checkedElem = document.getElementById(radioItemId);
69    var folder = aEvent.target._folder;
70    var modeValue  = checkedElem.value;
71    var radioGroup = checkedElem.radioGroup.getAttribute("id");
72    var picker;
73    switch (radioGroup)
74    {
75        case "VIdent_doFcc" :
76            vI.gFccRadioElemChoice = modeValue;
77            picker = document.getElementById("msgFccFolderPicker");
78            break;
79   
80        case "VIdent_messageDrafts" :
81            vI.gDraftsRadioElemChoice = modeValue;
82            picker = document.getElementById("msgDraftsFolderPicker");
83            break;
84
85        case "VIdent_messageTemplates" :
86            vI.gTmplRadioElemChoice = modeValue;
87            picker = document.getElementById("msgStationeryFolderPicker");
88            break;
89    }
90    picker.folder = folder;
91    picker.setAttribute("label", folder.prettyName);
92}
93
94// Save folder settings and radio element choices
95var SaveFolderSettings = function(radioElemChoice, 
96                            radioGroupId,
97                            folderSuffix,
98                            accountPickerId,
99                            folderPickerId,
100                            folderElementId,
101                            folderPickerModeId)
102{
103    var formElement = document.getElementById(folderElementId);
104    var uri = "";
105
106    switch (radioElemChoice) 
107    {
108        case "0" :
109            uri = document.getElementById(accountPickerId).selectedItem._folder.URI;
110            if (uri) {
111                // Create  Folder URI
112                uri = uri + folderSuffix;
113            }
114            break;
115
116        case "1" : 
117            uri = document.getElementById(folderPickerId).folder.URI;
118            break;
119
120        default :
121            break;
122    }
123    formElement.setAttribute("value", uri);
124
125    formElement = document.getElementById(folderPickerModeId);
126    formElement.setAttribute("value", radioElemChoice);
127}
128vI.InitFolderDisplays = InitFolderDisplays;
129vI.SaveFolderSettings = SaveFolderSettings;
130vI.noteSelectionChange = noteSelectionChange;
131}});
Note: See TracBrowser for help on using the repository browser.