1 | /* ***** BEGIN LICENSE BLOCK ***** |
---|
2 | This program is free software; you can redistribute it and/or modify |
---|
3 | it under the terms of the GNU General Public License as published by |
---|
4 | the Free Software Foundation; either version 2 of the License, or |
---|
5 | (at your option) any later version. |
---|
6 | |
---|
7 | This program is distributed in the hope that it will be useful, |
---|
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | GNU General Public License for more details. |
---|
11 | |
---|
12 | You should have received a copy of the GNU General Public License |
---|
13 | along with this program; if not, write to the Free Software |
---|
14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
15 | |
---|
16 | The Original Code is the Virtual Identity Extension. |
---|
17 | |
---|
18 | The Initial Developer of the Original Code is Rene Ejury. |
---|
19 | Portions created by the Initial Developer are Copyright (C) 2007 |
---|
20 | the Initial Developer. All Rights Reserved. |
---|
21 | |
---|
22 | Contributor(s): |
---|
23 | * ***** END LICENSE BLOCK ***** */ |
---|
24 | |
---|
25 | var vI_rdfDataEditor = { |
---|
26 | __rdfDatasource : null, |
---|
27 | |
---|
28 | storageExtras : null, |
---|
29 | |
---|
30 | init : function() { |
---|
31 | vI_rdfDataEditor.__rdfDatasource = window.arguments[1] |
---|
32 | |
---|
33 | document.getElementById("recipient").value = window.arguments[0]["recipientCol"]; |
---|
34 | |
---|
35 | var typeMenuPopup = document.getElementById("type_menu_popup") |
---|
36 | for each (typeField in Array("email", "maillist", "newsgroup")) { |
---|
37 | var menuitem = document.createElement("menuitem"); |
---|
38 | var label = document.getElementById("vI_rdfDataTreeBundle").getString("vI_rdfDataTree.dataType." + typeField) |
---|
39 | menuitem.setAttribute("label", label) |
---|
40 | menuitem.setAttribute("key", typeField) |
---|
41 | typeMenuPopup.appendChild(menuitem); |
---|
42 | if (label == window.arguments[0]["typeCol"]) document.getElementById("type_menu").selectedItem = menuitem |
---|
43 | } |
---|
44 | |
---|
45 | document.getElementById("sender").value = window.arguments[0]["senderCol"] |
---|
46 | |
---|
47 | var listitem = document.createElement("menuitem"); |
---|
48 | // listitem.setAttribute("label", document.getElementById("bundle_messenger").getString("defaultServerTag")); |
---|
49 | listitem.setAttribute("label", ""); |
---|
50 | document.getElementById("identity_list_popup").appendChild(listitem); |
---|
51 | document.getElementById("identity_list").selectedItem = listitem; |
---|
52 | var separator = document.createElement("menuseparator"); |
---|
53 | document.getElementById("identity_list_popup").appendChild(separator); |
---|
54 | |
---|
55 | if (typeof(FillIdentityList)=="function") // TB 3.x |
---|
56 | FillIdentityList(document.getElementById("identity_list")) |
---|
57 | else // TB 2.x |
---|
58 | FillIdentityListPopup(document.getElementById("identity_list_popup")) |
---|
59 | |
---|
60 | var MenuItems = document.getElementById("identity_list_popup").childNodes |
---|
61 | |
---|
62 | for (var index = 0; index < MenuItems.length; index++) { |
---|
63 | if (MenuItems[index].getAttribute("value") == window.arguments[0]["idKey"]) { |
---|
64 | document.getElementById("identity_list").selectedItem = |
---|
65 | MenuItems[index]; |
---|
66 | break; |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | document.getElementById("smtpServerListHbox").smtp = window.arguments[0]["smtpKey"] |
---|
71 | |
---|
72 | vI_rdfDataEditor.storageExtras = new vI_storageExtras() |
---|
73 | vI_rdfDataEditor.storageExtras.setEditorValues(); |
---|
74 | vI_storageExtrasHelper.hideUnusedEditorFields(); |
---|
75 | }, |
---|
76 | |
---|
77 | blurEvent : function(elementId) { |
---|
78 | var elem = document.getElementById(elementId) |
---|
79 | var address = vI_helper.parseAddress(elem.value) |
---|
80 | elem.value = address.combinedName; |
---|
81 | }, |
---|
82 | |
---|
83 | accept : function() { |
---|
84 | var address = vI_helper.parseAddress(document.getElementById("sender").value) |
---|
85 | |
---|
86 | vI_rdfDataEditor.storageExtras.readEditorValues(); |
---|
87 | |
---|
88 | var localIdentityData = new identityData(address.email, address.name, |
---|
89 | document.getElementById("identity_list").selectedItem.getAttribute("value"), |
---|
90 | document.getElementById("smtp_server_list").selectedItem.getAttribute("key"), |
---|
91 | vI_rdfDataEditor.storageExtras) |
---|
92 | |
---|
93 | vI_rdfDataEditor.__rdfDatasource.updateRDF( |
---|
94 | document.getElementById("recipient").value, |
---|
95 | document.getElementById("type_menu").selectedItem.getAttribute("key"), |
---|
96 | localIdentityData, true) |
---|
97 | } |
---|
98 | } |
---|
99 | window.addEventListener("load", vI_rdfDataEditor.init, false); |
---|