1 | function Im() |
---|
2 | { |
---|
3 | this.xtools = new XTools; |
---|
4 | this.conn = new Connector; |
---|
5 | this.vcard = "layer"; |
---|
6 | this.nickname = null; |
---|
7 | this.status = null; |
---|
8 | this.statusFlag = null; |
---|
9 | this.contacts_off_line = null; |
---|
10 | this.timeOut_im = null; |
---|
11 | this.nickname_contacts = []; |
---|
12 | } |
---|
13 | |
---|
14 | Im.prototype = { |
---|
15 | |
---|
16 | "addemotion" : function(pEmotion,pJid) |
---|
17 | { |
---|
18 | function get_Element(pJid) |
---|
19 | { |
---|
20 | var _document = document.getElementById('iframe_' + pJid); |
---|
21 | return _document.contentWindow.document.getElementsByTagName('body').item(0); |
---|
22 | } |
---|
23 | |
---|
24 | var content = get_Element(pJid); |
---|
25 | content.innerHTML += "" + this.insertEmoticons(pEmotion); |
---|
26 | }, |
---|
27 | |
---|
28 | "addrequest" : function(pEmail) |
---|
29 | { |
---|
30 | var email = pEmail; |
---|
31 | var name = pEmail.substr(0,pEmail.indexOf('@')); |
---|
32 | var group = 'default'; |
---|
33 | |
---|
34 | function handler_adduser(XmlData) |
---|
35 | { |
---|
36 | if(XmlData != "OK") |
---|
37 | alert("Contato não adicionado !"); |
---|
38 | } |
---|
39 | this.conn.go('$this.Ujabber.addContacts',{'request':handler_adduser},'email='+email+'&name='+name+'&group='+group); |
---|
40 | }, |
---|
41 | |
---|
42 | "adduser" : function() |
---|
43 | { |
---|
44 | if(!func.trim(func.byId('im_name').value) || !func.trim(func.byId('im_group').value)) |
---|
45 | alert('Informe todos os campos !'); |
---|
46 | else |
---|
47 | { |
---|
48 | var jid = func.byId('im_jid').value; |
---|
49 | var name = func.byId('im_name').value; |
---|
50 | var group = func.byId('im_group').value; |
---|
51 | var email = jid; |
---|
52 | |
---|
53 | if(func.byId('im_uid') != null) |
---|
54 | var uid = func.byId('im_uid').value; |
---|
55 | if(uid) |
---|
56 | email = uid + '@' + jid.substr((jid.indexOf('@')+1),jid.length); |
---|
57 | |
---|
58 | function handler_adduser(XmlData) |
---|
59 | { |
---|
60 | if(XmlData != "OK") |
---|
61 | alert("Contato não adicionado !"); |
---|
62 | else |
---|
63 | alert("Contato Adicionado !"); |
---|
64 | } |
---|
65 | this.conn.go('$this.Ujabber.addContacts',{'request':handler_adduser},'email='+email+'&name='+name+'&group='+group); |
---|
66 | } |
---|
67 | }, |
---|
68 | |
---|
69 | "button_color": function(pJid,pColor) |
---|
70 | { |
---|
71 | var _document = document.getElementById('iframe_' + pJid); |
---|
72 | var _font_color = ""; |
---|
73 | |
---|
74 | function get_Element(pJid) |
---|
75 | { |
---|
76 | return _document.contentWindow.document.getElementsByTagName('body').item(0); |
---|
77 | } |
---|
78 | var content = get_Element(pJid); |
---|
79 | |
---|
80 | if( _font_color = _document.contentWindow.document.getElementById('colors_'+pJid) ) |
---|
81 | content.innerHTML = "<span id='colors_"+pJid+"'style='color:"+pColor+"'>"+_font_color.innerHTML+"</span>"; |
---|
82 | else |
---|
83 | content.innerHTML = "<span id='colors_"+pJid+"'style='color:"+pColor+"'>"+content.innerHTML+"</span>"; |
---|
84 | }, |
---|
85 | |
---|
86 | "conf_font" : function(pJid,pAction) |
---|
87 | { |
---|
88 | function get_Element(pJid) |
---|
89 | { |
---|
90 | var _document = document.getElementById('iframe_' + pJid); |
---|
91 | return _document.contentWindow.document.getElementsByTagName('body').item(0); |
---|
92 | } |
---|
93 | |
---|
94 | switch(pAction) |
---|
95 | { |
---|
96 | case "button_bold" : |
---|
97 | var content = get_Element(pJid); |
---|
98 | content.innerHTML = "<span style='font-weight: bold;'>" + content.innerHTML + "</span>"; |
---|
99 | break; |
---|
100 | case "button_color" : |
---|
101 | templates.colors(pJid); |
---|
102 | break; |
---|
103 | case "button_emoticons" : |
---|
104 | templates.smiles(pJid); |
---|
105 | break; |
---|
106 | case "button_italic" : |
---|
107 | var content = get_Element(pJid); |
---|
108 | content.innerHTML = "<em>" + content.innerHTML + "</em>"; |
---|
109 | break; |
---|
110 | case "button_underline" : |
---|
111 | var content = get_Element(pJid); |
---|
112 | content.innerHTML = "<span style='text-decoration: underline;'>" + content.innerHTML + "</span>"; |
---|
113 | break; |
---|
114 | } |
---|
115 | }, |
---|
116 | |
---|
117 | "focus_select" : function(pObj,pEv) |
---|
118 | { |
---|
119 | pObj.focus(); |
---|
120 | pObj.select(); |
---|
121 | }, |
---|
122 | |
---|
123 | "get_contacts" : function() |
---|
124 | { |
---|
125 | var contact = func.byId('im_contact_list').firstChild; |
---|
126 | |
---|
127 | func.byId('im_remove_contact')[func.byId('im_remove_contact').length] = new Option('-- Selecione --', -1, true, true); |
---|
128 | |
---|
129 | while ( contact ) |
---|
130 | { |
---|
131 | if( contact.tagName == "DIV") |
---|
132 | { |
---|
133 | var options = new Option(contact.id.substr(0,contact.id.indexOf('@')), contact.id, false, true); |
---|
134 | func.byId('im_remove_contact')[func.byId('im_remove_contact').length] = options; |
---|
135 | } |
---|
136 | contact = contact.nextSibling; |
---|
137 | } |
---|
138 | |
---|
139 | func.byId('im_remove_contact')[0].selected = true; |
---|
140 | }, |
---|
141 | |
---|
142 | "get_lang" : function(_key, _arg1, _arg2, _arg3, _arg4) |
---|
143 | { |
---|
144 | var _value = ""; |
---|
145 | |
---|
146 | if ( !lang_im[_key.toLowerCase()] ) |
---|
147 | return _key + "*"; |
---|
148 | |
---|
149 | _value = lang_im[_key.toLowerCase()]; |
---|
150 | |
---|
151 | if ( _arg1 || _arg2 ||_arg3 || _arg4 ) |
---|
152 | { |
---|
153 | for (j = 1; j <= 4; j++ ) |
---|
154 | if( eval("_arg"+j) ) |
---|
155 | { |
---|
156 | var regExp = new RegExp("%" + j + ""); |
---|
157 | _value = _value.replace(regExp, eval("_arg"+j)); |
---|
158 | } |
---|
159 | } |
---|
160 | |
---|
161 | return _value; |
---|
162 | }, |
---|
163 | |
---|
164 | "get_preferences" : function() |
---|
165 | { |
---|
166 | var preferences = ""; |
---|
167 | |
---|
168 | function func_preferences(pString) |
---|
169 | { |
---|
170 | var result = pString.split(';'); |
---|
171 | |
---|
172 | for(var i in result) |
---|
173 | { |
---|
174 | var field = result[i].substr(0,result[i].indexOf(':')); |
---|
175 | var value = result[i].substr(result[i].indexOf(':') +1, result[i].length); |
---|
176 | if(value === 'true' || value === 'false') |
---|
177 | { |
---|
178 | if(func.byId(field)) |
---|
179 | func.byId(field).checked = eval(value); |
---|
180 | |
---|
181 | if(field === "ch_offline" ) |
---|
182 | im.contacts_off_line = eval(value); |
---|
183 | } |
---|
184 | else |
---|
185 | { |
---|
186 | if(func.byId(field)) |
---|
187 | func.byId(field).value = value; |
---|
188 | im.timeOut_im = value; |
---|
189 | } |
---|
190 | } |
---|
191 | } |
---|
192 | |
---|
193 | if(preferences = cookies_im.checkCookie('preferences_im')) |
---|
194 | func_preferences(preferences); |
---|
195 | else |
---|
196 | { |
---|
197 | function handler_preferences(XmlData) |
---|
198 | { |
---|
199 | func_preferences(XmlData); |
---|
200 | cookies_im.setCookie('preferences_im', XmlData, null); |
---|
201 | } |
---|
202 | this.conn.go('$this.db_im.get_preferences',{'request':handler_preferences}); |
---|
203 | } |
---|
204 | }, |
---|
205 | |
---|
206 | "group_close" : function(pGroup) |
---|
207 | { |
---|
208 | var contact = func.byId('im_contact_list').firstChild; |
---|
209 | var img_group_close = new Image(); |
---|
210 | img_group_close.src = path_im + "templates/default/images/group_close.gif"; |
---|
211 | |
---|
212 | while ( contact ) |
---|
213 | { |
---|
214 | if(contact.getAttribute('idgroup') == pGroup) |
---|
215 | contact.style.display = "none"; |
---|
216 | contact = contact.nextSibling; |
---|
217 | } |
---|
218 | |
---|
219 | func.byId('group_' + pGroup).src = img_group_close.src; |
---|
220 | func.byId('group_' + pGroup).onclick = function(){im.group_open(pGroup)}; |
---|
221 | }, |
---|
222 | |
---|
223 | "group_open" : function(pGroup) |
---|
224 | { |
---|
225 | var contact = func.byId('im_contact_list').firstChild; |
---|
226 | var img_group_open = new Image(); |
---|
227 | img_group_open.src = path_im + "templates/default/images/group_open.gif"; |
---|
228 | |
---|
229 | while ( contact ) |
---|
230 | { |
---|
231 | if(contact.getAttribute('idgroup') == pGroup) |
---|
232 | contact.style.display = "block"; |
---|
233 | contact = contact.nextSibling; |
---|
234 | } |
---|
235 | |
---|
236 | func.byId('group_' + pGroup).src = img_group_open.src; |
---|
237 | func.byId('group_' + pGroup).onclick = function(){im.group_close(pGroup)}; |
---|
238 | }, |
---|
239 | |
---|
240 | "insertEmoticons" : function(pEmotion) |
---|
241 | { |
---|
242 | var emotion_regexp; |
---|
243 | |
---|
244 | for ( i in cod_emotions ) |
---|
245 | { |
---|
246 | try |
---|
247 | { |
---|
248 | emotion_regexp = new RegExp(cod_emotions[i][1], 'gi'); |
---|
249 | if ( emotion_regexp.test(pEmotion) ) |
---|
250 | { |
---|
251 | var image = eval('smile_' + cod_emotions[i][0] + '.src.substr(smile_' +cod_emotions[i][0] + '.src.indexOf(path_im))'); |
---|
252 | emotion_regexp = new RegExp(cod_emotions[i][1], 'gi'); |
---|
253 | pEmotion = pEmotion.replace(emotion_regexp, '<img emotion="' + i + '" src="' + image + '">'); |
---|
254 | } |
---|
255 | }catch(e){} |
---|
256 | } |
---|
257 | return pEmotion; |
---|
258 | }, |
---|
259 | |
---|
260 | "ldap" : function() |
---|
261 | { |
---|
262 | var _this = this; |
---|
263 | |
---|
264 | function handler_ldap(XmlData) |
---|
265 | { |
---|
266 | func.byId('im_ldap_ou').innerHTML = _this.xtools.parse(XmlData,'list_ldap_org.xsl'); |
---|
267 | } |
---|
268 | this.conn.go('$this.ldap_im.list_organizations_ldap', {'request':handler_ldap}); |
---|
269 | }, |
---|
270 | |
---|
271 | "ldap_adduser" : function(pElement) |
---|
272 | { |
---|
273 | if(pElement.options.length > 0) |
---|
274 | for(var i=0; i < pElement.options.length; i++) |
---|
275 | if(pElement.options[i].selected == true) |
---|
276 | { |
---|
277 | document.getElementById('im_jid').value = pElement.options[i].value.substr(0,pElement.options[i].value.indexOf(';')); |
---|
278 | document.getElementById('im_name').value = pElement.options[i].value.substr(0,pElement.options[i].value.indexOf('@')); |
---|
279 | document.getElementById('im_group').focus(); |
---|
280 | document.getElementById('im_uid').value = pElement.options[i].value.substr((pElement.options[i].value.indexOf(';')+1), pElement.options[i].value.length); |
---|
281 | } |
---|
282 | }, |
---|
283 | |
---|
284 | "ldap_search_ou" : function(pElement) |
---|
285 | { |
---|
286 | var ldap_ou = ""; |
---|
287 | |
---|
288 | for(var i=0; i < pElement.options.length; i++) |
---|
289 | if( pElement.options[i].selected == true ) |
---|
290 | { |
---|
291 | ldap_ou = pElement.options[i].value; |
---|
292 | document.getElementById('im_jid').value = ""; |
---|
293 | document.getElementById('im_name').value = ""; |
---|
294 | document.getElementById('im_ldap_user').innerHTML = ""; |
---|
295 | } |
---|
296 | |
---|
297 | if(ldap_ou) |
---|
298 | this.ldap_search_contacts(ldap_ou); |
---|
299 | }, |
---|
300 | |
---|
301 | "ldap_search_contacts" : function(pOu) |
---|
302 | { |
---|
303 | var _this = this; |
---|
304 | document.getElementById('_span_load_im').style.display = "block"; |
---|
305 | |
---|
306 | function handler_ldap(XmlData) |
---|
307 | { |
---|
308 | document.getElementById('im_ldap_user').innerHTML = _this.xtools.parse(XmlData,'list_ldap_contacts.xsl'); |
---|
309 | document.getElementById('_span_load_im').style.display = "none"; |
---|
310 | } |
---|
311 | |
---|
312 | this.conn.go('$this.contacts_im.list_contacts',{'request':handler_ldap}, 'ou='+pOu); |
---|
313 | }, |
---|
314 | |
---|
315 | "ldap_photo" : function(pAvatar) |
---|
316 | { |
---|
317 | var uid = pAvatar; |
---|
318 | |
---|
319 | if(pAvatar != 'im_avatar') |
---|
320 | var uid = pAvatar.substr(0,pAvatar.indexOf('@')); |
---|
321 | |
---|
322 | function handler_ldap_photo(XmlData) |
---|
323 | { |
---|
324 | var data = eval(XmlData); |
---|
325 | if(data) |
---|
326 | if( document.getElementById(pAvatar) != null ) |
---|
327 | { |
---|
328 | var photo_img = document.getElementById(pAvatar); |
---|
329 | photo_img.src = ( path_im + "inc/class.ldap_im.inc.php?user="+uid ) ? path_im + "inc/class.ldap_im.inc.php?user="+uid : im_photo.src ; |
---|
330 | } |
---|
331 | } |
---|
332 | this.conn.go('$this.ldap_im.photo_ldap',{'request':handler_ldap_photo},'uid='+uid); |
---|
333 | }, |
---|
334 | |
---|
335 | "off_line" : function(pDisplay) |
---|
336 | { |
---|
337 | var group = func.byId('im_contact_list').firstChild; |
---|
338 | |
---|
339 | while(group) |
---|
340 | { |
---|
341 | if(group.hasChildNodes()) |
---|
342 | { |
---|
343 | if(group.id) |
---|
344 | if( func.byId('img_' + group.id).src == im_unavailable.src ) |
---|
345 | func.confEl(group,"style","margin-left:15px;cursor:pointer;display:" + pDisplay + ";"); |
---|
346 | } |
---|
347 | group = group.nextSibling; |
---|
348 | } |
---|
349 | }, |
---|
350 | |
---|
351 | "presence" : function(pType) |
---|
352 | { |
---|
353 | var imgStatus = null; |
---|
354 | |
---|
355 | switch(pType) |
---|
356 | { |
---|
357 | case 'away' : |
---|
358 | case 'dnd' : |
---|
359 | case 'xa' : |
---|
360 | this.status = 'show='+pType; |
---|
361 | this.statusFlag = pType; |
---|
362 | imgStatus = pType; |
---|
363 | break; |
---|
364 | case 'available' : |
---|
365 | case 'unavailable' : |
---|
366 | this.status = 'type='+pType; |
---|
367 | this.statusFlag = pType; |
---|
368 | imgStatus = pType; |
---|
369 | break; |
---|
370 | case 'custom' : |
---|
371 | var custom = prompt('Personalize seu Status : '); |
---|
372 | if(custom) |
---|
373 | this.status = 'status='+custom; |
---|
374 | else |
---|
375 | return; |
---|
376 | } |
---|
377 | |
---|
378 | cookies_im.setCookie('status', this.status, null); |
---|
379 | function handler_presence(XmlData) |
---|
380 | { |
---|
381 | if(imgStatus != null) |
---|
382 | func.byId('im_status_src').src = eval('im_' + imgStatus + '.src'); |
---|
383 | } |
---|
384 | this.conn.go('$this.Ujabber.setPresence', {'request' : handler_presence}, this.status); |
---|
385 | }, |
---|
386 | |
---|
387 | "remove" : function(pJid) |
---|
388 | { |
---|
389 | if(confirm('Deseja excluir o contato ' + pJid + ' ?')) |
---|
390 | { |
---|
391 | function handler_remove(XmlData) |
---|
392 | { |
---|
393 | if(XmlData == "OK") |
---|
394 | { |
---|
395 | func.byId(pJid).parentNode.removeChild(func.byId(pJid)); |
---|
396 | } |
---|
397 | } |
---|
398 | this.conn.go('$this.Ujabber.removeContact',{'request':handler_remove},'jid='+pJid); |
---|
399 | } |
---|
400 | }, |
---|
401 | |
---|
402 | "remove_contact" : function(pElement) |
---|
403 | { |
---|
404 | var Jid = ""; |
---|
405 | |
---|
406 | if( func.byId(pElement).options.length > 0 ) |
---|
407 | for(var i=0; i < func.byId(pElement).options.length; i++) |
---|
408 | if( func.byId(pElement).options[i].selected == true ) |
---|
409 | Jid = func.byId(pElement).options[i].value; |
---|
410 | |
---|
411 | if(confirm('Deseja excluir o contato ' + Jid + ' ?')) |
---|
412 | { |
---|
413 | if( Jid && Jid != -1 ) |
---|
414 | { |
---|
415 | function handler_remove(XmlData) |
---|
416 | { |
---|
417 | if(XmlData == "OK") |
---|
418 | { |
---|
419 | func.byId(Jid).parentNode.removeChild(func.byId(Jid)); |
---|
420 | for(var i=0 ; i < func.byId(pElement).options.length; i++) |
---|
421 | { |
---|
422 | func.byId(pElement).options[i] = null; |
---|
423 | i--; |
---|
424 | } |
---|
425 | } |
---|
426 | } |
---|
427 | this.conn.go('$this.Ujabber.removeContact',{'request':handler_remove},'jid='+Jid); |
---|
428 | } |
---|
429 | } |
---|
430 | }, |
---|
431 | |
---|
432 | "request_vcard" : function(pJid, pType) |
---|
433 | { |
---|
434 | this.vcard = pType; |
---|
435 | |
---|
436 | function handler_getVcard(XmlData) |
---|
437 | { |
---|
438 | if(XmlData != "OK") |
---|
439 | alert('Erro no Vcard !'); |
---|
440 | } |
---|
441 | this.conn.go('$this.Ujabber.getVcard',{'request':handler_getVcard},'jid='+pJid); |
---|
442 | }, |
---|
443 | |
---|
444 | "save_vcard" : function() |
---|
445 | { |
---|
446 | |
---|
447 | var xmlVcard = "<FN>" + func.byId('im_fn').value + "</FN>"; |
---|
448 | xmlVcard += "<NICKNAME>" + func.byId('im_nickname').value + "</NICKNAME>"; |
---|
449 | xmlVcard += "<ORG>"; |
---|
450 | xmlVcard += "<ORGNAME>" + func.byId('im_orgname').value + "</ORGNAME>"; |
---|
451 | xmlVcard += "<ORGUNIT>" + func.byId('im_orgunit').value + "</ORGUNIT>"; |
---|
452 | xmlVcard += "</ORG>"; |
---|
453 | xmlVcard += "<ROLE>" + func.byId('im_role').value + "</ROLE>"; |
---|
454 | xmlVcard += "<BDAY>" + func.byId('im_bday').value + "</BDAY>"; |
---|
455 | |
---|
456 | func.byId('im_layer_nickname').innerHTML = func.byId('im_nickname').value; |
---|
457 | |
---|
458 | function handler_savevcard(XmlData) |
---|
459 | { |
---|
460 | if( XmlData != "OK" ) |
---|
461 | alert('Vcard não cadastrado/atualizado !'); |
---|
462 | else |
---|
463 | alert('Vcard cadastrado/atualizado !'); |
---|
464 | } |
---|
465 | this.conn.go('$this.Ujabber.newVcard',{'request':handler_savevcard},"vcard="+xmlVcard); |
---|
466 | |
---|
467 | }, |
---|
468 | |
---|
469 | "set_preferences" : function() |
---|
470 | { |
---|
471 | var preferences = ""; |
---|
472 | var numbers = /^\d+$/; |
---|
473 | |
---|
474 | this.timeOut_im = 1; |
---|
475 | preferences = (func.byId('ch_offline').checked ) ? 'ch_offline:true;' : 'ch_offline:false;'; |
---|
476 | this.contacts_off_line = func.byId('ch_offline').checked; |
---|
477 | if(numbers.test(func.byId('time_xa_im').value) && func.byId('time_xa_im').value != "0") |
---|
478 | { |
---|
479 | preferences += "time_xa_im:" + func.byId('time_xa_im').value + ";"; |
---|
480 | this.timeOut_im = func.byId('time_xa_im').value; |
---|
481 | } |
---|
482 | else |
---|
483 | preferences += "time_xa_im:1;"; |
---|
484 | |
---|
485 | preferences += ( func.byId('rd_nm').checked ) ? 'rd_nm:true;' : 'rd_nm:false;'; |
---|
486 | preferences += ( func.byId('rd_ch').checked ) ? 'rd_ch:true' : 'rd_ch:false'; |
---|
487 | |
---|
488 | function handler_preferences(XmlData) |
---|
489 | { |
---|
490 | if(XmlData === "true") |
---|
491 | { |
---|
492 | cookies_im.setCookie('preferences_im', preferences, null); |
---|
493 | if(im.contacts_off_line) |
---|
494 | im.off_line('block'); |
---|
495 | else |
---|
496 | im.off_line('none'); |
---|
497 | alert('Preferências Salvas !'); |
---|
498 | } |
---|
499 | } |
---|
500 | this.conn.go('$this.db_im.set_preferences',{'request':handler_preferences},'preferences='+preferences); |
---|
501 | }, |
---|
502 | |
---|
503 | "set_timeOut" : function() |
---|
504 | { |
---|
505 | if( this.statusFlag === 'available') |
---|
506 | setTimeout("im.presence(\'xa\')",parseInt(im.timeOut_im)); |
---|
507 | }, |
---|
508 | |
---|
509 | "subscription" : function(pJid, pType) |
---|
510 | { |
---|
511 | function handler_request(XmlData) |
---|
512 | { |
---|
513 | if(XmlData != 1) |
---|
514 | alert(XmlData); |
---|
515 | } |
---|
516 | this.conn.go('$this.Ujabber.subscription',{'request':handler_request},"jid="+pJid+"&type="+pType); |
---|
517 | }, |
---|
518 | |
---|
519 | "update_nickname" : function(pJid) |
---|
520 | { |
---|
521 | var jid = pJid; |
---|
522 | var name = func.byId(pJid).getAttribute('idname'); |
---|
523 | var group = func.byId(pJid).getAttribute('idgroup'); |
---|
524 | cookies_im.setCookie('contacts', pJid + "=" + func.byId("img_"+ pJid).src, 1); |
---|
525 | |
---|
526 | if( value = prompt("Digite um novo apelido para : " + jid, "" )) |
---|
527 | { |
---|
528 | if(func.trim(value) != "" && value != null) |
---|
529 | { |
---|
530 | name = value; |
---|
531 | function handler_update_contact(XmlData) |
---|
532 | { |
---|
533 | if(XmlData != "OK") |
---|
534 | alert('Contato não atualizado !'); |
---|
535 | |
---|
536 | } |
---|
537 | this.conn.go('$this.Ujabber.updateContact',{'request':handler_update_contact},"jid="+jid+"&name="+name+"&group="+group); |
---|
538 | } |
---|
539 | } |
---|
540 | }, |
---|
541 | |
---|
542 | "update_group" : function(pJid) |
---|
543 | { |
---|
544 | var jid = pJid; |
---|
545 | var name = func.byId(pJid).getAttribute('idname'); |
---|
546 | var group = func.byId(pJid).getAttribute('idgroup'); |
---|
547 | cookies_im.setCookie('contacts', pJid + "=" + func.byId("img_"+ pJid).src, 1); |
---|
548 | |
---|
549 | if( value = prompt("Digite um novo grupo para : " + jid, "" )) |
---|
550 | { |
---|
551 | if(func.trim(value) != "" && value != null) |
---|
552 | { |
---|
553 | group = value; |
---|
554 | function handler_update_contact(XmlData) |
---|
555 | { |
---|
556 | if(XmlData != "OK") |
---|
557 | alert('Contato não atualizado !'); |
---|
558 | } |
---|
559 | this.conn.go('$this.Ujabber.updateContact',{'request':handler_update_contact},"jid="+jid+"&name="+name+"&group="+group); |
---|
560 | } |
---|
561 | } |
---|
562 | } |
---|
563 | } |
---|
564 | var im = new Im(); |
---|