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

source: content/vI_rdfDataEditor.js @ 184c6c

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

rearranged tree structure / added build-script

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