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

source: chrome/content/v_identity/vI_rdfDataEditor.js @ 92fd25

ng_0.8ng_0.9
Last change on this file since 92fd25 was 3f9026, checked in by rene <rene@…>, 11 years ago

changed preferences dialog

  • Property mode set to 100644
File size: 4.6 KB
Line 
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
25var vI_rdfDataEditor = {
26    __rdfDatasource : null,
27    __rdfDataTree : null,
28    __type : null,
29    __recipient : null,
30    __identityData : null,
31   
32    __populateIdentityMenu : function() {
33        var listitem = document.createElement("menuitem");
34//      listitem.setAttribute("label", document.getElementById("bundle_messenger").getString("defaultServerTag"));
35        listitem.setAttribute("label", "");
36        document.getElementById("identity_list_popup").appendChild(listitem);
37        document.getElementById("identity_list").selectedItem = listitem;
38        var separator = document.createElement("menuseparator");
39        document.getElementById("identity_list_popup").appendChild(separator);
40
41        FillIdentityList(document.getElementById("identity_list"))
42    },
43
44    init : function() {
45        if (window.arguments[0]["recipientCol"])
46            vI_rdfDataEditor.__recipient = window.arguments[0]["recipientCol"];
47        vI_rdfDataEditor.__type = window.arguments[1];
48        vI_rdfDataEditor.__rdfDatasource = window.arguments[2];
49        vI_rdfDataEditor.__rdfDataTree = window.arguments[3];
50        ;
51        vI_rdfDataEditor.__identityData = new vI_identityData();
52        vI_rdfDataEditor.__identityData.copy(window.arguments[0].identityData);
53
54       
55        // set recipient
56        document.getElementById("recipient").value = vI_rdfDataEditor.__recipient;
57       
58        // set type of entry (and populate Menu)
59        var typeMenuPopup = document.getElementById("type_menu_popup")
60        for each (typeField in Array("email", "maillist", "newsgroup", "filter")) {
61            var menuitem = document.createElement("menuitem");
62            var label = document.getElementById("vI_rdfDataTreeBundle").getString("vI_rdfDataTree.dataType." + typeField)
63            menuitem.setAttribute("label", label);
64            menuitem.setAttribute("key", typeField);
65            typeMenuPopup.appendChild(menuitem);
66            if (typeField == vI_rdfDataEditor.__type) document.getElementById("type_menu").selectedItem = menuitem
67        }
68       
69        // set sender
70        document.getElementById("sender").value = vI_rdfDataEditor.__identityData.combinedName;
71
72        // set Identity
73        vI_rdfDataEditor.__populateIdentityMenu();
74        var MenuItems = document.getElementById("identity_list_popup").childNodes;
75        for (var index = 0; index < MenuItems.length; index++) {
76            if (MenuItems[index].getAttribute("value") == vI_rdfDataEditor.__identityData.id.key) {
77                document.getElementById("identity_list").selectedItem =
78                        MenuItems[index];
79                break;
80            }
81        }
82
83        // set SMTP
84        document.getElementById("smtpServerListHbox").addNoneServer(); // add non (not stored) Server
85        document.getElementById("smtpServerListHbox").smtp = vI_rdfDataEditor.__identityData.smtp.keyNice;
86       
87        // set extra values
88        vI_rdfDataEditor.__identityData.extras.setEditorValues();
89        vI_storageExtrasHelper.hideUnusedEditorFields();
90    },
91   
92    blurEvent : function(elementId) {
93        var elem = document.getElementById(elementId);
94        var localIdentityData = new vI_identityData(elem.value, null, null, null, null, null, null);
95        elem.value = localIdentityData.combinedName;                   
96    },
97   
98    accept : function() {
99        var localIdentityData = new vI_identityData(document.getElementById("sender").value, null,
100            document.getElementById("identity_list").selectedItem.getAttribute("value"),
101            document.getElementById("smtp_server_list").selectedItem.getAttribute("key"));
102        localIdentityData.extras.readEditorValues();
103
104        vI_rdfDataEditor.__rdfDatasource.updateRDF(
105                document.getElementById("recipient").value,
106                document.getElementById("type_menu").selectedItem.getAttribute("key"),
107                localIdentityData,
108                true, true, vI_rdfDataEditor.__recipient, vI_rdfDataEditor.__type);
109       
110        return document.getElementById("type_menu").selectedItem.getAttribute("key");
111    }
112}
Note: See TracBrowser for help on using the repository browser.