1 | function Templates() |
---|
2 | { |
---|
3 | this.xtools = new XTools(); |
---|
4 | this.zValue = 100; |
---|
5 | this.documentMousedown = null; |
---|
6 | this.jabber = new Jabber; |
---|
7 | } |
---|
8 | |
---|
9 | Templates.prototype = { |
---|
10 | |
---|
11 | "add_user": function() |
---|
12 | { |
---|
13 | var XmlDoc = "<adduser>" + |
---|
14 | "<top>" + |
---|
15 | "<lang1>" + im.get_lang("Organization Unit")+ "</lang1>" + |
---|
16 | "</top>" + |
---|
17 | "<table>"+ |
---|
18 | "<lang1>" + im.get_lang("Jid Contact") + "</lang1>" + |
---|
19 | "<lang2>" + im.get_lang("Nickname") + "</lang2>" + |
---|
20 | "<lang3>" + im.get_lang("Group") + "</lang3>" + |
---|
21 | "<lang4>" + im.get_lang("Add") + "</lang4>" + |
---|
22 | "<lang5>" + im.get_lang("Close") + "</lang5>" + |
---|
23 | "</table>" + |
---|
24 | "</adduser>"; |
---|
25 | im_window.load('add_user_im','instant_messenger_content','<title>.:: Adicionar Novos Contatos ::.</title>','window.xsl','545',true,true,true); |
---|
26 | im_window.elementC('add_user_im').innerHTML = this.xtools.parse(XmlDoc,'add_user.xsl'); |
---|
27 | im.ldap(); |
---|
28 | }, |
---|
29 | |
---|
30 | "colors": function(pJid) |
---|
31 | { |
---|
32 | var Xmlsmiles = "<colors>" + |
---|
33 | "<lang1>Black</lang1>" + |
---|
34 | "<lang2>Silver</lang2>" + |
---|
35 | "<lang3>Yellow</lang3>" + |
---|
36 | "<lang4>Red</lang4>" + |
---|
37 | "<lang5>Pink</lang5>" + |
---|
38 | "<lang6>Green</lang6>" + |
---|
39 | "<lang7>Blue</lang7>" + |
---|
40 | "<lang8>Magenta</lang8>" + |
---|
41 | "<path>"+path_im+"</path>" + |
---|
42 | "<name>"+pJid+"</name>" + |
---|
43 | "</colors>"; |
---|
44 | |
---|
45 | menu_action.menu(pJid + '__button_dest', this.xtools.parse(Xmlsmiles,'colors.xsl')); |
---|
46 | func.byId(pJid + '__button_dest').style.top = func.byId(pJid + '__button_color').offsetTop + 10; |
---|
47 | func.byId(pJid + '__button_dest').style.left = func.byId(pJid + '__button_color').offsetLeft + 10; |
---|
48 | func.byId(pJid + '__button_dest').style.zIndex = this.zValue++; |
---|
49 | func.byId(pJid + '__button_dest').style.position = "absolute"; |
---|
50 | }, |
---|
51 | |
---|
52 | "fast_menu" : function() |
---|
53 | { |
---|
54 | if( document.getElementById('__contacts_im___window_master') != null ) |
---|
55 | { |
---|
56 | var XmlDoc = "<fast_menu>" + |
---|
57 | "<lang1>Online</lang1>" + |
---|
58 | "<lang2>Ausente</lang2>" + |
---|
59 | "<lang3>Ocupado</lang3>" + |
---|
60 | "<lang4>Offline</lang4>" + |
---|
61 | "<lang5>Mensagem</lang5>" + |
---|
62 | "<img1>"+path_im+"templates/default/images/available.gif</img1>" + |
---|
63 | "<img2>"+path_im+"templates/default/images/away.gif</img2>" + |
---|
64 | "<img3>"+path_im+"templates/default/images/dnd.gif</img3>" + |
---|
65 | "<img4>"+path_im+"templates/default/images/unavailable.gif</img4>" + |
---|
66 | "<img5>"+path_im+"templates/default/images/icon_edit.gif</img5>" + |
---|
67 | "</fast_menu>"; |
---|
68 | |
---|
69 | menu_action.menu('fast_menu_im', this.xtools.parse(XmlDoc,'fast_menu.xsl')); |
---|
70 | document.getElementById('fast_menu_im').style.top = document.getElementById('fast_menu_im').offsetTop + 60; |
---|
71 | document.getElementById('fast_menu_im').style.left = document.getElementById('fast_menu_im').offsetLeft + 5; |
---|
72 | document.getElementById('fast_menu_im').style.zIndex = this.zValue++; |
---|
73 | document.getElementById('fast_menu_im').style.position = "absolute"; |
---|
74 | } |
---|
75 | else |
---|
76 | alert('Aguarde carregando lista de contatos ....'); |
---|
77 | |
---|
78 | }, |
---|
79 | |
---|
80 | "mysettings": function() |
---|
81 | { |
---|
82 | var XmlDoc = "<settings>" + |
---|
83 | "<lang1>Opções</lang1>" + |
---|
84 | "<lang2>Exibir amigos desconectados</lang2>" + |
---|
85 | "<lang3>Ausente</lang3>" + |
---|
86 | "<lang4>Ficar ausente depois de</lang4>" + |
---|
87 | "<lang5>minutos</lang5>" + |
---|
88 | "<lang6>Ativar aviso de mensagens recebidas</lang6>" + |
---|
89 | "<lang7>Normal</lang7>" + |
---|
90 | "<lang8>Treme Tela</lang8>" + |
---|
91 | "<lang9>" + im.get_lang("Save") + "</lang9>" + |
---|
92 | "<lang10>" + im.get_lang("Close") + "</lang10> " + |
---|
93 | "</settings>"; |
---|
94 | |
---|
95 | im_window.load('my_settings_im','instant_messenger_content','<title>.:: ' + im.get_lang("My Settings") + ' ::.</title>','window.xsl','400',true,true,true); |
---|
96 | im_window.elementC('my_settings_im').innerHTML = this.xtools.parse(XmlDoc,'mysettings.xsl'); |
---|
97 | im.get_preferences(); |
---|
98 | }, |
---|
99 | |
---|
100 | "options" : function(pEv, pJid) |
---|
101 | { |
---|
102 | try |
---|
103 | { |
---|
104 | var pEvent = pEv; |
---|
105 | |
---|
106 | if ( pEvent.button > 1 ) |
---|
107 | { |
---|
108 | document.oncontextmenu = new Function("return false"); |
---|
109 | document.onmousedown = new Function("return false"); |
---|
110 | |
---|
111 | this.options_button_right(pJid); |
---|
112 | |
---|
113 | document.onmousedown = new Function("return true"); |
---|
114 | } |
---|
115 | else |
---|
116 | { |
---|
117 | this.options_button_left(pJid); |
---|
118 | } |
---|
119 | |
---|
120 | }catch(e){} |
---|
121 | |
---|
122 | }, |
---|
123 | |
---|
124 | "options_button_left" : function(pJid) |
---|
125 | { |
---|
126 | var _this = this; |
---|
127 | |
---|
128 | if(!(im.nickname_contacts[pJid])) |
---|
129 | im.request_vcard(pJid, false); |
---|
130 | |
---|
131 | if( (func.byId('img_' + pJid).src != im_unavailable.src) ) |
---|
132 | { |
---|
133 | im_window.load(pJid, 'instant_messenger_content', '<title>.:: Expresso Messenger ::.</title>', 'chat.xsl','310',true,true,true); |
---|
134 | |
---|
135 | func.byId(pJid + '__avatar').src = path_im + "/templates/default/images/photo.png"; |
---|
136 | |
---|
137 | if(func.byId('iframe_' + pJid) != null) |
---|
138 | func.byId('iframe_' + pJid).parentNode.removeChild(func.byId('iframe_' + pJid)); |
---|
139 | |
---|
140 | var win = im_window.elementC(pJid); |
---|
141 | |
---|
142 | var iframe = document.createElement('iframe'); |
---|
143 | iframe.id = 'iframe_' + pJid; |
---|
144 | iframe.style.width = '290px'; |
---|
145 | iframe.style.height = '46px'; |
---|
146 | iframe.style.border = '0'; |
---|
147 | iframe.style.margin = '0'; |
---|
148 | iframe.style.padding = '0'; |
---|
149 | |
---|
150 | var _messages_ = win.firstChild.firstChild.nextSibling.nextSibling; |
---|
151 | _messages_.appendChild(iframe); |
---|
152 | |
---|
153 | iframe.contentWindow.document.write('<html><body id="' + pJid + '" style="margin:0px;padding:0px"></body></html>'); |
---|
154 | iframe.contentWindow.document.close(); |
---|
155 | iframe.contentWindow.document.designMode = "On"; |
---|
156 | iframe.contentWindow.focus(); |
---|
157 | |
---|
158 | im.ldap_photo(pJid + "__avatar"); |
---|
159 | } |
---|
160 | }, |
---|
161 | |
---|
162 | "options_button_right" : function( pJid ) |
---|
163 | { |
---|
164 | |
---|
165 | var XmlDoc = "<options>" + |
---|
166 | "<lang1>" + im.get_lang("Nickname") + "</lang1>" + |
---|
167 | "<lang2>" + im.get_lang("Group") + "</lang2>" + |
---|
168 | "<lang3>" + im.get_lang("Remove") + "</lang3>" + |
---|
169 | "<lang4>" + im.get_lang("It requisition permission")+ "</lang4>" + |
---|
170 | "<lang5>" + im.get_lang("See Info") + "</lang5>" + |
---|
171 | "<jid>" + pJid + "</jid>" + |
---|
172 | "<path>" + path_im + "</path>" + |
---|
173 | "</options>"; |
---|
174 | |
---|
175 | var posX = parseInt(func.byId('sub_' + pJid).offsetLeft) - parseInt(func.byId('sub_' + pJid).parentNode.scrollLeft); |
---|
176 | var posY = parseInt(func.byId('sub_' + pJid).offsetTop) - parseInt(func.byId('sub_' + pJid).parentNode.scrollTop); |
---|
177 | |
---|
178 | menu_action.menu('im_sub_menu', this.xtools.parse(XmlDoc,'options.xsl')); |
---|
179 | func.byId('im_sub_menu').style.zIndex = '99999'; |
---|
180 | func.byId('im_sub_menu').style.top = posY; |
---|
181 | func.byId('im_sub_menu').style.left = posX + 20; |
---|
182 | func.byId('im_sub_menu').style.position = 'absolute'; |
---|
183 | }, |
---|
184 | |
---|
185 | "preferences": function(pElement) |
---|
186 | { |
---|
187 | var XmlDoc = "<preferences>" + |
---|
188 | "<lang1>" + im.get_lang("Add Contact") + "</lang1>" + |
---|
189 | "<function1>templates.add_user();</function1>" + |
---|
190 | "<lang2>" + im.get_lang("Remove Contact") + "</lang2>" + |
---|
191 | "<function2>templates.remove_user();</function2>" + |
---|
192 | "<lang3>" + im.get_lang("Vcard") +"</lang3>" + |
---|
193 | "<function3>im.request_vcard('this',true)</function3>" + |
---|
194 | "<lang4>" + im.get_lang("Preferences") + "</lang4>" + |
---|
195 | "<function4>templates.mysettings()</function4>" + |
---|
196 | "<path>"+ path_im + "</path>" + |
---|
197 | "</preferences>"; |
---|
198 | |
---|
199 | menu_action.menu(pElement, this.xtools.parse(XmlDoc,'preferences.xsl')); |
---|
200 | document.getElementById(pElement).style.zIndex = this.zValue++; |
---|
201 | document.getElementById(pElement).style.position = "absolute"; |
---|
202 | }, |
---|
203 | |
---|
204 | "remove_user": function() |
---|
205 | { |
---|
206 | var XmlDoc = "<remove_user>" + |
---|
207 | "<lang1>" + im.get_lang("Contact") + "</lang1>" + |
---|
208 | "<lang2>" + im.get_lang("Remove") +"</lang2>" + |
---|
209 | "<lang3>" + im.get_lang("Close") + "</lang3>" + |
---|
210 | "</remove_user>"; |
---|
211 | |
---|
212 | im_window.load('remove_user_im','instant_messenger_content','<title>.:: Remover Contatos ::.</title>','window.xsl','350',true,true,true); |
---|
213 | im_window.elementC('remove_user_im').innerHTML = this.xtools.parse(XmlDoc,'remove_user.xsl'); |
---|
214 | im.get_contacts(); |
---|
215 | //im_window.visible('remove_user_im','block'); |
---|
216 | }, |
---|
217 | |
---|
218 | "smiles": function(pJid) |
---|
219 | { |
---|
220 | var Xmlsmiles = "<smiles>" + |
---|
221 | "<path>"+path_im+"</path>" + |
---|
222 | "<pjid>"+pJid+"</pjid>" + |
---|
223 | "</smiles>"; |
---|
224 | |
---|
225 | menu_action.menu(pJid + '__button_dest', this.xtools.parse(Xmlsmiles,'smiles.xsl')); |
---|
226 | func.byId(pJid + '__button_dest').style.top = func.byId(pJid + '__button_emoticons').offsetTop + 10; |
---|
227 | func.byId(pJid + '__button_dest').style.left = func.byId(pJid + '__button_emoticons').offsetLeft + 10; |
---|
228 | func.byId(pJid + '__button_dest').style.zIndex = this.zValue++; |
---|
229 | func.byId(pJid + '__button_dest').style.position = "absolute"; |
---|
230 | }, |
---|
231 | |
---|
232 | "vcard_contact" : function(pXml) |
---|
233 | { |
---|
234 | im.vcard = false; |
---|
235 | var title = "Informações do Contato - Expresso"; |
---|
236 | var XmlDoc = "<vcard_contact>" + |
---|
237 | "<lang1>" + im.get_lang("Full Name") + "</lang1>" + |
---|
238 | "<lang2>" + im.get_lang("Nickname") + "</lang2>" + |
---|
239 | "<lang3>" + im.get_lang("Organization") +"</lang3>" + |
---|
240 | "<lang4>" + im.get_lang("Sector") + "</lang4>" + |
---|
241 | "<lang5>" + im.get_lang("Role") + "</lang5>" + |
---|
242 | "<lang6>" + im.get_lang("Birthday") + "</lang6>" + |
---|
243 | "<lang7>" + im.get_lang("Close") + "</lang7>" + |
---|
244 | this.xtools.parse(pXml,'vcard.xsl') + |
---|
245 | "<id>vcard_contact_im</id>"+ |
---|
246 | "</vcard_contact>"; |
---|
247 | |
---|
248 | im_window.load('vcard_contact_im','instant_messenger_content','<title>.:: ' + title +' ::.</title>','window.xsl','390',true,true,true); |
---|
249 | im_window.elementC('vcard_contact_im').innerHTML = this.xtools.parse(XmlDoc,'vcard_contacts.xsl'); |
---|
250 | }, |
---|
251 | |
---|
252 | "vcard_user" : function(pXml) |
---|
253 | { |
---|
254 | im.vcard = false; |
---|
255 | var title = "Informações Pessoais - Expresso"; |
---|
256 | var XmlDoc = "<vcard_user>" + |
---|
257 | "<lang1>" + im.get_lang("Full Name") + "</lang1>" + |
---|
258 | "<lang2>" + im.get_lang("Nickname") + "</lang2>" + |
---|
259 | "<lang3>" + im.get_lang("Organization") + "</lang3>" + |
---|
260 | "<lang4>" + im.get_lang("Sector") + "</lang4>" + |
---|
261 | "<lang5>" + im.get_lang("Role") + "</lang5>" + |
---|
262 | "<lang6>" + im.get_lang("Birthday") + "</lang6>" + |
---|
263 | "<lang7>" + im.get_lang("Save") + "</lang7>" + |
---|
264 | "<lang8>" + im.get_lang("Close") + "</lang8>" + |
---|
265 | this.xtools.parse(pXml,'vcard.xsl') + |
---|
266 | "<id>vcard_user_im</id>"+ |
---|
267 | "</vcard_user>"; |
---|
268 | im_window.load('vcard_user_im','instant_messenger_content','<title>.:: ' + title +' ::.</title>','window.xsl','470',true,true,true); |
---|
269 | im_window.elementC('vcard_user_im').innerHTML = this.xtools.parse(XmlDoc,'vcard_user.xsl'); |
---|
270 | } |
---|
271 | }; |
---|
272 | |
---|
273 | var templates = new Templates(); |
---|