[20] | 1 | var im_win = { |
---|
| 2 | |
---|
| 3 | chat_pJid : null, |
---|
| 4 | _imWindowTemplate : null, |
---|
| 5 | xslWin : false, |
---|
[55] | 6 | photo : false, |
---|
| 7 | |
---|
[20] | 8 | "load" : function() |
---|
| 9 | { |
---|
[55] | 10 | try |
---|
| 11 | { |
---|
[60] | 12 | var backFantom = func.newEl('div'); |
---|
[55] | 13 | func.confEl(backFantom, 'id', 'backFantom'); |
---|
| 14 | func.confEl(backFantom, 'style', 'position:absolute;top:0px;left:0px;width:100%;height:100%;z-Index:-1;'); |
---|
[20] | 15 | |
---|
[60] | 16 | var menu_contato = func.newEl('div'); |
---|
[55] | 17 | func.confEl(menu_contato, 'id', 'menu_contato'); |
---|
| 18 | func.confEl(menu_contato, 'class', 'menu_im'); |
---|
| 19 | func.confEl(menu_contato, 'style', 'position:absolute;z-index:99999'); |
---|
[20] | 20 | |
---|
[60] | 21 | var emotions = func.newEl('div'); |
---|
[55] | 22 | func.confEl(emotions, 'id', 'shared_emotions'); |
---|
| 23 | func.confEl(emotions, 'class', 'emotionFrame'); |
---|
| 24 | func.confEl(emotions, 'style', 'position:absolute;padding:1px;left:350px;visibility:hidden;top:0px'); |
---|
[20] | 25 | |
---|
[60] | 26 | var font_name = func.newEl('div'); |
---|
[55] | 27 | func.confEl(font_name, 'id', 'shared_fontName'); |
---|
| 28 | func.confEl(font_name, 'class', 'statusMenu'); |
---|
| 29 | func.confEl(font_name, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
[20] | 30 | |
---|
[60] | 31 | var font_size = func.newEl('div'); |
---|
[55] | 32 | func.confEl(font_size, 'id', 'shared_fontSize'); |
---|
| 33 | func.confEl(font_size, 'class', 'statusMenu'); |
---|
| 34 | func.confEl(font_size, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
[20] | 35 | |
---|
[60] | 36 | var font_color = func.newEl('div'); |
---|
[55] | 37 | func.confEl(font_color, 'id', 'shared_fontColor'); |
---|
| 38 | func.confEl(font_color, 'class', 'statusMenu'); |
---|
| 39 | func.confEl(font_color, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
[20] | 40 | |
---|
[60] | 41 | var font_style = func.newEl('div'); |
---|
[55] | 42 | func.confEl(font_style, 'id', 'shared_fontStyle'); |
---|
| 43 | func.confEl(font_style, 'class', 'statusMenu'); |
---|
| 44 | func.confEl(font_style, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
[20] | 45 | |
---|
[60] | 46 | func.insEl(backFantom, menu_contato, emotions, font_name, font_size, font_color, font_style, false); |
---|
[20] | 47 | |
---|
[55] | 48 | emotions.innerHTML = Templates.emotions(); |
---|
| 49 | font_name.innerHTML = Templates.font_name(); |
---|
| 50 | font_size.innerHTML = Templates.font_size(); |
---|
| 51 | font_color.innerHTML = Templates.font_color(); |
---|
[64] | 52 | /*font_style.innerHTML = Templates.font_style();*/ |
---|
[20] | 53 | |
---|
[60] | 54 | var pId = 'contacts'; |
---|
[20] | 55 | |
---|
[60] | 56 | var main_menu_all = func.newEl('div'); |
---|
[55] | 57 | func.confEl(main_menu_all, 'style', 'margin: 3px;'); |
---|
[20] | 58 | |
---|
[60] | 59 | var main_menu_head = func.newEl('div'); |
---|
[55] | 60 | func.confEl(main_menu_head, 'id', pId + '_im_window_body_inner_head'); |
---|
| 61 | func.confEl(main_menu_head, 'style', 'margin: 0px 0px 3px 0px; border: 1px solid #809aa9; display: block;'); |
---|
[20] | 62 | |
---|
[60] | 63 | var main_menu_vcard = func.newEl('div'); |
---|
[55] | 64 | func.confEl(main_menu_vcard, 'id', 'im_vcard_contacts'); |
---|
| 65 | func.confEl(main_menu_vcard, 'style', 'display: none;'); |
---|
[20] | 66 | |
---|
[60] | 67 | var main_menu_body = func.newEl('div'); |
---|
[55] | 68 | func.confEl(main_menu_body, 'id', 'div_contacts'); |
---|
| 69 | func.confEl(main_menu_body, 'style', 'border: 1px solid #809aa9;'); |
---|
[68] | 70 | main_menu_body.innerHTML = '<b>Nenhum Contato</b>'; |
---|
[20] | 71 | |
---|
[55] | 72 | func.insEl(main_menu_head, main_menu_vcard, main_menu_body, main_menu_all); |
---|
[20] | 73 | |
---|
[60] | 74 | var main_menu_head_picture = func.newEl('img'); |
---|
[55] | 75 | func.confEl(main_menu_head_picture, 'id', pId + '_avatar'); |
---|
| 76 | func.confEl(main_menu_head_picture, 'src', img_photo.src); |
---|
| 77 | func.confEl(main_menu_head_picture, 'style', 'float: left; height: 65px; margin: 2px; width: 49px;'); |
---|
[20] | 78 | |
---|
[60] | 79 | var main_menu_head_name = func.newEl('span'); |
---|
[55] | 80 | func.confEl(main_menu_head_name, 'id', 'span_nickname'); |
---|
[60] | 81 | var main_menu_head_name_txt = document.createTextNode(" your nickname"); |
---|
[55] | 82 | func.insEl(main_menu_head_name_txt, main_menu_head_name); |
---|
[20] | 83 | |
---|
[60] | 84 | var br1 = func.newEl('br'); |
---|
[20] | 85 | |
---|
[60] | 86 | var main_menu_head_message = func.newEl('span'); |
---|
[55] | 87 | func.confEl(main_menu_head_message, 'id', 'span_message'); |
---|
[60] | 88 | var main_menu_head_message_txt = document.createTextNode(' your message'); |
---|
[55] | 89 | func.insEl(main_menu_head_message_txt, main_menu_head_message); |
---|
[20] | 90 | |
---|
[60] | 91 | var br2 = func.newEl('br'); |
---|
[20] | 92 | |
---|
[55] | 93 | func.insEl(main_menu_head_picture, main_menu_head_name, br1, main_menu_head_message, br2, main_menu_head); |
---|
[20] | 94 | |
---|
[60] | 95 | var main_menu_head_div = func.newEl("div"); |
---|
[55] | 96 | func.confEl(main_menu_head_div,'id','menu_preferences'); |
---|
| 97 | func.confEl(main_menu_head_div,'class','menu_im'); |
---|
| 98 | func.confEl(main_menu_head_div,'style','float: left;cursor:pointer'); |
---|
[20] | 99 | |
---|
[55] | 100 | func.insEl(main_menu_head_div, false); |
---|
[20] | 101 | |
---|
[55] | 102 | var params = []; |
---|
| 103 | params['body'] = main_menu_all; |
---|
| 104 | params['close'] = true; |
---|
[63] | 105 | params['height'] = 270; |
---|
[55] | 106 | params['left'] = 10; |
---|
| 107 | params['id'] = pId; |
---|
| 108 | params['maximize'] = true; |
---|
| 109 | params['style'] = 'visibility:hidden'; |
---|
[63] | 110 | params['title'] = 'Expresso Messenger'; |
---|
[55] | 111 | params['top'] = 10; |
---|
[63] | 112 | params['width'] = 210; |
---|
[55] | 113 | this.build(params); |
---|
[20] | 114 | |
---|
[55] | 115 | this.config(pId); |
---|
[20] | 116 | |
---|
[55] | 117 | this.windowMinimize(pId + '_im'); |
---|
[20] | 118 | |
---|
[55] | 119 | main_menu_head.innerHTML += '<span id="span_menu_pref" style="float: left;" onmousedown="IM.menu_preferences(event ,\'menu_preferences\'); document.oncontextmenu = new Function(\'return false\');"></span>'; |
---|
[20] | 120 | |
---|
[60] | 121 | var br3 = func.newEl('br'); |
---|
[55] | 122 | func.confEl(br3, 'style', 'clear: both'); |
---|
| 123 | |
---|
[60] | 124 | var div_ie = func.newEl('div'); |
---|
[55] | 125 | |
---|
| 126 | func.insEl(br3, div_ie, main_menu_head); |
---|
| 127 | |
---|
| 128 | main_menu_head_pref_img = func.newEl('img'); |
---|
| 129 | func.confEl(main_menu_head_pref_img, 'src', img_group_close.src); |
---|
| 130 | func.confEl(main_menu_head_pref_img, 'id', 'img_pref'); |
---|
| 131 | |
---|
| 132 | main_menu_head_pref_txt = document.createTextNode(IM.get_lang('Options')); |
---|
| 133 | |
---|
| 134 | func.insEl(main_menu_head_pref_img, main_menu_head_pref_txt, 'span_menu_pref'); |
---|
| 135 | } |
---|
| 136 | catch(e) |
---|
| 137 | { |
---|
| 138 | alert("load\n\n" + e + "\n\n" + e.description) |
---|
| 139 | } |
---|
[20] | 140 | }, |
---|
| 141 | |
---|
| 142 | "config" : function(pId) |
---|
| 143 | { |
---|
[55] | 144 | try |
---|
| 145 | { |
---|
| 146 | ADD_DHTML("backFantom"+NO_DRAG); |
---|
| 147 | ADD_DHTML("shared_fontStyle"+NO_DRAG); |
---|
| 148 | ADD_DHTML("shared_fontColor"+NO_DRAG); |
---|
| 149 | ADD_DHTML("shared_fontSize"+NO_DRAG); |
---|
| 150 | ADD_DHTML("shared_fontName"+NO_DRAG); |
---|
| 151 | ADD_DHTML("shared_emotions"+NO_DRAG); |
---|
| 152 | ADD_DHTML(pId+"_im_window_body_inner"+NO_DRAG); |
---|
| 153 | ADD_DHTML(pId+"_im_window"+NO_DRAG); |
---|
| 154 | ADD_DHTML(pId+"_im_window_master"+NO_DRAG); |
---|
| 155 | ADD_DHTML(pId+"_im_window_fantom"+NO_DRAG); |
---|
| 156 | ADD_DHTML(pId+"_im_window_movable"+CURSOR_MOVE); |
---|
| 157 | ADD_DHTML(pId+"_im_window_resize"+CURSOR_NW_RESIZE); |
---|
[20] | 158 | |
---|
| 159 | |
---|
[55] | 160 | dd.elements.backFantom.setOpacity(0); |
---|
| 161 | document.getElementById("backFantom").style.zIndex = -1; |
---|
[20] | 162 | |
---|
| 163 | |
---|
[55] | 164 | dd.elements.contacts_im_window_resize.moveTo(dd.elements.contacts_im_window.x+dd.elements.contacts_im_window.w-dd.elements.contacts_im_window_resize.w-2, dd.elements.contacts_im_window.y+dd.elements.contacts_im_window.h-dd.elements.contacts_im_window_resize.h-2); |
---|
| 165 | dd.elements.contacts_im_window_movable.moveTo(dd.elements.contacts_im_window.x, dd.elements.contacts_im_window.y); |
---|
| 166 | dd.elements.contacts_im_window_movable.setOpacity(0); |
---|
[20] | 167 | |
---|
[55] | 168 | dd.elements.contacts_im_window_resize.setOpacity(1); |
---|
| 169 | dd.elements.contacts_im_window_resize.moveTo(dd.elements.contacts_im_window_fantom.x+dd.elements.contacts_im_window_fantom.w-dd.elements.contacts_im_window_resize.w-2, dd.elements.contacts_im_window_fantom.y+dd.elements.contacts_im_window_fantom.h-dd.elements.contacts_im_window_resize.h-2); |
---|
[20] | 170 | |
---|
[55] | 171 | var contacts_im_window = new Object(); |
---|
| 172 | contacts_im_window.x = dd.elements.contacts_im_window_master.x; |
---|
| 173 | contacts_im_window.y = dd.elements.contacts_im_window_master.y; |
---|
| 174 | contacts_im_window.w = dd.elements.contacts_im_window_master.w; |
---|
| 175 | contacts_im_window.h = dd.elements.contacts_im_window_master.h; |
---|
| 176 | contacts_im_window.state = WINDOW_STATE_REGULAR; |
---|
| 177 | windowItems[pId] = contacts_im_window; |
---|
| 178 | } |
---|
| 179 | catch(e) |
---|
| 180 | { |
---|
| 181 | alert("config\n\n" + e + "\n\n" + e.description) |
---|
| 182 | } |
---|
[20] | 183 | }, |
---|
| 184 | |
---|
| 185 | "build" : function() |
---|
| 186 | { |
---|
| 187 | var pBody = ''; |
---|
| 188 | var pClose = true; |
---|
| 189 | var pHeight = 360; |
---|
| 190 | var pId = false; |
---|
| 191 | var pLeft = NaN; |
---|
| 192 | var pMaximize = true; |
---|
| 193 | var pMinimize = true; |
---|
| 194 | var pStyle = ''; |
---|
| 195 | var pTitle = ''; |
---|
| 196 | var pTop = NaN; |
---|
| 197 | var pWidth = 250; |
---|
[55] | 198 | //for ( aa in arguments ) |
---|
[20] | 199 | for ( var i = 0; i < arguments.length; i++ ) |
---|
| 200 | { |
---|
[55] | 201 | //if ( func.isArray(arguments[i]) ) |
---|
[20] | 202 | for ( var n in arguments[i] ) |
---|
| 203 | if ( !func.isUndefined(arguments[i][n]) ) |
---|
| 204 | switch ( n ) |
---|
| 205 | { |
---|
| 206 | case 'body' : pBody = arguments[i][n]; break; |
---|
| 207 | case 'close' : pClose = arguments[i][n]; break; |
---|
| 208 | case 'height' : pHeight = arguments[i][n]; break; |
---|
| 209 | case 'id' : pId = arguments[i][n]; break; |
---|
| 210 | case 'left' : pLeft = arguments[i][n]; break; |
---|
| 211 | case 'maximize': pMaximize = arguments[i][n]; break; |
---|
| 212 | case 'minimize': pMinimize = arguments[i][n]; break; |
---|
| 213 | case 'style' : pStyle = arguments[i][n]; break; |
---|
| 214 | case 'title' : pTitle = arguments[i][n]; break; |
---|
| 215 | case 'top' : pTop = arguments[i][n]; break; |
---|
| 216 | case 'width' : pWidth = arguments[i][n]; break; |
---|
| 217 | } |
---|
| 218 | } |
---|
| 219 | |
---|
| 220 | if ( !pId || pHeight < 60 || pWidth < 100 ) |
---|
| 221 | return false; |
---|
| 222 | |
---|
| 223 | if ( isNaN(pLeft) ) |
---|
| 224 | if ( windowItems[pId] ) |
---|
| 225 | pLeft = windowItems[pId].x; |
---|
| 226 | else |
---|
| 227 | pLeft = Math.floor(Math.random()*(dd.getWndH()-100)); |
---|
| 228 | |
---|
| 229 | if ( isNaN(pTop) ) |
---|
| 230 | if ( windowItems[pId] ) |
---|
| 231 | pTop = windowItems[pId].y; |
---|
| 232 | else |
---|
| 233 | pTop = Math.floor(Math.random()*(dd.getWndW()-pHeight-480)) |
---|
| 234 | |
---|
| 235 | if ( windowItems[pId] ) |
---|
| 236 | { |
---|
| 237 | pHeight = dd.elements[pId + "_im_window_body_inner"].h; |
---|
| 238 | pWidth = dd.elements[pId + "_im_window_body_inner"].w; |
---|
| 239 | } |
---|
| 240 | |
---|
[55] | 241 | if ( !this.xslWin ) this.xslWin = XMLTools.load(im_path + 'xsl/window.xsl?' + Date.parse(new Date)); |
---|
[20] | 242 | _xmlDoc = '<window id="' + pId + '" title="' + pTitle + '" height="' + pHeight + '" width="' + pWidth + '" left="' + pLeft + '" top="' + pTop + '" minimize="' + pMinimize + '" maximize="' + pMaximize + '" close="' + pClose + '" style="position:absolute;' + pStyle + '" />'; |
---|
| 243 | |
---|
| 244 | a = document.createElement('div'); |
---|
| 245 | |
---|
| 246 | if (window.ActiveXObject) |
---|
| 247 | { |
---|
| 248 | var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); |
---|
| 249 | xmlDoc.async = "false"; |
---|
| 250 | xmlDoc.loadXML(_xmlDoc); |
---|
| 251 | } |
---|
| 252 | else |
---|
| 253 | { |
---|
| 254 | var parser = new DOMParser(); |
---|
| 255 | var xmlDoc = parser.parseFromString(_xmlDoc, "text/xml"); |
---|
| 256 | } |
---|
| 257 | a.innerHTML = XMLTools.transform(xmlDoc, this.xslWin); |
---|
| 258 | document.getElementsByTagName('body').item(0).appendChild(a); |
---|
| 259 | |
---|
| 260 | switch ( typeof pBody ) |
---|
| 261 | { |
---|
| 262 | case 'object' : |
---|
| 263 | func.insEl(pBody, pId + '_im_window_body_inner'); |
---|
| 264 | break; |
---|
| 265 | case 'string' : |
---|
| 266 | func.byId(pId + '_im_window_body_inner').innerHTML = pBody; |
---|
| 267 | |
---|
| 268 | } |
---|
| 269 | |
---|
| 270 | RoundedTop('div#' + pId + '_im_window_master', '', '#cbdae4'); |
---|
| 271 | this.windowMaximizeZ(pId); |
---|
[55] | 272 | |
---|
[20] | 273 | }, |
---|
| 274 | |
---|
| 275 | "hideAllChatSelections" : function() |
---|
| 276 | { |
---|
| 277 | this.hideEmotionSelection(); |
---|
| 278 | this.hideFontNameSelection(); |
---|
| 279 | this.hideFontSizeSelection(); |
---|
| 280 | this.hideFontColorSelection(); |
---|
| 281 | this.hideFontStyleSelection(); |
---|
| 282 | }, |
---|
| 283 | |
---|
| 284 | "hideWindowItem" : function(pId) |
---|
| 285 | { |
---|
[55] | 286 | try |
---|
[20] | 287 | { |
---|
[55] | 288 | dd.elements[pId + "_im_window"].hide(); |
---|
| 289 | dd.elements[pId + "_im_window_master"].hide(); |
---|
| 290 | dd.elements[pId + "_im_window_fantom"].hide(); |
---|
| 291 | dd.elements[pId + "_im_window_resize"].hide(); |
---|
| 292 | dd.elements[pId + "_im_window_movable"].hide(); |
---|
| 293 | if ( (name_document = document.getElementById(pId + '_divEdita')) ) |
---|
| 294 | { |
---|
| 295 | name_document.innerHTML = ''; |
---|
| 296 | var contact = func.byId(pId); |
---|
| 297 | var _status = IM.vcard_contacts[contact.getAttribute('nuncontact')].online |
---|
| 298 | contact.firstChild.src = ( _status == parseInt(1) ) ? img_online.src : img_offline.src; |
---|
| 299 | } |
---|
[20] | 300 | } |
---|
[55] | 301 | catch(e) |
---|
| 302 | {} |
---|
[20] | 303 | }, |
---|
| 304 | |
---|
| 305 | "incZ" : function() |
---|
| 306 | { |
---|
| 307 | zValue += 5; |
---|
| 308 | return zValue; |
---|
| 309 | }, |
---|
| 310 | |
---|
| 311 | "drag" : function() |
---|
| 312 | { |
---|
| 313 | try |
---|
| 314 | { |
---|
| 315 | var objName = dd.obj.name; |
---|
| 316 | i = objName.indexOf("_"); |
---|
| 317 | objName = objName.substr(0,i); |
---|
| 318 | |
---|
| 319 | this.incZ(); |
---|
| 320 | document.getElementById(objName + "_im_window_fantom").style.zIndex = zValue; |
---|
| 321 | dd.elements[objName + "_im_window_fantom"].setOpacity(0.5); |
---|
| 322 | |
---|
| 323 | document.getElementById(objName + "_im_window_fantom").className = "im_window_fantom"; |
---|
| 324 | |
---|
| 325 | var posX = dd.obj.x; |
---|
| 326 | var posY = dd.obj.y; |
---|
| 327 | if ( posX < 0 ) |
---|
| 328 | posX = 0; |
---|
| 329 | if ( posY < 0 ) |
---|
| 330 | posY = 0; |
---|
| 331 | |
---|
| 332 | dd.elements[objName + "_im_window_resize"].setOpacity(0); |
---|
| 333 | |
---|
| 334 | if ( dd.obj.name == (objName + "_im_window_resize") ) |
---|
| 335 | { |
---|
| 336 | windowState = WINDOW_STATE_REGULAR; |
---|
| 337 | |
---|
| 338 | // check if the re-size goes out of the screen |
---|
| 339 | if ( posX > ( dd.getWndW() - 15 ) ) |
---|
| 340 | posX = dd.getWndW()-15; |
---|
| 341 | if ( posY > ( dd.getWndH() - 13 ) ) |
---|
| 342 | posY = dd.getWndH()-13; |
---|
| 343 | |
---|
| 344 | // everything is fine, let's change the size of all required objects |
---|
| 345 | var newW = posX-dd.elements[objName + "_im_window_fantom"].x+15; |
---|
| 346 | var newH = posY-dd.elements[objName + "_im_window_fantom"].y+15; |
---|
| 347 | if ( newW < 100) newW = 100; |
---|
| 348 | if ( newH < 100) newH = 100; |
---|
| 349 | dd.elements[objName + "_im_window_fantom"].resizeTo(newW, newH); |
---|
[59] | 350 | |
---|
| 351 | if( document.getElementById(objName + "_chatMessages")) |
---|
| 352 | { |
---|
| 353 | func.confEl(document.getElementById(objName + "_chatMessages"),"style","width:" + (newW - 105) +";height:" + (newH - 150) +";margin: 2px 0px 2px 2px; overflow:auto;"); |
---|
| 354 | func.confEl(document.getElementById(objName + '_edita'),"style","width:" + (newW - 105) + ";height: 50px;margin: 3px 1px 0px 2px;float: left;"); |
---|
| 355 | } |
---|
| 356 | |
---|
[20] | 357 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
| 358 | var windowItem = windowItems[objName]; |
---|
| 359 | windowItem.state = WINDOW_STATE_REGULAR; |
---|
| 360 | } |
---|
| 361 | else |
---|
| 362 | { |
---|
| 363 | if ( posX > ( dd.getWndW() - dd.elements[objName + "_im_window_master"].w ) ) |
---|
| 364 | posX = dd.getWndW() - dd.elements[objName + "_im_window_master"].w; |
---|
| 365 | |
---|
| 366 | if ( posY > ( dd.getWndH() - dd.elements[objName + "_im_window_master"].h ) ) |
---|
| 367 | posY = dd.getWndH() - dd.elements[objName + "_im_window_master"].h; |
---|
| 368 | |
---|
| 369 | dd.elements[objName + "_im_window_fantom"].moveTo(posX, posY); |
---|
| 370 | } |
---|
| 371 | } |
---|
| 372 | catch(e) |
---|
| 373 | { |
---|
| 374 | } |
---|
| 375 | }, |
---|
| 376 | |
---|
| 377 | "drop" : function() |
---|
| 378 | { |
---|
| 379 | try |
---|
| 380 | { |
---|
| 381 | document.getElementById("backFantom").style.zIndex = -1; |
---|
| 382 | |
---|
| 383 | var objName = dd.obj.name; |
---|
| 384 | i = objName.indexOf("_"); |
---|
| 385 | objName = objName.substr(0,i); |
---|
| 386 | |
---|
| 387 | var posX = dd.obj.x; |
---|
| 388 | var posY = dd.obj.y; |
---|
| 389 | if ( posX < 0 ) |
---|
| 390 | posX = 0; |
---|
| 391 | if ( posY < 0 ) |
---|
| 392 | posY = 0; |
---|
| 393 | if ( posX > ( dd.getWndW() - dd.elements[objName + "_im_window_master"].w ) ) |
---|
| 394 | posX = dd.getWndW() - dd.elements[objName + "_im_window_master"].w; |
---|
| 395 | if ( posY > ( dd.getWndH() - dd.elements[objName + "_im_window_master"].h ) ) |
---|
| 396 | posY = dd.getWndH() - dd.elements[objName + "_im_window_master"].h; |
---|
| 397 | |
---|
| 398 | dd.elements[objName + "_im_window_resize"].setOpacity(1); |
---|
| 399 | |
---|
| 400 | if ( dd.obj.name == (objName + "_im_window_resize") ) |
---|
| 401 | { |
---|
| 402 | var newW = dd.obj.x-dd.elements[objName + "_im_window_fantom"].x+17; |
---|
| 403 | var newH = dd.obj.y-dd.elements[objName + "_im_window_fantom"].y+17; |
---|
| 404 | |
---|
| 405 | if ( newW < 100) newW = 100; |
---|
| 406 | if ( newH < 100) newH = 100; |
---|
| 407 | |
---|
| 408 | var winW = dd.elements[objName + "_im_window_master"].w - dd.elements[objName + "_im_window"].w; |
---|
| 409 | var winH = dd.elements[objName + "_im_window_master"].h - dd.elements[objName + "_im_window"].h; |
---|
| 410 | |
---|
| 411 | dd.elements[objName + "_im_window_fantom"].resizeTo(newW, newH); |
---|
| 412 | dd.elements[objName + "_im_window_master"].resizeTo(newW, newH); |
---|
| 413 | |
---|
| 414 | var bodyW = dd.elements[objName + "_im_window"].w - dd.elements[objName + "_im_window_body_inner"].w; |
---|
| 415 | var bodyH = dd.elements[objName + "_im_window"].h - dd.elements[objName + "_im_window_body_inner"].h; |
---|
| 416 | |
---|
| 417 | dd.elements[objName + "_im_window"].resizeTo(newW - winW, newH - winH); |
---|
| 418 | |
---|
| 419 | bodyW = dd.elements[objName + "_im_window"].w - bodyW; |
---|
| 420 | bodyH = dd.elements[objName + "_im_window"].h - bodyH; |
---|
| 421 | |
---|
| 422 | dd.elements[objName + "_im_window_body_inner"].resizeTo(bodyW, bodyH); |
---|
| 423 | |
---|
| 424 | dd.elements[objName + "_im_window_movable"].resizeTo(newW-55, 25); |
---|
| 425 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
| 426 | } |
---|
| 427 | else |
---|
| 428 | { |
---|
| 429 | dd.elements[objName + "_im_window_fantom"].moveTo(posX, posY); |
---|
| 430 | dd.elements[objName + "_im_window_master"].moveTo(posX, posY); |
---|
| 431 | dd.elements[objName + "_im_window"].moveTo(posX, (posY+4)); |
---|
| 432 | dd.elements[objName + "_im_window_movable"].moveTo(posX, posY); |
---|
| 433 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-3, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-3); |
---|
| 434 | } |
---|
| 435 | |
---|
| 436 | this.windowMaximizeZ(objName); |
---|
| 437 | |
---|
| 438 | dd.elements[objName + "_im_window_fantom"].setOpacity(0); |
---|
| 439 | var windowItem = windowItems[objName]; |
---|
| 440 | |
---|
| 441 | if ( windowItem != null ) |
---|
| 442 | { |
---|
| 443 | windowItem.x = dd.elements[objName + "_im_window_master"].x; |
---|
| 444 | windowItem.y = dd.elements[objName + "_im_window_master"].y; |
---|
| 445 | windowItem.w = dd.elements[objName + "_im_window_master"].w; |
---|
| 446 | windowItem.h = dd.elements[objName + "_im_window_master"].h; |
---|
| 447 | } |
---|
| 448 | } |
---|
| 449 | catch(e) |
---|
| 450 | { |
---|
| 451 | //alert(e) |
---|
| 452 | } |
---|
| 453 | }, |
---|
| 454 | |
---|
| 455 | "pick" : function() |
---|
| 456 | { |
---|
| 457 | document.getElementById("backFantom").style.zIndex = zValue; |
---|
| 458 | this.hideAllChatSelections(); |
---|
| 459 | var objName = dd.obj.name; |
---|
| 460 | i = objName.indexOf("_im"); |
---|
| 461 | objName = objName.substr(0,i); |
---|
| 462 | ACTIVE_OBJECTID = objName; |
---|
| 463 | }, |
---|
| 464 | |
---|
| 465 | "showWindowItem" : function(pId) |
---|
| 466 | { |
---|
[60] | 467 | /* |
---|
| 468 | * Não tire esta linha |
---|
| 469 | * Isso deve estar aqui para a janela 'oculta' |
---|
| 470 | * não 'piscar' na tela no momento que é criada. |
---|
| 471 | */ |
---|
| 472 | func.byId(pId + '_im_window_body_inner').style.overflow = 'auto'; |
---|
| 473 | |
---|
[20] | 474 | if ( (name_document = document.getElementById(pId + '_divEdita')) ) |
---|
| 475 | { |
---|
[55] | 476 | name_document.innerHTML = '<iframe name="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '_edita" class="edit_message" id="' + pId + '_edita" frameborder="0" style="border:margin: 3px 1px 0px 2px; width:220px; height:50px; float:left;"></iframe>'; |
---|
[20] | 477 | |
---|
| 478 | name_document = document.getElementById(pId + '_edita'); |
---|
| 479 | name_document.contentWindow.document.write('<html><body id="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '" style="margin:0px;padding:0px"></body></html>'); |
---|
| 480 | name_document.contentWindow.document.close(); |
---|
| 481 | name_document.contentWindow.document.designMode = "On"; |
---|
| 482 | |
---|
| 483 | func.attachEvent(name_document.contentWindow.document, 'keypress', im_win.getText); |
---|
| 484 | func.attachEvent(name_document.contentWindow.document, 'keyup', im_win.clearText); |
---|
| 485 | |
---|
| 486 | name_document.contentWindow.focus(); |
---|
| 487 | } |
---|
| 488 | |
---|
| 489 | dd.elements[pId + "_im_window_master"].show(); |
---|
| 490 | dd.elements[pId + "_im_window"].show(); |
---|
| 491 | dd.elements[pId + "_im_window_fantom"].show(); |
---|
| 492 | dd.elements[pId + "_im_window_resize"].show(); |
---|
| 493 | dd.elements[pId + "_im_window_movable"].show(); |
---|
[60] | 494 | |
---|
[20] | 495 | }, |
---|
| 496 | |
---|
| 497 | "windowMaximizeZ" : function(objName) |
---|
| 498 | { |
---|
[55] | 499 | try |
---|
| 500 | { |
---|
| 501 | this.incZ(); |
---|
| 502 | document.getElementById(objName + "_im_window_fantom").style.zIndex = zValue-3; |
---|
| 503 | document.getElementById(objName + "_im_window_master").style.zIndex = zValue-2; |
---|
| 504 | document.getElementById(objName + "_im_window").style.zIndex = zValue-1; |
---|
| 505 | document.getElementById(objName + "_im_window_body_inner").style.zIndex = zValue-1; |
---|
| 506 | document.getElementById(objName + "_im_window_resize").style.zIndex = zValue; |
---|
| 507 | document.getElementById(objName + "_im_window_movable").style.zIndex = zValue; |
---|
| 508 | if ( dd.elements[objName + "_im_window_movable"] ) |
---|
| 509 | dd.elements[objName + "_im_window_movable"].z = zValue+1; |
---|
| 510 | } |
---|
| 511 | catch(e) |
---|
| 512 | {} |
---|
[20] | 513 | }, |
---|
| 514 | |
---|
| 515 | "windowMinimize" : function(objName) |
---|
| 516 | { |
---|
| 517 | with(objName) |
---|
| 518 | objName = substr(0, indexOf('_im')); |
---|
| 519 | |
---|
| 520 | this.hideWindowItem(objName); |
---|
| 521 | windowItem = windowItems[objName]; |
---|
| 522 | if ( windowItem != null ) |
---|
| 523 | { |
---|
| 524 | windowItem.state = WINDOW_STATE_MINIMIZED; |
---|
| 525 | } |
---|
[55] | 526 | |
---|
[20] | 527 | }, |
---|
| 528 | |
---|
| 529 | "windowMaximizeRestore" : function(objName) |
---|
[60] | 530 | { |
---|
[20] | 531 | with(objName) |
---|
| 532 | objName = substr(0, indexOf('_im')); |
---|
| 533 | |
---|
| 534 | this.hideAllChatSelections(); |
---|
| 535 | |
---|
| 536 | windowItem = windowItems[objName]; |
---|
| 537 | |
---|
| 538 | if ( windowItem != null ) |
---|
| 539 | { |
---|
| 540 | var bodyW = dd.elements[objName + "_im_window"].w - dd.elements[objName + "_im_window_body_inner"].w; |
---|
| 541 | var bodyH = dd.elements[objName + "_im_window"].h - dd.elements[objName + "_im_window_body_inner"].h; |
---|
| 542 | |
---|
| 543 | if ( windowItem.state==WINDOW_STATE_REGULAR ) |
---|
| 544 | { |
---|
| 545 | windowItem.x = dd.elements[objName + "_im_window_master"].x; |
---|
| 546 | windowItem.y = dd.elements[objName + "_im_window_master"].y; |
---|
| 547 | windowItem.w = dd.elements[objName + "_im_window_master"].w; |
---|
| 548 | windowItem.h = dd.elements[objName + "_im_window_master"].h; |
---|
| 549 | |
---|
| 550 | var bodyX = dd.elements[objName + "_im_window_body_inner"].x + dd.elements[objName + "_im_window"].x; |
---|
| 551 | var bodyY = dd.elements[objName + "_im_window_body_inner"].y + dd.elements[objName + "_im_window"].y; |
---|
| 552 | |
---|
| 553 | dd.elements[objName + "_im_window_fantom"].moveTo(0, 0); |
---|
| 554 | dd.elements[objName + "_im_window_master"].moveTo(0, 0); |
---|
| 555 | dd.elements[objName + "_im_window"].moveTo(0, 4); |
---|
| 556 | |
---|
| 557 | dd.elements[objName + "_im_window_fantom"].resizeTo(dd.getWndW(), dd.getWndH()); |
---|
| 558 | dd.elements[objName + "_im_window_master"].resizeTo(dd.getWndW(), dd.getWndH()); |
---|
| 559 | dd.elements[objName + "_im_window"].resizeTo(dd.getWndW(), dd.getWndH() - 5); |
---|
| 560 | dd.elements[objName + "_im_window_body_inner"].resizeTo(dd.getWndW() - bodyW, dd.getWndH() - bodyH - 5); |
---|
| 561 | |
---|
| 562 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
| 563 | windowItem.state = WINDOW_STATE_MAXIMIZED; |
---|
| 564 | |
---|
| 565 | window.status = objName + "'s Z: " + document.getElementById(objName+"_im_window").style.zIndex; |
---|
| 566 | |
---|
| 567 | } |
---|
| 568 | else |
---|
| 569 | { |
---|
| 570 | dd.elements[objName + "_im_window_fantom"].resizeTo(windowItem.w, windowItem.h); |
---|
| 571 | dd.elements[objName + "_im_window_master"].resizeTo(windowItem.w, windowItem.h); |
---|
| 572 | dd.elements[objName + "_im_window"].resizeTo(windowItem.w, windowItem.h - 5); |
---|
| 573 | dd.elements[objName + "_im_window_body_inner"].resizeTo(windowItem.w - bodyW, windowItem.h - bodyH - 5); |
---|
| 574 | |
---|
| 575 | dd.elements[objName + "_im_window_fantom"].moveTo(windowItem.x, windowItem.y); |
---|
| 576 | dd.elements[objName + "_im_window_master"].moveTo(windowItem.x, windowItem.y); |
---|
| 577 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
| 578 | windowItem.state = WINDOW_STATE_REGULAR; |
---|
| 579 | } |
---|
| 580 | |
---|
| 581 | dd.elements[objName + "_im_window_movable"].moveTo(dd.elements[objName + "_im_window"].x, dd.elements[objName + "_im_window"].y); |
---|
| 582 | dd.elements[objName + "_im_window_movable"].resizeTo(dd.elements[objName + "_im_window"].w-55, 25); |
---|
| 583 | |
---|
| 584 | this.showWindowItem(objName); |
---|
| 585 | this.windowMaximizeZ(objName); |
---|
| 586 | } |
---|
[55] | 587 | |
---|
| 588 | if( !this.photo ) |
---|
| 589 | { |
---|
| 590 | setTimeout('im_win.get_photo_ldap(\"user@user\")',1000 ); |
---|
| 591 | this.photo = true; |
---|
| 592 | } |
---|
[20] | 593 | }, |
---|
| 594 | |
---|
| 595 | "create_window" : function() |
---|
| 596 | { |
---|
| 597 | pId = arguments[0]['id']; |
---|
| 598 | |
---|
| 599 | if ( document.getElementById(pId + '_im_window')) |
---|
| 600 | { |
---|
| 601 | this.windowMaximizeZ(pId); |
---|
[55] | 602 | this.showWindowItem(pId); |
---|
[20] | 603 | } |
---|
| 604 | else |
---|
| 605 | { |
---|
| 606 | this.build(arguments[0]); |
---|
| 607 | |
---|
| 608 | ADD_DHTML(pId + "_im_window_body_inner"+NO_DRAG); |
---|
| 609 | ADD_DHTML(pId + "_im_window"+NO_DRAG); |
---|
| 610 | ADD_DHTML(pId + "_im_window_master"+NO_DRAG); |
---|
| 611 | ADD_DHTML(pId + "_im_window_fantom"+NO_DRAG); |
---|
| 612 | ADD_DHTML(pId + "_im_window_movable"+CURSOR_MOVE); |
---|
| 613 | ADD_DHTML(pId + "_im_window_resize"+CURSOR_NW_RESIZE); |
---|
| 614 | |
---|
| 615 | dd.elements[pId + "_im_window_movable"].moveTo(dd.elements[pId + "_im_window"].x, dd.elements[pId + "_im_window"].y); |
---|
| 616 | dd.elements[pId + "_im_window_movable"].resizeTo(dd.elements[pId + "_im_window"].w-20, 25); |
---|
| 617 | dd.elements[pId + "_im_window_movable"].setOpacity(0); |
---|
| 618 | |
---|
| 619 | dd.elements[pId + "_im_window_resize"].setOpacity(1); |
---|
| 620 | |
---|
| 621 | dd.elements[pId + "_im_window_resize"].moveTo(dd.elements[pId + "_im_window"].x+dd.elements[pId + "_im_window"].w-dd.elements[pId + "_im_window_resize"].w-2, dd.elements[pId + "_im_window"].y+dd.elements[pId + "_im_window"].h-dd.elements[pId + "_im_window_resize"].h-2); |
---|
| 622 | dd.elements[pId + "_im_window_resize"].moveTo(dd.elements[pId + "_im_window_fantom"].x+dd.elements[pId + "_im_window_fantom"].w-dd.elements[pId + "_im_window_resize"].w-2, dd.elements[pId + "_im_window_fantom"].y+dd.elements[pId + "_im_window_fantom"].h-dd.elements[pId + "_im_window_resize"].h-2); |
---|
| 623 | |
---|
| 624 | var windowItem = new Object(); |
---|
| 625 | windowItem.x = dd.elements[pId + "_im_window_master"].x; |
---|
| 626 | windowItem.y = dd.elements[pId + "_im_window_master"].y; |
---|
| 627 | windowItem.w = dd.elements[pId + "_im_window_master"].w; |
---|
| 628 | windowItem.h = dd.elements[pId + "_im_window_master"].h; |
---|
| 629 | windowItem.state = WINDOW_STATE_MINIMIZED; |
---|
| 630 | windowItems[pId] = windowItem; |
---|
| 631 | |
---|
| 632 | title = (arguments[0]['title']) ? arguments[0]['title'] : arguments[0]['id']; |
---|
| 633 | this.windowMinimize(pId + '_im'); |
---|
| 634 | this.windowMaximizeRestore(pId + '_im'); |
---|
| 635 | } |
---|
| 636 | }, |
---|
| 637 | |
---|
| 638 | "open_chat" : function(pId) |
---|
| 639 | { |
---|
| 640 | if ( !func.byId(pId + '_im_window') ) |
---|
| 641 | { |
---|
| 642 | text = ''; |
---|
[59] | 643 | text += '<div class="border" id="' + pId + '_chatMessages" style="width:220px; height:130px; margin: 2px 0px 2px 2px; overflow:auto;"></div>'; |
---|
[55] | 644 | text += '<div style="float: left; position: relative; height:130px;">'; |
---|
[59] | 645 | text += ' <div class="myAvatar">'; |
---|
| 646 | text += ' <img id="' + pId + '_avatar" alt="Display Picture" title="Display Picture" src="' + im_path + 'templates/default/images/photo.png" width="49" height="65" border="0" />'; |
---|
| 647 | text += ' </div>'; |
---|
[55] | 648 | text += ' <div id="' + pId + '_composing" class="composing"><img src="' + img_typing.src + '" /></div>'; |
---|
| 649 | text += '</div>'; |
---|
[59] | 650 | text += '<br style="clear:both;"/>'; |
---|
| 651 | text += '<dl>'; |
---|
| 652 | text += ' <dd class="small">'; |
---|
| 653 | text += ' <span id="selectEmotionsDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showEmotionSelection(\'' + pId + '\');" title="Select Imotions here!"><img src="' + im_path + 'templates/default/images/img/1.gif" width="15" height="15" alt="Select Imotions here!" style="vertical-align: text-top;" /></span>'; |
---|
| 654 | text += ' </dd>'; |
---|
| 655 | text += ' <dd class="small">|</dd>'; |
---|
| 656 | text += ' <dd class="small">'; |
---|
| 657 | text += ' <span id="selectFontNameDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontNameSelection(\'' + pId + '\');" title="Select Font Name here!" style="height:19px;">'+IM.get_lang('Font')+'</span>'; |
---|
| 658 | text += ' </dd>'; |
---|
| 659 | text += ' <dd class="small">|</dd>'; |
---|
| 660 | text += ' <dd class="small">'; |
---|
| 661 | text += ' <span id="selectFontSizeDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontSizeSelection(\'' + pId + '\')" title="Select Font Size here!" style="height:19px;">'+IM.get_lang('Size')+'</span>'; |
---|
| 662 | text += ' </dd>'; |
---|
| 663 | text += ' <dd class="small">|</dd>'; |
---|
| 664 | text += ' <dd class="small">'; |
---|
| 665 | text += ' <span id="selectFontColorDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontColorSelection(\'' + pId + '\')" title="Select Font Color here!" style="height:19px;">'+IM.get_lang('Color')+'</span>'; |
---|
| 666 | text += ' </dd>'; |
---|
| 667 | text += ' <dd class="small">|</dd>'; |
---|
| 668 | text += ' <dd class="small">'; |
---|
| 669 | text += ' <span id="selectFontStyleDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontStyleSelection(\'' + pId + '\')" title="Select Font Color here!" style="height:19px;">'+IM.get_lang('Style')+'</span>'; |
---|
| 670 | text += ' </dd>'; |
---|
| 671 | text += '</dl>'; |
---|
| 672 | text += '<div id="' + pId + '_divEdita" style="margin: 0px 2px"><iframe name="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '_edita" class="edit_message" id="' + pId + '_edita" frameborder="0" style="margin: 3px 1px 0px 2px; width:220px; height:50px; float:left;"></iframe></div>'; |
---|
[64] | 673 | text += '<br/><a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left;margin: 0px 2px;"><img src="' + im_path + 'templates/default/images/send.gif" width="50" height="25" border=0 style="margin-top:3px"></a>'; |
---|
[55] | 674 | text += '<br style="clear:both" /><span id="' + pId + '_im_window_message" style="margin-left: 2px" />'; |
---|
[20] | 675 | |
---|
[36] | 676 | var params = []; |
---|
[20] | 677 | params['body'] = text; |
---|
[55] | 678 | params['height'] = 225; |
---|
[20] | 679 | params['id'] = pId; |
---|
| 680 | params['maximize'] = false; |
---|
| 681 | params['minimize'] = false; |
---|
| 682 | params['title'] = pId; |
---|
[55] | 683 | params['width'] = 320; |
---|
[20] | 684 | this.create_window(params); |
---|
| 685 | |
---|
| 686 | // Photo Ldap; |
---|
| 687 | this.get_photo_ldap(pId); |
---|
[60] | 688 | |
---|
[20] | 689 | name_document = document.getElementById(pId + '_edita'); |
---|
| 690 | name_document.contentWindow.document.write('<html><body id="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '" style="margin:0px;padding:0px"></body></html>'); |
---|
| 691 | name_document.contentWindow.document.close(); |
---|
| 692 | name_document.contentWindow.document.designMode = "On"; |
---|
| 693 | |
---|
| 694 | func.attachEvent(name_document.contentWindow.document, 'keypress', im_win.getText); |
---|
| 695 | func.attachEvent(name_document.contentWindow.document, 'keyup', im_win.clearText); |
---|
| 696 | |
---|
| 697 | name_document.contentWindow.focus(); |
---|
[55] | 698 | |
---|
| 699 | var status = func.byId(pId + '_im_window'); |
---|
| 700 | status.firstChild.style.background = 'url('+func.byId(pId).firstChild.src+')'; |
---|
[20] | 701 | } |
---|
| 702 | else |
---|
| 703 | { |
---|
| 704 | this.showWindowItem(pId); |
---|
| 705 | } |
---|
| 706 | }, |
---|
| 707 | |
---|
| 708 | "get_photo_ldap" : function(IdLdap) |
---|
| 709 | { |
---|
| 710 | var uid_ldap = IdLdap.substr(0,IdLdap.indexOf('@')); |
---|
[55] | 711 | var handler_photo_ldap = function(_XMLdata) |
---|
| 712 | { |
---|
| 713 | var data = _XMLdata.getElementsByTagName('retorno').item(0); |
---|
| 714 | data = eval(data.firstChild.nodeValue); |
---|
| 715 | if(data) |
---|
| 716 | { |
---|
| 717 | IdLdap = ( IdLdap == 'user@user' ) ? 'contacts' : IdLdap; |
---|
[27] | 718 | if( document.getElementById(IdLdap + "_avatar") != null ){ |
---|
| 719 | var ph_img = document.getElementById(IdLdap + "_avatar"); |
---|
| 720 | ph_img.src = (im_path + "inc/class.ldap_im.inc.php?user="+uid_ldap) ? im_path + "inc/class.ldap_im.inc.php?user="+uid_ldap : img_photo.src ; |
---|
[20] | 721 | } |
---|
| 722 | } |
---|
| 723 | } |
---|
[55] | 724 | |
---|
| 725 | XMLTools.__RETURN_MODE__ = 'XML'; |
---|
| 726 | XMLTools.request('$this.ldap_im.photo_ldap','POST',handler_photo_ldap,'uid='+uid_ldap); |
---|
[20] | 727 | }, |
---|
| 728 | |
---|
| 729 | "windowClose" : function(objName) |
---|
| 730 | { |
---|
| 731 | with(objName) |
---|
| 732 | objName = substr(0, indexOf('_im')); |
---|
| 733 | |
---|
| 734 | this.hideWindowItem(objName); |
---|
| 735 | this.hideAllChatSelections(); |
---|
| 736 | |
---|
| 737 | var windowItem = windowItems[objName]; |
---|
| 738 | if ( windowItem != null ) |
---|
| 739 | windowItem.state = WINDOW_STATE_CLOSED; |
---|
| 740 | |
---|
| 741 | if ( objName != 'contacts' ) |
---|
| 742 | { |
---|
[55] | 743 | var win = document.getElementById(objName + '_im_window_master'); |
---|
[20] | 744 | var resize = document.getElementById(objName + '_im_window_resize'); |
---|
| 745 | var fantom = document.getElementById(objName + '_im_window_fantom'); |
---|
| 746 | var movable = document.getElementById(objName + '_im_window_movable'); |
---|
| 747 | |
---|
[55] | 748 | win.parentNode.removeChild(win); |
---|
[20] | 749 | resize.parentNode.removeChild(resize); |
---|
| 750 | fantom.parentNode.removeChild(fantom); |
---|
| 751 | movable.parentNode.removeChild(movable); |
---|
| 752 | |
---|
| 753 | // delete windowItem; |
---|
| 754 | } |
---|
| 755 | }, |
---|
| 756 | |
---|
| 757 | "hideEmotionSelection" : function() |
---|
| 758 | { |
---|
| 759 | emotionsDiv = document.getElementById("shared_emotions"); |
---|
| 760 | if ( isEmotionSelectionVisible ) |
---|
| 761 | { |
---|
| 762 | emotionsDiv.style.visibility = "hidden"; |
---|
| 763 | isEmotionSelectionVisible = false; |
---|
| 764 | } |
---|
| 765 | }, |
---|
| 766 | |
---|
| 767 | "highlightie5" : function (e) |
---|
| 768 | { |
---|
| 769 | if ( e.className == "emotionItem" ) |
---|
| 770 | e.className = "emotionItem-sel"; |
---|
| 771 | else if ( e.className == "menuitems" ) |
---|
| 772 | e.className = "menuitems-sel"; |
---|
| 773 | |
---|
| 774 | }, |
---|
| 775 | |
---|
| 776 | "lowlightie5" : function(e) |
---|
| 777 | { |
---|
| 778 | if ( e.className == "emotionItem-sel" ) |
---|
| 779 | e.className = "emotionItem"; |
---|
| 780 | else if ( e.className == "menuitems-sel" ) |
---|
| 781 | e.className = "menuitems"; |
---|
| 782 | }, |
---|
| 783 | |
---|
| 784 | "addEmotion" : function(emotion) |
---|
| 785 | { |
---|
[64] | 786 | var n_document = document.getElementById(this.chat_pJid + '_edita'); |
---|
| 787 | var edita = n_document.contentWindow.document.getElementsByTagName('body').item(0); |
---|
| 788 | edita.innerHTML += IM.emotions_icons(emotion); |
---|
[20] | 789 | |
---|
[64] | 790 | this.hideEmotionSelection(); |
---|
[20] | 791 | }, |
---|
| 792 | |
---|
| 793 | "showEmotionSelection" : function(objName) |
---|
| 794 | { |
---|
| 795 | this.chat_pJid = objName; |
---|
| 796 | activeChatWindowId = objName; |
---|
| 797 | var emotionsDiv = document.getElementById("shared_emotions"); |
---|
| 798 | if(!isEmotionSelectionVisible) |
---|
| 799 | { |
---|
| 800 | this.hideAllChatSelections(); |
---|
| 801 | chatObj = dd.elements[objName + "_im_window"]; |
---|
| 802 | x = chatObj.x + 6; |
---|
| 803 | y = chatObj.y + chatObj.h - 200; |
---|
| 804 | dd.elements.shared_emotions.moveTo(x,y); |
---|
| 805 | this.incZ(); |
---|
| 806 | document.getElementById("shared_emotions").style.zIndex = zValue; |
---|
| 807 | emotionsDiv.style.visibility = "visible"; |
---|
| 808 | isEmotionSelectionVisible = true; |
---|
| 809 | } |
---|
| 810 | else |
---|
| 811 | { |
---|
| 812 | this.hideAllChatSelections(); |
---|
| 813 | } |
---|
| 814 | }, |
---|
| 815 | |
---|
| 816 | "showFontNameSelection" : function(objName) |
---|
| 817 | { |
---|
| 818 | this.chat_pJid = objName; |
---|
| 819 | activeChatWindowId = objName; |
---|
| 820 | var objDiv = document.getElementById("shared_fontName"); |
---|
| 821 | if(!isFontNameSelectionVisible) |
---|
| 822 | { |
---|
| 823 | this.hideAllChatSelections(); |
---|
| 824 | chatObj = dd.elements[objName + "_im_window"]; |
---|
| 825 | x = chatObj.x + 85; |
---|
| 826 | y = chatObj.y + chatObj.h - 185; |
---|
| 827 | dd.elements.shared_fontName.moveTo(x,y); |
---|
| 828 | this.incZ(); |
---|
| 829 | document.getElementById("shared_fontName").style.zIndex = zValue; |
---|
| 830 | objDiv.style.visibility = "visible"; |
---|
| 831 | isFontNameSelectionVisible = true; |
---|
| 832 | } |
---|
| 833 | else |
---|
| 834 | { |
---|
| 835 | this.hideAllChatSelections(); |
---|
| 836 | } |
---|
| 837 | }, |
---|
| 838 | |
---|
| 839 | "hideFontNameSelection" : function() |
---|
| 840 | { |
---|
| 841 | var objDiv = document.getElementById("shared_fontName"); |
---|
| 842 | if ( isFontNameSelectionVisible ) |
---|
| 843 | { |
---|
| 844 | objDiv.style.visibility = "hidden"; |
---|
| 845 | isFontNameSelectionVisible = false; |
---|
| 846 | } |
---|
| 847 | }, |
---|
| 848 | |
---|
| 849 | "showFontSizeSelection" : function(objName) |
---|
| 850 | { |
---|
| 851 | |
---|
| 852 | this.chat_pJid = objName; |
---|
| 853 | activeChatWindowId = objName; |
---|
| 854 | var objDiv = document.getElementById("shared_fontSize"); |
---|
| 855 | if ( !isFontSizeSelectionVisible ) |
---|
| 856 | { |
---|
| 857 | this.hideAllChatSelections(); |
---|
| 858 | chatObj = dd.elements[objName + "_im_window"]; |
---|
| 859 | x = chatObj.x + 154; |
---|
| 860 | y = chatObj.y + chatObj.h - 200; |
---|
| 861 | dd.elements.shared_fontSize.moveTo(x,y); |
---|
| 862 | this.incZ(); |
---|
| 863 | document.getElementById("shared_fontSize").style.zIndex = zValue; |
---|
| 864 | objDiv.style.visibility = "visible"; |
---|
| 865 | isFontSizeSelectionVisible = true; |
---|
| 866 | } |
---|
| 867 | else |
---|
| 868 | { |
---|
| 869 | this.hideAllChatSelections(); |
---|
| 870 | } |
---|
| 871 | }, |
---|
| 872 | |
---|
| 873 | "hideFontSizeSelection" : function() |
---|
| 874 | { |
---|
| 875 | var objDiv = document.getElementById("shared_fontSize"); |
---|
| 876 | if ( isFontSizeSelectionVisible ) |
---|
| 877 | { |
---|
| 878 | objDiv.style.visibility = "hidden"; |
---|
| 879 | isFontSizeSelectionVisible = false; |
---|
| 880 | } |
---|
| 881 | }, |
---|
| 882 | |
---|
| 883 | "showFontColorSelection" : function(objName) |
---|
| 884 | { |
---|
| 885 | this.chat_pJid = objName; |
---|
| 886 | activeChatWindowId = objName; |
---|
| 887 | var objDiv = document.getElementById("shared_fontColor"); |
---|
| 888 | if ( !isFontColorSelectionVisible ) |
---|
| 889 | { |
---|
| 890 | this.hideAllChatSelections(); |
---|
| 891 | chatObj = dd.elements[objName + "_im_window"]; |
---|
| 892 | x = chatObj.x + 191; |
---|
| 893 | y = chatObj.y + chatObj.h - 200; |
---|
| 894 | dd.elements.shared_fontColor.moveTo(x,y); |
---|
| 895 | this.incZ(); |
---|
| 896 | document.getElementById("shared_fontColor").style.zIndex = zValue; |
---|
| 897 | objDiv.style.visibility = "visible"; |
---|
| 898 | isFontColorSelectionVisible = true; |
---|
| 899 | } |
---|
| 900 | else |
---|
| 901 | { |
---|
| 902 | this.hideAllChatSelections(); |
---|
| 903 | } |
---|
| 904 | }, |
---|
| 905 | |
---|
| 906 | "showFontStyleSelection" : function(objName) |
---|
| 907 | { |
---|
| 908 | this.chat_pJid = objName; |
---|
| 909 | activeChatWindowId = objName; |
---|
| 910 | var objDiv = document.getElementById("shared_fontStyle"); |
---|
| 911 | if ( !isFontStyleSelectionVisible ) |
---|
| 912 | { |
---|
| 913 | this.hideAllChatSelections(); |
---|
| 914 | chatObj = dd.elements[objName + "_im_window"]; |
---|
| 915 | x = chatObj.x + 234; |
---|
| 916 | y = chatObj.y + chatObj.h - 181; |
---|
| 917 | dd.elements.shared_fontStyle.moveTo(x,y); |
---|
| 918 | this.incZ(); |
---|
| 919 | document.getElementById("shared_fontStyle").style.zIndex = zValue; |
---|
| 920 | objDiv.style.visibility = "visible"; |
---|
| 921 | isFontStyleSelectionVisible = true; |
---|
| 922 | } |
---|
| 923 | else |
---|
| 924 | { |
---|
| 925 | this.hideAllChatSelections(); |
---|
| 926 | } |
---|
| 927 | }, |
---|
| 928 | |
---|
| 929 | "showMessageHistoryWindow" : function() |
---|
| 930 | { |
---|
| 931 | // Revisar ALC |
---|
| 932 | alert("Função Indisponivel"); |
---|
| 933 | return false; |
---|
| 934 | }, |
---|
| 935 | |
---|
| 936 | "hideFontColorSelection" : function() |
---|
| 937 | { |
---|
| 938 | var objDiv = document.getElementById("shared_fontColor"); |
---|
| 939 | if ( isFontColorSelectionVisible ) |
---|
| 940 | { |
---|
| 941 | objDiv.style.visibility = "hidden"; |
---|
| 942 | isFontColorSelectionVisible = false; |
---|
| 943 | } |
---|
| 944 | }, |
---|
| 945 | |
---|
| 946 | "hideFontStyleSelection" : function() |
---|
| 947 | { |
---|
| 948 | var objDiv = document.getElementById("shared_fontStyle"); |
---|
| 949 | if ( isFontStyleSelectionVisible ) |
---|
| 950 | { |
---|
| 951 | objDiv.style.visibility = "hidden"; |
---|
| 952 | isFontStyleSelectionVisible = false; |
---|
| 953 | } |
---|
| 954 | }, |
---|
| 955 | |
---|
| 956 | "newMessageNotification" : function() |
---|
| 957 | { |
---|
| 958 | if ( !focusFlag ) |
---|
| 959 | { |
---|
| 960 | if ( document.title=="......................" ) |
---|
[55] | 961 | document.title = IM.get_lang("New Message!"); |
---|
[20] | 962 | else |
---|
| 963 | document.title = "......................"; |
---|
[32] | 964 | |
---|
[55] | 965 | this.Mod_Notification(); |
---|
| 966 | |
---|
[20] | 967 | if ( newMessageTimer ) |
---|
| 968 | clearTimeout(newMessageTimer); |
---|
| 969 | newMessageTimer = setTimeout("im_win.newMessageNotification()", 1000); |
---|
| 970 | } |
---|
| 971 | else |
---|
| 972 | { |
---|
| 973 | if ( newMessageTimer ) clearTimeout(newMessageTimer); |
---|
| 974 | } |
---|
[26] | 975 | |
---|
[20] | 976 | }, |
---|
| 977 | |
---|
[32] | 978 | "Mod_Notification" : function() |
---|
| 979 | { |
---|
[55] | 980 | // Aviso Normal |
---|
| 981 | if(eval(IM_Preferences.LoadPreferences('rd_nm'))) |
---|
| 982 | { |
---|
| 983 | } |
---|
| 984 | // Aviso Chato |
---|
| 985 | if(eval(IM_Preferences.LoadPreferences('rd_ch'))) |
---|
| 986 | { |
---|
| 987 | if(self.moveBy) |
---|
| 988 | { |
---|
| 989 | for(i=10;i>0;i--) |
---|
| 990 | { |
---|
| 991 | self.moveBy(i,0); |
---|
| 992 | self.moveBy(-i,0); |
---|
| 993 | } |
---|
| 994 | } |
---|
| 995 | } |
---|
[32] | 996 | }, |
---|
| 997 | |
---|
[20] | 998 | "getText" : function(e) |
---|
| 999 | { |
---|
| 1000 | if ( !focusFlag ) windowFocus(); |
---|
| 1001 | evt = e.keyCode; |
---|
| 1002 | pId = ( e.srcElement ) ? e.srcElement.id : e.target.getElementsByTagName('body').item(0).id; |
---|
| 1003 | pId = pId.replace('_at_', '@').replace(/_dot_/g, '.') |
---|
| 1004 | switch ( evt ) |
---|
| 1005 | { |
---|
| 1006 | case 13 : |
---|
| 1007 | if ( !e.shiftKey ) |
---|
| 1008 | IM.sendMessage(pId); |
---|
| 1009 | return false; |
---|
| 1010 | break; |
---|
| 1011 | case 27 : |
---|
| 1012 | im_win.windowClose(pId + '_im'); |
---|
| 1013 | break; |
---|
| 1014 | } |
---|
| 1015 | }, |
---|
| 1016 | |
---|
| 1017 | "clearText" : function(e) |
---|
| 1018 | { |
---|
| 1019 | if ( !focusFlag ) windowFocus(); |
---|
| 1020 | evt = e.keyCode; |
---|
| 1021 | _text = ( e.srcElement ) ? e.srcElement.id : e.target.getElementsByTagName('body').item(0); |
---|
| 1022 | |
---|
| 1023 | switch ( evt ) |
---|
| 1024 | { |
---|
| 1025 | case 13 : |
---|
| 1026 | //if ( !e.shiftKey ) |
---|
| 1027 | _text.innerHTML = ''; |
---|
| 1028 | return false; |
---|
| 1029 | break; |
---|
| 1030 | } |
---|
| 1031 | } |
---|
| 1032 | } |
---|
| 1033 | |
---|
| 1034 | function my_DragFunc() |
---|
| 1035 | { |
---|
| 1036 | im_win.drag(); |
---|
| 1037 | } |
---|
| 1038 | function my_DropFunc() |
---|
| 1039 | { |
---|
| 1040 | im_win.drop(); |
---|
| 1041 | } |
---|
| 1042 | function my_PickFunc() |
---|
| 1043 | { |
---|
| 1044 | im_win.pick(); |
---|
| 1045 | } |
---|
| 1046 | function selectDiv(obj) { |
---|
| 1047 | obj.className = "sel-small"; |
---|
| 1048 | } |
---|
| 1049 | function unselectDiv(obj) { |
---|
| 1050 | obj.className = "des-small"; |
---|
| 1051 | } |
---|
| 1052 | function getElementsBySelector(selector) |
---|
| 1053 | { |
---|
| 1054 | var i; |
---|
| 1055 | var s=[]; |
---|
| 1056 | var selid=""; |
---|
| 1057 | var selclass=""; |
---|
| 1058 | var tag=selector; |
---|
| 1059 | var objlist=[]; |
---|
| 1060 | if ( selector.indexOf(" ") > 0 ) |
---|
| 1061 | {//descendant selector like "tag#id tag" |
---|
| 1062 | s=selector.split(" "); |
---|
| 1063 | var fs=s[0].split("#"); |
---|
| 1064 | if ( fs.length == 1 ) |
---|
| 1065 | return(objlist); |
---|
| 1066 | return(document.getElementById(fs[1]).getElementsByTagName(s[1])); |
---|
| 1067 | } |
---|
| 1068 | if ( selector.indexOf("#") > 0 ) |
---|
| 1069 | {//id selector like "tag#id" |
---|
| 1070 | s=selector.split("#"); |
---|
| 1071 | tag=s[0]; |
---|
| 1072 | selid=s[1]; |
---|
| 1073 | } |
---|
| 1074 | if ( selid != "" ) |
---|
| 1075 | { |
---|
| 1076 | objlist.push(document.getElementById(selid)); |
---|
| 1077 | return(objlist); |
---|
| 1078 | } |
---|
| 1079 | if ( selector.indexOf(".") > 0 ) |
---|
| 1080 | {//class selector like "tag.class" |
---|
| 1081 | s=selector.split("."); |
---|
| 1082 | tag=s[0]; |
---|
| 1083 | selclass=s[1]; |
---|
| 1084 | } |
---|
| 1085 | var v = document.getElementsByTagName(tag); // tag selector like "tag" |
---|
| 1086 | if ( selclass == "" ) |
---|
| 1087 | return(v); |
---|
| 1088 | |
---|
| 1089 | for ( i = 0; i < v.length; i++ ) |
---|
| 1090 | if ( v[i].className ==selclass ) |
---|
| 1091 | objlist.push(v[i]); |
---|
| 1092 | |
---|
| 1093 | return(objlist); |
---|
| 1094 | } |
---|
[55] | 1095 | function AddTop(el,bk,color,size) |
---|
| 1096 | { |
---|
| 1097 | try |
---|
[20] | 1098 | { |
---|
[55] | 1099 | var i; |
---|
| 1100 | var d=document.createElement("b"); |
---|
| 1101 | var cn="_r"; |
---|
| 1102 | var lim=4; |
---|
| 1103 | if(size && size=="small"){ cn="_rs"; lim=2} |
---|
| 1104 | d.className="_rtop"; |
---|
| 1105 | d.style.backgroundColor=bk; |
---|
| 1106 | for(i=1;i<=lim;i++) |
---|
| 1107 | { |
---|
| 1108 | var x=document.createElement("b"); |
---|
| 1109 | x.className=cn + i; |
---|
| 1110 | x.style.backgroundColor=color; |
---|
| 1111 | d.appendChild(x); |
---|
| 1112 | } |
---|
| 1113 | el.insertBefore(d,el.firstChild); |
---|
[20] | 1114 | } |
---|
[55] | 1115 | catch(e) |
---|
| 1116 | {} |
---|
[20] | 1117 | } |
---|
| 1118 | function RoundedTop(selector,bk,color,size){ |
---|
| 1119 | var i; |
---|
| 1120 | var v=getElementsBySelector(selector); |
---|
| 1121 | for(i=0;i<v.length;i++) |
---|
| 1122 | AddTop(v[i],bk,color,size); |
---|
| 1123 | } |
---|
| 1124 | |
---|
| 1125 | im_win.load(); |
---|